SF.net SVN: geany:[3714] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Apr 19 18:14:12 UTC 2009


Revision: 3714
          http://geany.svn.sourceforge.net/geany/?rev=3714&view=rev
Author:   eht16
Date:     2009-04-19 18:14:12 +0000 (Sun, 19 Apr 2009)

Log Message:
-----------
Watch the 'show-hidden' property of the file chooser widget using GObject's "notify" signal which gives accurate results and remove the hack using the "selection-changed" signal.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/dialogs.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-04-19 17:54:09 UTC (rev 3713)
+++ trunk/ChangeLog	2009-04-19 18:14:12 UTC (rev 3714)
@@ -6,6 +6,9 @@
    file view.
    Remove the filename field as it is also provided by GTK itself with
    more features like auto-completion.
+   Watch the 'show-hidden' property of the file chooser widget using
+   GObject's "notify" signal which gives accurate results and remove
+   the hack using the "selection-changed" signal.
 
 
 2009-04-17  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2009-04-19 17:54:09 UTC (rev 3713)
+++ trunk/src/dialogs.c	2009-04-19 18:14:12 UTC (rev 3714)
@@ -67,10 +67,8 @@
 
 #if ! GEANY_USE_WIN32_DIALOG
 static GtkWidget *add_file_open_extra_widget(void);
-#endif
 
 
-#if ! GEANY_USE_WIN32_DIALOG
 static void
 on_file_open_dialog_response           (GtkDialog *dialog,
                                         gint response,
@@ -107,35 +105,32 @@
 		gtk_file_chooser_remove_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
 			app->project->base_path, NULL);
 }
-#endif
 
 
-#if ! GEANY_USE_WIN32_DIALOG
-static void
-on_file_open_selection_changed         (GtkFileChooser  *filechooser,
-                                        gpointer         user_data)
+static void on_file_open_notify(GObject *filechooser, GParamSpec *pspec, gpointer data)
 {
-	gboolean is_on = gtk_file_chooser_get_show_hidden(filechooser);
+	const gchar *name;
+	GValue *value;
 
+	name = g_intern_string(pspec->name);
+	value = g_new0(GValue, 1);
+	g_value_init(value, pspec->value_type);
+	g_object_get_property(filechooser, name, value);
+
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-			ui_lookup_widget(GTK_WIDGET(filechooser), "check_hidden")), is_on);
+		ui_lookup_widget(GTK_WIDGET(filechooser), "check_hidden")), g_value_get_boolean(value));
 }
-#endif
 
 
-#if ! GEANY_USE_WIN32_DIALOG
 static void
-on_file_open_check_hidden_toggled      (GtkToggleButton *togglebutton,
-                                        gpointer         user_data)
+on_file_open_check_hidden_toggled(GtkToggleButton *togglebutton, gpointer user_data)
 {
 	gboolean is_on = gtk_toggle_button_get_active(togglebutton);
 
 	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(ui_widgets.open_filesel), is_on);
 }
-#endif
 
 
-#if ! GEANY_USE_WIN32_DIALOG
 static void create_open_file_dialog(void)
 {
 	GtkWidget *filetype_combo, *encoding_combo;
@@ -202,8 +197,8 @@
 	gtk_combo_box_append_text(GTK_COMBO_BOX(encoding_combo), _("Detect from file"));
 	gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combo), GEANY_ENCODINGS_MAX);
 
-	g_signal_connect(ui_widgets.open_filesel, "selection-changed",
-				G_CALLBACK(on_file_open_selection_changed), NULL);
+	g_signal_connect(ui_widgets.open_filesel, "notify::show-hidden",
+				G_CALLBACK(on_file_open_notify), NULL);
 	g_signal_connect(ui_widgets.open_filesel, "delete-event",
 				G_CALLBACK(gtk_widget_hide_on_delete), NULL);
 	g_signal_connect(ui_widgets.open_filesel, "response",


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