[evolution/wip/webkit-composer] EEditorDialog: Close dialog when Escape is pressed



commit 51052961c688877c51d91deb811bd39db7f83288
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Mar 11 16:52:15 2014 +0100

    EEditorDialog: Close dialog when Escape is pressed

 e-util/e-editor-dialog.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-editor-dialog.c b/e-util/e-editor-dialog.c
index e7be9dd..89dc438 100644
--- a/e-util/e-editor-dialog.c
+++ b/e-util/e-editor-dialog.c
@@ -156,6 +156,19 @@ e_editor_dialog_class_init (EEditorDialogClass *class)
                        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 }
 
+static gboolean
+key_press_event_cb (GtkWidget *widget,
+                    GdkEventKey *event,
+                    gpointer user_data)
+{
+       if (event->keyval == GDK_KEY_Escape) {
+               gtk_widget_hide (widget);
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
 static void
 e_editor_dialog_init (EEditorDialog *dialog)
 {
@@ -202,6 +215,10 @@ e_editor_dialog_init (EEditorDialog *dialog)
        g_signal_connect (
                dialog, "delete-event",
                G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+       g_signal_connect (
+               dialog, "key-press-event",
+               G_CALLBACK (key_press_event_cb), NULL);
 }
 
 EEditor *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]