diff options
author | Olivier Abad <oabad@noos.fr> | 2002-09-21 11:36:30 +0000 |
---|---|---|
committer | Olivier Abad <oabad@noos.fr> | 2002-09-21 11:36:30 +0000 |
commit | d72aca0b7ec946e137da3d04418ea6f4a4dc77d8 (patch) | |
tree | 0662da2707b2b10450d3dd11b484e2887c32ab10 /gtk2 | |
parent | 820af9e2f22e0a84417fde57b7ef1d4c537a8a19 (diff) | |
download | wireshark-d72aca0b7ec946e137da3d04418ea6f4a4dc77d8.tar.gz wireshark-d72aca0b7ec946e137da3d04418ea6f4a4dc77d8.tar.bz2 wireshark-d72aca0b7ec946e137da3d04418ea6f4a4dc77d8.zip |
Removed all gtk calls in file.c :
- created a few packet_list_xxx functions (ui_util.h gtk/packet_list.c
gtk2/packet_list.c) ;
- removed almost all "gtk/xxx" and "gtk2/xxx" includes in file.c
The only remaining includes are related to color filters. We have to
make color_filter_t GUI independent by replacing GdkColor with color_t.
I'll work on this later.
svn path=/trunk/; revision=6311
Diffstat (limited to 'gtk2')
-rw-r--r-- | gtk2/Makefile.am | 3 | ||||
-rw-r--r-- | gtk2/packet_list.c | 153 | ||||
-rw-r--r-- | gtk2/packet_win.h | 5 | ||||
-rw-r--r-- | gtk2/proto_draw.c | 18 | ||||
-rw-r--r-- | gtk2/proto_draw.h | 6 | ||||
-rw-r--r-- | gtk2/ui_util.c | 3 |
6 files changed, 175 insertions, 13 deletions
diff --git a/gtk2/Makefile.am b/gtk2/Makefile.am index 540a21e8c6..d553a2a798 100644 --- a/gtk2/Makefile.am +++ b/gtk2/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for the GTK2 interface routines for Ethereal # -# $Id: Makefile.am,v 1.4 2002/09/07 09:28:05 sahlberg Exp $ +# $Id: Makefile.am,v 1.5 2002/09/21 11:36:30 oabad Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -70,6 +70,7 @@ libui_a_SOURCES = \ menu.h \ nameres_prefs.c \ nameres_prefs.h \ + packet_list.c \ packet_win.c \ packet_win.h \ plugins_dlg.c \ diff --git a/gtk2/packet_list.c b/gtk2/packet_list.c new file mode 100644 index 0000000000..7e3d7aeeb0 --- /dev/null +++ b/gtk2/packet_list.c @@ -0,0 +1,153 @@ +/* packet_list.c + * packet list related functions 2002 Olivier Abad + * + * $Id: packet_list.c,v 1.1 2002/09/21 11:36:30 oabad Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 <gtk/gtk.h> + +#include "gtkglobals.h" +#include "epan/epan.h" +#include "../ui_util.h" +#include "column.h" +#include "epan/column_info.h" + +void +packet_list_clear(void) +{ + gtk_clist_clear(GTK_CLIST(packet_list)); +} + +void +packet_list_freeze(void) +{ + gtk_clist_freeze(GTK_CLIST(packet_list)); +} + +void +packet_list_thaw(void) +{ + gtk_clist_thaw(GTK_CLIST(packet_list)); +} + +void +packet_list_select_row(gint row) +{ + gtk_signal_emit_by_name(GTK_OBJECT(packet_list), "select_row", row); +} + +void +packet_list_set_column_auto_resize(gint column, gboolean auto_resize) +{ + gtk_clist_set_column_auto_resize(GTK_CLIST(packet_list), column, + auto_resize); +} + +void +packet_list_set_column_resizeable(gint column, gboolean resizeable) +{ + gtk_clist_set_column_resizeable(GTK_CLIST(packet_list), column, resizeable); +} + +void +packet_list_set_column_width(gint column, gint width) +{ + gtk_clist_set_column_width(GTK_CLIST(packet_list), column, width); +} + +void +packet_list_moveto_end(void) +{ + gtk_clist_moveto(GTK_CLIST(packet_list), + GTK_CLIST(packet_list)->rows - 1, -1, 1.0, 1.0); +} + +gint +packet_list_append(gchar *text[], gpointer data) +{ + gint row; + + row = gtk_clist_append(GTK_CLIST(packet_list), text); + gtk_clist_set_row_data(GTK_CLIST(packet_list), row, data); + return row; +} + +void +packet_list_set_colors(gint row, GdkColor *fg, GdkColor *bg) +{ + if (fg) gtk_clist_set_foreground(GTK_CLIST(packet_list), row, fg); + if (bg) gtk_clist_set_background(GTK_CLIST(packet_list), row, bg); +} + +gint +packet_list_find_row_from_data(gpointer data) +{ + return gtk_clist_find_row_from_data(GTK_CLIST(packet_list), data); +} + +void +packet_list_set_text(gint row, gint column, const gchar *text) +{ + gtk_clist_set_text(GTK_CLIST(packet_list), row, column, text); +} + +/* Set the column widths of those columns that show the time in + * "command-line-specified" format. */ +void +packet_list_set_cls_time_width(gint column) +{ + GtkStyle *pl_style; + gint width; + + pl_style = gtk_widget_get_style(packet_list); + width = gdk_string_width(gdk_font_from_description(pl_style->font_desc), + get_column_longest_string(COL_CLS_TIME)); + packet_list_set_column_width(column, width); +} + +gpointer +packet_list_get_row_data(gint row) +{ + return gtk_clist_get_row_data(GTK_CLIST(packet_list), row); +} + +/* Set the selected row and the focus row of the packet list to the specified + * row, and make it visible if it's not currently visible. */ +void +packet_list_set_selected_row(gint row) +{ + if (gtk_clist_row_is_visible(GTK_CLIST(packet_list), row) != + GTK_VISIBILITY_FULL) + gtk_clist_moveto(GTK_CLIST(packet_list), row, -1, 0.0, 0.0); + + /* XXX - why is there no "gtk_clist_set_focus_row()", so that we + * can make the row for the frame we found the focus row? + * + * See http://www.gnome.org/mailing-lists/archives/gtk-list/2000-January/0038.shtml + */ + GTK_CLIST(packet_list)->focus_row = row; + + gtk_clist_select_row(GTK_CLIST(packet_list), row, -1); +} diff --git a/gtk2/packet_win.h b/gtk2/packet_win.h index b3b15be1f8..89649aad7f 100644 --- a/gtk2/packet_win.h +++ b/gtk2/packet_win.h @@ -3,7 +3,7 @@ * * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet_win.h,v 1.1 2002/08/31 09:55:22 oabad Exp $ + * $Id: packet_win.h,v 1.2 2002/09/21 11:36:30 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -30,9 +30,6 @@ /* Create a new packet window. */ extern void new_window_cb(GtkWidget *w); -/* Destroy all popup packet windows. */ -void destroy_packet_wins(void); - /* Redraw the hex dump panes of all packet windows. */ void redraw_hex_dump_packet_wins(void); diff --git a/gtk2/proto_draw.c b/gtk2/proto_draw.c index e22e219d16..177c023c41 100644 --- a/gtk2/proto_draw.c +++ b/gtk2/proto_draw.c @@ -1,7 +1,7 @@ /* proto_draw.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.3 2002/09/14 10:07:39 oabad Exp $ + * $Id: proto_draw.c,v 1.4 2002/09/21 11:36:30 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -554,8 +554,14 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb, } void +add_main_byte_views(epan_dissect_t *edt) +{ + add_byte_views(edt, tree_view, byte_nb_ptr); +} + +void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view, - GtkWidget *byte_nb_ptr) + GtkWidget *byte_nb_ptr) { GSList *src_le; data_source *src; @@ -573,7 +579,7 @@ add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view, for (src_le = edt->pi.data_src; src_le != NULL; src_le = src_le->next) { src = src_le->data; add_byte_tab(byte_nb_ptr, src->name, src->tvb, edt->tree, - tree_view); + tree_view); } /* @@ -948,6 +954,12 @@ struct proto_tree_draw_info { }; void +main_proto_tree_draw(proto_tree *protocol_tree) +{ + proto_tree_draw(protocol_tree, tree_view); +} + +void proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view) { GtkTreeStore *store; diff --git a/gtk2/proto_draw.h b/gtk2/proto_draw.h index 3bab41ebef..5b37269adc 100644 --- a/gtk2/proto_draw.h +++ b/gtk2/proto_draw.h @@ -1,7 +1,7 @@ /* proto_draw.h * Definitions for GTK+ packet display structures and routines * - * $Id: proto_draw.h,v 1.1 2002/08/31 09:55:22 oabad Exp $ + * $Id: proto_draw.h,v 1.2 2002/09/21 11:36:30 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -50,7 +50,7 @@ extern void redraw_hex_dump_all(void); extern GtkWidget *create_byte_view(gint bv_size, GtkWidget *pane); extern void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view, - GtkWidget *byte_nb_ptr); + GtkWidget *byte_nb_ptr); void packet_hex_print(GtkTextView *, const guint8 *, frame_data *, field_info *, guint); @@ -65,6 +65,4 @@ void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view); void set_ptree_sel_browse_all(gboolean); void set_ptree_font_all(PangoFontDescription *font); -void clear_tree_and_hex_views(void); - #endif diff --git a/gtk2/ui_util.c b/gtk2/ui_util.c index 8dc77b7ae3..6740dc57d6 100644 --- a/gtk2/ui_util.c +++ b/gtk2/ui_util.c @@ -1,7 +1,7 @@ /* ui_util.c * UI utility routines * - * $Id: ui_util.c,v 1.3 2002/09/14 10:07:40 oabad Exp $ + * $Id: ui_util.c,v 1.4 2002/09/21 11:36:30 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -31,6 +31,7 @@ #include "gtkglobals.h" #include "ui_util.h" #include "prefs.h" +#include "epan/epan.h" #include "../ui_util.h" #include "image/eicon3d16.xpm" |