SF.net SVN: geany:[5063] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Jun 23 16:57:29 UTC 2010


Revision: 5063
          http://geany.svn.sourceforge.net/geany/?rev=5063&view=rev
Author:   ntrel
Date:     2010-06-23 16:57:28 +0000 (Wed, 23 Jun 2010)

Log Message:
-----------
Use ui_hookup_widget() instead of g_object_set_data_full() for
widgets.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/export.c
    trunk/src/dialogs.c
    trunk/src/search.c
    trunk/src/ui_utils.c
    trunk/src/vte.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/ChangeLog	2010-06-23 16:57:28 UTC (rev 5063)
@@ -4,6 +4,10 @@
    Implement Find in Files file pattern search.
  * src/search.c:
    Add file pattern to combo box history.
+ * src/dialogs.c, src/vte.c, src/search.c, src/ui_utils.c,
+   plugins/export.c:
+   Use ui_hookup_widget() instead of g_object_set_data_full() for
+   widgets.
 
 
 2010-06-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/plugins/export.c	2010-06-23 16:57:28 UTC (rev 5063)
@@ -187,8 +187,7 @@
 		gtk_widget_show_all(vbox);
 		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox);
 
-		g_object_set_data_full(G_OBJECT(dialog), "check_zoom_level",
-					g_object_ref(check_zoom_level), (GDestroyNotify) g_object_unref);
+		ui_hookup_widget(dialog, check_zoom_level, "check_zoom_level");
 
 		exi->have_zoom_level_checkbox = TRUE;
 	}

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/src/dialogs.c	2010-06-23 16:57:28 UTC (rev 5063)
@@ -316,12 +316,9 @@
 	g_signal_connect(check_hidden, "toggled",
 				G_CALLBACK(on_file_open_check_hidden_toggled), NULL);
 
-	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "check_hidden",
-				g_object_ref(check_hidden), (GDestroyNotify)g_object_unref);
-	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "filetype_combo",
-				g_object_ref(filetype_combo), (GDestroyNotify)g_object_unref);
-	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "encoding_combo",
-				g_object_ref(encoding_combo), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(ui_widgets.open_filesel, check_hidden, "check_hidden");
+	ui_hookup_widget(ui_widgets.open_filesel, filetype_combo, "filetype_combo");
+	ui_hookup_widget(ui_widgets.open_filesel, encoding_combo, "encoding_combo");
 
 	return expander;
 }
@@ -460,8 +457,7 @@
 	g_signal_connect(check_open_new_tab, "toggled",
 				G_CALLBACK(on_save_as_new_tab_toggled), rename_btn);
 
-	g_object_set_data_full(G_OBJECT(ui_widgets.save_filesel), "check_open_new_tab",
-				g_object_ref(check_open_new_tab), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(ui_widgets.save_filesel, check_open_new_tab, "check_open_new_tab");
 
 	g_signal_connect(ui_widgets.save_filesel, "delete-event",
 		G_CALLBACK(gtk_widget_hide_on_delete), NULL);

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/src/search.c	2010-06-23 16:57:28 UTC (rev 5063)
@@ -224,8 +224,7 @@
 			  *checkbox7, *hbox, *fbox, *mbox;
 
 	check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_regexp",
-					g_object_ref(check_regexp), (GDestroyNotify) g_object_unref);
+	ui_hookup_widget(dialog, check_regexp, "check_regexp");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
 	ui_widget_set_tooltip_text(check_regexp, _("Use POSIX-like regular expressions. "
 		"For detailed information about using regular expressions, please read the documentation."));
@@ -235,8 +234,7 @@
 	if (dialog != GTK_DIALOG(find_dlg.dialog))
 	{
 		check_back = gtk_check_button_new_with_mnemonic(_("Search _backwards"));
-		g_object_set_data_full(G_OBJECT(dialog), "check_back",
-						g_object_ref(check_back), (GDestroyNotify)g_object_unref);
+		ui_hookup_widget(dialog, check_back, "check_back");
 		gtk_button_set_focus_on_click(GTK_BUTTON(check_back), FALSE);
 	}
 	else
@@ -249,8 +247,7 @@
 		g_object_unref(label_size);
 	}
 	checkbox7 = gtk_check_button_new_with_mnemonic(_("Use _escape sequences"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_escape",
-					g_object_ref(checkbox7), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(dialog, checkbox7, "check_escape");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox7), FALSE);
 	ui_widget_set_tooltip_text(checkbox7,
 		_("Replace \\\\, \\t, \\n, \\r and \\uXXXX (Unicode chararacters) with the "
@@ -263,18 +260,15 @@
 	gtk_container_add(GTK_CONTAINER(fbox), check_back);
 
 	checkbox1 = gtk_check_button_new_with_mnemonic(_("C_ase sensitive"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_case",
-					g_object_ref(checkbox1), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(dialog, checkbox1, "check_case");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
 
 	checkbox2 = gtk_check_button_new_with_mnemonic(_("Match only a _whole word"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_word",
-					g_object_ref(checkbox2), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(dialog, checkbox2, "check_word");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
 
 	checkbox5 = gtk_check_button_new_with_mnemonic(_("Match from s_tart of word"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_wordstart",
-					g_object_ref(checkbox5), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(dialog, checkbox5, "check_wordstart");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox5), FALSE);
 
 	/* Matching options */
@@ -396,8 +390,7 @@
 	button = ui_button_new_with_image(GTK_STOCK_GO_BACK, _("_Previous"));
 	gtk_dialog_add_action_widget(GTK_DIALOG(find_dlg.dialog), button,
 		GEANY_RESPONSE_FIND_PREVIOUS);
-	g_object_set_data_full(G_OBJECT(find_dlg.dialog), "btn_previous",
-					g_object_ref(button), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(find_dlg.dialog, button, "btn_previous");
 
 	button = ui_button_new_with_image(GTK_STOCK_GO_FORWARD, _("_Next"));
 	gtk_dialog_add_action_widget(GTK_DIALOG(find_dlg.dialog), button,
@@ -412,8 +405,7 @@
 	gtk_entry_set_max_length(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry))), 248);
 	gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry))), 50);
 	find_dlg.entry = GTK_BIN(entry)->child;
-	g_object_set_data_full(G_OBJECT(find_dlg.dialog), "entry",
-					g_object_ref(entry), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(find_dlg.dialog, entry, "entry");
 
 	g_signal_connect(gtk_bin_get_child(GTK_BIN(entry)), "activate",
 			G_CALLBACK(on_find_entry_activate), NULL);
@@ -457,8 +449,7 @@
 
 	/* close window checkbox */
 	check_close = gtk_check_button_new_with_mnemonic(_("Close _dialog"));
-	g_object_set_data_full(G_OBJECT(find_dlg.dialog), "check_close",
-					g_object_ref(check_close), (GDestroyNotify) g_object_unref);
+	ui_hookup_widget(find_dlg.dialog, check_close, "check_close");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
 	ui_widget_set_tooltip_text(check_close,
 			_("Disable this option to keep the dialog open"));
@@ -575,8 +566,7 @@
 	gtk_label_set_mnemonic_widget(GTK_LABEL(label_find), entry_find);
 	gtk_entry_set_max_length(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_find))), 248);
 	gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_find))), 50);
-	g_object_set_data_full(G_OBJECT(replace_dlg.dialog), "entry_find",
-		g_object_ref(entry_find), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(replace_dlg.dialog, entry_find, "entry_find");
 	replace_dlg.find_entry = GTK_BIN(entry_find)->child;
 
 	entry_replace = gtk_combo_box_entry_new_text();
@@ -584,8 +574,7 @@
 	gtk_label_set_mnemonic_widget(GTK_LABEL(label_replace), entry_replace);
 	gtk_entry_set_max_length(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_replace))), 248);
 	gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_replace))), 50);
-	g_object_set_data_full(G_OBJECT(replace_dlg.dialog), "entry_replace",
-		g_object_ref(entry_replace), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(replace_dlg.dialog, entry_replace, "entry_replace");
 	replace_dlg.replace_entry = GTK_BIN(entry_replace)->child;
 
 	/* catch tab key to set the focus to the replace entry instead of
@@ -645,8 +634,7 @@
 
 	/* close window checkbox */
 	check_close = gtk_check_button_new_with_mnemonic(_("Close _dialog"));
-	g_object_set_data_full(G_OBJECT(replace_dlg.dialog), "check_close",
-					g_object_ref(check_close), (GDestroyNotify) g_object_unref);
+	ui_hookup_widget(replace_dlg.dialog, check_close, "check_close");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
 	ui_widget_set_tooltip_text(check_close,
 			_("Disable this option to keep the dialog open"));
@@ -814,30 +802,25 @@
 	gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0);
 
 	check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_regexp",
-					g_object_ref(check_regexp), (GDestroyNotify) g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, check_regexp, "check_regexp");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
 	ui_widget_set_tooltip_text(check_regexp, _("See grep's manual page for more information"));
 
 	check_recursive = gtk_check_button_new_with_mnemonic(_("_Recurse in subfolders"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_recursive",
-					g_object_ref(check_recursive), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, check_recursive, "check_recursive");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_recursive), FALSE);
 
 	checkbox1 = gtk_check_button_new_with_mnemonic(_("C_ase sensitive"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_case",
-					g_object_ref(checkbox1), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, checkbox1, "check_case");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox1), TRUE);
 
 	check_wholeword = gtk_check_button_new_with_mnemonic(_("Match only a _whole word"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_wholeword",
-					g_object_ref(check_wholeword), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, check_wholeword, "check_wholeword");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_wholeword), FALSE);
 
 	checkbox2 = gtk_check_button_new_with_mnemonic(_("_Invert search results"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_invert",
-					g_object_ref(checkbox2), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, checkbox2, "check_invert");
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
 	ui_widget_set_tooltip_text(checkbox2,
 			_("Invert the sense of matching, to select non-matching lines"));
@@ -858,8 +841,7 @@
 	gtk_container_add(GTK_CONTAINER(vbox), hbox);
 
 	check_extra = gtk_check_button_new_with_mnemonic(_("E_xtra options:"));
-	g_object_set_data_full(G_OBJECT(fif_dlg.dialog), "check_extra",
-					g_object_ref(check_extra), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(fif_dlg.dialog, check_extra, "check_extra");
 	gtk_button_set_focus_on_click(GTK_BUTTON(check_extra), FALSE);
 
 	entry_extra = gtk_entry_new();

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/src/ui_utils.c	2010-06-23 16:57:28 UTC (rev 5063)
@@ -577,15 +577,13 @@
 	gtk_container_add(GTK_CONTAINER(menu_edit), item);
 	gtk_widget_show(item);
 	g_signal_connect(item, "activate", G_CALLBACK(on_menu_insert_date_activate), str);
-	g_object_set_data_full(G_OBJECT(main_widgets.window),
-		"insert_date_custom1", g_object_ref(item), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(main_widgets.window, item, "insert_date_custom1");
 
 	item = gtk_menu_item_new_with_mnemonic(str);
 	gtk_container_add(GTK_CONTAINER(menu_popup), item);
 	gtk_widget_show(item);
 	g_signal_connect(item, "activate", G_CALLBACK(on_insert_date_activate), str);
-	g_object_set_data_full(G_OBJECT(main_widgets.editor_menu),
-		"insert_date_custom2", g_object_ref(item), (GDestroyNotify)g_object_unref);
+	ui_hookup_widget(main_widgets.editor_menu, item, "insert_date_custom2");
 
 	insert_date_items(menu_edit, menu_popup, _("_Set Custom Date Format"));
 }
@@ -1615,8 +1613,7 @@
 		g_object_set_data_full(G_OBJECT(open_btn), "title", g_strdup(title),
 				(GDestroyNotify) g_free);
 	g_object_set_data(G_OBJECT(open_btn), "action", (gpointer) action);
-	g_object_set_data_full(G_OBJECT(open_btn), "entry",
-		g_object_ref(path_entry), (GDestroyNotify) g_object_unref);
+	ui_hookup_widget(open_btn, path_entry, "entry");
 	g_signal_connect(open_btn, "clicked", G_CALLBACK(ui_path_box_open_clicked), open_btn);
 }
 

Modified: trunk/src/vte.c
===================================================================
--- trunk/src/vte.c	2010-06-23 16:16:15 UTC (rev 5062)
+++ trunk/src/vte.c	2010-06-23 16:57:28 UTC (rev 5063)
@@ -854,32 +854,19 @@
 
 		gtk_box_pack_start(GTK_BOX(vbox), box, FALSE, FALSE, 0);
 
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "font_term",
-				g_object_ref(font_term),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "color_fore",
-				g_object_ref(color_fore),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "color_back",
-				g_object_ref(color_back),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "spin_scrollback",
-				g_object_ref(spin_scrollback),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "entry_shell",
-				g_object_ref(entry_shell),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_scroll_key",
-				g_object_ref(check_scroll_key),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_scroll_out",
-				g_object_ref(check_scroll_out),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_cursor_blinks",
-				g_object_ref(check_cursor_blinks),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_enable_bash_keys",
-				g_object_ref(check_enable_bash_keys),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_ignore_menu_key",
-				g_object_ref(check_ignore_menu_key),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_follow_path",
-				g_object_ref(check_follow_path),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_run_in_vte",
-				g_object_ref(check_run_in_vte),	(GDestroyNotify) g_object_unref);
-		g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_skip_script",
-				g_object_ref(check_skip_script),	(GDestroyNotify) g_object_unref);
+		ui_hookup_widget(ui_widgets.prefs_dialog, font_term, "font_term");
+		ui_hookup_widget(ui_widgets.prefs_dialog, color_fore, "color_fore");
+		ui_hookup_widget(ui_widgets.prefs_dialog, color_back, "color_back");
+		ui_hookup_widget(ui_widgets.prefs_dialog, spin_scrollback, "spin_scrollback");
+		ui_hookup_widget(ui_widgets.prefs_dialog, entry_shell, "entry_shell");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_scroll_key, "check_scroll_key");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_scroll_out, "check_scroll_out");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_cursor_blinks, "check_cursor_blinks");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_enable_bash_keys, "check_enable_bash_keys");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_ignore_menu_key, "check_ignore_menu_key");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_follow_path, "check_follow_path");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_run_in_vte, "check_run_in_vte");
+		ui_hookup_widget(ui_widgets.prefs_dialog, check_skip_script, "check_skip_script");
 
 		gtk_widget_show_all(frame);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list