[network-manager-applet/lr/ui-improvements: 19/20] editor: close the connection list on Escape key
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/ui-improvements: 19/20] editor: close the connection list on Escape key
- Date: Mon, 3 Jul 2017 09:27:23 +0000 (UTC)
commit 24bb400fdeefc2a2edd0371ba5e1bf08f50c56cf
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon Jul 3 10:04:13 2017 +0200
editor: close the connection list on Escape key
src/connection-editor/nm-connection-list.c | 12 ++++++++++++
src/connection-editor/nm-connection-list.ui | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 8a77e93..760a3da 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -470,6 +470,17 @@ list_close_cb (GtkDialog *dialog, gpointer user_data)
GTK_RESPONSE_CLOSE);
}
+static gboolean
+key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ if (event->keyval == GDK_KEY_Escape) {
+ gtk_window_close (GTK_WINDOW (user_data));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
nm_connection_list_init (NMConnectionList *list)
{
@@ -526,6 +537,7 @@ nm_connection_list_class_init (NMConnectionListClass *klass)
gtk_widget_class_bind_template_callback (widget_class, do_edit);
gtk_widget_class_bind_template_callback (widget_class, delete_clicked);
gtk_widget_class_bind_template_callback (widget_class, list_close_cb);
+ gtk_widget_class_bind_template_callback (widget_class, key_press_cb);
}
static void
diff --git a/src/connection-editor/nm-connection-list.ui b/src/connection-editor/nm-connection-list.ui
index 2bc3ddc..de60b69 100644
--- a/src/connection-editor/nm-connection-list.ui
+++ b/src/connection-editor/nm-connection-list.ui
@@ -9,6 +9,7 @@
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="gravity">north-east</property>
+ <signal name="key-press-event" handler="key_press_cb" swapped="no"/>
<signal name="destroy" handler="list_close_cb" swapped="no"/>
<child>
<object class="GtkBox" id="connection_box">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]