[Xfce4-commits] <xfce4-settings:master> Added Escape key to minimal dialog to close the dialog.

Sean Davis noreply at xfce.org
Fri Nov 23 16:26:01 CET 2012


Updating branch refs/heads/master
         to 0d78cf92c19943fdbcbab98457168cd1924432fa (commit)
       from 9dd260d8c81e1efc90e1765607655bc64e3c14d9 (commit)

commit 0d78cf92c19943fdbcbab98457168cd1924432fa
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Fri Nov 23 10:24:44 2012 -0500

    Added Escape key to minimal dialog to close the dialog.

 dialogs/display-settings/main.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index b120925..4a6be6c 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -31,6 +31,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
 
 #include <xfconf/xfconf.h>
 #include <exo/exo.h>
@@ -1770,6 +1771,19 @@ display_settings_show_main_dialog (GdkDisplay *display)
     g_object_unref (G_OBJECT (builder));
 }
 
+static gboolean
+display_settings_minimal_dialog_key_press_event(GtkWidget *widget, 
+                                                GdkEventKey *event, 
+                                                gpointer user_data)
+{
+    if (event->keyval == GDK_Escape)
+    {
+        gtk_main_quit();
+        return TRUE;
+    }
+    return FALSE;
+}
+
 static void
 display_settings_minimal_advanced_clicked (GtkButton  *button,
                                            GtkBuilder *builder)
@@ -1821,6 +1835,7 @@ display_settings_show_minimal_dialog (GdkDisplay *display)
         dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
         cancel = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
 
+        g_signal_connect (dialog, "key-press-event", G_CALLBACK (display_settings_minimal_dialog_key_press_event), NULL);
         g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
         g_signal_connect (cancel, "clicked", G_CALLBACK (gtk_main_quit), NULL);
 


More information about the Xfce4-commits mailing list