aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-11-20 10:37:16 +0000
committerGuy Harris <guy@alum.mit.edu>2001-11-20 10:37:16 +0000
commit1c3f2e4cd550a4bf76185c5c074e5864abf57f11 (patch)
tree994860e8b8eecf1545e6eb294514cdc65538d4ff /gtk
parent800030b8a0755c88b1bef45e447dba2be22bb584 (diff)
downloadwireshark-1c3f2e4cd550a4bf76185c5c074e5864abf57f11.tar.gz
wireshark-1c3f2e4cd550a4bf76185c5c074e5864abf57f11.tar.bz2
wireshark-1c3f2e4cd550a4bf76185c5c074e5864abf57f11.zip
Have a routine to add all the hex dump tabs to the hex dump notebook,
and call it both from "select_packet()" and "create_new_window()", rather than having two similar loops in both places. svn path=/trunk/; revision=4233
Diffstat (limited to 'gtk')
-rw-r--r--gtk/packet_win.c16
-rw-r--r--gtk/proto_draw.c30
-rw-r--r--gtk/proto_draw.h7
3 files changed, 30 insertions, 23 deletions
diff --git a/gtk/packet_win.c b/gtk/packet_win.c
index 0cdac5c660..8f016bb2c4 100644
--- a/gtk/packet_win.c
+++ b/gtk/packet_win.c
@@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet_win.c,v 1.24 2001/11/20 10:10:45 guy Exp $
+ * $Id: packet_win.c,v 1.25 2001/11/20 10:37:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -126,8 +126,8 @@ void new_window_cb(GtkWidget *w){
static void
-create_new_window ( char *Title, gint tv_size, gint bv_size){
-
+create_new_window(char *Title, gint tv_size, gint bv_size)
+{
GtkWidget *main_w, *main_vbox, *pane,
*tree_view, *tv_scrollw,
*bv_scrollw,
@@ -192,16 +192,10 @@ create_new_window ( char *Title, gint tv_size, gint bv_size){
GTK_SIGNAL_FUNC(destroy_new_window), DataPtr);
/* draw the protocol tree & print hex data */
+ add_byte_views(DataPtr->frame, DataPtr->protocol_tree, tree_view,
+ DataPtr->bv_nb_ptr);
proto_tree_draw(DataPtr->protocol_tree, tree_view);
- i=0; /* do all the hex views */
- while((bv_tvb = g_slist_nth_data ( DataPtr->frame->data_src, i++))){
- add_byte_tab( DataPtr->bv_nb_ptr, tvb_get_name( bv_tvb),
- tvb_get_ptr(bv_tvb, 0, -1), tvb_length(bv_tvb),
- DataPtr->protocol_tree, tree_view);
-
- }
-
DataPtr->finfo_selected = NULL;
gtk_widget_show(main_w);
}
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index 338f21cdea..46c8f1f6e3 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1,7 +1,7 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
- * $Id: proto_draw.c,v 1.40 2001/11/20 10:10:45 guy Exp $
+ * $Id: proto_draw.c,v 1.41 2001/11/20 10:37:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -373,7 +373,7 @@ byte_view_realize_cb( GtkWidget *bv, gpointer data){
}
-GtkWidget *
+static GtkWidget *
add_byte_tab(GtkWidget *byte_nb, const char *name, const guint8 *data, int len,
proto_tree *tree, GtkWidget *tree_view)
{
@@ -435,14 +435,28 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, const guint8 *data, int len,
return byte_view;
}
-
-int
-add_byte_view(const char *name, const guint8 *data, int len)
+void
+add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
+ GtkWidget *byte_nb_ptr)
{
- add_byte_tab(byte_nb_ptr, name, data, len, cfile.protocol_tree,
- tree_view);
+ int i;
+ tvbuff_t *bv_tvb;
+
+ /*
+ * Add to the specified byte view notebook tabs for hex dumps
+ * of all the data sources for the specified frame.
+ */
+ for (i = 0;
+ (bv_tvb = g_slist_nth_data(frame->data_src, i)) != NULL; i++) {
+ add_byte_tab(byte_nb_ptr, tvb_get_name(bv_tvb),
+ tvb_get_ptr(bv_tvb, 0, -1), tvb_length(bv_tvb),
+ tree, tree_view);
+ }
- return 0;
+ /*
+ * Initially select the first byte view.
+ */
+ set_notebook_page(byte_nb_ptr, 0);
}
void
diff --git a/gtk/proto_draw.h b/gtk/proto_draw.h
index ddb54f06e0..84764b9ba7 100644
--- a/gtk/proto_draw.h
+++ b/gtk/proto_draw.h
@@ -1,7 +1,7 @@
/* proto_draw.h
* Definitions for GTK+ packet display structures and routines
*
- * $Id: proto_draw.h,v 1.13 2001/11/20 10:10:45 guy Exp $
+ * $Id: proto_draw.h,v 1.14 2001/11/20 10:37:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -35,9 +35,8 @@
#define E_BYTE_VIEW_ENCODE_KEY "byte_view_encode"
#define E_BYTE_VIEW_NAME_KEY "byte_view_name"
-GtkWidget *add_byte_tab(GtkWidget *byte_nb, const char *name,
- const guint8 *data, int len, proto_tree *tree, GtkWidget *tree_view);
-int add_byte_view( const char *name, const guint8 *data, int len);
+void add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
+ GtkWidget *byte_nb_ptr);
void set_notebook_page( GtkWidget *nb_ptr, int num);
int find_notebook_page( GtkWidget *nb_ptr, gchar *label);