From a39c3fab30321ab0cc888069cdb9aea70a45ebce Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 24 Apr 2011 21:02:55 +0000 Subject: new_packet_list_find_row_from_data() is always used to select a packet, so get rid of the select_flag argument, and rename it new_packet_list_select_row_from_data(). It's also always passed a frame_data *, so make its argument a frame_data *. Its return value is used only to detect whether the packet was found in the display or not, so make it a gboolean. Check it in *all* cases where it's called, and change the dialog message a bit (the most likely cause is that the user cancelled a redissection of the packets, so not all packets in the capture file are in the display. Also, in the find case, pass it the new packet we found. svn path=/trunk/; revision=36839 --- gtk/new_packet_list.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gtk/new_packet_list.c') diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c index c54c83ace2..630485fe29 100644 --- a/gtk/new_packet_list.c +++ b/gtk/new_packet_list.c @@ -1134,18 +1134,22 @@ new_packet_list_check_end(void) return at_end; } -gint -new_packet_list_find_row_from_data(gpointer data, gboolean select_flag) +/* + * Given a frame_data structure, scroll to and select the row in the + * packet list corresponding to that frame. If there is no such + * row, return FALSE, otherwise return TRUE. + */ +gboolean +new_packet_list_select_row_from_data(frame_data *fdata_needle) { GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(packetlist->view)); GtkTreeIter iter; - frame_data *fdata_needle = data; /* Initializes iter with the first iterator in the tree (the one at the path "0") * and returns TRUE. Returns FALSE if the tree is empty */ if(!gtk_tree_model_get_iter_first(model, &iter)) - return -1; + return FALSE; do { PacketListRecord *record; @@ -1155,14 +1159,13 @@ new_packet_list_find_row_from_data(gpointer data, gboolean select_flag) fdata = record->fdata; if(fdata == fdata_needle) { - if(select_flag) - scroll_to_and_select_iter(model, NULL, &iter); + scroll_to_and_select_iter(model, NULL, &iter); - return fdata->num; + return TRUE; } } while (gtk_tree_model_iter_next(model, &iter)); - return -1; + return FALSE; } void -- cgit v1.2.1