Implement new_packet_list_recreate(). This should be reimplemented to

avoid building a new table and redissecting all packets.

svn path=/trunk/; revision=31024
This commit is contained in:
Stig Bjørlykke 2009-11-19 21:11:41 +00:00
parent 907bf4e36b
commit 542a34ced8
5 changed files with 36 additions and 9 deletions

View File

@ -803,11 +803,13 @@ void apply_as_custom_column_cb (GtkWidget *widget _U_, gpointer data _U_)
if (cfile.finfo_selected) {
column_prefs_add_custom(COL_CUSTOM, cfile.finfo_selected->hfinfo->name,
cfile.finfo_selected->hfinfo->abbrev);
#ifndef NEW_PACKET_LIST
/* Recreate the packet list according to new preferences */
#ifdef NEW_PACKET_LIST
new_packet_list_recreate ();
#else
packet_list_recreate ();
cfile.cinfo.columns_changed = FALSE; /* Reset value */
#endif
cfile.cinfo.columns_changed = FALSE; /* Reset value */
}
}
@ -3482,11 +3484,13 @@ void change_configuration_profile (const gchar *profile_name)
/* Reload list of interfaces on welcome page */
welcome_if_panel_reload();
#ifndef NEW_PACKET_LIST
/* Recreate the packet list according to new preferences */
#ifdef NEW_PACKET_LIST
new_packet_list_recreate ();
#else
packet_list_recreate ();
cfile.cinfo.columns_changed = FALSE; /* Reset value */
#endif
cfile.cinfo.columns_changed = FALSE; /* Reset value */
user_font_apply();
/* Update menus with new recent values */

View File

@ -678,9 +678,7 @@ static GtkItemFactoryEntry menu_items[] =
0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
{"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
{"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
#ifndef NEW_PACKET_LIST
{"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
#endif
{"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
{"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
@ -990,11 +988,9 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
{"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
#ifndef NEW_PACKET_LIST
{"/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
{"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
#endif
{"/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL,},
{"/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),

View File

@ -62,6 +62,7 @@
#include "gtk/capture_file_dlg.h"
#include "gtk/main_statusbar.h"
#include "gtk/packet_win.h"
#include "gtk/main.h"
static PacketList *packetlist;
static gboolean last_at_end = FALSE;
@ -101,6 +102,25 @@ new_packet_list_create(void)
return scrollwin;
}
/* XXX - implement a smarter solution for recreating the packet list */
void
new_packet_list_recreate(void)
{
gtk_widget_destroy(pkt_scrollw);
prefs.num_cols = g_list_length(prefs.col_list);
build_column_format_array(&cfile.cinfo, prefs.num_cols, FALSE);
pkt_scrollw = new_packet_list_create();
gtk_widget_show_all(pkt_scrollw);
main_widgets_rearrange();
if(cfile.state != FILE_CLOSED)
redissect_packets();
}
guint
new_packet_list_append(column_info *cinfo _U_, frame_data *fdata, packet_info *pinfo _U_)
{

View File

@ -31,6 +31,7 @@
#define RECENT_KEY_COL_WIDTH "column.width"
GtkWidget *new_packet_list_create(void);
void new_packet_list_recreate(void);
void new_packet_list_resize_columns_cb(GtkWidget *widget _U_, gpointer data _U_);
gboolean new_packet_list_get_event_row_column(GdkEventButton *event_button, gint *physical_row, gint *row, gint *column);

View File

@ -39,7 +39,11 @@
#include "gtk/prefs_column.h"
#include "gtk/gtkglobals.h"
#include "gtk/gui_utils.h"
#ifdef NEW_PACKET_LIST
#include "gtk/new_packet_list.h"
#else
#include "gtk/main_packet_list.h"
#endif
#include "gtk/filter_dlg.h"
#include "gtk/filter_autocomplete.h"
@ -630,7 +634,9 @@ column_prefs_apply(GtkWidget *w _U_)
{
/* Redraw the packet list if the columns were changed */
if(cfile.cinfo.columns_changed) {
#ifndef NEW_PACKET_LIST
#ifdef NEW_PACKET_LIST
new_packet_list_recreate();
#else
packet_list_recreate();
#endif
cfile.cinfo.columns_changed = FALSE; /* Reset value */