[gnome-bluetooth] Close the preferences dialog when pressing Escape key (Bug 589864)
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Close the preferences dialog when pressing Escape key (Bug 589864)
- Date: Fri, 31 Jul 2009 14:09:53 +0000 (UTC)
commit 0c9387415ebb1d591291d87605038a2982895211
Author: Baptiste Mille-Mathias <baptiste millemathias gmail com>
Date: Mon Jul 27 22:43:44 2009 +0200
Close the preferences dialog when pressing Escape key (Bug 589864)
properties/main.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/properties/main.c b/properties/main.c
index da60ff5..3706aab 100644
--- a/properties/main.c
+++ b/properties/main.c
@@ -27,6 +27,8 @@
#endif
#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <unique/uniqueapp.h>
@@ -49,6 +51,18 @@ static gboolean delete_callback(GtkWidget *window, GdkEvent *event,
return FALSE;
}
+static void
+keypress_callback (GtkWidget *window,
+ GdkEventKey *key,
+ gpointer user_data)
+{
+ if (key->keyval == GDK_Escape) {
+ gtk_widget_destroy(GTK_WIDGET(window));
+
+ gtk_main_quit();
+ }
+}
+
static void close_callback(GtkWidget *button, gpointer user_data)
{
GtkWidget *window = user_data;
@@ -148,6 +162,9 @@ static GtkWidget *create_window(GtkWidget *notebook)
g_signal_connect(G_OBJECT(window), "delete-event",
G_CALLBACK(delete_callback), NULL);
+ g_signal_connect(G_OBJECT(window), "key-press-event",
+ G_CALLBACK(keypress_callback), NULL);
+
vbox = gtk_vbox_new(FALSE, 6);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
gtk_container_add(GTK_CONTAINER(window), vbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]