diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2004-04-12 08:53:02 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2004-04-12 08:53:02 +0000 |
commit | a7c964355b767381913a5532fd49c443c2e175a6 (patch) | |
tree | 7a35502592901fe41728e7d11ed44d65ac032953 /gtk | |
parent | 1717eed35fce6d197c7366beb839a829ea734cb6 (diff) |
added a close button to the dialogs,
use the dlg_window_new function for all dialogs
svn path=/trunk/; revision=10584
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/ansi_a_stat.c | 100 | ||||
-rw-r--r-- | gtk/ansi_map_stat.c | 58 | ||||
-rw-r--r-- | gtk/bootp_stat.c | 46 | ||||
-rw-r--r-- | gtk/dcerpc_stat.c | 27 | ||||
-rw-r--r-- | gtk/fc_stat.c | 30 | ||||
-rw-r--r-- | gtk/gsm_a_stat.c | 56 | ||||
-rw-r--r-- | gtk/gsm_map_stat.c | 74 | ||||
-rw-r--r-- | gtk/h225_counter.c | 20 | ||||
-rw-r--r-- | gtk/h225_ras_srt.c | 22 | ||||
-rw-r--r-- | gtk/http_stat.c | 54 | ||||
-rw-r--r-- | gtk/isup_stat.c | 56 | ||||
-rw-r--r-- | gtk/ldap_stat.c | 30 | ||||
-rw-r--r-- | gtk/rpc_stat.c | 31 | ||||
-rw-r--r-- | gtk/smb_stat.c | 32 |
14 files changed, 342 insertions, 294 deletions
diff --git a/gtk/ansi_a_stat.c b/gtk/ansi_a_stat.c index a849d4ff93..5a4224248f 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.16 2004/03/13 15:15:22 ulfl Exp $ + * $Id: ansi_a_stat.c,v 1.17 2004/04/12 08:53:01 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -301,50 +301,23 @@ ansi_a_stat_gtk_win_create( GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - GtkWidget *dialog_vbox; - GtkWidget *dialog_action_area; - dlg_p->win = gtk_dialog_new(); + dlg_p->win = dlg_window_new(title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 480, 450); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_a_stat_gtk_win_destroy_cb, dlg_p); - dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; - gtk_widget_show(dialog_vbox); - - dialog_action_area = GTK_DIALOG(dlg_p->win)->action_area; - gtk_widget_show(dialog_action_area); - gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area), 10); - - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_start(GTK_BOX(dialog_action_area), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); - - 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); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_widget_ref(vbox); - OBJECT_SET_DATA_FULL(dlg_p->win, "vbox", vbox, gtk_widget_unref); - gtk_widget_show(vbox); - gtk_box_pack_start(GTK_BOX(dialog_vbox), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); + vbox=gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); - gtk_widget_ref(dlg_p->scrolled_win); - OBJECT_SET_DATA_FULL(dlg_p->win, "scrolled_win", dlg_p->scrolled_win, - gtk_widget_unref); - gtk_widget_show(dlg_p->scrolled_win); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); - dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - gtk_widget_ref(dlg_p->table); - OBJECT_SET_DATA_FULL(dlg_p->win, "table", dlg_p->table, gtk_widget_unref); - gtk_widget_show(dlg_p->table); + /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ + gtk_widget_show_all(dlg_p->win); - gtk_widget_show(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); @@ -366,37 +339,37 @@ ansi_a_stat_gtk_win_create( for (i = 0; i < INIT_TABLE_NUM_COLUMNS; i++) { - col_arrows[i].table = gtk_table_new(2, 2, FALSE); + col_arrows[i].table = gtk_table_new(2, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(col_arrows[i].table), 5); + gtk_table_set_col_spacings(GTK_TABLE(col_arrows[i].table), 5); - column_lb = gtk_label_new(default_titles[i]); + column_lb = gtk_label_new(default_titles[i]); - gtk_table_attach(GTK_TABLE(col_arrows[i].table), column_lb, - 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); + gtk_table_attach(GTK_TABLE(col_arrows[i].table), column_lb, + 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - gtk_widget_show(column_lb); + gtk_widget_show(column_lb); - col_arrows[i].ascend_pm = - gtk_pixmap_new(ascend_pm, ascend_bm); + col_arrows[i].ascend_pm = + 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); + 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 = + 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); + gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, + 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); - if (i == 0) - { - /* default column sorting */ - gtk_widget_show(col_arrows[i].ascend_pm); - } + if (i == 0) + { + /* default column sorting */ + gtk_widget_show(col_arrows[i].ascend_pm); + } - gtk_clist_set_column_widget(GTK_CLIST(dlg_p->table), i, col_arrows[i].table); - gtk_widget_show(col_arrows[i].table); + gtk_clist_set_column_widget(GTK_CLIST(dlg_p->table), i, col_arrows[i].table); + gtk_widget_show(col_arrows[i].table); } gtk_clist_column_titles_show(GTK_CLIST(dlg_p->table)); @@ -413,6 +386,21 @@ ansi_a_stat_gtk_win_create( gtk_container_add(GTK_CONTAINER(dlg_p->scrolled_win), dlg_p->table); SIGNAL_CONNECT(dlg_p->table, "click-column", ansi_a_stat_gtk_click_column_cb, col_arrows); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + + gtk_widget_show_all(dlg_p->win); } diff --git a/gtk/ansi_map_stat.c b/gtk/ansi_map_stat.c index bdf8ca3254..876876a243 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.19 2004/03/13 15:15:22 ulfl Exp $ + * $Id: ansi_map_stat.c,v 1.20 2004/04/12 08:53:01 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -275,50 +275,23 @@ ansi_map_stat_gtk_win_create( GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - GtkWidget *dialog_vbox; - GtkWidget *dialog_action_area; - dlg_p->win = gtk_dialog_new(); + dlg_p->win = dlg_window_new(title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 500, 450); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_map_stat_gtk_win_destroy_cb, dlg_p); - dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; - gtk_widget_show(dialog_vbox); - - dialog_action_area = GTK_DIALOG(dlg_p->win)->action_area; - gtk_widget_show(dialog_action_area); - gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area), 10); - - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_start(GTK_BOX(dialog_action_area), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); - - 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); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_widget_ref(vbox); - OBJECT_SET_DATA_FULL(dlg_p->win, "vbox", vbox, gtk_widget_unref); - gtk_widget_show(vbox); - gtk_box_pack_start(GTK_BOX(dialog_vbox), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); + vbox = gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); - gtk_widget_ref(dlg_p->scrolled_win); - OBJECT_SET_DATA_FULL(dlg_p->win, "scrolled_win", dlg_p->scrolled_win, - gtk_widget_unref); - gtk_widget_show(dlg_p->scrolled_win); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); - dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - gtk_widget_ref(dlg_p->table); - OBJECT_SET_DATA_FULL(dlg_p->win, "table", dlg_p->table, gtk_widget_unref); - gtk_widget_show(dlg_p->table); + /* We must display dialog widget before calling gdk_pixmap_create_from_xpm_d() */ + gtk_widget_show_all(dlg_p->win); - gtk_widget_show(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); @@ -387,6 +360,21 @@ ansi_map_stat_gtk_win_create( gtk_container_add(GTK_CONTAINER(dlg_p->scrolled_win), dlg_p->table); SIGNAL_CONNECT(dlg_p->table, "click-column", ansi_map_stat_gtk_click_column_cb, col_arrows); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + gtk_widget_show_all(dlg_p->win); } diff --git a/gtk/bootp_stat.c b/gtk/bootp_stat.c index b152fb2c73..453baf7a02 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.25 2004/03/27 11:13:02 guy Exp $ + * $Id: bootp_stat.c,v 1.26 2004/04/12 08:53:01 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -188,17 +188,31 @@ 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 -gtk_dhcpstat_init(char *optarg) +dhcpstat_init(char *optarg) { dhcpstat_t *sp; char *filter=NULL; char *title=NULL; GString *error_string; GtkWidget *message_type_fr; + GtkWidget *vbox; + GtkWidget *bt_close; + GtkWidget *bbox; if (strncmp (optarg, "bootp,stat,", 11) == 0){ filter=optarg+11; @@ -217,13 +231,17 @@ gtk_dhcpstat_init(char *optarg) } /* top level window */ - sp->win = window_new( GTK_WINDOW_TOPLEVEL, title); + sp->win = dlg_window_new(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); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); + /* Status Codes frame */ message_type_fr = gtk_frame_new("DHCP Message Type"); - gtk_container_add(GTK_CONTAINER(sp->win), message_type_fr); + gtk_container_add(GTK_CONTAINER(vbox), message_type_fr); gtk_widget_show(message_type_fr); sp->table_message_type = gtk_table_new( 0, 4, FALSE); @@ -248,21 +266,35 @@ gtk_dhcpstat_init(char *optarg) g_string_free(error_string, TRUE); return ; } - gtk_widget_show_all( sp->win ); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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 ); retap_packets(&cfile); } static tap_dfilter_dlg dhcp_stat_dlg = { "BOOTP-DHCP Packet Counter", "bootp,stat", - gtk_dhcpstat_init, + dhcpstat_init, -1 }; void register_tap_listener_gtkdhcpstat(void) { - register_ethereal_tap("bootp,stat", gtk_dhcpstat_init); + register_ethereal_tap("bootp,stat", dhcpstat_init); register_tap_menu_item("BOOTP-DHCP", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(dhcp_stat_dlg)); diff --git a/gtk/dcerpc_stat.c b/gtk/dcerpc_stat.c index 492c5cfb44..b05c8a6c6c 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.53 2004/03/13 15:15:23 ulfl Exp $ + * $Id: dcerpc_stat.c,v 1.54 2004/04/12 08:53:01 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -194,6 +194,8 @@ gtk_dcerpcstat_init(char *optarg) GtkWidget *vbox; GtkWidget *stat_label; GtkWidget *filter_label; + GtkWidget *bbox; + GtkWidget *close_bt; dcerpc_sub_dissector *procs; e_uuid_t uuid; guint d1,d2,d3,d40,d41,d42,d43,d44,d45,d46,d47; @@ -259,26 +261,23 @@ gtk_dcerpcstat_init(char *optarg) rs->uuid=uuid; rs->ver=ver; - rs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + rs->win=dlg_window_new(""); 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, 0); + vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(rs->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_widget_show(vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); title_string=dcerpcstat_gen_title(rs); stat_label=gtk_label_new(title_string); g_free(title_string); gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); - gtk_widget_show(stat_label); g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); filter_label=gtk_label_new(filter_string); gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0); - gtk_widget_show(filter_label); for(i=0,max_procs=0;procs[i].name;i++){ if(procs[i].num>max_procs){ @@ -288,7 +287,7 @@ gtk_dcerpcstat_init(char *optarg) rs->num_procedures=max_procs+1; /* We must display TOP LEVEL Widget before calling init_srt_table() */ - gtk_widget_show(rs->win); + gtk_widget_show_all(rs->win); if(hf_opnum!=-1){ init_srt_table(&rs->srt_table, max_procs+1, vbox, proto_registrar_get_nth(hf_opnum)->abbrev); @@ -321,6 +320,18 @@ gtk_dcerpcstat_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); retap_packets(&cfile); diff --git a/gtk/fc_stat.c b/gtk/fc_stat.c index 89a6726776..24ce796f82 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.30 2004/03/13 15:15:24 ulfl Exp $ + * $Id: fc_stat.c,v 1.31 2004/04/12 08:53:01 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -137,6 +137,8 @@ gtk_fcstat_init(char *optarg) GString *error_string; int i; GtkWidget *vbox; + GtkWidget *bbox; + GtkWidget *close_bt; if(!strncmp(optarg,"fc,srt,",7)){ filter=optarg+7; @@ -146,32 +148,27 @@ gtk_fcstat_init(char *optarg) fc=g_malloc(sizeof(fcstat_t)); - fc->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + fc->win=dlg_window_new(""); 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, 0); + vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(fc->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_widget_show(vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); label=gtk_label_new("Fibre Channel Service Response Time statistics"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); label=gtk_label_new(filter_string); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - label=gtk_label_new("Fibre Channel Types"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); /* We must display TOP LEVEL Widget before calling init_srt_table() */ - gtk_widget_show(fc->win); + gtk_widget_show_all(fc->win); init_srt_table(&fc->fc_srt_table, 256, vbox, NULL); for(i=0;i<256;i++){ @@ -187,6 +184,19 @@ gtk_fcstat_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + gtk_widget_show_all(fc->win); retap_packets(&cfile); } diff --git a/gtk/gsm_a_stat.c b/gtk/gsm_a_stat.c index ed9fafba0b..12221e7c2d 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.16 2004/03/13 15:15:24 ulfl Exp $ + * $Id: gsm_a_stat.c,v 1.17 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -385,50 +385,23 @@ gsm_a_stat_gtk_win_create( GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - GtkWidget *dialog_vbox; - GtkWidget *dialog_action_area; - dlg_p->win = gtk_dialog_new(); + dlg_p->win = dlg_window_new(title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 490, 500); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_a_stat_gtk_win_destroy_cb, dlg_p); - dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; - gtk_widget_show(dialog_vbox); - - dialog_action_area = GTK_DIALOG(dlg_p->win)->action_area; - gtk_widget_show(dialog_action_area); - gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area), 10); - - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_start(GTK_BOX(dialog_action_area), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); - - 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); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_widget_ref(vbox); - OBJECT_SET_DATA_FULL(dlg_p->win, "vbox", vbox, gtk_widget_unref); - gtk_widget_show(vbox); - gtk_box_pack_start(GTK_BOX(dialog_vbox), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); + vbox = gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); - gtk_widget_ref(dlg_p->scrolled_win); - OBJECT_SET_DATA_FULL(dlg_p->win, "scrolled_win", dlg_p->scrolled_win, - gtk_widget_unref); - gtk_widget_show(dlg_p->scrolled_win); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - gtk_widget_ref(dlg_p->table); - OBJECT_SET_DATA_FULL(dlg_p->win, "table", dlg_p->table, gtk_widget_unref); - gtk_widget_show(dlg_p->table); - gtk_widget_show(dlg_p->win); + /* 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); @@ -497,6 +470,21 @@ gsm_a_stat_gtk_win_create( gtk_container_add(GTK_CONTAINER(dlg_p->scrolled_win), dlg_p->table); SIGNAL_CONNECT(dlg_p->table, "click-column", gsm_a_stat_gtk_click_column_cb, col_arrows); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + + gtk_widget_show_all(dlg_p->win); } diff --git a/gtk/gsm_map_stat.c b/gtk/gsm_map_stat.c index 6a55f87644..8e4db490e5 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.5 2004/03/13 15:15:24 ulfl Exp $ + * $Id: gsm_map_stat.c,v 1.6 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -271,65 +271,24 @@ gsm_map_stat_gtk_win_create( GtkWidget *column_lb; GtkWidget *vbox; GtkWidget *bt_close; - GtkWidget *hbuttonbox; - GtkWidget *dialog_vbox; - GtkWidget *dialog_action_area; + GtkWidget *bbox; - dlg_p->win = gtk_dialog_new(); + dlg_p->win = dlg_window_new(title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 560, 390); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", gsm_map_stat_gtk_win_destroy_cb, dlg_p); - dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; - gtk_widget_show(dialog_vbox); - - dialog_action_area = GTK_DIALOG(dlg_p->win)->action_area; - gtk_widget_show(dialog_action_area); - gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area), 10); - - hbuttonbox = gtk_hbutton_box_new(); - gtk_widget_ref(hbuttonbox); - gtk_object_set_data_full(GTK_OBJECT(dlg_p->win), "hbuttonbox", hbuttonbox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show(hbuttonbox); - gtk_box_pack_start(GTK_BOX(dialog_action_area), hbuttonbox, FALSE, FALSE, 0); - gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox), 0); - - bt_close = gtk_button_new_with_label("Close"); - gtk_widget_ref(bt_close); - gtk_object_set_data_full(GTK_OBJECT(dlg_p->win), "bt_close", bt_close, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show(bt_close); - gtk_container_add(GTK_CONTAINER(hbuttonbox), bt_close); - GTK_WIDGET_SET_FLAGS(bt_close, GTK_CAN_DEFAULT); - SIGNAL_CONNECT(bt_close, "clicked", gsm_map_stat_gtk_dlg_close_cb, dlg_p); + vbox = gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); - vbox = gtk_vbox_new(FALSE, 0); - gtk_widget_ref(vbox); - gtk_object_set_data_full(GTK_OBJECT(dlg_p->win), "vbox", vbox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show(vbox); - gtk_box_pack_start(GTK_BOX(dialog_vbox), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); - - dlg_p->scrolled_win = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_ref(dlg_p->scrolled_win); - gtk_object_set_data_full(GTK_OBJECT(dlg_p->win), "scrolled_win", dlg_p->scrolled_win, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show(dlg_p->scrolled_win); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dlg_p->scrolled_win), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); + dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - gtk_widget_ref(dlg_p->table); - gtk_object_set_data_full(GTK_OBJECT(dlg_p->win), "table", GTK_CLIST(dlg_p->table), - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show(dlg_p->table); - gtk_widget_show(dlg_p->win); + /* 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); @@ -398,6 +357,21 @@ gsm_map_stat_gtk_win_create( gtk_container_add(GTK_CONTAINER(dlg_p->scrolled_win), dlg_p->table); SIGNAL_CONNECT(dlg_p->table, "click-column", gsm_map_stat_gtk_click_column_cb, col_arrows); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + + gtk_widget_show_all(dlg_p->win); } diff --git a/gtk/h225_counter.c b/gtk/h225_counter.c index 24365ac19b..5d6f4a940b 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.17 2004/03/27 11:13:02 guy Exp $ + * $Id: h225_counter.c,v 1.18 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -508,6 +508,8 @@ gtk_h225counter_init(char *optarg) h225counter_t *hs; char *filter=NULL; GString *error_string; + GtkWidget *bbox; + GtkWidget *close_bt; if(strncmp(optarg,"h225,counter,",13) == 0){ filter=optarg+13; @@ -524,7 +526,8 @@ gtk_h225counter_init(char *optarg) hs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); - hs->vbox=gtk_vbox_new(FALSE, 0); + hs->vbox=gtk_vbox_new(FALSE, 3); + gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12); init_main_stat_window(hs->win, hs->vbox, "ITU-T H.225 Message and Message Reason Counter", filter); @@ -543,6 +546,19 @@ gtk_h225counter_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + gtk_widget_show_all(hs->win); redissect_packets(&cfile); } diff --git a/gtk/h225_ras_srt.c b/gtk/h225_ras_srt.c index a32caf0d87..a7a8137bb9 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.15 2004/03/27 11:13:02 guy Exp $ + * $Id: h225_ras_srt.c,v 1.16 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -288,6 +288,8 @@ gtk_h225rassrt_init(char *optarg) h225rassrt_t *hs; char *filter=NULL; GString *error_string; + GtkWidget *bbox; + GtkWidget *close_bt; if(strncmp(optarg,"h225,srt,",9) == 0){ filter=optarg+9; @@ -301,10 +303,11 @@ gtk_h225rassrt_init(char *optarg) h225rassrt_reset(hs); - hs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + hs->win=dlg_window_new(""); SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs); - hs->vbox=gtk_vbox_new(FALSE, 0); + hs->vbox=gtk_vbox_new(FALSE, 3); + gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12); init_main_stat_window(hs->win, hs->vbox, "ITU-T H.225 RAS Service Response Time", filter); @@ -323,6 +326,19 @@ gtk_h225rassrt_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + gtk_widget_show_all(hs->win); redissect_packets(&cfile); } diff --git a/gtk/http_stat.c b/gtk/http_stat.c index e60f1db0f6..bf97391c58 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.26 2004/03/27 11:13:02 guy Exp $ + * $Id: http_stat.c,v 1.27 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -378,6 +378,18 @@ 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. */ static void @@ -390,6 +402,8 @@ gtk_httpstat_init(char *optarg) GtkWidget *main_vb, *separator, *informational_fr, *success_fr, *redirection_fr, *client_errors_fr, *server_errors_fr, *request_fr; + GtkWidget *bt_close; + GtkWidget *bbox; if (strncmp (optarg, "http,stat,", 10) == 0){ filter=optarg+10; @@ -407,71 +421,54 @@ gtk_httpstat_init(char *optarg) } /* top level window */ - sp->win = window_new( GTK_WINDOW_TOPLEVEL, title); + sp->win = dlg_window_new(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, 10); - gtk_container_border_width(GTK_CONTAINER(main_vb), 10); + main_vb = gtk_vbox_new(FALSE, 6); + gtk_container_border_width(GTK_CONTAINER(main_vb), 12); gtk_container_add(GTK_CONTAINER(sp->win), main_vb); - gtk_widget_show(main_vb); /* number of packets */ sp->packets=0; sp->packets_label = gtk_label_new("HTTP stats (0 HTTP packets)"); gtk_container_add( GTK_CONTAINER(main_vb), sp->packets_label); - gtk_widget_show(sp->packets_label); /* Informational response frame */ informational_fr = gtk_frame_new("Informational HTTP 1xx"); gtk_container_add(GTK_CONTAINER(main_vb), informational_fr); - gtk_widget_show(informational_fr); sp->informational_table = gtk_table_new( 0, 2, FALSE); gtk_container_add(GTK_CONTAINER(informational_fr), sp->informational_table); - gtk_widget_show(sp->informational_table); - /* success response frame */ success_fr = gtk_frame_new ("Success HTTP 2xx"); gtk_container_add(GTK_CONTAINER(main_vb), success_fr); - gtk_widget_show(success_fr); sp->success_table = gtk_table_new( 0, 2, FALSE); gtk_container_add(GTK_CONTAINER(success_fr), sp->success_table); - gtk_widget_show(sp->success_table); - /* redirection response frame */ redirection_fr = gtk_frame_new ("Redirection HTTP 3xx"); gtk_container_add(GTK_CONTAINER(main_vb), redirection_fr); - gtk_widget_show(redirection_fr); sp->redirection_table = gtk_table_new( 0, 2, FALSE); gtk_container_add(GTK_CONTAINER(redirection_fr), sp->redirection_table); - gtk_widget_show(sp->redirection_table); - /* client_errors response frame */ client_errors_fr = gtk_frame_new("Client errors HTTP 4xx"); gtk_container_add(GTK_CONTAINER(main_vb), client_errors_fr); - gtk_widget_show(client_errors_fr); sp->client_error_table = gtk_table_new( 0, 2, FALSE); gtk_container_add(GTK_CONTAINER(client_errors_fr), sp->client_error_table); - gtk_widget_show(sp->client_error_table); - /* server_errors response frame */ server_errors_fr = gtk_frame_new("Server errors HTTP 5xx"); gtk_container_add(GTK_CONTAINER(main_vb), server_errors_fr); - gtk_widget_show(server_errors_fr); sp->server_errors_table = gtk_table_new( 0, 2, FALSE); gtk_container_add(GTK_CONTAINER(server_errors_fr), sp->server_errors_table); - gtk_widget_show(sp->server_errors_table); - separator = gtk_hseparator_new(); gtk_container_add(GTK_CONTAINER(main_vb), separator ); @@ -480,11 +477,9 @@ gtk_httpstat_init(char *optarg) request_fr = gtk_frame_new("List of request methods"); gtk_container_add(GTK_CONTAINER(main_vb), request_fr); gtk_container_border_width(GTK_CONTAINER(request_fr), 0); - gtk_widget_show(request_fr); sp->request_box = gtk_vbox_new(FALSE, 10); gtk_container_add(GTK_CONTAINER(request_fr), sp->request_box); - gtk_widget_show(sp->request_box); error_string = register_tap_listener( "http", @@ -502,6 +497,19 @@ gtk_httpstat_init(char *optarg) return ; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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 ); http_init_hash(sp); retap_packets(&cfile); diff --git a/gtk/isup_stat.c b/gtk/isup_stat.c index 3e227b4744..f984f049c0 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.20 2004/03/13 15:15:25 ulfl Exp $ + * $Id: isup_stat.c,v 1.21 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -277,50 +277,23 @@ isup_stat_gtk_win_create( GtkWidget *vbox; GtkWidget *bt_close; GtkWidget *bbox; - GtkWidget *dialog_vbox; - GtkWidget *dialog_action_area; - dlg_p->win = gtk_dialog_new(); + dlg_p->win = dlg_window_new(title); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 560, 450); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", isup_stat_gtk_win_destroy_cb, dlg_p); - dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; - gtk_widget_show(dialog_vbox); - - dialog_action_area = GTK_DIALOG(dlg_p->win)->action_area; - gtk_widget_show(dialog_action_area); - gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area), 10); - - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_start(GTK_BOX(dialog_action_area), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); - - 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); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_widget_ref(vbox); - OBJECT_SET_DATA_FULL(dlg_p->win, "vbox", vbox, gtk_widget_unref); - gtk_widget_show(vbox); - gtk_box_pack_start(GTK_BOX(dialog_vbox), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); + vbox = gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(dlg_p->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); dlg_p->scrolled_win = scrolled_window_new(NULL, NULL); - gtk_widget_ref(dlg_p->scrolled_win); - OBJECT_SET_DATA_FULL(dlg_p->win, "scrolled_win", dlg_p->scrolled_win, - gtk_widget_unref); - gtk_widget_show(dlg_p->scrolled_win); gtk_box_pack_start(GTK_BOX(vbox), dlg_p->scrolled_win, TRUE, TRUE, 0); dlg_p->table = gtk_clist_new(INIT_TABLE_NUM_COLUMNS); - gtk_widget_ref(dlg_p->table); - OBJECT_SET_DATA_FULL(dlg_p->win, "table", dlg_p->table, gtk_widget_unref); - gtk_widget_show(dlg_p->table); - gtk_widget_show(dlg_p->win); + /* 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); @@ -390,6 +363,21 @@ isup_stat_gtk_win_create( gtk_container_add(GTK_CONTAINER(dlg_p->scrolled_win), dlg_p->table); SIGNAL_CONNECT(dlg_p->table, "click-column", isup_stat_gtk_click_column_cb, col_arrows); + + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + + gtk_widget_show_all(dlg_p->win); } diff --git a/gtk/ldap_stat.c b/gtk/ldap_stat.c index ee989f2e52..e02853be09 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.18 2004/03/13 15:15:25 ulfl Exp $ + * $Id: ldap_stat.c,v 1.19 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -151,6 +151,8 @@ gtk_ldapstat_init(char *optarg) char filter_string[256]; GString *error_string; GtkWidget *vbox; + GtkWidget *bbox; + GtkWidget *close_bt; if(!strncmp(optarg,"ldap,srt,",9)){ filter=optarg+9; @@ -160,32 +162,27 @@ gtk_ldapstat_init(char *optarg) ldap=g_malloc(sizeof(ldapstat_t)); - ldap->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + ldap->win=dlg_window_new(""); 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, 0); + vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(ldap->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_widget_show(vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); label=gtk_label_new("LDAP Service Response Time statistics"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); label=gtk_label_new(filter_string); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - label=gtk_label_new("LDAP Commands"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); /* We must display TOP LEVEL Widget before calling init_srt_table() */ - gtk_widget_show(ldap->win); + gtk_widget_show_all(ldap->win); init_srt_table(&ldap->ldap_srt_table, 24, vbox, NULL); init_srt_table_row(&ldap->ldap_srt_table, 0, "Bind"); @@ -222,6 +219,19 @@ gtk_ldapstat_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + gtk_widget_show_all(ldap->win); retap_packets(&cfile); } diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c index 2d510d8899..8cecfc7e81 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.44 2004/04/07 04:31:32 sahlberg Exp $ + * $Id: rpc_stat.c,v 1.45 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -217,6 +217,8 @@ gtk_rpcstat_init(char *optarg) GtkWidget *vbox; GtkWidget *stat_label; GtkWidget *filter_label; + GtkWidget *bbox; + GtkWidget *close_bt; int program, version, pos; char *filter=NULL; GString *error_string; @@ -244,26 +246,23 @@ gtk_rpcstat_init(char *optarg) hf_index=rpc_prog_hf(rpc_program, rpc_version); hfi=proto_registrar_get_nth(hf_index); - rs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + rs->win=dlg_window_new(""); 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, 0); + vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(rs->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_widget_show(vbox); - - title_string = rpcstat_gen_title(rs); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); + + title_string = rpcstat_gen_title(rs); stat_label=gtk_label_new(title_string); g_free(title_string); gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); - gtk_widget_show(stat_label); g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); filter_label=gtk_label_new(filter_string); gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0); - gtk_widget_show(filter_label); rpc_min_proc=-1; rpc_max_proc=-1; @@ -271,7 +270,7 @@ gtk_rpcstat_init(char *optarg) rs->num_procedures=rpc_max_proc+1; /* We must display TOP LEVEL Widget before calling init_srt_table() */ - gtk_widget_show(rs->win); + gtk_widget_show_all(rs->win); init_srt_table(&rs->srt_table, rpc_max_proc+1, vbox, hfi->abbrev); @@ -289,6 +288,18 @@ gtk_rpcstat_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); retap_packets(&cfile); diff --git a/gtk/smb_stat.c b/gtk/smb_stat.c index 244541f0f8..777dc1d544 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.41 2004/03/13 15:15:25 ulfl Exp $ + * $Id: smb_stat.c,v 1.42 2004/04/12 08:53:02 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -159,6 +159,8 @@ gtk_smbstat_init(char *optarg) GString *error_string; int i; GtkWidget *vbox; + GtkWidget *bbox; + GtkWidget *close_bt; if(!strncmp(optarg,"smb,srt,",8)){ filter=optarg+8; @@ -168,32 +170,27 @@ gtk_smbstat_init(char *optarg) ss=g_malloc(sizeof(smbstat_t)); - ss->win=window_new(GTK_WINDOW_TOPLEVEL, NULL); + ss->win=dlg_window_new(""); 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, 0); + vbox=gtk_vbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(ss->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_widget_show(vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); label=gtk_label_new("SMB Service Response Time statistics"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); label=gtk_label_new(filter_string); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - label=gtk_label_new("SMB Commands"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); /* We must display TOP LEVEL Widget before calling init_srt_table() */ - gtk_widget_show(ss->win); + gtk_widget_show_all(ss->win); init_srt_table(&ss->smb_srt_table, 256, vbox, "smb.cmd"); for(i=0;i<256;i++){ @@ -203,7 +200,6 @@ gtk_smbstat_init(char *optarg) label=gtk_label_new("Transaction2 Sub-Commands"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); init_srt_table(&ss->trans2_srt_table, 256, vbox, "smb.trans2.cmd"); for(i=0;i<256;i++){ init_srt_table_row(&ss->trans2_srt_table, i, val_to_str(i, trans2_cmd_vals, "Unknown(0x%02x)")); @@ -212,7 +208,6 @@ gtk_smbstat_init(char *optarg) label=gtk_label_new("NT Transaction Sub-Commands"); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); init_srt_table(&ss->nt_trans_srt_table, 256, vbox, "smb.nt.function"); for(i=0;i<256;i++){ init_srt_table_row(&ss->nt_trans_srt_table, i, val_to_str(i, nt_cmd_vals, "Unknown(0x%02x)")); @@ -227,6 +222,19 @@ gtk_smbstat_init(char *optarg) return; } + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + 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); + + /* 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); + gtk_widget_show_all(ss->win); retap_packets(&cfile); } |