aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/simple_dialog.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-05-03 07:19:38 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-05-03 07:19:38 +0000
commit7b04efa22b135aa27c4d01e9f2b52c2c652ae2d6 (patch)
tree871909fdd3745cb22287029da8eaea603d202c7d /gtk/simple_dialog.c
parentc4d619c4ec340558e0c7318f2005a55741ec7a77 (diff)
Make dialog boxes created with "simple_dialog()" use the new utilities
to make the Esc key cancel the dialog box (or accept it, if it has no "Cancel" button). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1905 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/simple_dialog.c')
-rw-r--r--gtk/simple_dialog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c
index 1cb19175fc..71603e0f62 100644
--- a/gtk/simple_dialog.c
+++ b/gtk/simple_dialog.c
@@ -1,7 +1,7 @@
/* dialog.c
* Dialog box routines.
*
- * $Id: simple_dialog.c,v 1.1 2000/01/03 06:59:25 guy Exp $
+ * $Id: simple_dialog.c,v 1.2 2000/05/03 07:19:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -45,6 +45,7 @@
#include "gtkglobals.h"
#include "simple_dialog.h"
+#include "dlg_utils.h"
#include "image/icon-excl.xpm"
#include "image/icon-ethereal.xpm"
@@ -151,6 +152,16 @@ simple_dialog(gint type, gint *btn_mask, gchar *msg_format, ...) {
gtk_container_add(GTK_CONTAINER(bbox), cancel_btn);
GTK_WIDGET_SET_FLAGS(cancel_btn, GTK_CAN_DEFAULT);
gtk_widget_show(cancel_btn);
+
+ /* Catch the "key_press_event" signal in the window, so that we can catch
+ the ESC key being pressed and act as if the "Cancel" button had
+ been selected. */
+ dlg_set_cancel(win, cancel_btn);
+ } else {
+ /* Catch the "key_press_event" signal in the window, so that we can catch
+ the ESC key being pressed and act as if the "OK" button had
+ been selected. */
+ dlg_set_cancel(win, ok_btn);
}
if (btn_mask)