diff options
author | TingPing <tngpng@gmail.com> | 2013-03-17 16:16:46 -0700 |
---|---|---|
committer | TingPing <tngpng@gmail.com> | 2013-03-17 16:16:46 -0700 |
commit | 20e352217731a13a7674d5a962e6d7e8bef49423 (patch) | |
tree | 5edcfdc924f26e6b8fa4823ae56a12ce63d9c5da /src/fe-gtk/gtkutil.c | |
parent | 89d62ee4f8e563fe083b7d6132768cc5c8c63910 (diff) | |
parent | c9540df92d70025b0ec9a66e2a21cbae7c97bd26 (diff) |
Merge pull request #455 from RichardHitt/escape
Let the ESC key close certain windows. Closes #211
Diffstat (limited to 'src/fe-gtk/gtkutil.c')
-rw-r--r-- | src/fe-gtk/gtkutil.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c index d032cf48..3743b5e3 100644 --- a/src/fe-gtk/gtkutil.c +++ b/src/fe-gtk/gtkutil.c @@ -45,6 +45,7 @@ #include <gtk/gtkcellrenderertoggle.h> #include <gtk/gtkversion.h> #include <gtk/gtkfilechooserdialog.h> +#include <gdk/gdkkeysyms.h> #include "../common/hexchat.h" #include "../common/fe.h" @@ -338,6 +339,20 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte gtk_widget_show (dialog); } +static gboolean +gtkutil_esc_destroy (GtkWidget * win, GdkEventKey * key, gpointer userdata) +{ + if (key->keyval == GDK_Escape) + gtk_widget_destroy (win); + return FALSE; +} + +void +gtkutil_destroy_on_esc (GtkWidget *win) +{ + g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (gtkutil_esc_destroy), win); +} + void gtkutil_destroy (GtkWidget * igad, GtkWidget * dgad) { |