aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-06-24 05:37:04 +0000
committerGuy Harris <guy@alum.mit.edu>1999-06-24 05:37:04 +0000
commit5a128fea68a891b82569f8a1c4676468413fa55d (patch)
tree5f2c2b66265e01214271bc377d7dce1364f2391c
parent3b0b8e40f45c2b9ffdc3c6cbafa918cf38654711 (diff)
If the "Cancel" button is clicked in the "Display Options"
window, revert the timestamp type display option to the value it had before that window was popped up, undoing any changes applied with the "Apply" button. If "Display/Options" is selected while there's a "Display Options" window active, don't pop up another "Display Options" window (we really should, if that's done, switch the input focus to the existing "Display Options" window, if possible). svn path=/trunk/; revision=329
-rw-r--r--display.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/display.c b/display.c
index 3c4875ea19..67e265d19d 100644
--- a/display.c
+++ b/display.c
@@ -1,7 +1,7 @@
/* display.c
* Routines for packet display windows
*
- * $Id: display.c,v 1.6 1999/06/22 22:43:56 gram Exp $
+ * $Id: display.c,v 1.7 1999/06/24 05:37:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -76,10 +76,30 @@ static void display_opt_ok_cb(GtkWidget *, gpointer);
static void display_opt_apply_cb(GtkWidget *, gpointer);
static void display_opt_close_cb(GtkWidget *, gpointer);
+/*
+ * Keep track of whether the "Display Options" window is active, so that,
+ * if it is, selecting "Display/Options" doesn't pop up another such
+ * window.
+ */
+static int display_opt_window_active;
+static ts_type prev_timestamp_type;
+
void
display_opt_cb(GtkWidget *w, gpointer d) {
GtkWidget *display_opt_w, *button, *main_vb, *bbox, *ok_bt, *apply_bt, *cancel_bt;
+ /* If there's already a "Display Options" window active, don't pop
+ up another one.
+
+ XXX - this should arguably give the input focus to the active
+ "Display Options" window, if possible. */
+ if (display_opt_window_active)
+ return;
+
+ /* Save the current timestamp type, so that "Cancel" can put it back
+ if we've changed it with "Apply". */
+ prev_timestamp_type = timestamp_type;
+
display_opt_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(display_opt_w), "Ethereal: Display Options");
@@ -146,6 +166,7 @@ display_opt_cb(GtkWidget *w, gpointer d) {
gtk_box_pack_start (GTK_BOX (bbox), cancel_bt, TRUE, TRUE, 0);
gtk_widget_show(cancel_bt);
+ display_opt_window_active = TRUE;
gtk_widget_show(display_opt_w);
}
@@ -169,6 +190,7 @@ display_opt_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
timestamp_type = DELTA;
gtk_widget_destroy(GTK_WIDGET(parent_w));
+ display_opt_window_active = FALSE;
change_time_formats(&cf);
}
@@ -198,6 +220,12 @@ display_opt_apply_cb(GtkWidget *ok_bt, gpointer parent_w) {
static void
display_opt_close_cb(GtkWidget *close_bt, gpointer parent_w) {
+ if (timestamp_type != prev_timestamp_type) {
+ timestamp_type = prev_timestamp_type;
+ change_time_formats(&cf);
+ }
+
gtk_grab_remove(GTK_WIDGET(parent_w));
gtk_widget_destroy(GTK_WIDGET(parent_w));
+ display_opt_window_active = FALSE;
}