[network-manager-applet/lr/ui-improvements: 19/23] 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/23] editor: close the connection list on Escape key
- Date: Mon, 3 Jul 2017 11:13:09 +0000 (UTC)
commit f158189b8b69ba5127fe9ce78439e31d848d313b
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 d24c0ca..36ac5d0 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -458,6 +458,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)
{
@@ -515,6 +526,7 @@ nm_connection_list_class_init (NMConnectionListClass *klass)
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, selection_changed_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 d23a5f5..e3e48e8 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]