Add a "window_new()" routine that creates a window of a given type, sets

the title, and arranges to set the icon for it.  Use that instead of
"gtk_window_new()" and separate calls to set the title and arrange to
set the icon.

Regularize #includes a bit.

Clean up white space.

svn path=/trunk/; revision=10054
This commit is contained in:
Guy Harris 2004-02-13 00:53:37 +00:00
parent 5f27347dfa
commit 36ece5a17a
24 changed files with 245 additions and 217 deletions

View File

@ -1,7 +1,7 @@
/* bootp_stat.c
* boop_stat 2003 Jean-Michel FAYARD
*
* $Id: bootp_stat.c,v 1.17 2004/02/11 04:28:47 guy Exp $
* $Id: bootp_stat.c,v 1.18 2004/02/13 00:53:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -30,10 +30,12 @@
#include <gtk/gtk.h>
#include <string.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
@ -216,8 +218,7 @@ gtk_dhcpstat_init(char *optarg)
}
/* top level window */
sp->win = gtk_window_new( GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(sp->win), title );
sp->win = window_new( GTK_WINDOW_TOPLEVEL, title);
g_free(title);
SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp);

View File

@ -1,7 +1,7 @@
/* capture_prefs.c
* Dialog box for capture preferences
*
* $Id: capture_prefs.c,v 1.29 2004/02/06 19:19:09 ulfl Exp $
* $Id: capture_prefs.c,v 1.30 2004/02/13 00:53:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -238,15 +238,11 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
/* create a new dialog */
ifopts_edit_dlg = dlg_window_new("Ethereal: Preferences: Interface Options");
/*gtk_window_set_title(GTK_WINDOW(ifopts_edit_dlg),
"Ethereal: Preferences: Interface Options");*/
SIGNAL_CONNECT(ifopts_edit_dlg, "destroy", ifopts_edit_destroy_cb, NULL);
SIGNAL_CONNECT(ifopts_edit_dlg, "realize", window_icon_realize_cb, NULL);
main_vb = gtk_vbox_new(FALSE, 1);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
gtk_container_add(GTK_CONTAINER(ifopts_edit_dlg), main_vb);
gtk_widget_show(main_vb);
main_vb = gtk_vbox_new(FALSE, 1);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
gtk_container_add(GTK_CONTAINER(ifopts_edit_dlg), main_vb);
gtk_widget_show(main_vb);
/* create current options frame */
cur_opts_fr = gtk_frame_new("Current options");
@ -338,15 +334,15 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(if_hide_cb);
/* button row: OK and Cancel buttons */
bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
gtk_widget_show(bbox);
ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
gtk_widget_grab_default(ok_bt);
ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
gtk_widget_grab_default(ok_bt);
SIGNAL_CONNECT(ok_bt, "clicked", ifopts_edit_ok_cb, ifopts_edit_dlg);
cancel_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
cancel_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
SIGNAL_CONNECT(cancel_bt, "clicked", ifopts_edit_close_cb, ifopts_edit_dlg);
/* Call a handler when we're destroyed, so we can inform

View File

@ -1,7 +1,7 @@
/* dcerpc_stat.c
* dcerpc_stat 2002 Ronnie Sahlberg
*
* $Id: dcerpc_stat.c,v 1.48 2004/02/11 04:28:47 guy Exp $
* $Id: dcerpc_stat.c,v 1.49 2004/02/13 00:53:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -33,11 +33,13 @@
# include "config.h"
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "simple_dialog.h"
#include "dlg_utils.h"
@ -257,9 +259,9 @@ gtk_dcerpcstat_init(char *optarg)
rs->uuid=uuid;
rs->ver=ver;
rs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400);
rs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
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);

View File

@ -1,7 +1,7 @@
/* dlg_utils.c
* Utilities to use when constructing dialogs
*
* $Id: dlg_utils.c,v 1.20 2004/01/31 12:13:22 ulfl Exp $
* $Id: dlg_utils.c,v 1.21 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -292,10 +292,9 @@ dlg_window_new(const gchar *title)
GtkWidget *win;
#if GTK_MAJOR_VERSION < 2
win = gtk_window_new(GTK_WINDOW_DIALOG);
win = window_new(GTK_WINDOW_DIALOG, title);
#else
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
win = window_new(GTK_WINDOW_TOPLEVEL, title);
#endif
/*
* XXX - if we're running in the capture child process, we can't easily
@ -314,8 +313,9 @@ dlg_window_new(const gchar *title)
if (top_level) {
gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
}
gtk_window_set_title(GTK_WINDOW(win), title);
SIGNAL_CONNECT(win, "realize", window_icon_realize_cb, NULL);
#if GTK_MAJOR_VERSION >= 2
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
#endif
return win;
}

View File

@ -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.30 2004/02/06 19:19:09 ulfl Exp $
* $Id: endpoint_talkers_table.c,v 1.31 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -33,7 +33,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <gtk/gtk.h>
#include "compat_macros.h"
#include "epan/packet_info.h"
#include "epan/to_str.h"
@ -958,10 +960,9 @@ init_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filt
talkers=g_malloc(sizeof(endpoints_table));
talkers->name=table_name;
talkers->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(talkers->win), 750, 400);
snprintf(title, 255, "%s Conversations: %s", table_name, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(talkers->win), title);
talkers->win=window_new(GTK_WINDOW_TOPLEVEL, title);
gtk_window_set_default_size(GTK_WINDOW(talkers->win), 750, 400);
SIGNAL_CONNECT(talkers->win, "destroy", ett_win_destroy_cb, talkers);

View File

@ -1,7 +1,7 @@
/* fc_stat.c
* fc_stat 2003 Ronnie Sahlberg
*
* $Id: fc_stat.c,v 1.24 2004/02/11 04:28:48 guy Exp $
* $Id: fc_stat.c,v 1.25 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -30,18 +30,22 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../packet-fc.h"
#include "../register.h"
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
@ -142,7 +146,7 @@ gtk_fcstat_init(char *optarg)
fc=g_malloc(sizeof(fcstat_t));
fc->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
fc->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
gtk_window_set_default_size(GTK_WINDOW(fc->win), 550, 400);
fcstat_set_title(fc);
SIGNAL_CONNECT(fc->win, "destroy", win_destroy_cb, fc);

View File

@ -1,6 +1,6 @@
/* follow_dlg.c
*
* $Id: follow_dlg.c,v 1.45 2004/02/11 01:37:12 guy Exp $
* $Id: follow_dlg.c,v 1.46 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -242,7 +242,13 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
fclose(data_out_file);
/* The data_out_filename file now has all the text that was in the session */
streamwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
if (incomplete_tcp_stream) {
streamwindow = window_new(GTK_WINDOW_TOPLEVEL,
"Contents of TCP stream (incomplete)");
} else {
streamwindow = window_new(GTK_WINDOW_TOPLEVEL,
"Contents of TCP stream");
}
/* needed in follow_filter_out_stream(), is there a better way? */
follow_info->streamwindow = streamwindow;
@ -250,14 +256,6 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
gtk_widget_set_name(streamwindow, "TCP stream window");
SIGNAL_CONNECT(streamwindow, "destroy", follow_destroy_cb, NULL);
SIGNAL_CONNECT(streamwindow, "realize", window_icon_realize_cb, NULL);
if (incomplete_tcp_stream) {
gtk_window_set_title(GTK_WINDOW(streamwindow),
"Contents of TCP stream (incomplete)");
} else {
gtk_window_set_title(GTK_WINDOW(streamwindow),
"Contents of TCP stream");
}
WIDGET_SET_SIZE(streamwindow, DEF_WIDTH, DEF_HEIGHT);
gtk_container_border_width(GTK_CONTAINER(streamwindow), 2);

View File

@ -2,7 +2,7 @@
* h225 message counter for ethereal
* Copyright 2003 Lars Roland
*
* $Id: h225_counter.c,v 1.11 2004/02/11 04:28:48 guy Exp $
* $Id: h225_counter.c,v 1.12 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -31,13 +31,16 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../register.h"
#include "../packet-h225.h"
#include "gtk_stat_util.h"
@ -486,7 +489,7 @@ gtk_h225counter_init(char *optarg)
h225counter_reset(hs);
hs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
hs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs);
hs->vbox=gtk_vbox_new(FALSE, 0);

View File

@ -2,7 +2,7 @@
* h225 RAS Service Response Time statistics for ethereal
* Copyright 2003 Lars Roland
*
* $Id: h225_ras_srt.c,v 1.10 2004/02/11 04:28:48 guy Exp $
* $Id: h225_ras_srt.c,v 1.11 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -31,13 +31,16 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../register.h"
#include "../packet-h225.h"
#include "../timestats.h"
@ -283,7 +286,7 @@ gtk_h225rassrt_init(char *optarg)
h225rassrt_reset(hs);
hs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
hs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs);
hs->vbox=gtk_vbox_new(FALSE, 0);

View File

@ -1,7 +1,7 @@
/* http_stat.c
* http_stat 2003 Jean-Michel FAYARD
*
* $Id: http_stat.c,v 1.19 2004/02/11 04:28:48 guy Exp $
* $Id: http_stat.c,v 1.20 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -26,13 +26,16 @@
# include "config.h"
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
@ -395,8 +398,7 @@ gtk_httpstat_init(char *optarg)
}
/* top level window */
sp->win = gtk_window_new( GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(sp->win), title );
sp->win = window_new( GTK_WINDOW_TOPLEVEL, title);
g_free(title);
SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp);

View File

@ -1,7 +1,7 @@
/* io_stat.c
* io_stat 2002 Ronnie Sahlberg
*
* $Id: io_stat.c,v 1.62 2004/02/11 04:28:48 guy Exp $
* $Id: io_stat.c,v 1.63 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -36,9 +36,12 @@
#include <ctype.h>
#include <gtk/gtk.h>
#include <epan/epan_dissect.h>
#include <epan/packet_info.h>
#include "gtkglobals.h"
#include "epan/epan_dissect.h"
#include "epan/packet_info.h"
#include "ui_util.h"
#include "tap_menu.h"
#include "../tap.h"
#include "../register.h"
@ -1752,7 +1755,7 @@ init_io_stat_window(io_stat_t *io)
GtkWidget *hbox;
/* create the main window */
io->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
io->window=window_new(GTK_WINDOW_TOPLEVEL, NULL);
gtk_widget_set_name(io->window, "I/O Statistics");

View File

@ -1,7 +1,7 @@
/* ldap_stat.c
* ldap_stat 2003 Ronnie Sahlberg
*
* $Id: ldap_stat.c,v 1.12 2004/02/11 04:28:48 guy Exp $
* $Id: ldap_stat.c,v 1.13 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -30,18 +30,22 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../packet-ldap.h"
#include "../register.h"
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
@ -156,7 +160,7 @@ gtk_ldapstat_init(char *optarg)
ldap=g_malloc(sizeof(ldapstat_t));
ldap->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
ldap->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
gtk_window_set_default_size(GTK_WINDOW(ldap->win), 550, 400);
ldapstat_set_title(ldap);
SIGNAL_CONNECT(ldap->win, "destroy", win_destroy_cb, ldap);

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.396 2004/02/13 00:00:25 guy Exp $
* $Id: main.c,v 1.397 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -3630,7 +3630,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
};
/* Main window */
top_level = gtk_window_new(GTK_WINDOW_TOPLEVEL);
top_level = window_new(GTK_WINDOW_TOPLEVEL, "The Ethereal Network Analyzer");
tooltips = gtk_tooltips_new();
@ -3643,8 +3643,6 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
gtk_widget_set_name(top_level, "main window");
SIGNAL_CONNECT(top_level, "delete_event", main_window_delete_event_cb,
NULL);
SIGNAL_CONNECT(top_level, "realize", window_icon_realize_cb, NULL);
gtk_window_set_title(GTK_WINDOW(top_level), "The Ethereal Network Analyzer");
gtk_window_set_policy(GTK_WINDOW(top_level), TRUE, TRUE, FALSE);
/* Container for menu bar, toolbar(s), paned windows and progress/info box */

View File

@ -2,7 +2,7 @@
* mgcp-statistics for ethereal
* Copyright 2003 Lars Roland
*
* $Id: mgcp_stat.c,v 1.27 2004/02/11 04:28:49 guy Exp $
* $Id: mgcp_stat.c,v 1.28 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -31,13 +31,16 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../register.h"
#include "../plugins/mgcp/packet-mgcp.h"
#include "../timestats.h"
@ -274,7 +277,7 @@ gtk_mgcpstat_init(char *optarg)
mgcpstat_reset(ms);
ms->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
ms->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
SIGNAL_CONNECT(ms->win, "destroy", win_destroy_cb, ms);
ms->vbox=gtk_vbox_new(FALSE, 0);

View File

@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet_win.c,v 1.43 2004/01/19 00:42:10 ulfl Exp $
* $Id: packet_win.c,v 1.44 2004/02/13 00:53:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -56,6 +56,7 @@
#include "proto_draw.h"
#include "keys.h"
#include "gtkglobals.h"
#include "ui_util.h"
#include <epan/plugins.h>
#include <epan/epan_dissect.h>
#include "compat_macros.h"
@ -114,8 +115,6 @@ void new_window_cb(GtkWidget *w _U_)
DataPtr->frame, &cfile.cinfo);
epan_dissect_fill_in_columns(DataPtr->edt);
main_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/*
* Build title of window by getting column data constructed when the
* frame was dissected.
@ -128,7 +127,7 @@ void new_window_cb(GtkWidget *w _U_)
}
}
gtk_window_set_title(GTK_WINDOW(main_w), Title);
main_w = window_new(GTK_WINDOW_TOPLEVEL, Title);
gtk_window_set_default_size(GTK_WINDOW(main_w), DEF_WIDTH, -1);
/* Container for paned windows */

View File

@ -1,7 +1,7 @@
/* rpc_progs.c
* rpc_progs 2002 Ronnie Sahlberg
*
* $Id: rpc_progs.c,v 1.18 2004/02/11 04:28:49 guy Exp $
* $Id: rpc_progs.c,v 1.19 2004/02/13 00:53:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -34,13 +34,15 @@
#include <gtk/gtk.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "tap.h"
#include "../register.h"
#include "packet-rpc.h"
#include "../globals.h"
#include "ui_util.h"
#include "compat_macros.h"
static GtkWidget *win=NULL;
@ -319,7 +321,6 @@ win_destroy_cb(void *dummy _U_, gpointer data _U_)
void
gtk_rpcprogs_init(char *optarg _U_)
{
char title_string[60];
GtkWidget *vbox;
GtkWidget *stat_label;
GtkWidget *tmp;
@ -330,9 +331,7 @@ gtk_rpcprogs_init(char *optarg _U_)
return;
}
win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
sprintf(title_string,"ONC-RPC Program Statistics");
gtk_window_set_title(GTK_WINDOW(win), title_string);
win=window_new(GTK_WINDOW_TOPLEVEL, "ONC-RPC Program Statistics");
SIGNAL_CONNECT(win, "destroy", win_destroy_cb, win);
vbox=gtk_vbox_new(FALSE, 0);
@ -340,7 +339,7 @@ gtk_rpcprogs_init(char *optarg _U_)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_widget_show(vbox);
stat_label=gtk_label_new(title_string);
stat_label=gtk_label_new("ONC-RPC Program Statistics");
gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0);
gtk_widget_show(stat_label);

View File

@ -1,7 +1,7 @@
/* rpc_stat.c
* rpc_stat 2002 Ronnie Sahlberg
*
* $Id: rpc_stat.c,v 1.37 2004/02/11 04:28:49 guy Exp $
* $Id: rpc_stat.c,v 1.38 2004/02/13 00:53:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -34,10 +34,12 @@
#include <gtk/gtk.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
@ -230,7 +232,7 @@ gtk_rpcstat_init(char *optarg)
hf_index=rpc_prog_hf(rpc_program, rpc_version);
hfi=proto_registrar_get_nth(hf_index);
rs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
rs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400);
rpcstat_set_title(rs);
SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs);

View File

@ -1,7 +1,7 @@
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
* $Id: rtp_analysis.c,v 1.36 2004/02/12 22:24:28 guy Exp $
* $Id: rtp_analysis.c,v 1.37 2004/02/13 00:53:36 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -44,9 +44,10 @@
#include "../graph/graph.h"
#endif
#include <epan/epan_dissect.h>
#include <epan/filesystem.h>
#include "util.h"
#include "epan/epan_dissect.h"
#include "epan/filesystem.h"
#include "tap.h"
#include "register.h"
#include "packet-rtp.h"
@ -1918,8 +1919,7 @@ void create_rtp_dialog(user_data_t* user_data)
column_arrows *col_arrows_rev;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Ethereal: RTP Stream Analysis");
window = window_new (GTK_WINDOW_TOPLEVEL, "Ethereal: RTP Stream Analysis");
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
SIGNAL_CONNECT(window, "destroy", on_destroy, user_data);

View File

@ -1,7 +1,7 @@
/* smb_stat.c
* smb_stat 2003 Ronnie Sahlberg
*
* $Id: smb_stat.c,v 1.35 2004/02/11 04:28:49 guy Exp $
* $Id: smb_stat.c,v 1.36 2004/02/13 00:53:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -30,18 +30,22 @@
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "../epan/packet_info.h"
#include "../epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include "tap_menu.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../smb.h"
#include "../register.h"
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
@ -164,7 +168,7 @@ gtk_smbstat_init(char *optarg)
ss=g_malloc(sizeof(smbstat_t));
ss->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
ss->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
gtk_window_set_default_size(GTK_WINDOW(ss->win), 550, 600);
smbstat_set_title(ss);
SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss);

View File

@ -1,7 +1,7 @@
/* summary_dlg.c
* Routines for capture file summary window
*
* $Id: summary_dlg.c,v 1.26 2004/02/02 22:51:30 guy Exp $
* $Id: summary_dlg.c,v 1.27 2004/02/13 00:53:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -77,9 +77,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* initial computations */
seconds = summary.stop_time - summary.start_time;
sum_open_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(sum_open_w), "Ethereal: Summary");
SIGNAL_CONNECT(sum_open_w, "realize", window_icon_realize_cb, NULL);
sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: Summary");
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 3);

View File

@ -3,7 +3,7 @@
* By Pavel Mores <pvl@uh.cz>
* Win32 port: rwh@unifiedtech.com
*
* $Id: tcp_graph.c,v 1.50 2004/02/06 19:19:11 ulfl Exp $
* $Id: tcp_graph.c,v 1.51 2004/02/13 00:53:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -583,11 +583,10 @@ static void create_text_widget (struct graph *g)
GtkWidget *streamwindow, *txt_scrollw, *box;
debug(DBS_FENTRY) puts ("create_text_widget()");
streamwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
streamwindow = window_new (GTK_WINDOW_TOPLEVEL, "Ethereal: Packet chain");
gtk_widget_set_name (streamwindow, "Packet chain");
WIDGET_SET_SIZE(streamwindow, TXT_WIDTH, TXT_HEIGHT);
gtk_container_border_width (GTK_CONTAINER(streamwindow), 2);
SIGNAL_CONNECT(streamwindow, "realize", window_icon_realize_cb, NULL);
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (streamwindow), box);
@ -709,9 +708,10 @@ static void create_drawing_area (struct graph *g)
g->font = gdk_font_load ("-biznet-fotinostypewriter-medium-r-normal-*-*-120"
"-*-*-m-*-iso8859-2");
#endif
g->toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
snprintf (window_title, WINDOW_TITLE_LENGTH, "TCP Graph %d - Ethereal",
refnum);
g->toplevel = window_new (GTK_WINDOW_TOPLEVEL, window_title);
gtk_widget_set_name (g->toplevel, "Test Graph");
SIGNAL_CONNECT(g->toplevel, "realize", window_icon_realize_cb, NULL);
/* Create the drawing area */
g->drawing_area = gtk_drawing_area_new ();
@ -770,9 +770,6 @@ static void create_drawing_area (struct graph *g)
gtk_container_add (GTK_CONTAINER (g->toplevel), g->drawing_area);
gtk_widget_show (g->toplevel);
snprintf (window_title, WINDOW_TITLE_LENGTH, "TCP Graph %d - Ethereal",
refnum);
gtk_window_set_title (GTK_WINDOW (g->toplevel), window_title);
/* in case we didn't get what we asked for */
g->wp.width = GTK_WIDGET (g->drawing_area)->allocation.width -
@ -871,8 +868,9 @@ static void control_panel_create (struct graph *g)
control_panel_add_cross_page (g, notebook);
control_panel_add_graph_type_page (g, notebook);
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
SIGNAL_CONNECT(toplevel, "realize", window_icon_realize_cb, NULL);
snprintf (window_title, WINDOW_TITLE_LENGTH,
"Graph %d - Control - Ethereal", refnum);
toplevel = window_new (GTK_WINDOW_TOPLEVEL, window_title);
SIGNAL_CONNECT(toplevel, "destroy", callback_toplevel_destroy, g);
table = gtk_table_new (2, 1, FALSE);
@ -882,24 +880,21 @@ static void control_panel_create (struct graph *g)
GTK_FILL|GTK_EXPAND, GTK_FILL, 5, 5);
/* bottom buttons */
bbox = dlg_button_row_new(GTK_STOCK_HELP, GTK_STOCK_CLOSE, NULL);
gtk_table_attach (GTK_TABLE (table), bbox, 0, 1, 1, 2,
bbox = dlg_button_row_new(GTK_STOCK_HELP, GTK_STOCK_CLOSE, NULL);
gtk_table_attach (GTK_TABLE (table), bbox, 0, 1, 1, 2,
GTK_FILL|GTK_EXPAND, GTK_FILL, 5, 5);
gtk_widget_show(bbox);
gtk_widget_show(bbox);
help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP);
help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP);
SIGNAL_CONNECT(help_bt, "clicked", callback_create_help, g);
close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE);
gtk_widget_grab_default(close_bt);
close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE);
gtk_widget_grab_default(close_bt);
SIGNAL_CONNECT(close_bt, "clicked", callback_close, g);
/* gtk_widget_show_all (table); */
/* g->gui.control_panel = table; */
gtk_widget_show_all (toplevel);
snprintf (window_title, WINDOW_TITLE_LENGTH,
"Graph %d - Control - Ethereal", refnum);
gtk_window_set_title (GTK_WINDOW (toplevel), window_title);
g->gui.control_panel = toplevel;
}
@ -1019,10 +1014,8 @@ static void callback_create_help(GtkWidget *widget _U_, gpointer data _U_)
GtkTextBuffer *buf;
#endif
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(toplevel), "Help for TCP graphing");
toplevel = window_new (GTK_WINDOW_TOPLEVEL, "Help for TCP graphing");
WIDGET_SET_SIZE(toplevel, 500, 400);
SIGNAL_CONNECT(toplevel, "realize", window_icon_realize_cb, NULL);
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (toplevel), box);
@ -2688,8 +2681,7 @@ 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 = gtk_window_new (GTK_WINDOW_POPUP);
SIGNAL_CONNECT(mg->toplevel, "realize", window_icon_realize_cb, NULL);
mg->toplevel = window_new (GTK_WINDOW_POPUP, NULL);
mg->drawing_area = mg->toplevel;
WIDGET_SET_SIZE(mg->toplevel, g->magnify.width, g->magnify.height);
gtk_widget_set_events (mg->drawing_area, GDK_EXPOSURE_MASK

View File

@ -1,7 +1,7 @@
/* ui_util.c
* UI utility routines
*
* $Id: ui_util.c,v 1.18 2004/02/06 19:19:11 ulfl Exp $
* $Id: ui_util.c,v 1.19 2004/02/13 00:53:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -45,6 +45,81 @@
#include "image/eicon3d16.xpm"
/* Set our window icon. The GDK documentation doesn't provide any
actual documentation for gdk_window_set_icon(), so we'll steal
libgimp/gimpdialog.c:gimp_dialog_realize_callback() from the Gimp
sources and assume it's safe.
XXX - The current icon size is fixed at 16x16 pixels, which looks fine
with kwm (KDE 1.x's window manager), Sawfish (the "default" window
manager for GNOME?), and under Windows with Exceed putting X windows
on the Windows desktop, using Exceed as the window manager, as those
window managers put a 16x16 icon on the title bar.
The window managers in some windowing environments (e.g. dtwm in CDE)
and some stand-alone window managers have larger icon sizes (many window
managers put the window icon on the desktop, in the Windows 3.x style,
rather than in the titlebar, in the Windows 4.x style), so we need to
find a way to size our icon appropriately.
The X11 Inter-Client Communications Conventions Manual, Version 1.1,
in X11R5, specifies that "a window manager that wishes to place
constraints on the sizes of icon pixmaps and/or windows should
place a property called WM_ICON_SIZE on the root"; that property
contains minimum width and height, maximum width and height, and
width and height increment values. "XGetIconSizes()" retrieves
that property; unfortunately, I've yet to find a window manager
that sets it on the root window (kwm, AfterStep, and Exceed don't
appear to set it).
The X Desktop Group's Window Manager Standard specifies, in the section
on Application Window Properties, an _NET_WM_ICON property, presumably
set by the window manager, which is an array of possible icon sizes
for the client. There's no API in GTK+ 1.2[.x] for this; there may
eventually be one either in GTK+ 2.0 or GNOME 2.0.
Some window managers can be configured to take the window name
specified by the WM_NAME property of a window or the resource
or class name specified by the WM_CLASS property and base the
choice of icon for the window on one of those; WM_CLASS for
Ethereal's windows has a resource name of "ethereal" and a class
name of "Ethereal". However, the way that's done is window-manager-
specific, and there's no way to determine what size a particular
window manager would want, so there's no way to automate this as
part of the installation of Ethereal.
*/
static void
window_icon_realize_cb (GtkWidget *win, gpointer data _U_)
{
#ifndef WIN32
static GdkPixmap *icon_pmap = NULL;
static GdkBitmap *icon_mask = NULL;
GtkStyle *style;
style = gtk_widget_get_style (win);
if (icon_pmap == NULL) {
icon_pmap = gdk_pixmap_create_from_xpm_d (win->window,
&icon_mask, &style->bg[GTK_STATE_NORMAL], eicon3d16_xpm);
}
gdk_window_set_icon (win->window, NULL, icon_pmap, icon_mask);
#endif
}
/* Create a new window, of the specified type, with the specified title
(if any) and the Ethereal icon. */
GtkWidget *
window_new(GtkWindowType type, const gchar *title)
{
GtkWidget *win;
win = gtk_window_new(type);
if (title != NULL)
gtk_window_set_title(GTK_WINDOW(win), title);
SIGNAL_CONNECT(win, "realize", window_icon_realize_cb, NULL);
return win;
}
/* Set the name of the top-level window and its icon to the specified
string. */
@ -222,68 +297,6 @@ reactivate_window(GtkWidget *win)
gdk_window_raise(win->window);
}
/* Set our window icon. The GDK documentation doesn't provide any
actual documentation for gdk_window_set_icon(), so we'll steal
libgimp/gimpdialog.c:gimp_dialog_realize_callback() from the Gimp
sources and assume it's safe.
XXX - The current icon size is fixed at 16x16 pixels, which looks fine
with kwm (KDE 1.x's window manager), Sawfish (the "default" window
manager for GNOME?), and under Windows with Exceed putting X windows
on the Windows desktop, using Exceed as the window manager, as those
window managers put a 16x16 icon on the title bar.
The window managers in some windowing environments (e.g. dtwm in CDE)
and some stand-alone window managers have larger icon sizes (many window
managers put the window icon on the desktop, in the Windows 3.x style,
rather than in the titlebar, in the Windows 4.x style), so we need to
find a way to size our icon appropriately.
The X11 Inter-Client Communications Conventions Manual, Version 1.1,
in X11R5, specifies that "a window manager that wishes to place
constraints on the sizes of icon pixmaps and/or windows should
place a property called WM_ICON_SIZE on the root"; that property
contains minimum width and height, maximum width and height, and
width and height increment values. "XGetIconSizes()" retrieves
that property; unfortunately, I've yet to find a window manager
that sets it on the root window (kwm, AfterStep, and Exceed don't
appear to set it).
The X Desktop Group's Window Manager Standard specifies, in the section
on Application Window Properties, an _NET_WM_ICON property, presumably
set by the window manager, which is an array of possible icon sizes
for the client. There's no API in GTK+ 1.2[.x] for this; there may
eventually be one either in GTK+ 2.0 or GNOME 2.0.
Some window managers can be configured to take the window name
specified by the WM_NAME property of a window or the resource
or class name specified by the WM_CLASS property and base the
choice of icon for the window on one of those; WM_CLASS for
Ethereal's windows has a resource name of "ethereal" and a class
name of "Ethereal". However, the way that's done is window-manager-
specific, and there's no way to determine what size a particular
window manager would want, so there's no way to automate this as
part of the installation of Ethereal.
*/
void
window_icon_realize_cb (GtkWidget *win, gpointer data _U_)
{
#ifndef WIN32
static GdkPixmap *icon_pmap = NULL;
static GdkBitmap *icon_mask = NULL;
GtkStyle *style;
style = gtk_widget_get_style (win);
if (icon_pmap == NULL) {
icon_pmap = gdk_pixmap_create_from_xpm_d (win->window,
&icon_mask, &style->bg[GTK_STATE_NORMAL], eicon3d16_xpm);
}
gdk_window_set_icon (win->window, NULL, icon_pmap, icon_mask);
#endif
}
/* List of all GtkScrolledWindows, so we can globally set the scrollbar
placement of all of them. */
static GList *scrolled_windows;

View File

@ -1,7 +1,7 @@
/* ui_util.h
* Definitions for UI utility routines
*
* $Id: ui_util.h,v 1.6 2002/11/03 17:38:34 oabad Exp $
* $Id: ui_util.h,v 1.7 2004/02/13 00:53:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -25,6 +25,10 @@
#ifndef __GTKGUIUI_UTIL_H__
#define __GTKGUIUI_UTIL_H__
/* Create a new window, of the specified type, with the specified title
(if any) and the Ethereal icon. */
GtkWidget *window_new(GtkWindowType, const gchar *);
/* Given a pointer to a GtkWidget for a top-level window, raise it and
de-iconify it. This routine is used if the user has done something to
ask that a window of a certain type be popped up when there can be only
@ -32,9 +36,6 @@
pop up the existing one rather than creating a new one. */
void reactivate_window(GtkWidget *);
/* Set the window icon to the 16x16 3D icon. */
void window_icon_realize_cb (GtkWidget *, gpointer);
/* Create a GtkScrolledWindow, set its scrollbar placement appropriately,
and remember it. */
GtkWidget *scrolled_window_new(GtkAdjustment *hadjustment,

View File

@ -1,7 +1,7 @@
/* wsp_stat.c
* wsp_stat 2003 Jean-Michel FAYARD
*
* $Id: wsp_stat.c,v 1.17 2004/02/11 04:28:49 guy Exp $
* $Id: wsp_stat.c,v 1.18 2004/02/13 00:53:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -27,13 +27,16 @@
# include "config.h"
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "epan/packet_info.h"
#include "epan/epan.h"
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include "tap_menu.h"
#include "simple_dialog.h"
#include "ui_util.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
@ -349,8 +352,7 @@ gtk_wspstat_init(char *optarg)
sp->pdu_stats[i].packets=0;
}
sp->win = gtk_window_new( GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(sp->win), title );
sp->win = window_new( GTK_WINDOW_TOPLEVEL, title);
g_free(title);
SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp);