PluginIF: Fix GTK PluginIF interface
- Move the apply-filter code to main_menubar, because there already the code of the preference pop-ups is handled - Fix the apply-filter callback, which was not working at all Change-Id: I25d5a161d8b78695c15b3100653be36786129408 Reviewed-on: https://code.wireshark.org/review/10444 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
b0aec6d961
commit
61ea02b145
|
@ -111,23 +111,30 @@ filter_save_cb(GtkWidget *w _U_, GtkWindow *parent_w)
|
|||
}
|
||||
|
||||
static void
|
||||
plugin_if_filter_apply(gconstpointer filter_text)
|
||||
plugin_if_filter_apply(gconstpointer user_data)
|
||||
{
|
||||
/* code is derived from voip_calls_dlg.c::voip_calls_on_filter */
|
||||
|
||||
int pos = 0;
|
||||
size_t filter_length;
|
||||
size_t max_filter_length = 2048;
|
||||
gchar *filter_string;
|
||||
|
||||
if ( main_display_filter_widget != 0 )
|
||||
{
|
||||
filter_string = g_strndup((const char *)filter_text, max_filter_length);
|
||||
filter_length = strlen(filter_string);
|
||||
pos = (int)filter_length;
|
||||
|
||||
if ( filter_length < max_filter_length )
|
||||
gtk_editable_insert_text(GTK_EDITABLE(main_display_filter_widget), filter_string, -1, &pos);
|
||||
GHashTable * dataSet = (GHashTable *) user_data;
|
||||
|
||||
if ( g_hash_table_lookup_extended(dataSet, "filter_string", NULL, NULL ) )
|
||||
{
|
||||
filter_string = g_strndup((const char *)g_hash_table_lookup(dataSet, "filter_string"), max_filter_length);
|
||||
filter_length = strlen(filter_string);
|
||||
|
||||
if ( filter_length < max_filter_length )
|
||||
{
|
||||
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
|
||||
main_filter_packets(&cfile, filter_string, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,8 @@ static void colorize_cb(GtkWidget *w, gpointer d);
|
|||
static void rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences,
|
||||
GtkUIManager *ui_menu, const char *path);
|
||||
|
||||
static void plugin_if_menubar_preference(gconstpointer user_data);
|
||||
|
||||
|
||||
/* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
|
||||
http://developer.gnome.org/projects/gup/hig/1.0/index.html
|
||||
|
@ -2548,6 +2550,8 @@ main_menu_new(GtkAccelGroup ** table)
|
|||
if (table)
|
||||
*table = grp;
|
||||
|
||||
plugin_if_register_gui_cb(PLUGIN_IF_PREFERENCE_SAVE, plugin_if_menubar_preference);
|
||||
|
||||
return menubar;
|
||||
}
|
||||
|
||||
|
@ -5524,6 +5528,27 @@ ws_menubar_external_menus(void)
|
|||
}
|
||||
}
|
||||
|
||||
void plugin_if_menubar_preference(gconstpointer user_data)
|
||||
{
|
||||
if ( user_data != NULL )
|
||||
{
|
||||
GHashTable * dataSet = (GHashTable *) user_data;
|
||||
const char * module_name;
|
||||
const char * pref_name;
|
||||
const char * pref_value;
|
||||
if ( g_hash_table_lookup_extended(dataSet, "pref_module", NULL, (void**)&module_name ) &&
|
||||
g_hash_table_lookup_extended(dataSet, "pref_key", NULL, (void**)&pref_name ) &&
|
||||
g_hash_table_lookup_extended(dataSet, "pref_value", NULL, (void**)&pref_value ) )
|
||||
{
|
||||
if ( prefs_store_ext(module_name, pref_name, pref_value) )
|
||||
{
|
||||
redissect_packets();
|
||||
redissect_all_packet_windows();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
|
|
|
@ -92,7 +92,6 @@ static void show_cell_data_func(GtkTreeViewColumn *col,
|
|||
static gint row_number_from_iter(GtkTreeIter *iter);
|
||||
static void scroll_to_current(void);
|
||||
static gboolean query_packet_list_tooltip_cb(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer data _U_);
|
||||
static void plugin_if_pktlist_preference(gconstpointer user_data);
|
||||
|
||||
GtkWidget *
|
||||
packet_list_create(void)
|
||||
|
@ -107,8 +106,6 @@ packet_list_create(void)
|
|||
|
||||
g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY, view);
|
||||
|
||||
plugin_if_register_gui_cb(PLUGIN_IF_PREFERENCE_SAVE, plugin_if_pktlist_preference);
|
||||
|
||||
return scrollwin;
|
||||
}
|
||||
|
||||
|
@ -1736,25 +1733,6 @@ query_packet_list_tooltip_cb(GtkWidget *widget, gint x, gint y, gboolean keyboar
|
|||
return result;
|
||||
}
|
||||
|
||||
void plugin_if_pktlist_preference(gconstpointer user_data)
|
||||
{
|
||||
if ( packetlist != NULL && user_data != NULL )
|
||||
{
|
||||
GHashTable * dataSet = (GHashTable *) user_data;
|
||||
const char * module_name;
|
||||
const char * pref_name;
|
||||
const char * pref_value;
|
||||
if ( g_hash_table_lookup_extended(dataSet, "pref_module", NULL, (void**)&module_name ) &&
|
||||
g_hash_table_lookup_extended(dataSet, "pref_key", NULL, (void**)&pref_name ) &&
|
||||
g_hash_table_lookup_extended(dataSet, "pref_value", NULL, (void**)&pref_value ) )
|
||||
{
|
||||
if ( prefs_store_ext(module_name, pref_name, pref_value) )
|
||||
packet_list_recreate();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue