From cc6836803788de14432c597fcda0ad3154b421e4 Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Sun, 23 May 2004 23:24:07 +0000 Subject: use new functions in window API (ui_util.h), use window_new instead of dlg_window_new for the statistics windows (as these are no dialog windows) do some code cleanup svn path=/trunk/; revision=10979 --- gtk/wsp_stat.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'gtk/wsp_stat.c') 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 @@ -250,18 +250,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) g_free(sp); } -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) { @@ -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 = { -- cgit v1.2.3