diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-07-03 10:04:13 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-07-11 17:51:04 +0200 |
commit | 7e5543504768f8026a8d13fdd160b86faf8ec065 (patch) | |
tree | e469ee13e9a2b923bb6bdecb189af067147f0283 | |
parent | 0e1004baea7b9d479695b78c6c039a51a4445202 (diff) | |
download | network-manager-applet-7e5543504768f8026a8d13fdd160b86faf8ec065.tar.gz |
editor: close the connection list on Escape key
-rw-r--r-- | src/connection-editor/nm-connection-list.c | 12 | ||||
-rw-r--r-- | 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 d24c0ca4..36ac5d00 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 d23a5f57..e3e48e80 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"> |