forked from osmocom/wireshark
From Ronald Henderson, when closing IO-Stat window, also close any open Filter dialogs
svn path=/trunk/; revision=6916
This commit is contained in:
parent
68799ac1cd
commit
07bcd090fc
|
@ -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.40 2002/11/11 15:39:05 oabad Exp $
|
||||
* $Id: filter_prefs.c,v 1.41 2003/01/11 11:10:33 sahlberg Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -155,7 +155,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. */
|
||||
void
|
||||
GtkWidget *
|
||||
display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
|
||||
{
|
||||
construct_args_t *construct_args = construct_args_ptr;
|
||||
|
@ -170,7 +170,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;
|
||||
return filter_browse_w;
|
||||
}
|
||||
|
||||
/* No. Get the text entry attached to the button. */
|
||||
|
@ -187,6 +187,8 @@ display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
|
|||
|
||||
/* Set the E_FILT_DIALOG_PTR_KEY for the caller to point to us */
|
||||
OBJECT_SET_DATA(caller, E_FILT_DIALOG_PTR_KEY, filter_browse_w);
|
||||
|
||||
return filter_browse_w;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* (This used to be a notebook page under "Preferences", hence the
|
||||
* "prefs" in the file name.)
|
||||
*
|
||||
* $Id: filter_prefs.h,v 1.12 2002/08/28 21:03:47 jmayer Exp $
|
||||
* $Id: filter_prefs.h,v 1.13 2003/01/11 11:10:33 sahlberg Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -40,7 +40,7 @@ typedef struct {
|
|||
} construct_args_t;
|
||||
|
||||
void capture_filter_construct_cb(GtkWidget *w, gpointer user_data);
|
||||
void display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr);
|
||||
GtkWidget *display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr);
|
||||
void cfilter_dialog_cb(GtkWidget *w);
|
||||
void dfilter_dialog_cb(GtkWidget *w);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* io_stat.c
|
||||
* io_stat 2002 Ronnie Sahlberg
|
||||
*
|
||||
* $Id: io_stat.c,v 1.13 2002/12/16 21:18:37 guy Exp $
|
||||
* $Id: io_stat.c,v 1.14 2003/01/11 11:10:33 sahlberg Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -117,6 +117,9 @@ typedef struct _io_stat_graph_t {
|
|||
GtkWidget *calc_field;
|
||||
GdkColor color;
|
||||
GdkGC *gc;
|
||||
construct_args_t *args;
|
||||
GtkWidget *filter_bt;
|
||||
GtkWidget *filter_main_win;
|
||||
} io_stat_graph_t;
|
||||
|
||||
typedef struct _io_stat_yscale_t {
|
||||
|
@ -861,6 +864,14 @@ gtk_iostat_init(char *optarg _U_)
|
|||
io->graphs[i].filter_button=NULL;
|
||||
io->graphs[i].advanced_buttons=NULL;
|
||||
io->graphs[i].io=io;
|
||||
|
||||
io->graphs[i].args=g_malloc(sizeof(construct_args_t));
|
||||
io->graphs[i].args->title = NULL;
|
||||
io->graphs[i].args->wants_apply_button=TRUE;
|
||||
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)){
|
||||
|
@ -918,6 +929,17 @@ quit(GtkWidget *widget, GdkEventExpose *event _U_)
|
|||
g_free(it);
|
||||
}
|
||||
unprotect_thread_critical_region();
|
||||
|
||||
free(io->graphs[i].args->title);
|
||||
io->graphs[i].args->title=NULL;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -1469,28 +1491,52 @@ create_advanced_box(io_stat_graph_t *gio, GtkWidget *box)
|
|||
}
|
||||
|
||||
|
||||
gint delete_filter_event(GtkWidget *widget _U_, io_stat_graph_t *gio)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<MAX_GRAPHS;i++){
|
||||
if (GTK_WIDGET_STATE (gio->io->graphs[i].filter_bt)
|
||||
== GTK_STATE_INSENSITIVE) {
|
||||
gtk_widget_set_sensitive (gio->io->graphs[i].filter_bt,1);
|
||||
}
|
||||
}
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
create_filter_box(io_stat_graph_t *gio, GtkWidget *box)
|
||||
filter_button_clicked(GtkWidget *w, gpointer uio)
|
||||
{
|
||||
int i;
|
||||
io_stat_graph_t *gio=(io_stat_graph_t *)uio;
|
||||
|
||||
for(i=0;i<MAX_GRAPHS;i++){
|
||||
if( gio->io->graphs[i].filter_bt != w ){
|
||||
gtk_widget_set_sensitive(gio->io->graphs[i].filter_bt,0);
|
||||
}
|
||||
}
|
||||
gio->filter_main_win=display_filter_construct_cb(w, gio->args);
|
||||
SIGNAL_CONNECT(gio->filter_main_win, "delete_event", delete_filter_event, gio);
|
||||
SIGNAL_CONNECT(gio->filter_main_win, "destroy", delete_filter_event, gio);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
create_filter_box(io_stat_graph_t *gio, GtkWidget *box, int num)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
/* filter prefs dialog */
|
||||
GtkWidget *filter_bt;
|
||||
static construct_args_t args = {
|
||||
"Ethereal: Display Filter",
|
||||
TRUE,
|
||||
TRUE
|
||||
};
|
||||
/* filter prefs dialog */
|
||||
|
||||
char str[256];
|
||||
|
||||
hbox=gtk_hbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(box), hbox);
|
||||
gtk_box_set_child_packing(GTK_BOX(box), hbox, FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_widget_show(hbox);
|
||||
|
||||
label=gtk_label_new(" Display:");
|
||||
|
||||
sprintf(str, "Filter:%d", num);
|
||||
label=gtk_label_new(str);
|
||||
gtk_widget_show(label);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -1541,16 +1587,23 @@ create_filter_box(io_stat_graph_t *gio, GtkWidget *box)
|
|||
label=gtk_label_new(" ");
|
||||
gtk_widget_show(label);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
||||
filter_bt = gtk_button_new_with_label("Filter:");
|
||||
SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), filter_bt, FALSE, TRUE, 0);
|
||||
gtk_widget_show(filter_bt);
|
||||
/* filter prefs dialog */
|
||||
gio->filter_bt = gtk_button_new_with_label("Filter:");
|
||||
|
||||
sprintf(str, "Ethereal: Display Filter IO-Stat (Filter:%d)", num);
|
||||
if(gio->args->title){
|
||||
free(gio->args->title);
|
||||
}
|
||||
gio->args->title=strdup(str);
|
||||
|
||||
SIGNAL_CONNECT(gio->filter_bt, "clicked", filter_button_clicked, gio);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), gio->filter_bt, FALSE, TRUE, 0);
|
||||
gtk_widget_show(gio->filter_bt);
|
||||
|
||||
gio->filter_button=gtk_entry_new_with_max_length(256);
|
||||
|
||||
/* filter prefs dialog */
|
||||
OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, gio->filter_button);
|
||||
OBJECT_SET_DATA(gio->filter_bt, E_FILT_TE_PTR_KEY, gio->filter_button);
|
||||
/* filter prefs dialog */
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), gio->filter_button, FALSE, FALSE, 0);
|
||||
|
@ -1574,7 +1627,7 @@ create_filter_area(io_stat_t *io, GtkWidget *box)
|
|||
gtk_widget_show(vbox);
|
||||
|
||||
for(i=0;i<MAX_GRAPHS;i++){
|
||||
create_filter_box(&io->graphs[i], vbox);
|
||||
create_filter_box(&io->graphs[i], vbox, i+1);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1589,6 +1642,7 @@ init_io_stat_window(io_stat_t *io)
|
|||
|
||||
/* create the main window */
|
||||
io->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_widget_set_name(io->window, "I/O Statistics");
|
||||
|
||||
vbox=gtk_vbox_new(FALSE, 0);
|
||||
|
|
Loading…
Reference in New Issue