[network-manager-applet/lr/ui-improvements: 20/20] editor: close the editor window on Escape key
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/ui-improvements: 20/20] editor: close the editor window on Escape key
- Date: Mon, 3 Jul 2017 09:27:28 +0000 (UTC)
commit d80a2a1878033bc183e0f6d6c44c347962dab488
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon Jul 3 10:04:13 2017 +0200
editor: close the editor window on Escape key
src/connection-editor/nm-connection-editor.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 3361969..208f39d 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -1132,6 +1132,17 @@ editor_closed_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
cancel_button_clicked_cb (widget, user_data);
}
+static gboolean
+key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ if (event->keyval == GDK_KEY_Escape) {
+ gtk_window_close (GTK_WINDOW (widget));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
added_connection_cb (GObject *client,
GAsyncResult *result,
@@ -1280,6 +1291,8 @@ nm_connection_editor_run (NMConnectionEditor *self)
g_signal_connect (G_OBJECT (self->window), "delete-event",
G_CALLBACK (editor_closed_cb), self);
+ g_signal_connect (G_OBJECT (self->window), "key-press-event",
+ G_CALLBACK (key_press_cb), self);
g_signal_connect (G_OBJECT (self->ok_button), "clicked",
G_CALLBACK (ok_button_clicked_cb), self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]