Assorted GUI cleanups.

svn path=/trunk/; revision=8544
This commit is contained in:
Guy Harris 2003-09-26 02:09:44 +00:00
parent 87d87ace4e
commit 59938a45fe
11 changed files with 580 additions and 230 deletions

View File

@ -1,7 +1,7 @@
/* bootp_stat.c
* boop_stat 2003 Jean-Michel FAYARD
*
* $Id: bootp_stat.c,v 1.4 2003/09/24 02:36:34 guy Exp $
* $Id: bootp_stat.c,v 1.5 2003/09/26 02:09:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -32,6 +32,7 @@
#include "epan/epan.h"
#include "menu.h"
#include "simple_dialog.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
#include "../globals.h"
@ -57,10 +58,8 @@ typedef struct _dhcp_message_type_t {
dhcpstat_t *sp; /* entire program interface */
} dhcp_message_type_t;
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static void
dhcp_free_hash( gpointer key _U_ , gpointer value, gpointer user_data _U_ )
@ -197,7 +196,7 @@ gtk_dhcpstat_init(char *optarg)
char *filter=NULL;
char *title=NULL;
GString *error_string;
GtkWidget *message_type_fr ;
GtkWidget *message_type_fr;
if (!strncmp (optarg, "bootp,stat,", 11)){
filter=optarg+11;
@ -210,18 +209,18 @@ gtk_dhcpstat_init(char *optarg)
if(filter){
sp->filter=g_malloc(strlen(filter)+1);
strcpy(sp->filter,filter);
title=g_strdup_printf("DHCP Stats with filter: %s", filter);
title=g_strdup_printf("DHCP statistics with filter: %s", filter);
} else {
sp->filter=NULL;
title=g_strdup("DHCP Stats");
title=g_strdup("DHCP statistics");
}
/* top level window */
sp->win = gtk_window_new( GTK_WINDOW_TOPLEVEL);
gtk_window_set_title( GTK_WINDOW(sp->win), title );
g_free(title);
SIGNAL_CONNECT( sp->win, "destroy", win_destroy_cb, sp);
/* Status Codes frame */
message_type_fr = gtk_frame_new("DHCP Message Type");
gtk_container_add(GTK_CONTAINER(sp->win), message_type_fr);
@ -261,16 +260,14 @@ gtk_dhcpstat_init(char *optarg)
static void
dhcp_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
char *filter;
char str[256];
str = g_string_new("dhcp,stat,");
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_dhcpstat_init("dhcp,stat,");
} else {
sprintf(str, "dhcp,stat,%s", filter);
gtk_dhcpstat_init(str);
}
str = g_string_append(str, filter);
gtk_dhcpstat_init(str->str);
g_string_free(str, TRUE);
}
static void
@ -279,46 +276,91 @@ dlg_destroy_cb(void)
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
gtk_dhcpstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "WSP Statistics");
dlg=dlg_window_new("Ethereal: Compute DHCP statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
dhcp_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -332,6 +374,6 @@ register_tap_listener_gtkdhcpstat(void)
void
register_tap_menu_gtkdhcpstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/BOOTP-DHCP",
register_tap_menu_item("Statistics/Watch protocol/BOOTP-DHCP...",
gtk_dhcpstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* dcerpc_stat.c
* dcerpc_stat 2002 Ronnie Sahlberg
*
* $Id: dcerpc_stat.c,v 1.23 2003/09/24 02:36:34 guy Exp $
* $Id: dcerpc_stat.c,v 1.24 2003/09/26 02:09:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -80,16 +80,23 @@ uuid_equal(e_uuid_t *uuid1, e_uuid_t *uuid2)
}
return 1;
}
static void
dcerpcstat_set_title(rpcstat_t *rs)
{
char *title;
title = g_strdup_printf("DCE-RPC Service Response Time statistics for %s version %d.%d: %s",
rs->prog, rs->ver&0xff, rs->ver>>8, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(rs->win), title);
g_free(title);
}
static void
dcerpcstat_reset(rpcstat_t *rs)
{
char title_string[256];
reset_srt_table_data(&rs->srt_table);
snprintf(title_string, 255, "DCE-RPC Service Response Time statistics for %s version %d.%d : %s", rs->prog, rs->ver&0xff, rs->ver>>8, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(rs->win), title_string);
dcerpcstat_set_title(rs);
}
@ -212,8 +219,7 @@ gtk_dcerpcstat_init(char *optarg)
rs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400);
snprintf(title_string, 255, "DCE-RPC Service Response Time statistics for %s version %d.%d : %s", rs->prog, rs->ver&0xff, rs->ver>>8, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(rs->win), title_string);
dcerpcstat_set_title(rs);
SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs);
vbox=gtk_vbox_new(FALSE, 0);
@ -276,13 +282,10 @@ gtk_dcerpcstat_init(char *optarg)
static e_uuid_t *dcerpc_uuid_program=NULL;
static guint16 dcerpc_version;
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *prog_box;
static GtkWidget *prog_label, *prog_opt, *prog_menu;
static GtkWidget *vers_label, *vers_opt, *vers_menu;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *prog_menu;
static GtkWidget *vers_opt, *vers_menu;
static GtkWidget *filter_entry;
static dcerpc_uuid_key *current_uuid_key=NULL;
static dcerpc_uuid_value *current_uuid_value=NULL;
static dcerpc_uuid_key *new_uuid_key=NULL;
@ -292,18 +295,26 @@ static dcerpc_uuid_value *new_uuid_value=NULL;
static void
dcerpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
char *filter;
char str[256];
str = g_string_new("dcerpc,srt");
g_string_sprintfa(str,
",%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d",
dcerpc_uuid_program->Data1, dcerpc_uuid_program->Data2,
dcerpc_uuid_program->Data3,
dcerpc_uuid_program->Data4[0], dcerpc_uuid_program->Data4[1],
dcerpc_uuid_program->Data4[2], dcerpc_uuid_program->Data4[3],
dcerpc_uuid_program->Data4[4], dcerpc_uuid_program->Data4[5],
dcerpc_uuid_program->Data4[6], dcerpc_uuid_program->Data4[7],
dcerpc_version&0xff, dcerpc_version>>8);
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
sprintf(str, "dcerpc,srt,%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d",dcerpc_uuid_program->Data1,dcerpc_uuid_program->Data2,dcerpc_uuid_program->Data3,dcerpc_uuid_program->Data4[0],dcerpc_uuid_program->Data4[1],dcerpc_uuid_program->Data4[2],dcerpc_uuid_program->Data4[3],dcerpc_uuid_program->Data4[4],dcerpc_uuid_program->Data4[5],dcerpc_uuid_program->Data4[6],dcerpc_uuid_program->Data4[7],dcerpc_version&0xff,dcerpc_version>>8);
} else {
sprintf(str, "dcerpc,srt,%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d,%s",dcerpc_uuid_program->Data1,dcerpc_uuid_program->Data2,dcerpc_uuid_program->Data3,dcerpc_uuid_program->Data4[0],dcerpc_uuid_program->Data4[1],dcerpc_uuid_program->Data4[2],dcerpc_uuid_program->Data4[3],dcerpc_uuid_program->Data4[4],dcerpc_uuid_program->Data4[5],dcerpc_uuid_program->Data4[6],dcerpc_uuid_program->Data4[7],dcerpc_version&0xff,dcerpc_version>>8, filter);
if(filter[0]!=0){
g_string_sprintfa(str, ",%s", filter);
}
gtk_dcerpcstat_init(str);
gtk_dcerpcstat_init(str->str);
g_string_free(str, TRUE);
}
@ -444,7 +455,11 @@ dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
static void
gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *bbox, *cancel_button;
GtkWidget *dlg_box;
GtkWidget *prog_box, *prog_label, *prog_opt;
GtkWidget *vers_label;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
char *filter;
/* if the window is already open, bring it to front and
@ -454,14 +469,17 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
return;
}
dlg=dlg_window_new("Ethereal: DCE-RPC SRT Statistics");
dlg=dlg_window_new("Ethereal: Compute DCE-RPC SRT statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Program box */
prog_box=gtk_hbox_new(FALSE, 3);
prog_box=gtk_hbox_new(FALSE, 10);
/* Program label */
gtk_container_set_border_width(GTK_CONTAINER(prog_box), 10);
prog_label=gtk_label_new("Program:");
@ -484,7 +502,6 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
current_uuid_value=new_uuid_value;
} while(new_uuid_key!=NULL);
gtk_option_menu_set_menu(GTK_OPTION_MENU(prog_opt), prog_menu);
gtk_box_pack_start(GTK_BOX(prog_box), prog_opt, TRUE, TRUE, 0);
gtk_widget_show(prog_opt);
@ -507,17 +524,18 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), prog_box, TRUE, TRUE, 0);
gtk_widget_show(prog_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
@ -527,19 +545,19 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox=gtk_hbutton_box_new();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_container_add(GTK_CONTAINER(dlg_box), bbox);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
dcerpcstat_start_button_clicked, NULL);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
@ -580,6 +598,6 @@ register_tap_listener_gtkdcerpcstat(void)
void
register_tap_menu_gtkdcerpcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/DCE-RPC",
register_tap_menu_item("Statistics/Service Response Time/DCE-RPC...",
gtk_dcerpcstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* fc_stat.c
* fc_stat 2003 Ronnie Sahlberg
*
* $Id: fc_stat.c,v 1.11 2003/09/24 02:36:34 guy Exp $
* $Id: fc_stat.c,v 1.12 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -44,6 +44,7 @@
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
#include "service_response_time_table.h"
@ -56,17 +57,24 @@ typedef struct _fcstat_t {
srt_stat_table fc_srt_table;
} fcstat_t;
static void
fcstat_set_title(fcstat_t *fc)
{
char *title;
title = g_strdup_printf("Fibre Channel Service Response Time statistics: %s",
cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(fc->win), title);
g_free(title);
}
static void
fcstat_reset(void *pfc)
{
fcstat_t *fc=(fcstat_t *)pfc;
char title[256];
reset_srt_table_data(&fc->fc_srt_table);
snprintf(title, 255, "Fibre Channel Service Response Time statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(fc->win), title);
fcstat_set_title(fc);
}
static int
@ -126,7 +134,6 @@ gtk_fcstat_init(char *optarg)
GString *error_string;
int i;
GtkWidget *vbox;
char title[256];
if(!strncmp(optarg,"fc,srt,",7)){
filter=optarg+7;
@ -138,8 +145,7 @@ gtk_fcstat_init(char *optarg)
fc->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(fc->win), 550, 400);
snprintf(title, 255, "Fibre Channel Service Response Time statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(fc->win), title);
fcstat_set_title(fc);
SIGNAL_CONNECT(fc->win, "destroy", win_destroy_cb, fc);
vbox=gtk_vbox_new(FALSE, 0);
@ -184,10 +190,8 @@ gtk_fcstat_init(char *optarg)
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static void
dlg_destroy_cb(void)
@ -195,24 +199,33 @@ dlg_destroy_cb(void)
dlg=NULL;
}
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;
char *filter;
char str[256];
str = g_string_new("fc,srt");
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_fcstat_init("fc,srt");
} else {
sprintf(str,"fc,srt,%s", filter);
gtk_fcstat_init(str);
if(filter[0]!=0){
g_string_sprintfa(str,",%s", filter);
}
gtk_fcstat_init(str->str);
g_string_free(str, TRUE);
}
static void
gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
char *filter;
/* if the window is already open, bring it to front */
@ -221,24 +234,26 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_)
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "Fibre Channel Service Response Time statistics");
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, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
@ -248,14 +263,47 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox=gtk_hbutton_box_new();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
fcstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -268,6 +316,6 @@ register_tap_listener_gtkfcstat(void)
void
register_tap_menu_gtkfcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/Fibre Channel",
register_tap_menu_item("Statistics/Service Response Time/Fibre Channel...",
gtk_fcstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* http_stat.c
* http_stat 2003 Jean-Michel FAYARD
*
* $Id: http_stat.c,v 1.5 2003/09/24 02:36:34 guy Exp $
* $Id: http_stat.c,v 1.6 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -31,6 +31,7 @@
#include "epan/epan.h"
#include "menu.h"
#include "simple_dialog.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
#include "../globals.h"
@ -77,10 +78,8 @@ typedef struct _http_request_methode_t {
httpstat_t *sp;
} http_request_methode_t;
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static const value_string vals_status_code[] = {
{ 100, "Continue" },
@ -389,10 +388,10 @@ gtk_httpstat_init(char *optarg)
if(filter){
sp->filter=g_malloc(strlen(filter)+1);
strcpy(sp->filter,filter);
title=g_strdup_printf("HTTP Stats with filter: %s", filter);
title=g_strdup_printf("HTTP statistics with filter: %s", filter);
} else {
sp->filter=NULL;
title=g_strdup("HTTP Stats");
title=g_strdup("HTTP statistics");
}
/* top level window */
@ -506,16 +505,14 @@ gtk_httpstat_init(char *optarg)
static void
httpstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
char *filter;
char str[256];
str = g_string_new("http,stat,");
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_httpstat_init("http,stat,");
} else {
sprintf(str, "http,stat,%s", filter);
gtk_httpstat_init(str);
}
str = g_string_append(str, filter);
gtk_httpstat_init(str->str);
g_string_free(str, TRUE);
}
static void
@ -524,46 +521,91 @@ dlg_destroy_cb(void)
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
gtk_httpstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "HTTP Statistics");
dlg=dlg_window_new("Ethereal: Compute HTTP statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
httpstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -577,6 +619,6 @@ register_tap_listener_gtkhttpstat(void)
void
register_tap_menu_gtkhttpstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/HTTP",
register_tap_menu_item("Statistics/Watch protocol/HTTP...",
gtk_httpstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* io_stat.c
* io_stat 2002 Ronnie Sahlberg
*
* $Id: io_stat.c,v 1.29 2003/09/24 02:36:34 guy Exp $
* $Id: io_stat.c,v 1.30 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -194,14 +194,21 @@ io_stat_widget_equal(gconstpointer k1, gconstpointer k2)
return frame1==frame2;
}
static void
io_stat_set_title(io_stat_t *io)
{
char *title;
title = g_strdup_printf("IO-Stat: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(io->window), title);
g_free(title);
}
static void
gtk_iostat_reset(void *g)
{
io_stat_graph_t *gio=g;
io_stat_item_t *it;
char title[256];
gio->io->needs_redraw=1;
@ -223,8 +230,7 @@ gtk_iostat_reset(void *g)
gio->io->last_interval=0xffffffff;
gio->io->max_interval=0;
snprintf(title, 255, "IO-Stat: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(gio->io->window), title);
io_stat_set_title(gio->io);
}
@ -1620,7 +1626,6 @@ init_io_stat_window(io_stat_t *io)
{
GtkWidget *vbox;
GtkWidget *hbox;
char title[256];
/* create the main window */
io->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
@ -1641,9 +1646,8 @@ init_io_stat_window(io_stat_t *io)
create_filter_area(io, hbox);
create_ctrl_area(io, hbox);
io_stat_set_title(io);
gtk_widget_show(io->window);
snprintf(title, 255, "IO-Stat: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(io->window), title);
}

View File

@ -2,7 +2,7 @@
* mgcp-statistics for ethereal
* Copyright 2003 Lars Roland
*
* $Id: mgcp_stat.c,v 1.16 2003/09/24 02:36:35 guy Exp $
* $Id: mgcp_stat.c,v 1.17 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -46,6 +46,7 @@
#include "gtk_stat_util.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
@ -80,10 +81,8 @@ static const value_string mgcp_mesage_type[] = {
{ 0, NULL}
};
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static void
@ -91,7 +90,7 @@ mgcpstat_reset(void *pms)
{
mgcpstat_t *ms=(mgcpstat_t *)pms;
int i;
char title[256];
char *title;
for(i=0;i<NUM_TIMESTATS;i++) {
ms->rtd[i].num=0;
@ -110,10 +109,11 @@ mgcpstat_reset(void *pms)
ms->req_dup_num=0;
ms->rsp_dup_num=0;
snprintf(title, 255, "MGCP SRT Statistics: %s", cf_get_display_name(&cfile));
if (! dlg)
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
title = g_strdup_printf("MGCP SRT statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(dlg), title);
g_free(title);
}
@ -317,6 +317,12 @@ dlg_destroy_cb(void)
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
mgcpstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
@ -338,7 +344,10 @@ static void
gtk_mgcpstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
char *filter;
char title[256];
char *title;
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
@ -346,25 +355,29 @@ gtk_mgcpstat_cb(GtkWidget *w _U_, gpointer d _U_)
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
snprintf(title, 255, "MGCP SRT Statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(dlg), title);
title = g_strdup_printf("Ethereal: Compute MGCP SRT statistics: %s", cf_get_display_name(&cfile));
dlg=dlg_window_new(title);
g_free(title);
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
@ -374,14 +387,47 @@ gtk_mgcpstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
mgcpstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -395,7 +441,7 @@ void
register_tap_menu_gtkmgcpstat(void)
{
if (find_tap_id("mgcp"))
register_tap_menu_item("Statistics/Service Response Time/MGCP",
register_tap_menu_item("Statistics/Service Response Time/MGCP...",
gtk_mgcpstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rpc_stat.c
* rpc_stat 2002 Ronnie Sahlberg
*
* $Id: rpc_stat.c,v 1.22 2003/09/24 02:36:35 guy Exp $
* $Id: rpc_stat.c,v 1.23 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -37,6 +37,7 @@
#include "epan/epan.h"
#include "menu.h"
#include "simple_dialog.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
#include "packet-rpc.h"
@ -56,18 +57,31 @@ typedef struct _rpcstat_t {
guint32 num_procedures;
} rpcstat_t;
static char *
rpcstat_gen_title(rpcstat_t *rs)
{
char *title;
title = g_strdup_printf("ONC-RPC Service Response Time statistics for %s version %d: %s",
rs->prog, rs->version, cf_get_display_name(&cfile));
return title;
}
static void
rpcstat_set_title(rpcstat_t *rs)
{
char *title;
title = rpcstat_gen_title(rs);
gtk_window_set_title(GTK_WINDOW(rs->win), title);
g_free(title);
}
static void
rpcstat_reset(rpcstat_t *rs)
{
char title_string[256];
reset_srt_table_data(&rs->srt_table);
snprintf(title_string, 256, "ONC-RPC Service Response Time statistics for %s version %d: %s", rs->prog, rs->version, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(rs->win), title_string);
rpcstat_set_title(rs);
}
@ -182,7 +196,7 @@ gtk_rpcstat_init(char *optarg)
{
rpcstat_t *rs;
guint32 i;
char title_string[256];
char *title_string;
char filter_string[256];
GtkWidget *vbox;
GtkWidget *stat_label;
@ -216,8 +230,7 @@ gtk_rpcstat_init(char *optarg)
rs->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400);
snprintf(title_string, 256, "ONC-RPC Service Response Time statistics for %s version %d: %s", rs->prog, rs->version, cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(rs->win), title_string);
rpcstat_set_title(rs);
SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs);
vbox=gtk_vbox_new(FALSE, 0);
@ -225,7 +238,9 @@ gtk_rpcstat_init(char *optarg)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_widget_show(vbox);
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);
@ -266,29 +281,27 @@ gtk_rpcstat_init(char *optarg)
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *prog_box;
static GtkWidget *prog_label, *prog_opt, *prog_menu;
static GtkWidget *vers_label, *vers_opt, *vers_menu;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *prog_menu;
static GtkWidget *vers_opt, *vers_menu;
static GtkWidget *filter_entry;
static void
rpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
char *filter;
char str[256];
str = g_string_new("rpc,srt");
g_string_sprintfa(str, ",%d,%d", rpc_program, rpc_version);
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
sprintf(str, "rpc,srt,%d,%d", rpc_program, rpc_version);
filter="";
} else {
sprintf(str, "rpc,srt,%d,%d,%s", rpc_program, rpc_version, filter);
if(filter[0]!=0){
g_string_sprintfa(str, ",%s", filter);
}
gtk_rpcstat_init(str);
gtk_rpcstat_init(str->str);
g_string_free(str, TRUE);
}
@ -358,9 +371,20 @@ dlg_destroy_cb(void)
dlg=NULL;
}
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;
GtkWidget *prog_box, *prog_label, *prog_opt;
GtkWidget *vers_label;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
int i;
char *filter;
@ -370,15 +394,17 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "ONC-RPC Service Response Time statistics");
dlg=dlg_window_new("Ethereal: Compute ONC-RPC SRT statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Program box */
prog_box=gtk_hbox_new(FALSE, 10);
/* Program label */
gtk_container_set_border_width(GTK_CONTAINER(prog_box), 10);
prog_label=gtk_label_new("Program:");
@ -417,7 +443,6 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_widget_show(menu_item);
gtk_menu_append(GTK_MENU(vers_menu), menu_item);
}
gtk_option_menu_set_menu(GTK_OPTION_MENU(vers_opt), vers_menu);
gtk_box_pack_start(GTK_BOX(prog_box), vers_opt, TRUE, TRUE, 0);
gtk_widget_show(vers_opt);
@ -425,17 +450,18 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), prog_box, TRUE, TRUE, 0);
gtk_widget_show(prog_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
@ -445,14 +471,47 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox=gtk_hbutton_box_new();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
rpcstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -466,6 +525,6 @@ register_tap_listener_gtkrpcstat(void)
void
register_tap_menu_gtkrpcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/ONC-RPC",
register_tap_menu_item("Statistics/Service Response Time/ONC-RPC...",
gtk_rpcstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
* $Id: rtp_analysis.c,v 1.2 2003/09/25 19:35:14 guy Exp $
* $Id: rtp_analysis.c,v 1.3 2003/09/26 02:09:44 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -1559,7 +1559,8 @@ void create_rtp_dialog(user_data_t* user_data)
gchar str_ip_dst[16];
window = dlg_window_new("Ethereal: RTP Stream Analysis");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Ethereal: RTP Stream Analysis");
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(on_destroy), user_data);

View File

@ -1,7 +1,7 @@
/* rtp_stream_dlg.c
* RTP streams summary addition for ethereal
*
* $Id: rtp_stream_dlg.c,v 1.1 2003/09/24 07:48:11 guy Exp $
* $Id: rtp_stream_dlg.c,v 1.2 2003/09/26 02:09:44 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -501,7 +501,7 @@ static void rtpstream_dlg_create (void)
GtkWidget *bt_analyse;
GtkWidget *bt_close;
rtpstream_dlg_w = gtk_dialog_new ();
rtpstream_dlg_w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (rtpstream_dlg_w), "Ethereal: RTP Streams");
dialog_vbox1 = GTK_DIALOG (rtpstream_dlg_w)->vbox;

View File

@ -1,7 +1,7 @@
/* smb_stat.c
* smb_stat 2003 Ronnie Sahlberg
*
* $Id: smb_stat.c,v 1.19 2003/09/24 02:36:35 guy Exp $
* $Id: smb_stat.c,v 1.20 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -44,6 +44,7 @@
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
#include "service_response_time_table.h"
@ -58,19 +59,26 @@ typedef struct _smbstat_t {
srt_stat_table nt_trans_srt_table;
} smbstat_t;
static void
smbstat_set_title(smbstat_t *ss)
{
char *title;
title = g_strdup_printf("SMB Service Response Time statistics: %s",
cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(ss->win), title);
g_free(title);
}
static void
smbstat_reset(void *pss)
{
smbstat_t *ss=(smbstat_t *)pss;
char title[256];
reset_srt_table_data(&ss->smb_srt_table);
reset_srt_table_data(&ss->trans2_srt_table);
reset_srt_table_data(&ss->nt_trans_srt_table);
snprintf(title, 255, "SMB Service Response Time statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(ss->win), title);
smbstat_set_title(ss);
}
static int
@ -144,7 +152,6 @@ gtk_smbstat_init(char *optarg)
GString *error_string;
int i;
GtkWidget *vbox;
char title[256];
if(!strncmp(optarg,"smb,srt,",8)){
filter=optarg+8;
@ -156,8 +163,7 @@ gtk_smbstat_init(char *optarg)
ss->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(ss->win), 550, 600);
snprintf(title, 255, "SMB Service Response Time statistics: %s", cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(ss->win), title);
smbstat_set_title(ss);
SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss);
vbox=gtk_vbox_new(FALSE, 0);
@ -220,10 +226,8 @@ gtk_smbstat_init(char *optarg)
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static void
dlg_destroy_cb(void)
@ -231,24 +235,33 @@ dlg_destroy_cb(void)
dlg=NULL;
}
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;
char *filter;
char str[256];
str = g_string_new("smb,srt");
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_smbstat_init("smb,srt");
} else {
sprintf(str,"smb,srt,%s", filter);
gtk_smbstat_init(str);
if(filter[0]!=0){
g_string_sprintfa(str,",%s", filter);
}
gtk_smbstat_init(str->str);
g_string_free(str, TRUE);
}
static void
gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
char *filter;
/* if the window is already open, bring it to front */
@ -257,24 +270,26 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "SMB Service Response Time statistics");
dlg=dlg_window_new("Ethereal: Compute SMB SRT statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
@ -284,14 +299,47 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox=gtk_hbutton_box_new();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
smbstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -304,6 +352,6 @@ register_tap_listener_gtksmbstat(void)
void
register_tap_menu_gtksmbstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/SMB",
register_tap_menu_item("Statistics/Service Response Time/SMB...",
gtk_smbstat_cb, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* wsp_stat.c
* wsp_stat 2003 Jean-Michel FAYARD
*
* $Id: wsp_stat.c,v 1.4 2003/09/24 02:36:35 guy Exp $
* $Id: wsp_stat.c,v 1.5 2003/09/26 02:09:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -32,6 +32,7 @@
#include "epan/epan.h"
#include "menu.h"
#include "simple_dialog.h"
#include "dlg_utils.h"
#include "tap.h"
#include "../register.h"
#include "../globals.h"
@ -64,10 +65,8 @@ typedef struct _wsp_status_code_t {
wspstat_t *sp; /* entire program interface */
} wsp_status_code_t;
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
static void
wsp_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
@ -339,10 +338,10 @@ gtk_wspstat_init(char *optarg)
if(filter){
sp->filter=g_malloc(strlen(filter)+1);
strcpy(sp->filter,filter);
title=g_strdup_printf("WSP Stats with filter: %s", filter);
title=g_strdup_printf("Ethereal: WSP statistics with filter: %s", filter);
} else {
sp->filter=NULL;
title=g_strdup("WSP Stats");
title=g_strdup("Ethereal: WSP statistics");
}
for (i=0;i<=sp->num_pdus; i++)
{
@ -409,16 +408,14 @@ gtk_wspstat_init(char *optarg)
static void
wspstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
char *filter;
char str[256];
str = g_string_new("wsp,stat,");
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_wspstat_init("wsp,stat,");
} else {
sprintf(str, "wsp,stat,%s", filter);
gtk_wspstat_init(str);
}
str = g_string_append(str, filter);
gtk_wspstat_init(str->str);
g_string_free(str, TRUE);
}
static void
@ -427,46 +424,91 @@ dlg_destroy_cb(void)
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
gtk_wspstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "WSP Statistics");
dlg=dlg_window_new("Ethereal: Compute WSP statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
/* Filter entry */
filter_entry=gtk_entry_new();
gtk_widget_set_usize(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
wspstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* 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);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
@ -480,6 +522,6 @@ register_tap_listener_gtkwspstat(void)
void
register_tap_menu_gtkwspstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/WAP-WSP",
register_tap_menu_item("Statistics/Watch protocol/WAP-WSP...",
gtk_wspstat_cb, NULL, NULL);
}