summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--file.c35
-rw-r--r--gtk/new_packet_list.c19
-rw-r--r--ui_util.h2
3 files changed, 38 insertions, 18 deletions
diff --git a/file.c b/file.c
index a7f203931d..50c499e126 100644
--- a/file.c
+++ b/file.c
@@ -1923,7 +1923,15 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
if (selected_frame_num == 0) {
new_packet_list_select_first_row();
}else{
- new_packet_list_find_row_from_data(selected_frame, TRUE);
+ if (!new_packet_list_select_row_from_data(selected_frame)) {
+ /* We didn't find a row corresponding to this frame.
+ This means that the frame isn't being displayed currently,
+ so we can't select it. */
+ simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
+ "%sEnd of capture exceeded!%s\n\n"
+ "The capture file is probably not fully dissected.",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
+ }
}
}
@@ -3214,7 +3222,7 @@ find_packet(capture_file *cf,
progdlg_t *progbar = NULL;
gboolean stop_flag;
int count;
- int row;
+ gboolean found;
float progbar_val;
GTimeVal start_time;
gchar status_str[100];
@@ -3357,16 +3365,16 @@ find_packet(capture_file *cf,
if (new_fd != NULL) {
/* Find and select */
cf->search_in_progress = TRUE;
- row = new_packet_list_find_row_from_data(fdata, TRUE);
+ found = new_packet_list_select_row_from_data(new_fd);
cf->search_in_progress = FALSE;
cf->search_pos = 0; /* Reset the position */
- if (row == -1) {
- /* We didn't find a row even though we know that a frame
- * exists that satifies the search criteria. This means that the
- * frame isn't being displayed currently so we can't select it. */
+ if (!found) {
+ /* We didn't find a row corresponding to this frame.
+ This means that the frame isn't being displayed currently,
+ so we can't select it. */
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
"%sEnd of capture exceeded!%s\n\n"
- "The capture file is probably not fully loaded.",
+ "The capture file is probably not fully dissected.",
simple_dialog_primary_start(), simple_dialog_primary_end());
return FALSE;
}
@@ -3395,7 +3403,16 @@ cf_goto_frame(capture_file *cf, guint fnumber)
return FALSE; /* we failed to go to that packet */
}
- new_packet_list_find_row_from_data(fdata, TRUE);
+ if (!new_packet_list_select_row_from_data(fdata)) {
+ /* We didn't find a row corresponding to this frame.
+ This means that the frame isn't being displayed currently,
+ so we can't select it. */
+ simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
+ "%sEnd of capture exceeded!%s\n\n"
+ "The capture file is probably not fully dissected.",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
+ return FALSE;
+ }
return TRUE; /* we got to that packet */
}
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
diff --git a/ui_util.h b/ui_util.h
index 2e0e5ae1d6..cd023a32a7 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -71,7 +71,7 @@ void new_packet_list_select_first_row(void);
void new_packet_list_select_last_row(void);
void new_packet_list_moveto_end(void);
gboolean new_packet_list_check_end(void);
-gint new_packet_list_find_row_from_data(gpointer data, gboolean select);
+gboolean new_packet_list_select_row_from_data(frame_data *fdata_needle);
void new_packet_list_resize_column(gint col);
#ifdef __cplusplus