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



commit fec5f4b0e60f1466aa153de697988a7b7b903dbb
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 3e636f9..d7f610f 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]