diff options
-rw-r--r-- | file.c | 7 | ||||
-rw-r--r-- | gtk/new_packet_list.c | 9 | ||||
-rw-r--r-- | gtk/packet_list_store.c | 26 | ||||
-rw-r--r-- | gtk/packet_list_store.h | 1 | ||||
-rw-r--r-- | ui_util.h | 1 |
5 files changed, 44 insertions, 0 deletions
@@ -362,6 +362,7 @@ cf_reset_state(capture_file *cf) /* Clear the packet list. */ #ifdef NEW_PACKET_LIST new_packet_list_freeze(); + new_packet_list_clear(); new_packet_list_thaw(); #else packet_list_freeze(); @@ -1635,6 +1636,12 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, /* Initialize all data structures used for dissection. */ init_dissection(); + +#ifdef NEW_PACKET_LIST + /* We need to redissect the packets so we have to discard our old + * packet list store. */ + new_packet_list_clear(); +#endif } /* Freeze the packet list while we redo it, so we don't get any diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c index f2f085db37..9d9d1711b8 100644 --- a/gtk/new_packet_list.c +++ b/gtk/new_packet_list.c @@ -172,6 +172,15 @@ create_view_and_model(void) } void +new_packet_list_clear(void) +{ + packet_history_clear(); + + new_packet_list_store_clear(packetlist); + gtk_widget_queue_draw(packetlist->view); +} + +void new_packet_list_freeze(void) { /* So we don't lose the model by the time we want to thaw it */ diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c index 5464c74de9..656131e300 100644 --- a/gtk/packet_list_store.c +++ b/gtk/packet_list_store.c @@ -517,6 +517,32 @@ new_packet_list_new(void) } void +new_packet_list_store_clear(PacketList *packet_list) +{ + GtkTreePath *path; + guint i; + + g_return_if_fail(packet_list != NULL); + g_return_if_fail(PACKETLIST_IS_LIST(packet_list)); + + if(packet_list->num_rows == 0) + return; + + path = gtk_tree_path_new(); + + for(i = 0; i < packet_list->num_rows; ++i) { + gtk_tree_model_row_deleted(GTK_TREE_MODEL(packet_list), path); + } + + gtk_tree_path_free(path); + + /* XXX - hold on to these rows and reuse them instead */ + g_free(packet_list->rows); + packet_list->rows = NULL; + packet_list->num_rows = 0; +} + +void packet_list_append_record(PacketList *packet_list, row_data_t *row_data) { GtkTreeIter iter; diff --git a/gtk/packet_list_store.h b/gtk/packet_list_store.h index 3262ac6b93..c9389abad9 100644 --- a/gtk/packet_list_store.h +++ b/gtk/packet_list_store.h @@ -89,6 +89,7 @@ struct _PacketListClass GType packet_list_list_get_type(void); PacketList *new_packet_list_new(void); +void new_packet_list_store_clear(PacketList *packet_list); void packet_list_append_record(PacketList *packet_list, row_data_t *row_data); #endif /* NEW_PACKET_LIST */ @@ -59,6 +59,7 @@ extern void pipe_input_set_handler(gint source, gpointer user_data, int *child_p /* packet_list.c */ #ifdef NEW_PACKET_LIST +void new_packet_list_clear(void); void new_packet_list_freeze(void); void new_packet_list_thaw(void); void new_packet_list_next(void); |