[Xfce4-commits] <xfce4-session:master> Fix the response handling of the settings dialog.

Nick Schermer noreply at xfce.org
Thu Jan 28 19:52:16 CET 2010


Updating branch refs/heads/master
         to 99fef1bfdca9866d54a1e0e883044e4c91bac481 (commit)
       from 44df9f7e55887fbecd7c948473cfa8d297a3cee3 (commit)

commit 99fef1bfdca9866d54a1e0e883044e4c91bac481
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Jan 24 18:18:34 2010 +0100

    Fix the response handling of the settings dialog.
    
    The close button and the help button did not work anymore. Add a handler
    for the "response" and "delete-event" signals.

 settings/main.c                       |   18 +++++++++++++++---
 settings/xfce4-session-settings.glade |    4 ++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index e5ebecc..8588dd4 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -44,6 +44,17 @@ static GOptionEntry option_entries[] =
     { NULL }
 };
 
+static void xfce4_session_settings_dialog_response (GtkDialog *dialog, gint response, gpointer userdata)
+{
+    if (response == GTK_RESPONSE_HELP) {
+       g_signal_stop_emission_by_name(dialog, "response");
+       g_spawn_command_line_async("xfhelp4 xfce4-session.html", NULL);
+    }
+    else {
+      gtk_widget_destroy(GTK_WIDGET(dialog));
+      gtk_main_quit ();
+    }
+}
 
 int
 main(int argc,
@@ -122,10 +133,11 @@ main(int argc,
     if(G_UNLIKELY(opt_socket_id == 0)) {
         GtkWidget *dialog = GTK_WIDGET(gtk_builder_get_object(builder, "xfce4_session_settings_dialog"));
 
-        while(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_HELP)
-            g_spawn_command_line_async("xfhelp4 xfce4-session.html", NULL);
+        g_signal_connect(dialog, "response", G_CALLBACK(xfce4_session_settings_dialog_response), NULL);
+        g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
 
-        gtk_widget_destroy(dialog);
+        gtk_widget_show(dialog);
+        gtk_main ();
     } else {
         GtkWidget *plug, *plug_child;
 
diff --git a/settings/xfce4-session-settings.glade b/settings/xfce4-session-settings.glade
index d84e17e..f09cf9e 100644
--- a/settings/xfce4-session-settings.glade
+++ b/settings/xfce4-session-settings.glade
@@ -716,6 +716,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="-11">button1</action-widget>
+      <action-widget response="-7">button2</action-widget>
+    </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_saving">
     <property name="border_width">5</property>



More information about the Xfce4-commits mailing list