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

@@ -32,7 +32,6 @@
#include <gtk/gtkvseparator.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtktogglebutton.h>
#include <gdk/gdkkeysyms.h>
#include "../common/hexchat.h"
#include "../common/fe.h"
@@ -119,14 +118,6 @@ search_entry_cb (GtkWidget * entry, session * sess)
search_search (sess, gtk_entry_get_text (GTK_ENTRY (entry)));
}
static gboolean
search_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
{
if (key->keyval == GDK_Escape)
gtk_widget_destroy (window);
return FALSE;
}
static void
search_caseign_cb (GtkToggleButton * but, session * sess)
{
@@ -152,6 +143,7 @@ search_highlight_cb (GtkToggleButton * but, session * sess)
search_search (sess, NULL);
}
int RBHesc = 0;
void
search_open (session * sess)
{
@@ -238,7 +230,7 @@ search_open (session * sess)
add_tip (wid, "Close this box, reset highlighted search items, and stop searching new lines.");
/* Add recognition of the ESC key to close the box */
g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (search_key_cb), win);
gtkutil_destroy_on_esc (win);
/* That's all, folks */
searchwin = win;