summary refs log tree commit diff stats
path: root/src/fe-gtk/gtkutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk/gtkutil.c')
-rw-r--r--src/fe-gtk/gtkutil.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index d032cf48..41948e44 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -26,25 +26,7 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktooltips.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkclipboard.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#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 +320,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)
 {