esc key close for advanced dialogs

This commit is contained in:
berkeviktor@aol.com 2010-09-22 20:55:18 +02:00
parent 4f810be85f
commit 4de113c15b
1 changed files with 110 additions and 5 deletions

View File

@ -781,7 +781,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/chanlist.c xchat-wdk/src
chanlist_reset_counters (serv);
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/editlist.c xchat-wdk/src/fe-gtk/editlist.c
--- xchat-wdk.orig/src/fe-gtk/editlist.c 2006-03-13 08:33:45 +0000
+++ xchat-wdk/src/fe-gtk/editlist.c 2010-09-22 15:30:07 +0000
+++ xchat-wdk/src/fe-gtk/editlist.c 2010-09-22 18:36:22 +0000
@@ -19,7 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
@ -790,6 +790,43 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/editlist.c xchat-wdk/src
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -30,6 +29,7 @@
#include <gtk/gtkclist.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvseparator.h>
+#include <gdk/gdkkeysyms.h>
#include "../common/xchat.h"
#include "../common/cfgfiles.h"
@@ -294,6 +294,17 @@
editlist_gui_window = 0;
}
+static gboolean
+editlist_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+ if (key->keyval == GDK_Escape)
+ {
+ gtk_widget_destroy (window);
+ }
+
+ return FALSE;
+}
+
void
editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass,
char *file, char *help)
@@ -404,6 +415,10 @@
gtk_widget_show (hbox);
editlist_gui_load (editlist_gui_list);
+
+ g_signal_connect (G_OBJECT (editlist_gui_window), "key_press_event",
+ G_CALLBACK (editlist_key_cb), editlist_gui_window);
+
gtk_widget_show (editlist_gui_window);
}
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fe-gtk.c xchat-wdk/src/fe-gtk/fe-gtk.c
--- xchat-wdk.orig/src/fe-gtk/fe-gtk.c 2010-08-14 01:46:21 +0000
+++ xchat-wdk/src/fe-gtk/fe-gtk.c 2010-09-22 15:30:07 +0000
@ -841,7 +878,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fe-gtk.h xchat-wdk/src/f
#endif
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fkeys.c xchat-wdk/src/fe-gtk/fkeys.c
--- xchat-wdk.orig/src/fe-gtk/fkeys.c 2008-02-24 05:09:34 +0000
+++ xchat-wdk/src/fe-gtk/fkeys.c 2010-09-22 15:30:07 +0000
+++ xchat-wdk/src/fe-gtk/fkeys.c 2010-09-22 18:43:54 +0000
@@ -20,7 +20,6 @@
#include <stdlib.h>
#include <sys/types.h>
@ -850,6 +887,34 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fkeys.c xchat-wdk/src/fe
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
@@ -695,6 +694,17 @@
}
}
+static gboolean
+key_dialog_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+ if (key->keyval == GDK_Escape)
+ {
+ gtk_widget_destroy (window);
+ }
+
+ return FALSE;
+}
+
void
key_dialog_show ()
{
@@ -830,6 +840,9 @@
gtk_widget_show (hbox2);
key_dialog_text = wid;
+
+ g_signal_connect (G_OBJECT (key_dialog), "key_press_event",
+ G_CALLBACK (key_dialog_key_cb), key_dialog);
gtk_widget_show_all (key_dialog);
}
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/gtkutil.c xchat-wdk/src/fe-gtk/gtkutil.c
--- xchat-wdk.orig/src/fe-gtk/gtkutil.c 2009-07-18 12:38:10 +0000
+++ xchat-wdk/src/fe-gtk/gtkutil.c 2010-09-22 15:30:07 +0000
@ -1240,7 +1305,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/servlistgui.c xchat-wdk/
}
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe-gtk/setup.c
--- xchat-wdk.orig/src/fe-gtk/setup.c 2008-02-08 09:04:45 +0000
+++ xchat-wdk/src/fe-gtk/setup.c 2010-09-22 18:03:18 +0000
+++ xchat-wdk/src/fe-gtk/setup.c 2010-09-22 18:34:13 +0000
@@ -47,6 +47,7 @@
#include <gtk/gtktreeselection.h>
#include <gtk/gtkcellrenderertext.h>
@ -1300,12 +1365,13 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe
static GtkWidget *
setup_window_open (void)
{
@@ -2095,6 +2106,8 @@
@@ -2095,6 +2106,9 @@
wid = gtk_hseparator_new ();
gtk_box_pack_end (GTK_BOX (vbox), wid, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (setup_key_cb), win);
+ g_signal_connect (G_OBJECT (win), "key_press_event",
+ G_CALLBACK (setup_key_cb), win);
gtk_widget_show_all (win);
@ -1333,6 +1399,45 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/sexy-spell-entry.c xchat
/*
* Bunch of poop to make enchant into a runtime dependency rather than a
* compile-time dependency. This makes it so I don't have to hear the
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/textgui.c xchat-wdk/src/fe-gtk/textgui.c
--- xchat-wdk.orig/src/fe-gtk/textgui.c 2007-05-23 08:55:58 +0000
+++ xchat-wdk/src/fe-gtk/textgui.c 2010-09-22 18:50:21 +0000
@@ -35,6 +35,7 @@
#include <gtk/gtkvbox.h>
#include <gtk/gtkvpaned.h>
#include <gtk/gtkvscrollbar.h>
+#include <gdk/gdkkeysyms.h>
#include "../common/xchat.h"
#include "../common/xchatc.h"
@@ -355,6 +356,17 @@
}
}
+static gboolean
+pevent_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+ if (key->keyval == GDK_Escape)
+ {
+ gtk_widget_destroy (window);
+ }
+
+ return FALSE;
+}
+
void
pevent_dialog_show ()
{
@@ -451,6 +463,9 @@
gtk_widget_show (wid);
gtk_widget_show (hbox);
+
+ g_signal_connect (G_OBJECT (pevent_dialog), "key_press_event",
+ G_CALLBACK (pevent_key_cb), pevent_dialog);
gtk_widget_show (pevent_dialog);
}
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/xtext.c xchat-wdk/src/fe-gtk/xtext.c
--- xchat-wdk.orig/src/fe-gtk/xtext.c 2008-08-29 11:24:17 +0000
+++ xchat-wdk/src/fe-gtk/xtext.c 2010-09-22 15:30:07 +0000