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.
This commit is contained in:
RichardHitt
2013-03-17 15:11:23 -07:00
parent e8a78b9aa1
commit ecdcc99280
10 changed files with 28 additions and 19 deletions

View File

@@ -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)
{