diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/ansi_a_stat.c | 54 | ||||
-rw-r--r-- | gtk/ansi_map_stat.c | 57 | ||||
-rw-r--r-- | gtk/bootp_stat.c | 33 | ||||
-rw-r--r-- | gtk/dcerpc_stat.c | 40 | ||||
-rw-r--r-- | gtk/endpoint_talkers_table.c | 34 | ||||
-rw-r--r-- | gtk/fc_stat.c | 36 | ||||
-rw-r--r-- | gtk/gsm_a_stat.c | 54 | ||||
-rw-r--r-- | gtk/gsm_map_stat.c | 54 | ||||
-rw-r--r-- | gtk/gsm_map_summary.c | 13 | ||||
-rw-r--r-- | gtk/h225_counter.c | 17 | ||||
-rw-r--r-- | gtk/h225_ras_srt.c | 19 | ||||
-rw-r--r-- | gtk/hostlist_table.c | 37 | ||||
-rw-r--r-- | gtk/http_stat.c | 35 | ||||
-rw-r--r-- | gtk/io_stat.c | 23 | ||||
-rw-r--r-- | gtk/isup_stat.c | 53 | ||||
-rw-r--r-- | gtk/ldap_stat.c | 42 | ||||
-rw-r--r-- | gtk/mgcp_stat.c | 27 | ||||
-rw-r--r-- | gtk/mtp3_stat.c | 54 | ||||
-rw-r--r-- | gtk/mtp3_summary.c | 40 | ||||
-rw-r--r-- | gtk/proto_draw.c | 25 | ||||
-rw-r--r-- | gtk/proto_hier_stats_dlg.c | 13 | ||||
-rw-r--r-- | gtk/rpc_progs.c | 30 | ||||
-rw-r--r-- | gtk/rpc_stat.c | 50 | ||||
-rw-r--r-- | gtk/rtp_analysis.c | 21 | ||||
-rw-r--r-- | gtk/sip_stat.c | 31 | ||||
-rw-r--r-- | gtk/smb_stat.c | 43 | ||||
-rw-r--r-- | gtk/summary_dlg.c | 14 | ||||
-rw-r--r-- | gtk/supported_protos_dlg.c | 24 | ||||
-rw-r--r-- | gtk/tap_dfilter_dlg.c | 26 | ||||
-rw-r--r-- | gtk/tcp_graph.c | 46 | ||||
-rw-r--r-- | gtk/wsp_stat.c | 33 |
31 files changed, 328 insertions, 750 deletions
diff --git a/gtk/ansi_a_stat.c b/gtk/ansi_a_stat.c index 5a4224248f..8ba09badd3 100644 --- a/gtk/ansi_a_stat.c +++ b/gtk/ansi_a_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: ansi_a_stat.c,v 1.17 2004/04/12 08:53:01 ulfl Exp $ + * $Id: ansi_a_stat.c,v 1.18 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -265,18 +265,6 @@ ansi_a_stat_gtk_sort_column( static void -ansi_a_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - ansi_a_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - - -static void ansi_a_stat_gtk_win_destroy_cb( GtkWindow *win _U_, gpointer user_data _U_) @@ -294,18 +282,14 @@ ansi_a_stat_gtk_win_create( char *default_titles[] = { "IEI", "Message Name", "Count" }; int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 480, 450); - SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_a_stat_gtk_win_destroy_cb, dlg_p); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -314,29 +298,11 @@ ansi_a_stat_gtk_win_create( dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -350,14 +316,12 @@ ansi_a_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -392,15 +356,13 @@ ansi_a_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - gtk_widget_grab_default(bt_close); - SIGNAL_CONNECT(bt_close, "clicked", ansi_a_stat_gtk_dlg_close_cb, dlg_p); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_a_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/ansi_map_stat.c b/gtk/ansi_map_stat.c index 4283aefaae..b10fd90a7f 100644 --- a/gtk/ansi_map_stat.c +++ b/gtk/ansi_map_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: ansi_map_stat.c,v 1.21 2004/04/21 05:53:59 guy Exp $ + * $Id: ansi_map_stat.c,v 1.22 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -261,18 +261,6 @@ ansi_map_stat_gtk_sort_column( static void -ansi_map_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - ansi_map_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - - -static void ansi_map_stat_gtk_win_destroy_cb( GtkWindow *win _U_, gpointer user_data _U_) @@ -288,18 +276,14 @@ ansi_map_stat_gtk_win_create( { int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 500, 450); - SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_map_stat_gtk_win_destroy_cb, dlg_p); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -308,29 +292,11 @@ ansi_map_stat_gtk_win_create( dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - dlg_p->table = gtk_clist_new(ANSI_MAP_INIT_TABLE_NUM_COLUMNS); col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * ANSI_MAP_INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < ANSI_MAP_INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -344,14 +310,14 @@ ansi_map_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); + // gtk_pixmap_new(ascend_pm, ascend_bm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); + // gtk_pixmap_new(descend_pm, descend_bm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -389,15 +355,14 @@ ansi_map_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - gtk_widget_grab_default(bt_close); - SIGNAL_CONNECT(bt_close, "clicked", ansi_map_stat_gtk_dlg_close_cb, dlg_p); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); + + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_map_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/bootp_stat.c b/gtk/bootp_stat.c index 453baf7a02..cf313cc562 100644 --- a/gtk/bootp_stat.c +++ b/gtk/bootp_stat.c @@ -1,7 +1,7 @@ /* bootp_stat.c * boop_stat 2003 Jean-Michel FAYARD * - * $Id: bootp_stat.c,v 1.26 2004/04/12 08:53:01 ulfl Exp $ + * $Id: bootp_stat.c,v 1.27 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -188,18 +188,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) } -static void -dhspstat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - dhcpstat_t *sp = user_data; - - gtk_grab_remove(GTK_WIDGET(sp->win)); - gtk_widget_destroy(GTK_WIDGET(sp->win)); -} - - /* When called, this function will create a new instance of gtk2-dhcpstat. */ static void @@ -231,9 +219,8 @@ dhcpstat_init(char *optarg) } /* top level window */ - sp->win = dlg_window_new(title); + sp->win = window_new(GTK_WINDOW_TOPLEVEL, title); g_free(title); - SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(sp->win), vbox); @@ -272,16 +259,16 @@ dhcpstat_init(char *optarg) gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", dhspstat_gtk_dlg_close_cb, sp); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(sp->win, bt_close, window_cancel_button_cb); + + SIGNAL_CONNECT(sp->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(sp->win, "destroy", win_destroy_cb, sp); + + gtk_widget_show_all(sp->win); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sp->win, bt_close); + window_present(sp->win); - gtk_widget_show_all( sp->win ); - retap_packets(&cfile); + retap_packets(&cfile); } static tap_dfilter_dlg dhcp_stat_dlg = { diff --git a/gtk/dcerpc_stat.c b/gtk/dcerpc_stat.c index 54b887fd82..b88f0eaf63 100644 --- a/gtk/dcerpc_stat.c +++ b/gtk/dcerpc_stat.c @@ -1,7 +1,7 @@ /* dcerpc_stat.c * dcerpc_stat 2002 Ronnie Sahlberg * - * $Id: dcerpc_stat.c,v 1.55 2004/05/07 11:25:15 ulfl Exp $ + * $Id: dcerpc_stat.c,v 1.56 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -261,10 +261,9 @@ gtk_dcerpcstat_init(char *optarg) rs->uuid=uuid; rs->ver=ver; - rs->win=dlg_window_new(""); + rs->win=window_new(GTK_WINDOW_TOPLEVEL, "dcerpc-stat"); dcerpcstat_set_title(rs); gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400); - SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(rs->win), vbox); @@ -325,16 +324,15 @@ gtk_dcerpcstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, rs->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb); + + SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(rs->win, close_bt); + gtk_widget_show_all(rs->win); + window_present(rs->win); - gtk_widget_show_all(rs->win); - retap_packets(&cfile); + retap_packets(&cfile); } @@ -540,13 +538,6 @@ dlg_destroy_cb(void) static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - - -static void gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_) { GtkWidget *dlg_box; @@ -569,7 +560,6 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_) } dlg=dlg_window_new("Ethereal: Compute DCE-RPC SRT statistics"); - SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -658,12 +648,14 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT); - gtk_widget_grab_default(start_button ); SIGNAL_CONNECT_OBJECT(start_button, "clicked", dcerpcstat_start_button_clicked, NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg); + window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb); + + SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); /* Catch the "activate" signal on the filter text entry, so that if the user types Return there, we act as if the "Create Stat" @@ -672,15 +664,13 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_) focus. */ dlg_set_activate(filter_entry, start_button); - /* 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(dlg, cancel_button); + gtk_widget_grab_default(start_button ); /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(filter_entry); gtk_widget_show_all(dlg); + window_present(dlg); } void diff --git a/gtk/endpoint_talkers_table.c b/gtk/endpoint_talkers_table.c index f187683d89..6b2e7756c3 100644 --- a/gtk/endpoint_talkers_table.c +++ b/gtk/endpoint_talkers_table.c @@ -4,7 +4,7 @@ * endpoint_talkers_table 2003 Ronnie Sahlberg * Helper routines common to all endpoint talkers tap. * - * $Id: endpoint_talkers_table.c,v 1.39 2004/05/05 20:12:50 ulfl Exp $ + * $Id: endpoint_talkers_table.c,v 1.40 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1177,13 +1177,11 @@ init_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filt talkers->name=table_name; g_snprintf(title, 255, "%s Conversations: %s", table_name, cf_get_display_name(&cfile)); - talkers->win=dlg_window_new(title); + talkers->win=window_new(GTK_WINDOW_TOPLEVEL, title); talkers->page_lb=NULL; talkers->resolve_names=TRUE; gtk_window_set_default_size(GTK_WINDOW(talkers->win), 750, 400); - SIGNAL_CONNECT(talkers->win, "destroy", ett_win_destroy_cb, talkers); - vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(talkers->win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); @@ -1199,15 +1197,14 @@ init_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filt gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, talkers->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(talkers->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(talkers->win, close_bt); + SIGNAL_CONNECT(talkers->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(talkers->win, "destroy", ett_win_destroy_cb, talkers); gtk_widget_show_all(talkers->win); + window_present(talkers->win); + retap_packets(&cfile); /* after retapping, redraw table */ @@ -1326,11 +1323,9 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) pages = g_malloc(sizeof(void *) * (g_slist_length(registered_ett_tables) + 1)); g_snprintf(title, 255, "Conversations: %s", cf_get_display_name(&cfile)); - win=dlg_window_new(title); + win=window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(win), 750, 400); - SIGNAL_CONNECT(win, "destroy", ett_win_destroy_notebook_cb, pages); - vbox=gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); @@ -1372,16 +1367,15 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(win, close_bt); + SIGNAL_CONNECT(win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(win, "destroy", ett_win_destroy_notebook_cb, pages); gtk_widget_show_all(win); - retap_packets(&cfile); + window_present(win); + + retap_packets(&cfile); /* after retapping, redraw table */ for (page=1; page<=GPOINTER_TO_INT(pages[0]); page++) { diff --git a/gtk/fc_stat.c b/gtk/fc_stat.c index 24ce796f82..5ff9d812aa 100644 --- a/gtk/fc_stat.c +++ b/gtk/fc_stat.c @@ -1,7 +1,7 @@ /* fc_stat.c * fc_stat 2003 Ronnie Sahlberg * - * $Id: fc_stat.c,v 1.31 2004/04/12 08:53:01 ulfl Exp $ + * $Id: fc_stat.c,v 1.32 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -148,10 +148,9 @@ gtk_fcstat_init(char *optarg) fc=g_malloc(sizeof(fcstat_t)); - fc->win=dlg_window_new(""); + fc->win=window_new(GTK_WINDOW_TOPLEVEL, "fc-stat"); gtk_window_set_default_size(GTK_WINDOW(fc->win), 550, 400); fcstat_set_title(fc); - SIGNAL_CONNECT(fc->win, "destroy", win_destroy_cb, fc); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(fc->win), vbox); @@ -189,16 +188,15 @@ gtk_fcstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, fc->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(fc->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(fc->win, close_bt); + SIGNAL_CONNECT(fc->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(fc->win, "destroy", win_destroy_cb, fc); gtk_widget_show_all(fc->win); - retap_packets(&cfile); + window_present(fc->win); + + retap_packets(&cfile); } @@ -213,12 +211,6 @@ dlg_destroy_cb(void) } static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - -static void fcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_) { GString *str; @@ -253,7 +245,6 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_) } dlg=dlg_window_new("Ethereal: Compute Fibre Channel Service Response Time statistics"); - SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -299,7 +290,7 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_) fcstat_start_button_clicked, NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg); + window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb); /* Catch the "activate" signal on the filter text entry, so that if the user types Return there, we act as if the "Create Stat" @@ -308,15 +299,14 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_) focus. */ dlg_set_activate(filter_entry, start_button); - /* 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(dlg, cancel_button); - /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(filter_entry); + SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); + gtk_widget_show_all(dlg); + window_present(dlg); } void diff --git a/gtk/gsm_a_stat.c b/gtk/gsm_a_stat.c index 12221e7c2d..7a20d98874 100644 --- a/gtk/gsm_a_stat.c +++ b/gtk/gsm_a_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: gsm_a_stat.c,v 1.17 2004/04/12 08:53:02 ulfl Exp $ + * $Id: gsm_a_stat.c,v 1.18 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -349,18 +349,6 @@ gsm_a_stat_gtk_sort_column( static void -gsm_a_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - gsm_a_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - - -static void gsm_a_stat_gtk_win_destroy_cb( GtkWindow *win _U_, gpointer user_data _U_) @@ -378,18 +366,14 @@ gsm_a_stat_gtk_win_create( char *default_titles[] = { "IEI", "Message Name", "Count" }; int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 490, 500); - SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_a_stat_gtk_win_destroy_cb, dlg_p); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -400,27 +384,9 @@ gsm_a_stat_gtk_win_create( dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -434,14 +400,12 @@ gsm_a_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -476,15 +440,13 @@ gsm_a_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", gsm_a_stat_gtk_dlg_close_cb, dlg_p); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_a_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/gsm_map_stat.c b/gtk/gsm_map_stat.c index c2f6809383..ebd5e784ec 100644 --- a/gtk/gsm_map_stat.c +++ b/gtk/gsm_map_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: gsm_map_stat.c,v 1.8 2004/04/21 05:53:59 guy Exp $ + * $Id: gsm_map_stat.c,v 1.9 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -294,18 +294,6 @@ gsm_map_stat_gtk_sort_column( static void -gsm_map_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - gsm_map_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - - -static void gsm_map_stat_gtk_win_destroy_cb( GtkWindow *win _U_, gpointer user_data _U_) @@ -321,18 +309,14 @@ gsm_map_stat_gtk_win_create( { int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 560, 390); - SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_map_stat_gtk_win_destroy_cb, dlg_p); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -343,27 +327,9 @@ gsm_map_stat_gtk_win_create( dlg_p->table = gtk_clist_new(GSM_MAP_INIT_TABLE_NUM_COLUMNS); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * GSM_MAP_INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < GSM_MAP_INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -377,14 +343,12 @@ gsm_map_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -422,15 +386,13 @@ gsm_map_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", gsm_map_stat_gtk_dlg_close_cb, dlg_p); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_map_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/gsm_map_summary.c b/gtk/gsm_map_summary.c index 486844dc50..9071c7fdf9 100644 --- a/gtk/gsm_map_summary.c +++ b/gtk/gsm_map_summary.c @@ -6,7 +6,7 @@ * * Modified from summary_dlg.c * - * $Id: gsm_map_summary.c,v 1.2 2004/05/22 19:56:18 ulfl Exp $ + * $Id: gsm_map_summary.c,v 1.3 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -85,7 +85,7 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) /* initial compututations */ seconds = summary.stop_time - summary.start_time; - sum_open_w = dlg_window_new("GSM MAP Statistics: Summary"); + sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "GSM MAP Statistics: Summary"); /* Container for each row of widgets */ main_vb = gtk_vbox_new(FALSE, 3); @@ -249,15 +249,12 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, sum_open_w); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(sum_open_w, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can catch - the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sum_open_w, close_bt); + SIGNAL_CONNECT(sum_open_w, "delete_event", window_delete_event_cb, NULL); gtk_widget_show(sum_open_w); + window_present(sum_open_w); } diff --git a/gtk/h225_counter.c b/gtk/h225_counter.c index 7c89e3d462..35990a0072 100644 --- a/gtk/h225_counter.c +++ b/gtk/h225_counter.c @@ -2,7 +2,7 @@ * h225 message counter for ethereal * Copyright 2003 Lars Roland * - * $Id: h225_counter.c,v 1.19 2004/05/22 19:56:18 ulfl Exp $ + * $Id: h225_counter.c,v 1.20 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -523,8 +523,7 @@ gtk_h225counter_init(char *optarg) h225counter_reset(hs); - hs->win=dlg_window_new("Ethereal: H225 counters"); - SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); + hs->win=window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: H225 counters"); hs->vbox=gtk_vbox_new(FALSE, 3); gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12); @@ -551,15 +550,15 @@ gtk_h225counter_init(char *optarg) gtk_box_pack_end(GTK_BOX(hs->vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, hs->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(hs->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(hs->win, close_bt); + SIGNAL_CONNECT(hs->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); gtk_widget_show_all(hs->win); + window_present(hs->win); + + /* XXX - shouldn't this be retap_packets? */ redissect_packets(&cfile); } diff --git a/gtk/h225_ras_srt.c b/gtk/h225_ras_srt.c index a7a8137bb9..f6b8e1ab5f 100644 --- a/gtk/h225_ras_srt.c +++ b/gtk/h225_ras_srt.c @@ -2,7 +2,7 @@ * h225 RAS Service Response Time statistics for ethereal * Copyright 2003 Lars Roland * - * $Id: h225_ras_srt.c,v 1.16 2004/04/12 08:53:02 ulfl Exp $ + * $Id: h225_ras_srt.c,v 1.17 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -303,8 +303,7 @@ gtk_h225rassrt_init(char *optarg) h225rassrt_reset(hs); - hs->win=dlg_window_new(""); - SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); + hs->win=window_new(GTK_WINDOW_TOPLEVEL, "h225-ras-srt"); hs->vbox=gtk_vbox_new(FALSE, 3); gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12); @@ -331,16 +330,16 @@ gtk_h225rassrt_init(char *optarg) gtk_box_pack_end(GTK_BOX(hs->vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, hs->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(hs->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(hs->win, close_bt); + SIGNAL_CONNECT(hs->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); gtk_widget_show_all(hs->win); - redissect_packets(&cfile); + window_present(hs->win); + + /* XXX - shouldn't this be retap_packets? */ + redissect_packets(&cfile); } void diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index 1a864415ec..21791b441b 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -2,7 +2,7 @@ * modified from endpoint_talkers_table.c 2003 Ronnie Sahlberg * Helper routines common to all host list taps. * - * $Id: hostlist_table.c,v 1.11 2004/05/07 12:15:23 ulfl Exp $ + * $Id: hostlist_table.c,v 1.12 2004/05/23 23:24:05 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -657,13 +657,11 @@ init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char hosttable->name=table_name; g_snprintf(title, 255, "%s Endpoints: %s", table_name, cf_get_display_name(&cfile)); - hosttable->win=dlg_window_new(title); + hosttable->win=window_new(GTK_WINDOW_TOPLEVEL, title); hosttable->page_lb=NULL; hosttable->resolve_names=TRUE; gtk_window_set_default_size(GTK_WINDOW(hosttable->win), 750, 400); - SIGNAL_CONNECT(hosttable->win, "destroy", hostlist_win_destroy_cb, hosttable); - vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(hosttable->win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); @@ -679,16 +677,15 @@ init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, hosttable->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(hosttable->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(hosttable->win, close_bt); + SIGNAL_CONNECT(hosttable->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(hosttable->win, "destroy", hostlist_win_destroy_cb, hosttable); gtk_widget_show_all(hosttable->win); - retap_packets(&cfile); + window_present(hosttable->win); + + retap_packets(&cfile); /* after retapping, redraw table */ draw_hostlist_table_data(hosttable); @@ -805,12 +802,11 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) pages = g_malloc(sizeof(void *) * (g_slist_length(registered_hostlist_tables) + 1)); + win=window_new(GTK_WINDOW_TOPLEVEL, "hostlist"); g_snprintf(title, 255, "Endpoints: %s", cf_get_display_name(&cfile)); - win=dlg_window_new(title); + gtk_window_set_title(GTK_WINDOW(win), title); gtk_window_set_default_size(GTK_WINDOW(win), 750, 400); - SIGNAL_CONNECT(win, "destroy", hostlist_win_destroy_notebook_cb, pages); - vbox=gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); @@ -852,16 +848,15 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(win, close_bt); + SIGNAL_CONNECT(win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(win, "destroy", hostlist_win_destroy_notebook_cb, pages); gtk_widget_show_all(win); - retap_packets(&cfile); + window_present(win); + + retap_packets(&cfile); /* after retapping, redraw table */ for (page=1; page<=GPOINTER_TO_INT(pages[0]); page++) { diff --git a/gtk/http_stat.c b/gtk/http_stat.c index 4ac5595bde..f1fb482456 100644 --- a/gtk/http_stat.c +++ b/gtk/http_stat.c @@ -1,7 +1,7 @@ /* http_stat.c * http_stat 2003 Jean-Michel FAYARD * - * $Id: http_stat.c,v 1.29 2004/05/13 12:19:24 ulfl Exp $ + * $Id: http_stat.c,v 1.30 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -379,17 +379,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) g_free(sp); } -static void -httpstat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - httpstat_t *sp = user_data; - - gtk_grab_remove(GTK_WIDGET(sp->win)); - gtk_widget_destroy(GTK_WIDGET(sp->win)); -} - /* When called, this function will create a new instance of gtk_httpstat. */ @@ -412,7 +401,10 @@ gtk_httpstat_init(char *optarg) filter=NULL; } - sp = g_malloc( sizeof(httpstat_t) ); + /* top level window */ + sp = g_malloc( sizeof(httpstat_t) ); + sp->win = window_new(GTK_WINDOW_TOPLEVEL, "http-stat"); + if(filter){ sp->filter=g_strdup(filter); title=g_strdup_printf("HTTP statistics with filter: %s", filter); @@ -421,10 +413,8 @@ gtk_httpstat_init(char *optarg) title=g_strdup("HTTP statistics"); } - /* top level window */ - sp->win = dlg_window_new(title); + gtk_window_set_title(GTK_WINDOW(sp->win), title); g_free(title); - SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp); /* container for each group of status code */ main_vb = gtk_vbox_new(FALSE, 12); @@ -503,15 +493,14 @@ gtk_httpstat_init(char *optarg) gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", httpstat_gtk_dlg_close_cb, sp); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(sp->win, bt_close, window_cancel_button_cb); + + SIGNAL_CONNECT(sp->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(sp->win, "destroy", win_destroy_cb, sp); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sp->win, bt_close); + gtk_widget_show_all(sp->win); + window_present(sp->win); - gtk_widget_show_all( sp->win ); http_init_hash(sp); retap_packets(&cfile); } diff --git a/gtk/io_stat.c b/gtk/io_stat.c index a590967e96..da0e0475c7 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.75 2004/05/22 19:56:18 ulfl Exp $ + * $Id: io_stat.c,v 1.76 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1868,16 +1868,6 @@ create_filter_area(io_stat_t *io, GtkWidget *box) } -static void -io_stat_close_cb( - GtkButton *button _U_, - gpointer parent_w) -{ - gtk_grab_remove(GTK_WIDGET(parent_w)); - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - - static void init_io_stat_window(io_stat_t *io) { @@ -1886,7 +1876,7 @@ init_io_stat_window(io_stat_t *io) GtkWidget *bt_close; /* create the main window */ - io->window=dlg_window_new("I/O Graphs"); + io->window=window_new(GTK_WINDOW_TOPLEVEL, "I/O Graphs"); vbox=gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(io->window), vbox); @@ -1910,15 +1900,12 @@ init_io_stat_window(io_stat_t *io) gtk_widget_show(hbox); bt_close = OBJECT_GET_DATA(hbox, GTK_STOCK_CLOSE); - gtk_widget_grab_default(bt_close); - SIGNAL_CONNECT(bt_close, "clicked", io_stat_close_cb, io->window); + window_set_cancel_button(io->window, bt_close, window_cancel_button_cb); - /* 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(io->window, bt_close); + SIGNAL_CONNECT(io->window, "delete_event", window_delete_event_cb, NULL); gtk_widget_show(io->window); + window_present(io->window); } diff --git a/gtk/isup_stat.c b/gtk/isup_stat.c index 2fe3c976c6..16c97a6df3 100644 --- a/gtk/isup_stat.c +++ b/gtk/isup_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: isup_stat.c,v 1.22 2004/04/21 05:53:59 guy Exp $ + * $Id: isup_stat.c,v 1.23 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -238,17 +238,6 @@ isup_stat_gtk_sort_column( } -static void -isup_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - isup_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - static void isup_stat_gtk_win_destroy_cb( @@ -268,18 +257,14 @@ isup_stat_gtk_win_create( char *default_titles[] = { "ID", "Acronym", "Message Name", "Count" }; int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 560, 450); - SIGNAL_CONNECT(dlg_p->win, "destroy", isup_stat_gtk_win_destroy_cb, dlg_p); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -290,27 +275,9 @@ isup_stat_gtk_win_create( dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -324,14 +291,12 @@ isup_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -367,15 +332,13 @@ isup_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", isup_stat_gtk_dlg_close_cb, dlg_p); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", isup_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/ldap_stat.c b/gtk/ldap_stat.c index e02853be09..f54646124a 100644 --- a/gtk/ldap_stat.c +++ b/gtk/ldap_stat.c @@ -1,7 +1,7 @@ /* ldap_stat.c * ldap_stat 2003 Ronnie Sahlberg * - * $Id: ldap_stat.c,v 1.19 2004/04/12 08:53:02 ulfl Exp $ + * $Id: ldap_stat.c,v 1.20 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -162,10 +162,9 @@ gtk_ldapstat_init(char *optarg) ldap=g_malloc(sizeof(ldapstat_t)); - ldap->win=dlg_window_new(""); + ldap->win=window_new(GTK_WINDOW_TOPLEVEL, "ldap-stat"); gtk_window_set_default_size(GTK_WINDOW(ldap->win), 550, 400); ldapstat_set_title(ldap); - SIGNAL_CONNECT(ldap->win, "destroy", win_destroy_cb, ldap); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(ldap->win), vbox); @@ -224,16 +223,15 @@ gtk_ldapstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, ldap->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(ldap->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(ldap->win, close_bt); + SIGNAL_CONNECT(ldap->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(ldap->win, "destroy", win_destroy_cb, ldap); - gtk_widget_show_all(ldap->win); - retap_packets(&cfile); + gtk_widget_show_all(ldap->win); + window_present(ldap->win); + + retap_packets(&cfile); } @@ -248,12 +246,6 @@ dlg_destroy_cb(void) } static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - -static void ldapstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_) { GString *str; @@ -288,7 +280,6 @@ gtk_ldapstat_cb(GtkWidget *w _U_, gpointer d _U_) } dlg=dlg_window_new("Ethereal: Compute LDAP Service Response Time statistics"); - SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -329,12 +320,11 @@ gtk_ldapstat_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT); - gtk_widget_grab_default(start_button ); SIGNAL_CONNECT_OBJECT(start_button, "clicked", ldapstat_start_button_clicked, NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg); + window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb); /* Catch the "activate" signal on the filter text entry, so that if the user types Return there, we act as if the "Create Stat" @@ -343,15 +333,15 @@ gtk_ldapstat_cb(GtkWidget *w _U_, gpointer d _U_) focus. */ dlg_set_activate(filter_entry, start_button); - /* 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(dlg, cancel_button); + gtk_widget_grab_default(start_button ); - /* Give the initial focus to the "Filter" entry box. */ + /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(filter_entry); - gtk_widget_show_all(dlg); + SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); + + gtk_widget_show_all(dlg); + window_present(dlg); } void diff --git a/gtk/mgcp_stat.c b/gtk/mgcp_stat.c index b9ea9acaa9..f31b93906f 100644 --- a/gtk/mgcp_stat.c +++ b/gtk/mgcp_stat.c @@ -2,7 +2,7 @@ * mgcp-statistics for ethereal * Copyright 2003 Lars Roland * - * $Id: mgcp_stat.c,v 1.34 2004/05/22 19:56:19 ulfl Exp $ + * $Id: mgcp_stat.c,v 1.35 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -263,6 +263,8 @@ gtk_mgcpstat_init(char *optarg) mgcpstat_t *ms; char *filter=NULL; GString *error_string; + GtkWidget *bt_close; + GtkWidget *bbox; if(strncmp(optarg,"mgcp,srt,",9) == 0){ filter=optarg+9; @@ -276,10 +278,9 @@ gtk_mgcpstat_init(char *optarg) mgcpstat_reset(ms); - ms->win=dlg_window_new("MGCP SRT"); - SIGNAL_CONNECT(ms->win, "destroy", win_destroy_cb, ms); + ms->win=window_new(GTK_WINDOW_TOPLEVEL, "MGCP SRT"); - ms->vbox=gtk_vbox_new(FALSE, 0); + ms->vbox=gtk_vbox_new(FALSE, 3); init_main_stat_window(ms->win, ms->vbox, "MGCP Service Response Time (SRT) Statistics", filter); @@ -299,8 +300,20 @@ gtk_mgcpstat_init(char *optarg) return; } - gtk_widget_show_all(ms->win); - retap_packets(&cfile); + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + gtk_box_pack_start(GTK_BOX(ms->vbox), bbox, FALSE, FALSE, 0); + + bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); + window_set_cancel_button(ms->win, bt_close, window_cancel_button_cb); + + SIGNAL_CONNECT(ms->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(ms->win, "destroy", win_destroy_cb, ms); + + gtk_widget_show_all(ms->win); + window_present(ms->win); + + retap_packets(&cfile); } static tap_dfilter_dlg mgcp_srt_dlg = { @@ -316,6 +329,6 @@ register_tap_listener_gtkmgcpstat(void) register_ethereal_tap("mgcp,srt", gtk_mgcpstat_init); if (find_tap_id("mgcp")) - register_tap_menu_item("MGCP...", REGISTER_TAP_GROUP_NONE, + register_tap_menu_item("MGCP...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(mgcp_srt_dlg)); } diff --git a/gtk/mtp3_stat.c b/gtk/mtp3_stat.c index a16e8192b8..4199fb5bca 100644 --- a/gtk/mtp3_stat.c +++ b/gtk/mtp3_stat.c @@ -5,7 +5,7 @@ * * Modified from gsm_map_stat.c * - * $Id: mtp3_stat.c,v 1.1 2004/04/21 17:57:31 guy Exp $ + * $Id: mtp3_stat.c,v 1.2 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -310,18 +310,6 @@ mtp3_stat_gtk_sort_column( static void -mtp3_stat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - mtp3_stat_dlg_t *dlg_p = user_data; - - gtk_grab_remove(GTK_WIDGET(dlg_p->win)); - gtk_widget_destroy(GTK_WIDGET(dlg_p->win)); -} - - -static void mtp3_stat_gtk_win_destroy_cb( GtkWindow *win _U_, gpointer user_data _U_) @@ -337,18 +325,14 @@ mtp3_stat_gtk_win_create( { int i; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - dlg_p->win = dlg_window_new(title); + dlg_p->win = window_new(GTK_WINDOW_TOPLEVEL, title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 640, 390); - SIGNAL_CONNECT(dlg_p->win, "destroy", mtp3_stat_gtk_win_destroy_cb, dlg_p); vbox = gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); @@ -357,29 +341,11 @@ mtp3_stat_gtk_win_create( dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(dlg_p->win); - dlg_p->table = gtk_clist_new(MTP3_INIT_TABLE_NUM_COLUMNS); col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * MTP3_INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(dlg_p->scrolled_win); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(dlg_p->scrolled_win->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < MTP3_INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -393,14 +359,12 @@ mtp3_stat_gtk_win_create( gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -438,15 +402,13 @@ mtp3_stat_gtk_win_create( gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - gtk_widget_grab_default(bt_close); - SIGNAL_CONNECT(bt_close, "clicked", mtp3_stat_gtk_dlg_close_cb, dlg_p); + window_set_cancel_button(dlg_p->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(dlg_p->win, bt_close); + SIGNAL_CONNECT(dlg_p->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg_p->win, "destroy", mtp3_stat_gtk_win_destroy_cb, dlg_p); gtk_widget_show_all(dlg_p->win); + window_present(dlg_p->win); } diff --git a/gtk/mtp3_summary.c b/gtk/mtp3_summary.c index e339c763fa..32eb053595 100644 --- a/gtk/mtp3_summary.c +++ b/gtk/mtp3_summary.c @@ -6,7 +6,7 @@ * * Modified from gsm_map_summary.c * - * $Id: mtp3_summary.c,v 1.2 2004/05/22 19:56:19 ulfl Exp $ + * $Id: mtp3_summary.c,v 1.3 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -242,9 +242,6 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) *tot_fr, *tot_box, *table, *column_lb, *table_fr; column_arrows *col_arrows; - GdkBitmap *ascend_bm, *descend_bm; - GdkPixmap *ascend_pm, *descend_pm; - GtkStyle *win_style; gchar string_buff[SUM_STR_MAX]; double seconds; @@ -258,7 +255,7 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) /* initial compututations */ seconds = summary.stop_time - summary.start_time; - sum_open_w = dlg_window_new("MTP3 Statistics: Summary"); + sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "MTP3 Statistics: Summary"); /* Container for each row of widgets */ main_vb = gtk_vbox_new(FALSE, 3); @@ -325,24 +322,6 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * MTP3_SUM_INIT_TABLE_NUM_COLUMNS); - win_style = - gtk_widget_get_style(sum_open_w); - - /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ - gtk_widget_show_all(sum_open_w); - - ascend_pm = - gdk_pixmap_create_from_xpm_d(sum_open_w->window, - &ascend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **) clist_ascend_xpm); - - descend_pm = - gdk_pixmap_create_from_xpm_d(sum_open_w->window, - &descend_bm, - &win_style->bg[GTK_STATE_NORMAL], - (gchar **)clist_descend_xpm); - for (i = 0; i < MTP3_SUM_INIT_TABLE_NUM_COLUMNS; i++) { col_arrows[i].table = gtk_table_new(2, 2, FALSE); @@ -356,14 +335,12 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = xpm_to_widget(clist_ascend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = - gtk_pixmap_new(descend_pm, descend_bm); + col_arrows[i].descend_pm = xpm_to_widget(clist_descend_xpm); gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); @@ -427,15 +404,12 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, sum_open_w); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(sum_open_w, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can catch - the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sum_open_w, close_bt); + SIGNAL_CONNECT(sum_open_w, "delete_event", window_delete_event_cb, NULL); gtk_widget_show_all(sum_open_w); + window_present(sum_open_w); } diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index f7aa6597dd..6d190fd058 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* proto_draw.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.99 2004/05/21 00:18:46 guy Exp $ + * $Id: proto_draw.c,v 1.100 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -792,12 +792,6 @@ savehex_dlg_destroy_cb(void) savehex_dlg = NULL; } -static void -savehex_dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - /* Forward declaration */ static void savehex_save_clicked_cb(GtkWidget * w, gpointer data); @@ -846,7 +840,6 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_) */ savehex_dlg=dlg_window_new("Ethereal: Export Selected Packet Bytes"); - SIGNAL_CONNECT(savehex_dlg, "destroy", savehex_dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -895,11 +888,10 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_) save_button = OBJECT_GET_DATA(bbox, GTK_STOCK_SAVE); SIGNAL_CONNECT_OBJECT(save_button, "clicked", savehex_save_clicked_cb, NULL); - gtk_widget_grab_default(save_button); gtk_tooltips_set_tip (tooltips, save_button, ("Save the data to the specified file"), NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", savehex_dlg_cancel_cb, savehex_dlg); + window_set_cancel_button(savehex_dlg, cancel_button, window_cancel_button_cb); gtk_tooltips_set_tip (tooltips, cancel_button, ("Cancel save and quit dialog"), NULL); /* Catch the "activate" signal on the filter text entry, so that @@ -909,15 +901,16 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_) focus. */ dlg_set_activate(file_entry, save_button); - /* 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(savehex_dlg, cancel_button); + gtk_widget_grab_default(save_button); - /* Give the initial focus to the "File" entry box. */ + /* Give the initial focus to the "File" entry box. */ gtk_widget_grab_focus(file_entry); - gtk_widget_show_all(savehex_dlg); + SIGNAL_CONNECT(savehex_dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(savehex_dlg, "destroy", savehex_dlg_destroy_cb, NULL); + + gtk_widget_show_all(savehex_dlg); + window_present(savehex_dlg); } /* save the current highlighted hex data as hex_raw.dat */ diff --git a/gtk/proto_hier_stats_dlg.c b/gtk/proto_hier_stats_dlg.c index fbb3b4b98e..4f98863f18 100644 --- a/gtk/proto_hier_stats_dlg.c +++ b/gtk/proto_hier_stats_dlg.c @@ -1,6 +1,6 @@ /* proto_hier_stats_dlg.c * - * $Id: proto_hier_stats_dlg.c,v 1.17 2004/05/01 18:40:20 ulfl Exp $ + * $Id: proto_hier_stats_dlg.c,v 1.18 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -322,7 +322,7 @@ proto_hier_stats_cb(GtkWidget *w _U_, gpointer d _U_) return; } - dlg = dlg_window_new("Ethereal: Protocol Hierarchy Statistics"); + dlg = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: Protocol Hierarchy Statistics"); vbox = gtk_vbox_new(FALSE, 5); gtk_container_border_width(GTK_CONTAINER(vbox), 5); @@ -339,14 +339,11 @@ proto_hier_stats_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK); - SIGNAL_CONNECT_OBJECT(ok_bt, "clicked", gtk_widget_destroy, dlg); - gtk_widget_grab_default(ok_bt); + window_set_cancel_button(dlg, ok_bt, window_cancel_button_cb); - /* 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(dlg, ok_bt); + SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL); gtk_widget_show_all(dlg); + window_present(dlg); } diff --git a/gtk/rpc_progs.c b/gtk/rpc_progs.c index c64d429646..3059bf47dc 100644 --- a/gtk/rpc_progs.c +++ b/gtk/rpc_progs.c @@ -1,7 +1,7 @@ /* rpc_progs.c * rpc_progs 2002 Ronnie Sahlberg * - * $Id: rpc_progs.c,v 1.24 2004/05/17 20:06:32 sahlberg Exp $ + * $Id: rpc_progs.c,v 1.25 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -317,16 +317,6 @@ win_destroy_cb(void *dummy _U_, gpointer data _U_) } -static void -rpcprogs_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - gtk_grab_remove(GTK_WIDGET(user_data)); - gtk_widget_destroy(GTK_WIDGET(user_data)); -} - - /* When called, this function will start rpcprogs */ void @@ -344,8 +334,7 @@ gtk_rpcprogs_init(char *optarg _U_) return; } - win=dlg_window_new("ONC-RPC Program Statistics"); - SIGNAL_CONNECT(win, "destroy", win_destroy_cb, win); + win=window_new(GTK_WINDOW_TOPLEVEL, "ONC-RPC Program Statistics"); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(win), vbox); @@ -395,16 +384,15 @@ gtk_rpcprogs_init(char *optarg _U_) gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", rpcprogs_gtk_dlg_close_cb, win); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(win, bt_close); + SIGNAL_CONNECT(win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(win, "destroy", win_destroy_cb, win); - gtk_widget_show_all(win); - redissect_packets(&cfile); + gtk_widget_show_all(win); + window_present(win); + + redissect_packets(&cfile); } static void diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c index 8cecfc7e81..55e3fd05ff 100644 --- a/gtk/rpc_stat.c +++ b/gtk/rpc_stat.c @@ -1,7 +1,7 @@ /* rpc_stat.c * rpc_stat 2002 Ronnie Sahlberg * - * $Id: rpc_stat.c,v 1.45 2004/04/12 08:53:02 ulfl Exp $ + * $Id: rpc_stat.c,v 1.46 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -246,10 +246,9 @@ gtk_rpcstat_init(char *optarg) hf_index=rpc_prog_hf(rpc_program, rpc_version); hfi=proto_registrar_get_nth(hf_index); - rs->win=dlg_window_new(""); + rs->win=window_new(GTK_WINDOW_TOPLEVEL, "rpc-stat"); gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400); rpcstat_set_title(rs); - SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(rs->win), vbox); @@ -293,16 +292,15 @@ gtk_rpcstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, rs->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb); + + SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(rs->win, close_bt); + gtk_widget_show_all(rs->win); + window_present(rs->win); - gtk_widget_show_all(rs->win); - retap_packets(&cfile); + retap_packets(&cfile); } @@ -399,12 +397,6 @@ dlg_destroy_cb(void) } static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - -static void gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) { GtkWidget *dlg_box; @@ -427,7 +419,6 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) } dlg=dlg_window_new("Ethereal: Compute ONC-RPC SRT statistics"); - SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -516,29 +507,22 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT); - gtk_widget_grab_default(start_button ); SIGNAL_CONNECT_OBJECT(start_button, "clicked", rpcstat_start_button_clicked, NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg); - - /* Catch the "activate" signal on the filter text entry, so that - if the user types Return there, we act as if the "Create Stat" - button had been selected, as happens if Return is typed if some - widget that *doesn't* handle the Return key has the input - focus. */ - dlg_set_activate(filter_entry, start_button); - - /* 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(dlg, cancel_button); + window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb); /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(filter_entry); - gtk_widget_show_all(dlg); + gtk_widget_grab_default(start_button ); + + SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); + + gtk_widget_show_all(dlg); + window_present(dlg); } diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 6235e03bd4..317393ec18 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -1,7 +1,7 @@ /* rtp_analysis.c * RTP analysis addition for ethereal * - * $Id: rtp_analysis.c,v 1.41 2004/05/22 19:56:19 ulfl Exp $ + * $Id: rtp_analysis.c,v 1.42 2004/05/23 23:24:06 ulfl Exp $ * * Copyright 2003, Alcatel Business Systems * By Lars Ruoff <lars.ruoff@gmx.net> @@ -917,14 +917,6 @@ static void on_refresh_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data _U_) } /****************************************************************************/ -/* on_destroy is automatically called after that */ -static void on_close_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data _U_) -{ - gtk_grab_remove(GTK_WIDGET(user_data->dlg.window)); - gtk_widget_destroy(GTK_WIDGET(user_data->dlg.window)); -} - -/****************************************************************************/ static void on_next_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data _U_) { GtkCList *clist; @@ -1920,8 +1912,7 @@ void create_rtp_dialog(user_data_t* user_data) column_arrows *col_arrows_rev; - window = dlg_window_new("Ethereal: RTP Stream Analysis"); - SIGNAL_CONNECT(window, "destroy", on_destroy, user_data); + window = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: RTP Stream Analysis"); /* Container for each row of widgets */ main_vb = gtk_vbox_new(FALSE, 2); @@ -2057,9 +2048,13 @@ void create_rtp_dialog(user_data_t* user_data) close_bt = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLOSE); gtk_container_add(GTK_CONTAINER(box4), close_bt); gtk_widget_show(close_bt); - SIGNAL_CONNECT(close_bt, "clicked", on_close_bt_clicked, user_data); + window_set_cancel_button(window, close_bt, window_cancel_button_cb); + + SIGNAL_CONNECT(window, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(window, "destroy", on_destroy, user_data); - gtk_widget_show(window); + gtk_widget_show(window); + window_present(window); /* sort by column feature */ col_arrows_fwd = add_sort_by_column(window, clist_fwd, user_data); diff --git a/gtk/sip_stat.c b/gtk/sip_stat.c index f0e6cf2780..3d68fdc244 100644 --- a/gtk/sip_stat.c +++ b/gtk/sip_stat.c @@ -1,7 +1,7 @@ /* sip_stat.c * sip_stat 2004 Martin Mathieson * - * $Id: sip_stat.c,v 1.5 2004/04/22 20:08:46 etxrab Exp $ + * $Id: sip_stat.c,v 1.6 2004/05/23 23:24:06 ulfl Exp $ * Copied from http_stat.c * * Ethereal - Network traffic analyzer @@ -495,17 +495,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) g_free(sp); } -static void -sipstat_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - sipstat_t *sp = user_data; - - gtk_grab_remove(GTK_WIDGET(sp->win)); - gtk_widget_destroy(GTK_WIDGET(sp->win)); -} - /* Create a new instance of gtk_sipstat. */ static void @@ -536,6 +525,7 @@ gtk_sipstat_init(char *optarg) /* Create sip stats window structure */ sp = g_malloc(sizeof(sipstat_t)); + sp->win = window_new(GTK_WINDOW_TOPLEVEL, "sip-stat"); /* Set title to include any filter given */ if (filter) @@ -549,13 +539,9 @@ gtk_sipstat_init(char *optarg) title = g_strdup("SIP statistics"); } - /* Create underlying window */ - sp->win = dlg_window_new(title); + gtk_window_set_title(GTK_WINDOW(sp->win), title); g_free(title); - /* Set destroy callback for underlying window */ - SIGNAL_CONNECT(sp->win, "destroy", win_destroy_cb, sp); - /* Create container for all widgets */ main_vb = gtk_vbox_new(FALSE, 12); @@ -652,16 +638,15 @@ gtk_sipstat_init(char *optarg) gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", sipstat_gtk_dlg_close_cb, sp); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(sp->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sp->win, bt_close); + SIGNAL_CONNECT(sp->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(sp->win, "destroy", win_destroy_cb, sp); /* Display up-to-date contents */ gtk_widget_show_all(sp->win); + window_present(sp->win); + sip_init_hash(sp); retap_packets(&cfile); } diff --git a/gtk/smb_stat.c b/gtk/smb_stat.c index 777dc1d544..9cbb5568b7 100644 --- a/gtk/smb_stat.c +++ b/gtk/smb_stat.c @@ -1,7 +1,7 @@ /* smb_stat.c * smb_stat 2003 Ronnie Sahlberg * - * $Id: smb_stat.c,v 1.42 2004/04/12 08:53:02 ulfl Exp $ + * $Id: smb_stat.c,v 1.43 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -170,10 +170,9 @@ gtk_smbstat_init(char *optarg) ss=g_malloc(sizeof(smbstat_t)); - ss->win=dlg_window_new(""); + ss->win=window_new(GTK_WINDOW_TOPLEVEL, "smb-stat"); gtk_window_set_default_size(GTK_WINDOW(ss->win), 550, 600); smbstat_set_title(ss); - SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss); vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(ss->win), vbox); @@ -227,16 +226,15 @@ gtk_smbstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, ss->win); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(ss->win, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(ss->win, close_bt); + SIGNAL_CONNECT(ss->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss); - gtk_widget_show_all(ss->win); - retap_packets(&cfile); + gtk_widget_show_all(ss->win); + window_present(ss->win); + + retap_packets(&cfile); } @@ -251,12 +249,6 @@ dlg_destroy_cb(void) } static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - -static void smbstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_) { GString *str; @@ -291,7 +283,6 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_) } dlg=dlg_window_new("Ethereal: Compute SMB SRT statistics"); - SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -332,12 +323,11 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_show(bbox); start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT); - gtk_widget_grab_default(start_button ); SIGNAL_CONNECT_OBJECT(start_button, "clicked", smbstat_start_button_clicked, NULL); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg); + window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb); /* Catch the "activate" signal on the filter text entry, so that if the user types Return there, we act as if the "Create Stat" @@ -346,15 +336,16 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_) focus. */ dlg_set_activate(filter_entry, start_button); - /* 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(dlg, cancel_button); + gtk_widget_grab_default(start_button ); - /* Give the initial focus to the "Filter" entry box. */ + /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(filter_entry); - gtk_widget_show_all(dlg); + SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL); + + gtk_widget_show_all(dlg); + window_present(dlg); } void diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c index c332711fac..8ac4a0ecb5 100644 --- a/gtk/summary_dlg.c +++ b/gtk/summary_dlg.c @@ -1,7 +1,7 @@ /* summary_dlg.c * Routines for capture file summary window * - * $Id: summary_dlg.c,v 1.32 2004/05/22 19:56:19 ulfl Exp $ + * $Id: summary_dlg.c,v 1.33 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -107,7 +107,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) seconds = summary.stop_time - summary.start_time; disp_seconds = summary.filtered_stop - summary.filtered_start; - sum_open_w = dlg_window_new("Ethereal: Summary"); + sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: Summary"); /* Container for each row of widgets */ main_vb = gtk_vbox_new(FALSE, 12); @@ -303,14 +303,12 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) gtk_container_add(GTK_CONTAINER(main_vb), bbox); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT_OBJECT(close_bt, "clicked", gtk_widget_destroy, sum_open_w); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(sum_open_w, close_bt, window_cancel_button_cb); + gtk_widget_grab_focus(close_bt); - /* Catch the "key_press_event" signal in the window, so that we can catch - the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sum_open_w, close_bt); + SIGNAL_CONNECT(sum_open_w, "delete_event", window_delete_event_cb, NULL); gtk_widget_show_all(sum_open_w); + window_present(sum_open_w); } diff --git a/gtk/supported_protos_dlg.c b/gtk/supported_protos_dlg.c index 2693d6e0e1..04ad9d270b 100644 --- a/gtk/supported_protos_dlg.c +++ b/gtk/supported_protos_dlg.c @@ -2,7 +2,7 @@ * * Laurent Deniel <laurent.deniel@free.fr> * - * $Id: supported_protos_dlg.c,v 1.10 2004/03/13 12:09:27 ulfl Exp $ + * $Id: supported_protos_dlg.c,v 1.11 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -55,7 +55,6 @@ typedef enum { DFILTER_SUPPORTED } supported_type_t; -static void supported_close_cb(GtkWidget *w, gpointer data); static void supported_destroy_cb(GtkWidget *w, gpointer data); static void insert_text(GtkWidget *w, const char *buffer, int nchars); static void set_supported_text(GtkWidget *w, supported_type_t type); @@ -92,9 +91,8 @@ void supported_cb(GtkWidget *w _U_, gpointer data _U_) return; } - supported_w = dlg_window_new("Ethereal: Supported Protocols"); - SIGNAL_CONNECT(supported_w, "destroy", supported_destroy_cb, NULL); - WIDGET_SET_SIZE(supported_w, DEF_WIDTH * 2/3, DEF_HEIGHT * 2/3); + supported_w = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: Supported Protocols"); + gtk_window_set_default_size(GTK_WINDOW(supported_w), DEF_WIDTH * 2/3, DEF_HEIGHT * 2/3); gtk_container_border_width(GTK_CONTAINER(supported_w), 2); /* Container for each row of widgets */ @@ -229,25 +227,17 @@ void supported_cb(GtkWidget *w _U_, gpointer data _U_) gtk_widget_show(bbox); ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK); - SIGNAL_CONNECT(ok_bt, "clicked", supported_close_cb, supported_w); - gtk_widget_grab_default(ok_bt); + window_set_cancel_button(supported_w, ok_bt, window_cancel_button_cb); 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, ok_bt); + SIGNAL_CONNECT(supported_w, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(supported_w, "destroy", supported_destroy_cb, NULL); gtk_widget_show(supported_w); - + window_present(supported_w); } /* supported_cb */ -static void supported_close_cb(GtkWidget *w _U_, gpointer data) -{ - gtk_widget_destroy(GTK_WIDGET(data)); -} - static void supported_destroy_cb(GtkWidget *w _U_, gpointer data _U_) { /* Note that we no longer have a Help window. */ diff --git a/gtk/tap_dfilter_dlg.c b/gtk/tap_dfilter_dlg.c index c7d5cf3111..cc20d17cfd 100644 --- a/gtk/tap_dfilter_dlg.c +++ b/gtk/tap_dfilter_dlg.c @@ -2,7 +2,7 @@ * Routines for display filter dialog used by gui taps * Copyright 2003 Lars Roland * - * $Id: tap_dfilter_dlg.c,v 1.7 2004/03/13 12:09:27 ulfl Exp $ + * $Id: tap_dfilter_dlg.c,v 1.8 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -44,6 +44,7 @@ #include "filter_prefs.h" #include "../tap_dfilter_dlg.h" #include "tap_dfilter_dlg.h" +#include "ui_util.h" extern GtkWidget *main_display_filter_widget; @@ -82,12 +83,6 @@ dlg_destroy_cb(GtkWidget *item _U_, gpointer dialog_data) } static void -dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w) -{ - gtk_widget_destroy(GTK_WIDGET(parent_w)); -} - -static void tap_dfilter_dlg_start_button_clicked(GtkWidget *item _U_, gpointer dialog_data) { char *filter; @@ -164,7 +159,6 @@ gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data) current_dlg->dlg=dlg_window_new(title); g_free(title); - SIGNAL_CONNECT(current_dlg->dlg, "destroy", dlg_destroy_cb, current_dlg); dlg_box=gtk_vbox_new(FALSE, 10); gtk_container_border_width(GTK_CONTAINER(dlg_box), 10); @@ -205,12 +199,11 @@ gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data) gtk_widget_show(bbox); start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT); - gtk_widget_grab_default(start_button ); SIGNAL_CONNECT(start_button, "clicked", tap_dfilter_dlg_start_button_clicked, current_dlg); cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); - SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, current_dlg->dlg); + window_set_cancel_button(current_dlg->dlg, cancel_button, window_cancel_button_cb); /* Catch the "activate" signal on the filter text entry, so that if the user types Return there, we act as if the "Create Stat" @@ -219,13 +212,14 @@ gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data) focus. */ dlg_set_activate(current_dlg->filter_entry, start_button); - /* 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(current_dlg->dlg, cancel_button); - /* Give the initial focus to the "Filter" entry box. */ gtk_widget_grab_focus(current_dlg->filter_entry); - gtk_widget_show_all(current_dlg->dlg); + gtk_widget_grab_default(start_button ); + + SIGNAL_CONNECT(current_dlg->dlg, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(current_dlg->dlg, "destroy", dlg_destroy_cb, current_dlg); + + gtk_widget_show_all(current_dlg->dlg); + window_present(current_dlg->dlg); } diff --git a/gtk/tcp_graph.c b/gtk/tcp_graph.c index ca134ece3c..4a15020691 100644 --- a/gtk/tcp_graph.c +++ b/gtk/tcp_graph.c @@ -3,7 +3,7 @@ * By Pavel Mores <pvl@uh.cz> * Win32 port: rwh@unifiedtech.com * - * $Id: tcp_graph.c,v 1.60 2004/04/12 09:48:18 ulfl Exp $ + * $Id: tcp_graph.c,v 1.61 2004/05/23 23:24:06 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -423,7 +423,6 @@ static void callback_mag_flags (GtkWidget * , gpointer ); static void callback_graph_type (GtkWidget * , gpointer ); static void callback_graph_init_on_typechg (GtkWidget * , gpointer ); static void callback_create_help (GtkWidget * , gpointer ); -static void callback_close_help (GtkWidget * , gpointer ); static void update_zoom_spins (struct graph * ); static int get_headers (frame_data *, char * , struct segment * ); static int compare_headers (struct segment * , struct segment * , int ); @@ -722,7 +721,8 @@ static void create_drawing_area (struct graph *g) (current.iphdr.daddr>>24)&0xff, g_ntohs(current.tcphdr.dest) ); - g->toplevel = dlg_window_new (window_title); + g->toplevel = dlg_window_new ("Tcp Graph"); + gtk_window_set_title(GTK_WINDOW(g->toplevel), window_title); gtk_widget_set_name (g->toplevel, "Test Graph"); /* Create the drawing area */ @@ -882,8 +882,8 @@ static void control_panel_create (struct graph *g) g_snprintf (window_title, WINDOW_TITLE_LENGTH, "Graph %d - Control - Ethereal", refnum); - toplevel = dlg_window_new (window_title); - SIGNAL_CONNECT(toplevel, "destroy", callback_toplevel_destroy, g); + toplevel = dlg_window_new ("tcp-graph-control"); + gtk_window_set_title(GTK_WINDOW(toplevel), window_title); table = gtk_table_new (2, 1, FALSE); gtk_container_add (GTK_CONTAINER (toplevel), table); @@ -908,10 +908,14 @@ static void control_panel_create (struct graph *g) been selected. */ dlg_set_cancel(toplevel, close_bt); + SIGNAL_CONNECT(toplevel, "destroy", callback_toplevel_destroy, g); + /* gtk_widget_show_all (table); */ /* g->gui.control_panel = table; */ gtk_widget_show_all (toplevel); - g->gui.control_panel = toplevel; + window_present(toplevel); + + g->gui.control_panel = toplevel; } static void control_panel_add_zoom_page (struct graph *g, GtkWidget *n) @@ -1031,7 +1035,7 @@ static void callback_create_help(GtkWidget *widget _U_, gpointer data _U_) #endif toplevel = dlg_window_new ("Help for TCP graphing"); - WIDGET_SET_SIZE(toplevel, 500, 400); + gtk_window_set_default_size(GTK_WINDOW(toplevel), 500, 400); vbox = gtk_vbox_new (FALSE, 3); gtk_container_border_width(GTK_CONTAINER(vbox), 12); @@ -1063,20 +1067,12 @@ static void callback_create_help(GtkWidget *widget _U_, gpointer data _U_) gtk_widget_show(bbox); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(close_bt, "clicked", callback_close_help, toplevel); - gtk_widget_grab_default(close_bt); + window_set_cancel_button(toplevel, close_bt, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(toplevel, close_bt); + SIGNAL_CONNECT(toplevel, "delete_event", window_delete_event_cb, NULL); gtk_widget_show_all (toplevel); -} - -static void callback_close_help (GtkWidget *widget _U_, gpointer data) -{ - gtk_widget_destroy ((GtkWidget * )data); + window_present(toplevel); } static void callback_time_origin (GtkWidget *toggle _U_, gpointer data) @@ -1763,10 +1759,10 @@ static void graph_destroy (struct graph *g) axis_destroy (g->x_axis); axis_destroy (g->y_axis); - /* gtk_widget_destroy (g->drawing_area); */ - gtk_widget_destroy (g->gui.control_panel); - gtk_widget_destroy (g->toplevel); - /* gtk_widget_destroy (g->text); */ + /* window_destroy (g->drawing_area); */ + window_destroy (g->gui.control_panel); + window_destroy (g->toplevel); + /* window_destroy (g->text); */ gdk_gc_unref (g->fg_gc); gdk_gc_unref (g->bg_gc); #if GTK_MAJOR_VERSION < 2 @@ -2705,9 +2701,9 @@ static void magnify_create (struct graph *g, int x, int y) mg = g->magnify.g = (struct graph * )malloc (sizeof (struct graph)); memcpy ((void * )mg, (void * )g, sizeof (struct graph)); - mg->toplevel = dlg_window_new (NULL); + mg->toplevel = dlg_window_new("tcp graph magnify"); mg->drawing_area = mg->toplevel; - WIDGET_SET_SIZE(mg->toplevel, g->magnify.width, g->magnify.height); + gtk_window_set_default_size(GTK_WINDOW(mg->toplevel), g->magnify.width, g->magnify.height); gtk_widget_set_events (mg->drawing_area, GDK_EXPOSURE_MASK /* | GDK_ENTER_NOTIFY_MASK */ /* | GDK_ALL_EVENTS_MASK */ @@ -2788,7 +2784,7 @@ static void magnify_destroy (struct graph *g) struct element_list *list; struct graph *mg = g->magnify.g; - gtk_widget_destroy (GTK_WIDGET (mg->drawing_area)); + window_destroy (GTK_WIDGET (mg->drawing_area)); gdk_pixmap_unref (mg->pixmap[0]); gdk_pixmap_unref (mg->pixmap[1]); for (list=mg->elists; list; list=list->next) diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c index de02c66842..a3a3713144 100644 --- a/gtk/wsp_stat.c +++ b/gtk/wsp_stat.c @@ -1,7 +1,7 @@ /* wsp_stat.c * wsp_stat 2003 Jean-Michel FAYARD * - * $Id: wsp_stat.c,v 1.26 2004/04/12 09:48:19 ulfl Exp $ + * $Id: wsp_stat.c,v 1.27 2004/05/23 23:24:07 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -251,18 +251,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) } static void -wsp_gtk_dlg_close_cb( - GtkButton *button _U_, - gpointer user_data _U_) -{ - wspstat_t *sp = user_data; - - gtk_grab_remove(GTK_WIDGET(sp->win)); - gtk_widget_destroy(GTK_WIDGET(sp->win)); -} - - -static void add_table_entry(wspstat_t *sp, char *str, int x, int y, int index) { GtkWidget *tmp; @@ -336,6 +324,7 @@ gtk_wspstat_init(char *optarg) } sp = g_malloc( sizeof(wspstat_t) ); + sp->win = window_new(GTK_WINDOW_TOPLEVEL, "wsp-stat"); sp->hash = g_hash_table_new( g_int_hash, g_int_equal); for (i=0 ; vals_status[i].strptr ; i++ ) { @@ -366,9 +355,8 @@ gtk_wspstat_init(char *optarg) sp->pdu_stats[i].packets=0; } - sp->win = dlg_window_new(title); + gtk_window_set_title(GTK_WINDOW(sp->win), title); g_free(title); - SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp); /* container for the two frames */ main_vb = gtk_vbox_new(FALSE, 3); @@ -416,16 +404,15 @@ gtk_wspstat_init(char *optarg) gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0); bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - SIGNAL_CONNECT(bt_close, "clicked", wsp_gtk_dlg_close_cb, sp); - gtk_widget_grab_default(bt_close); + window_set_cancel_button(sp->win, bt_close, window_cancel_button_cb); - /* Catch the "key_press_event" signal in the window, so that we can - catch the ESC key being pressed and act as if the "Close" button had - been selected. */ - dlg_set_cancel(sp->win, bt_close); + SIGNAL_CONNECT(sp->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(sp->win, "destroy", win_destroy_cb, sp); - gtk_widget_show_all( sp->win ); - retap_packets(&cfile); + gtk_widget_show_all(sp->win); + window_present(sp->win); + + retap_packets(&cfile); } static tap_dfilter_dlg wsp_stat_dlg = { |