diff options
author | RichardHitt <rbh00@netcom.com> | 2013-03-17 15:11:23 -0700 |
---|---|---|
committer | RichardHitt <rbh00@netcom.com> | 2013-03-17 15:11:23 -0700 |
commit | ecdcc99280d29994791b8bc3273bf03a670d0b7b (patch) | |
tree | 947e2145e5cf149f0ccfc4d86d77dd2f2b278943 /src/fe-gtk/gtkutil.c | |
parent | e8a78b9aa1398deb69d20d599be2a630f721cafa (diff) |
ESC key will destroy the windows mentioned at issue 211.
This change implements generic routine gtkutil_destroy_on_esc () and adds invocations of it in the requisite window-handling places.
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) { |