summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-01-15 05:58:50 +0000
committerGuy Harris <guy@alum.mit.edu>2003-01-15 05:58:50 +0000
commitf71d13b16e3bc3923eaeee775d6e0d5e7dfac010 (patch)
treeb0144af341f4dfd4fbedf3fb1be87189e6aeb6ff
parenta2f01014c141592a9d0c662fea616a0fe7c981df (diff)
downloadwireshark-f71d13b16e3bc3923eaeee775d6e0d5e7dfac010.tar.gz
Move the code that associates buttons with filter dialogs, and vice
versa, into "filter_dialog_new()", rather than replicating it in a couple of routines. The return value of "display_filter_construct_cb()" isn't used for anything, it's ignored by most callers and stored but subsequently ignored by io_stat.c; get rid of the return value, and don't bother storing it in io_stat.c. Before destroying a filter dialog box associated with a button being destroyed, break the association. Get rid of an unused variable in io_stat.c. svn path=/trunk/; revision=6931
-rw-r--r--gtk/filter_prefs.c37
-rw-r--r--gtk/filter_prefs.h7
-rw-r--r--gtk/io_stat.c12
3 files changed, 21 insertions, 35 deletions
diff --git a/gtk/filter_prefs.c b/gtk/filter_prefs.c
index 22e9a7682b..33a715ce0d 100644
--- a/gtk/filter_prefs.c
+++ b/gtk/filter_prefs.c
@@ -3,7 +3,7 @@
* (This used to be a notebook page under "Preferences", hence the
* "prefs" in the file name.)
*
- * $Id: filter_prefs.c,v 1.42 2003/01/15 05:20:18 guy Exp $
+ * $Id: filter_prefs.c,v 1.43 2003/01/15 05:58:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -133,13 +133,6 @@ capture_filter_construct_cb(GtkWidget *w, gpointer user_data _U_)
/* Now create a new dialog, without an "Add Expression..." button. */
filter_browse_w = filter_dialog_new(w, parent_filter_te,
CFILTER_LIST, &args);
-
- /* Set the E_FILT_BUTTON_PTR_KEY for the new dialog to point to
- the button. */
- OBJECT_SET_DATA(filter_browse_w, E_FILT_BUTTON_PTR_KEY, w);
-
- /* Set the E_FILT_DIALOG_PTR_KEY for the button to point to us */
- OBJECT_SET_DATA(w, E_FILT_DIALOG_PTR_KEY, filter_browse_w);
}
#endif
@@ -155,7 +148,7 @@ capture_filter_construct_cb(GtkWidget *w, gpointer user_data _U_)
If "wants_apply_button" is non-null, we add an "Apply" button that
acts like "OK" but doesn't dismiss this dialog. */
-GtkWidget *
+void
display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
{
construct_args_t *construct_args = construct_args_ptr;
@@ -168,7 +161,7 @@ display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
if (filter_browse_w != NULL) {
/* Yes. Just re-activate that dialog box. */
reactivate_window(filter_browse_w);
- return filter_browse_w;
+ return;
}
/* No. Get the text entry attached to the button. */
@@ -178,15 +171,6 @@ display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
definitely with an "Add Expression..." button. */
filter_browse_w = filter_dialog_new(w, parent_filter_te,
DFILTER_LIST, construct_args);
-
- /* Set the E_FILT_BUTTON_PTR_KEY for the new dialog to point to
- the button. */
- OBJECT_SET_DATA(filter_browse_w, E_FILT_BUTTON_PTR_KEY, w);
-
- /* Set the E_FILT_DIALOG_PTR_KEY for the button to point to us */
- OBJECT_SET_DATA(w, E_FILT_DIALOG_PTR_KEY, filter_browse_w);
-
- return filter_browse_w;
}
/* Should be called when a button that creates filters is destroyed; it
@@ -201,7 +185,8 @@ filter_button_destroy_cb(GtkWidget *button, gpointer user_data _U_)
filter_w = OBJECT_GET_DATA(button, E_FILT_DIALOG_PTR_KEY);
if (filter_w != NULL) {
- /* Yes. Destroy it. */
+ /* Yes. Break the association, and destroy the dialog. */
+ OBJECT_SET_DATA(button, E_FILT_DIALOG_PTR_KEY, NULL);
gtk_widget_destroy(filter_w);
}
}
@@ -325,7 +310,7 @@ get_filter_dialog_list(filter_list_type_t list)
}
static GtkWidget *
-filter_dialog_new(GtkWidget *button _U_, GtkWidget *parent_filter_te,
+filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te,
filter_list_type_t list, construct_args_t *construct_args)
{
GtkWidget *main_w, /* main window */
@@ -682,6 +667,16 @@ filter_dialog_new(GtkWidget *button _U_, GtkWidget *parent_filter_te,
gtk_widget_show(main_w);
+ if (button != NULL) {
+ /* This dialog box was created by a "Filter" button.
+ Set the E_FILT_BUTTON_PTR_KEY for the new dialog to point to
+ the button. */
+ OBJECT_SET_DATA(main_w, E_FILT_BUTTON_PTR_KEY, button);
+
+ /* Set the E_FILT_DIALOG_PTR_KEY for the button to point to us */
+ OBJECT_SET_DATA(button, E_FILT_DIALOG_PTR_KEY, main_w);
+ }
+
return main_w;
}
diff --git a/gtk/filter_prefs.h b/gtk/filter_prefs.h
index ef92174947..cc85a5d8eb 100644
--- a/gtk/filter_prefs.h
+++ b/gtk/filter_prefs.h
@@ -3,13 +3,12 @@
* (This used to be a notebook page under "Preferences", hence the
* "prefs" in the file name.)
*
- * $Id: filter_prefs.h,v 1.14 2003/01/15 05:20:19 guy Exp $
+ * $Id: filter_prefs.h,v 1.15 2003/01/15 05:58:50 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -40,7 +39,7 @@ typedef struct {
} construct_args_t;
void capture_filter_construct_cb(GtkWidget *w, gpointer user_data);
-GtkWidget *display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr);
+void display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr);
void filter_button_destroy_cb(GtkWidget *button, gpointer user_data);
void cfilter_dialog_cb(GtkWidget *w);
void dfilter_dialog_cb(GtkWidget *w);
diff --git a/gtk/io_stat.c b/gtk/io_stat.c
index 86ddd67826..f64f351714 100644
--- a/gtk/io_stat.c
+++ b/gtk/io_stat.c
@@ -1,7 +1,7 @@
/* io_stat.c
* io_stat 2002 Ronnie Sahlberg
*
- * $Id: io_stat.c,v 1.15 2003/01/15 05:20:19 guy Exp $
+ * $Id: io_stat.c,v 1.16 2003/01/15 05:58:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -119,7 +119,6 @@ typedef struct _io_stat_graph_t {
GdkGC *gc;
construct_args_t *args;
GtkWidget *filter_bt;
- GtkWidget *filter_main_win;
} io_stat_graph_t;
typedef struct _io_stat_yscale_t {
@@ -871,7 +870,6 @@ gtk_iostat_init(char *optarg _U_)
io->graphs[i].args->activate_on_ok=TRUE;
io->graphs[i].filter_bt=NULL;
- io->graphs[i].filter_main_win=NULL;
}
if(register_tap_listener("frame", &io->graphs[0], NULL, gtk_iostat_reset, gtk_iostat_packet, gtk_iostat_draw)){
@@ -935,11 +933,6 @@ quit(GtkWidget *widget, GdkEventExpose *event _U_)
g_free(io->graphs[i].args);
io->graphs[i].args=NULL;
-
- if(io->graphs[i].filter_main_win){
- gtk_widget_destroy(io->graphs[i].filter_main_win);
- io->graphs[i].filter_main_win=NULL;
- }
}
g_free(io);
@@ -1494,10 +1487,9 @@ create_advanced_box(io_stat_graph_t *gio, GtkWidget *box)
static void
filter_button_clicked(GtkWidget *w, gpointer uio)
{
- int i;
io_stat_graph_t *gio=(io_stat_graph_t *)uio;
- gio->filter_main_win=display_filter_construct_cb(w, gio->args);
+ display_filter_construct_cb(w, gio->args);
return;
}