aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/packet_win.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-03-08 06:48:01 +0000
committerGuy Harris <guy@alum.mit.edu>2000-03-08 06:48:01 +0000
commit050979d522abbdf9e894b38851c96208f55c5a6d (patch)
treef41f143380d62300eb71f55e799901d44b29428e /gtk/packet_win.c
parentdc8fa8baf3d48dd60dd3da778bd84d1eb82c5d32 (diff)
We already set the foreground and background color for every frame,
which means we're already doing a "do something to the last row in the packet list" operation on every frame we add to the list, so adding a call to "gtk_clist_set_row_data()" won't make matters worse. In addition, we already set one column in a row on a "change time format" operation, so finding the row for a frame by calling "gtk_clist_find_row_from_data()" doesn't turn a constant-time operation into a linear-time operation, it just cranks the proportionality constant up - it was quadratic before, alas, and it's still quadratic. Adding calls to "gtk_clist_find_row_from_data()" to the "Find Frame" and "Go To Frame" code does add an extra linear operation there, but those operations shouldn't be common - and "Go To Frame", going to the last frame on an ~100,000-frame big capture file, was quick, at least on my 450 MHz Pentium II machine, so maybe it won't be too bad. And "select_packet()" either has to search the frame table for the frame with the specified row number, or has to call "gtk_clist_get_row_data()" to do that - the first is linear in the position of the frame in the frame table, and the latter is linear in its position in the CList, and the latter is less than or equal to the former, so the only thing making it worse would be a change in the proportionality constant. So it probably won't hurt performance by much. Furthermore, if we add the ability to sort the display on an arbitrary column, or to delete frames from the display - both of which are in the wish list - storing the row number of the frame in the "frame_data" structure won't necessarily work, as the row number can change out from under us. Therefore, reinstate the old way of doing things, where we associate with each row a pointer to the "frame_data" structure for the row, using "gtk_clist_set_row_data()". svn path=/trunk/; revision=1703
Diffstat (limited to 'gtk/packet_win.c')
-rw-r--r--gtk/packet_win.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/packet_win.c b/gtk/packet_win.c
index ca88f9c1f4..88b7a06214 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.3 2000/03/02 07:05:57 guy Exp $
+ * $Id: packet_win.c,v 1.4 2000/03/08 06:48:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -98,6 +98,7 @@ void new_window_cb(GtkWidget *w){
#define NewWinTitleLen 1000
+ int row;
gint tv_size = 95, bv_size = 75;
int i;
char Title[ NewWinTitleLen] = "";
@@ -105,10 +106,14 @@ void new_window_cb(GtkWidget *w){
/* build title of window by getting */
/* data from the packet_list GtkCList */
+ /* Find what row this packet is in. */
+ row = gtk_clist_find_row_from_data(GTK_CLIST(packet_list),
+ cf.current_frame);
+ g_assert(row != -1);
for( i = 0; i < cf.cinfo.num_cols; ++i){
if ( gtk_clist_get_text(GTK_CLIST( packet_list),
- cf.current_frame->row, i, &TextPtr)){
+ row, i, &TextPtr)){
if (( strlen( Title) + strlen( TextPtr))
< ( NewWinTitleLen - 1)){