2 * packet list related functions 2002 Olivier Abad
4 * $Id: packet_list.c,v 1.2 2002/09/23 19:09:52 oabad Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include "gtkglobals.h"
32 #include "epan/epan.h"
34 #include "../ui_util.h"
35 #include "color_utils.h"
37 #include "epan/column_info.h"
40 packet_list_clear(void)
42 gtk_clist_clear(GTK_CLIST(packet_list));
46 packet_list_freeze(void)
48 gtk_clist_freeze(GTK_CLIST(packet_list));
52 packet_list_thaw(void)
54 gtk_clist_thaw(GTK_CLIST(packet_list));
58 packet_list_select_row(gint row)
60 gtk_signal_emit_by_name(GTK_OBJECT(packet_list), "select_row", row);
64 packet_list_set_column_auto_resize(gint column, gboolean auto_resize)
66 gtk_clist_set_column_auto_resize(GTK_CLIST(packet_list), column,
71 packet_list_set_column_resizeable(gint column, gboolean resizeable)
73 gtk_clist_set_column_resizeable(GTK_CLIST(packet_list), column, resizeable);
77 packet_list_set_column_width(gint column, gint width)
79 gtk_clist_set_column_width(GTK_CLIST(packet_list), column, width);
83 packet_list_moveto_end(void)
85 gtk_clist_moveto(GTK_CLIST(packet_list),
86 GTK_CLIST(packet_list)->rows - 1, -1, 1.0, 1.0);
90 packet_list_append(gchar *text[], gpointer data)
94 row = gtk_clist_append(GTK_CLIST(packet_list), text);
95 gtk_clist_set_row_data(GTK_CLIST(packet_list), row, data);
100 packet_list_set_colors(gint row, color_t *fg, color_t *bg)
102 GdkColor gdkfg, gdkbg;
106 color_t_to_gdkcolor(&gdkfg, fg);
107 gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &gdkfg);
111 color_t_to_gdkcolor(&gdkbg, bg);
112 gtk_clist_set_background(GTK_CLIST(packet_list), row, &gdkbg);
117 packet_list_find_row_from_data(gpointer data)
119 return gtk_clist_find_row_from_data(GTK_CLIST(packet_list), data);
123 packet_list_set_text(gint row, gint column, const gchar *text)
125 gtk_clist_set_text(GTK_CLIST(packet_list), row, column, text);
128 /* Set the column widths of those columns that show the time in
129 * "command-line-specified" format. */
131 packet_list_set_cls_time_width(gint column)
136 pl_style = gtk_widget_get_style(packet_list);
137 width = gdk_string_width(gdk_font_from_description(pl_style->font_desc),
138 get_column_longest_string(COL_CLS_TIME));
139 packet_list_set_column_width(column, width);
143 packet_list_get_row_data(gint row)
145 return gtk_clist_get_row_data(GTK_CLIST(packet_list), row);
148 /* Set the selected row and the focus row of the packet list to the specified
149 * row, and make it visible if it's not currently visible. */
151 packet_list_set_selected_row(gint row)
153 if (gtk_clist_row_is_visible(GTK_CLIST(packet_list), row) !=
155 gtk_clist_moveto(GTK_CLIST(packet_list), row, -1, 0.0, 0.0);
157 /* XXX - why is there no "gtk_clist_set_focus_row()", so that we
158 * can make the row for the frame we found the focus row?
160 * See http://www.gnome.org/mailing-lists/archives/gtk-list/2000-January/0038.shtml
162 GTK_CLIST(packet_list)->focus_row = row;
164 gtk_clist_select_row(GTK_CLIST(packet_list), row, -1);