aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/summary_dlg.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2007-11-30 13:28:12 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2007-11-30 13:28:12 +0000
commit0abea9b7d961ebc89d5edbf0cdb131f0b29fb91d (patch)
tree712f6440af9feb801dd89ce1f095da4cdf7b76d4 /gtk/summary_dlg.c
parentf9fae482f57a31049634823a9c1c5bd39ca4ddc2 (diff)
downloadwireshark-0abea9b7d961ebc89d5edbf0cdb131f0b29fb91d.tar.gz
wireshark-0abea9b7d961ebc89d5edbf0cdb131f0b29fb91d.tar.bz2
wireshark-0abea9b7d961ebc89d5edbf0cdb131f0b29fb91d.zip
More summary enhancements:
- Don't hide columns in the GUI - Show Packets count first - Always show values in Packets count - Don't show Avg. packet size if 1 packet - Don't show time between packets if 1 packet svn path=/trunk/; revision=23684
Diffstat (limited to 'gtk/summary_dlg.c')
-rw-r--r--gtk/summary_dlg.c200
1 files changed, 88 insertions, 112 deletions
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index e7a11222f6..6e871e06f5 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -87,15 +87,9 @@ add_string_to_table(GtkWidget *list, guint *row, gchar *title, gchar *value)
static void
-add_string_to_list(GtkWidget *list, gchar *title, gchar *col1, gchar *col2, gchar *col3, guint no_col)
+add_string_to_list(GtkWidget *list, gchar *title, gchar *captured, gchar *displayed, gchar *marked)
{
- if (no_col == 1) {
- simple_list_append(list, 0, title, 1, col1, -1);
- } else if (no_col == 2) {
- simple_list_append(list, 0, title, 1, col1, 2, col2, -1);
- } else {
- simple_list_append(list, 0, title, 1, col1, 2, col2, 3, col3, -1);
- }
+ simple_list_append(list, 0, title, 1, captured, 2, displayed, 3, marked, -1);
}
void
@@ -106,11 +100,11 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
*main_vb, *bbox, *close_bt, *help_bt;
GtkWidget *table;
GtkWidget *list;
- static const char *titles1[] = { "Traffic", "Captured", "Displayed", "Marked" };
- static const char *titles2[] = { "Traffic", "Captured", "Marked" };
+ static const char *titles[] = { "Traffic", "Captured", "Displayed", "Marked" };
gchar string_buff[SUM_STR_MAX];
- gchar string_buff3[3][SUM_STR_MAX];
+ gchar string_buff2[SUM_STR_MAX];
+ gchar string_buff3[SUM_STR_MAX];
double seconds;
double disp_seconds;
@@ -118,7 +112,6 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
guint offset;
guint snip;
guint row;
- guint no_cols;
gchar *str_dup;
gchar *str_work;
@@ -278,154 +271,137 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
}
/* Traffic */
- no_cols = 1 + (summary.dfilter ? 1 : 0) + (summary.marked_count ? 1 : 0);
+ list = simple_list_new(4, titles);
+ gtk_container_add(GTK_CONTAINER(main_vb), list);
+ /* Packet count */
+ g_snprintf(string_buff, SUM_STR_MAX, "%i", summary.packet_count);
if (summary.dfilter) {
- list = simple_list_new(1 + no_cols, titles1);
+ g_snprintf(string_buff2, SUM_STR_MAX, "%i", summary.filtered_count);
} else {
- list = simple_list_new(1 + no_cols, titles2);
+ strcpy(string_buff2, string_buff);
}
- gtk_container_add(GTK_CONTAINER(main_vb), list);
+ g_snprintf(string_buff3, SUM_STR_MAX, "%i", summary.marked_count);
+ add_string_to_list(list, "Packets", string_buff, string_buff2, string_buff3);
/* Time between first and last */
- no_cols = 0;
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f sec", seconds);
- if (summary.dfilter) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f sec", disp_seconds);
- }
- if (summary.marked_count) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f sec", marked_seconds);
+ if (seconds > 0) {
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f sec", seconds);
+ } else {
+ strcpy(string_buff, "");
}
- add_string_to_list(list, "Between first and last packet", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
-
- /* Packet count */
- no_cols = 0;
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%i", summary.packet_count);
- if (summary.dfilter) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%i", summary.filtered_count);
+ if (summary.dfilter && disp_seconds > 0) {
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f sec", disp_seconds);
+ } else {
+ strcpy(string_buff2, "");
}
- if (summary.marked_count) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%i", summary.marked_count);
+ if (summary.marked_count && marked_seconds > 0) {
+ g_snprintf(string_buff3, SUM_STR_MAX, "%.3f sec", marked_seconds);
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Packets", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Between first and last packet", string_buff, string_buff2, string_buff3);
/* Packets per second */
- no_cols = 0;
if (seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", summary.packet_count/seconds);
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.packet_count/seconds);
} else {
- strcpy(string_buff3[no_cols++], "");
+ strcpy(string_buff, "");
}
- if(summary.dfilter) {
- if (disp_seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", summary.filtered_count/disp_seconds);
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if(summary.dfilter && disp_seconds > 0) {
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", summary.filtered_count/disp_seconds);
+ } else {
+ strcpy(string_buff2, "");
}
- if(summary.marked_count) {
- if (marked_seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", summary.marked_count/marked_seconds);
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if(summary.marked_count && marked_seconds > 0) {
+ g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", summary.marked_count/marked_seconds);
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Avg. packets/sec", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Avg. packets/sec", string_buff, string_buff2, string_buff3);
/* Packet size */
- no_cols = 0;
- if (summary.packet_count > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f bytes",
+ if (summary.packet_count > 1) {
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f bytes",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
(float) ((gint64) summary.bytes)/summary.packet_count);
} else {
- strcpy(string_buff3[no_cols++], "");
+ strcpy(string_buff, "");
}
- if (summary.dfilter) {
- if (summary.filtered_count > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f bytes",
- /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- (float) ((gint64) summary.filtered_bytes)/summary.filtered_count);
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if (summary.dfilter && summary.filtered_count > 1) {
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f bytes",
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ (float) ((gint64) summary.filtered_bytes)/summary.filtered_count);
+ } else {
+ strcpy(string_buff2, "");
}
- if (summary.marked_count) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f bytes",
+ if (summary.marked_count > 1) {
+ g_snprintf(string_buff3, SUM_STR_MAX, "%.3f bytes",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
(float) ((gint64) summary.marked_bytes)/summary.marked_count);
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Avg. packet size", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Avg. packet size", string_buff, string_buff2, string_buff3);
/* Byte count */
- no_cols = 0;
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.bytes);
- if (summary.dfilter) {
- if (summary.filtered_count > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.filtered_bytes);
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ g_snprintf(string_buff, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.bytes);
+ if (summary.dfilter && summary.filtered_count > 0) {
+ g_snprintf(string_buff2, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.filtered_bytes);
+ } else {
+ strcpy(string_buff2, "");
}
if (summary.marked_count) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.marked_bytes);
+ g_snprintf(string_buff3, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.marked_bytes);
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Bytes", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Bytes", string_buff, string_buff2, string_buff3);
/* Bytes per second */
- no_cols = 0;
if (seconds > 0){
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds);
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds);
} else {
- strcpy(string_buff3[no_cols++], "");
+ strcpy(string_buff, "");
}
- if (summary.dfilter) {
- if (disp_seconds > 0) {
- /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds);
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if (summary.dfilter && disp_seconds > 0) {
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds);
+ } else {
+ strcpy(string_buff2, "");
}
- if (summary.marked_count) {
- if (marked_seconds > 0) {
- /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f", ((gint64) summary.marked_bytes)/marked_seconds);
- } else {
- strcpy(string_buff3[no_cols], "");
- }
+ if (summary.marked_count && marked_seconds > 0) {
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", ((gint64) summary.marked_bytes)/marked_seconds);
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Avg. bytes/sec", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Avg. bytes/sec", string_buff, string_buff2, string_buff3);
/* MBit per second */
- no_cols = 0;
if (seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f",
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
((gint64) summary.bytes) * 8.0 / (seconds * 1000.0 * 1000.0));
} else {
- strcpy(string_buff3[no_cols++], "");
+ strcpy(string_buff, "");
}
- if (summary.dfilter) {
- if (disp_seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f",
- /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- ((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if (summary.dfilter && disp_seconds > 0) {
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f",
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ ((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
+ } else {
+ strcpy(string_buff2, "");
}
- if (summary.marked_count) {
- if (marked_seconds > 0) {
- g_snprintf(string_buff3[no_cols++], SUM_STR_MAX, "%.3f",
- /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
- ((gint64) summary.marked_bytes) * 8.0 / (marked_seconds * 1000.0 * 1000.0));
- } else {
- strcpy(string_buff3[no_cols++], "");
- }
+ if (summary.marked_count && marked_seconds > 0) {
+ g_snprintf(string_buff3, SUM_STR_MAX, "%.3f",
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ ((gint64) summary.marked_bytes) * 8.0 / (marked_seconds * 1000.0 * 1000.0));
+ } else {
+ strcpy(string_buff3, "");
}
- add_string_to_list(list, "Avg. MBit/sec", string_buff3[0], string_buff3[1], string_buff3[2], no_cols);
+ add_string_to_list(list, "Avg. MBit/sec", string_buff, string_buff2, string_buff3);
/* Button row. */