forked from osmocom/wireshark
Move some routines that specifically handle the main window's packet
panes to main_packet_panes.c. Rename main_tree_view_new() to proto_tree_view_new() - it's not just for creating the main window's protocol tree view, it's also for creating protocol tree views in packet windows. svn path=/trunk/; revision=43292
This commit is contained in:
parent
95988da72b
commit
75dba53ad6
|
@ -99,6 +99,7 @@ WIRESHARK_GTK_SRC = \
|
|||
main_airpcap_toolbar.c \
|
||||
main_filter_toolbar.c \
|
||||
main_menubar.c \
|
||||
main_packet_panes.c \
|
||||
manual_addr_resolv.c \
|
||||
packet_panes.c \
|
||||
main_statusbar.c \
|
||||
|
@ -294,6 +295,7 @@ noinst_HEADERS = \
|
|||
main_airpcap_toolbar.h \
|
||||
main_filter_toolbar.h \
|
||||
main_menubar_private.h \
|
||||
main_packet_panes.h \
|
||||
menus.h \
|
||||
packet_panes.h \
|
||||
main_statusbar_private.h \
|
||||
|
|
|
@ -151,6 +151,7 @@ extern gint if_list_comparator_alph (const void *first_arg, const void *second_a
|
|||
#include "ui/gtk/main_welcome.h"
|
||||
#include "ui/gtk/drag_and_drop.h"
|
||||
#include "ui/gtk/capture_file_dlg.h"
|
||||
#include "ui/gtk/main_packet_panes.h"
|
||||
#include "ui/gtk/packet_panes.h"
|
||||
#include "ui/gtk/keys.h"
|
||||
#include "ui/gtk/packet_win.h"
|
||||
|
@ -3740,7 +3741,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs_p)
|
|||
gtk_widget_show_all(pkt_scrollw);
|
||||
|
||||
/* Tree view */
|
||||
tv_scrollw = main_tree_view_new(prefs_p, &tree_view_gbl);
|
||||
tv_scrollw = proto_tree_view_new(prefs_p, &tree_view_gbl);
|
||||
gtk_widget_set_size_request(tv_scrollw, -1, tv_size);
|
||||
gtk_widget_show(tv_scrollw);
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/* main_packet_panes.c
|
||||
* Routines for GTK+ packet display in the main window (packet details
|
||||
* and hex dump panes)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <epan/epan_dissect.h>
|
||||
#include <epan/prefs.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "ui/gtk/gtkglobals.h"
|
||||
#include "ui/gtk/main_packet_panes.h"
|
||||
#include "ui/gtk/packet_panes.h"
|
||||
|
||||
void
|
||||
add_main_byte_views(epan_dissect_t *edt)
|
||||
{
|
||||
add_byte_views(edt, tree_view_gbl, byte_nb_ptr_gbl);
|
||||
}
|
||||
|
||||
void
|
||||
main_proto_tree_draw(proto_tree *protocol_tree)
|
||||
{
|
||||
proto_tree_draw(protocol_tree, tree_view_gbl);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the hex dump and protocol tree panes.
|
||||
*/
|
||||
void
|
||||
clear_tree_and_hex_views(void)
|
||||
{
|
||||
/* Clear the hex dump by getting rid of all the byte views. */
|
||||
while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(byte_nb_ptr_gbl), 0) != NULL)
|
||||
gtk_notebook_remove_page(GTK_NOTEBOOK(byte_nb_ptr_gbl), 0);
|
||||
|
||||
/* Add a placeholder byte view so that there's at least something
|
||||
displayed in the byte view notebook. */
|
||||
add_byte_tab(byte_nb_ptr_gbl, "", NULL, NULL, tree_view_gbl);
|
||||
|
||||
/* Clear the protocol tree */
|
||||
proto_tree_draw(NULL, tree_view_gbl);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/* main_packet_panes.h
|
||||
* Definitions for GTK+ packet display structures and routines in the
|
||||
* main window (packet details and hex dump panes)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_PACKET_PANES_H__
|
||||
#define __MAIN_PACKET_PANES_H__
|
||||
|
||||
/** @file
|
||||
* Packet tree and details panes.
|
||||
* @ingroup main_window_group
|
||||
*/
|
||||
|
||||
/** Create byte views in the main window.
|
||||
*/
|
||||
void add_main_byte_views(epan_dissect_t *edt);
|
||||
|
||||
/** Display the protocol tree in the main window.
|
||||
*/
|
||||
void main_proto_tree_draw(proto_tree *protocol_tree);
|
||||
|
||||
#endif /* __MAIN_PACKET_PANES_H__ */
|
|
@ -1,5 +1,5 @@
|
|||
/* packet_panes.c
|
||||
* Routines for GTK+ packet display
|
||||
* Routines for GTK+ packet display (packet details and hex dump panes)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
@ -97,10 +97,6 @@
|
|||
#define E_BYTE_VIEW_APP_END_KEY "byte_view_app_end"
|
||||
#define E_BYTE_VIEW_ENCODE_KEY "byte_view_encode"
|
||||
|
||||
static GtkWidget *
|
||||
add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
|
||||
proto_tree *tree, GtkWidget *tree_view);
|
||||
|
||||
/* Get the current text window for the notebook. */
|
||||
GtkWidget *
|
||||
get_notebook_bv_ptr(GtkWidget *nb_ptr)
|
||||
|
@ -686,7 +682,7 @@ byte_view_realize_cb(GtkWidget *bv, gpointer data _U_)
|
|||
packet_hex_print(bv, byte_data, cfile.current_frame, NULL, byte_len);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
GtkWidget *
|
||||
add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
|
||||
proto_tree *tree, GtkWidget *tree_view)
|
||||
{
|
||||
|
@ -782,12 +778,6 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
|
|||
return byte_view;
|
||||
}
|
||||
|
||||
void
|
||||
add_main_byte_views(epan_dissect_t *edt)
|
||||
{
|
||||
add_byte_views(edt, tree_view_gbl, byte_nb_ptr_gbl);
|
||||
}
|
||||
|
||||
void
|
||||
add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view,
|
||||
GtkWidget *byte_nb_ptr)
|
||||
|
@ -2001,7 +1991,7 @@ tree_cell_renderer(GtkTreeViewColumn *tree_column _U_, GtkCellRenderer *cell,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
main_tree_view_new(e_prefs *prefs_p, GtkWidget **tree_view_p)
|
||||
proto_tree_view_new(e_prefs *prefs_p, GtkWidget **tree_view_p)
|
||||
{
|
||||
GtkWidget *tv_scrollw, *tree_view;
|
||||
ProtoTreeModel *store;
|
||||
|
@ -2066,14 +2056,6 @@ collapse_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view)
|
|||
gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree_view));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
main_proto_tree_draw(proto_tree *protocol_tree)
|
||||
{
|
||||
proto_tree_draw(protocol_tree, tree_view_gbl);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tree_view_follow_link(field_info *fi)
|
||||
{
|
||||
|
@ -2162,24 +2144,6 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
|
|||
g_object_unref(G_OBJECT(model));
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the hex dump and protocol tree panes.
|
||||
*/
|
||||
void
|
||||
clear_tree_and_hex_views(void)
|
||||
{
|
||||
/* Clear the hex dump by getting rid of all the byte views. */
|
||||
while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(byte_nb_ptr_gbl), 0) != NULL)
|
||||
gtk_notebook_remove_page(GTK_NOTEBOOK(byte_nb_ptr_gbl), 0);
|
||||
|
||||
/* Add a placeholder byte view so that there's at least something
|
||||
displayed in the byte view notebook. */
|
||||
add_byte_tab(byte_nb_ptr_gbl, "", NULL, NULL, tree_view_gbl);
|
||||
|
||||
/* Clear the protocol tree */
|
||||
proto_tree_draw(NULL, tree_view_gbl);
|
||||
}
|
||||
|
||||
void
|
||||
select_bytes_view (GtkWidget *w _U_, gpointer data _U_, gint view)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* proto_draw.h
|
||||
* Definitions for GTK+ packet display structures and routines
|
||||
/* packet_panes.h
|
||||
* Definitions for GTK+ packet display structures and routines (packet
|
||||
* details and hex dump panes)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
@ -22,22 +23,14 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_PROTO_DRAW_H__
|
||||
#define __MAIN_PROTO_DRAW_H__
|
||||
#ifndef __PACKET_PANES_H__
|
||||
#define __PACKET_PANES_H__
|
||||
|
||||
/** @file
|
||||
* Packet tree and details panes.
|
||||
* @ingroup main_window_group
|
||||
*/
|
||||
|
||||
/** Create byte views in the main window.
|
||||
*/
|
||||
void add_main_byte_views(epan_dissect_t *edt);
|
||||
|
||||
/** Display the protocol tree in the main window.
|
||||
*/
|
||||
void main_proto_tree_draw(proto_tree *protocol_tree);
|
||||
|
||||
/** Clear the hex dump and protocol tree panes.
|
||||
*/
|
||||
void clear_tree_and_hex_views(void);
|
||||
|
@ -85,6 +78,12 @@ extern void redraw_packet_bytes_all(void);
|
|||
*/
|
||||
extern GtkWidget *byte_view_new(void);
|
||||
|
||||
/** Add a new tab to a byte view.
|
||||
*/
|
||||
extern GtkWidget *add_byte_tab(GtkWidget *byte_nb, const char *name,
|
||||
tvbuff_t *tvb, proto_tree *tree,
|
||||
GtkWidget *tree_view);
|
||||
|
||||
/** Clear and fill all the byte view notebook tabs.
|
||||
*
|
||||
* @param edt current dissections
|
||||
|
@ -189,7 +188,7 @@ extern GtkTreePath *tree_find_by_field_info(GtkTreeView *tree_view, field_info *
|
|||
* @param tree_view_p fill in the new tree view
|
||||
* @return the new scrolled window (parent of the tree view)
|
||||
*/
|
||||
extern GtkWidget * main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p);
|
||||
extern GtkWidget * proto_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p);
|
||||
|
||||
/** Clear and redraw the whole tree view.
|
||||
*
|
||||
|
@ -251,4 +250,4 @@ extern gchar *expert_color_warn_str;
|
|||
extern gchar *expert_color_error_str;
|
||||
extern gchar *expert_color_foreground_str;
|
||||
|
||||
#endif /* __MAIN_PROTO_DRAW_H__ */
|
||||
#endif /* __PACKET_PANES_H__ */
|
||||
|
|
|
@ -930,7 +930,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean editable _U_)
|
|||
gtk_widget_show(pane);
|
||||
|
||||
/* Tree view */
|
||||
tv_scrollw = main_tree_view_new(&prefs, &tree_view);
|
||||
tv_scrollw = proto_tree_view_new(&prefs, &tree_view);
|
||||
gtk_paned_pack1(GTK_PANED(pane), tv_scrollw, TRUE, TRUE);
|
||||
gtk_widget_set_size_request(tv_scrollw, -1, TV_SIZE);
|
||||
gtk_widget_show(tv_scrollw);
|
||||
|
|
Loading…
Reference in New Issue