aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2003-11-28 00:13:08 +0000
committerUlf Lamping <ulf.lamping@web.de>2003-11-28 00:13:08 +0000
commitcd01ca6cb034c64b07e0d7915b5b5e4a7f2da1d1 (patch)
tree749c0360e125fd667be06d52ebedce170e2891f2
parent131eeab31d85afbef5558f123a6d7422e7b2d7e3 (diff)
using dlg_utils.c functions to catch the ESC key to close the dialog
svn path=/trunk/; revision=9110
-rw-r--r--gtk/main.c7
-rw-r--r--gtk/plugins_dlg.c13
-rw-r--r--gtk/supported_protos_dlg.c16
3 files changed, 24 insertions, 12 deletions
diff --git a/gtk/main.c b/gtk/main.c
index 5530cc9408..60572a121b 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.332 2003/11/27 22:12:18 guy Exp $
+ * $Id: main.c,v 1.333 2003/11/28 00:13:08 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -234,6 +234,11 @@ about_ethereal( GtkWidget *w _U_, gpointer data _U_ ) {
gtk_widget_grab_default(ok_btn);
gtk_widget_show(ok_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, ok_btn);
+
gtk_widget_show(win);
}
diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c
index 3cde21e910..9be4a0d49d 100644
--- a/gtk/plugins_dlg.c
+++ b/gtk/plugins_dlg.c
@@ -1,7 +1,7 @@
/* plugins_dlg.c
* Dialog boxes for plugins
*
- * $Id: plugins_dlg.c,v 1.30 2003/03/02 17:14:08 deniel Exp $
+ * $Id: plugins_dlg.c,v 1.31 2003/11/28 00:08:35 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -130,14 +130,21 @@ tools_plugins_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
gtk_widget_show(main_hbnbox);
#if GTK_MAJOR_VERSION < 2
- close_bn = gtk_button_new_with_label("Close");
+ close_bn = gtk_button_new_with_label("OK");
#else
- close_bn = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+ close_bn = gtk_button_new_from_stock(GTK_STOCK_OK);
#endif
gtk_container_add(GTK_CONTAINER(main_hbnbox), close_bn);
+ GTK_WIDGET_SET_FLAGS(close_bn, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(close_bn);
gtk_widget_show(close_bn);
SIGNAL_CONNECT(close_bn, "clicked", plugins_close_cb, plugins_window);
+ /* 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(plugins_window, close_bn);
+
gtk_widget_show(plugins_window);
}
diff --git a/gtk/supported_protos_dlg.c b/gtk/supported_protos_dlg.c
index ab9aef6283..c6e6462120 100644
--- a/gtk/supported_protos_dlg.c
+++ b/gtk/supported_protos_dlg.c
@@ -38,6 +38,7 @@
#include "gtkglobals.h"
#include "ui_util.h"
#include "compat_macros.h"
+#include "dlg_utils.h"
@@ -93,15 +94,8 @@ void supported_cb(GtkWidget *w _U_, gpointer data _U_)
return;
}
-#if GTK_MAJOR_VERSION < 2
- supported_w = gtk_window_new(GTK_WINDOW_DIALOG);
-#else
- supported_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-#endif
- gtk_widget_set_name(supported_w, "Ethereal Supported Protocols window" );
- gtk_window_set_title(GTK_WINDOW(supported_w), "Ethereal: Supported Protocols");
+ supported_w = dlg_window_new("Ethereal: Supported Protocols");
SIGNAL_CONNECT(supported_w, "destroy", supported_destroy_cb, NULL);
- SIGNAL_CONNECT(supported_w, "realize", window_icon_realize_cb, NULL);
WIDGET_SET_SIZE(supported_w, DEF_WIDTH * 2/3, DEF_HEIGHT * 2/3);
gtk_container_border_width(GTK_CONTAINER(supported_w), 2);
@@ -242,6 +236,12 @@ void supported_cb(GtkWidget *w _U_, gpointer data _U_)
gtk_widget_show(close_bt);
gtk_quit_add_destroy(gtk_main_level(), GTK_OBJECT(supported_w));
+
+ /* 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(supported_w, close_bt);
+
gtk_widget_show(supported_w);
} /* supported_cb */