summaryrefslogtreecommitdiff
path: root/ui/gtk/packet_list.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-06-05 11:19:37 +0200
committerAnders Broman <a.broman58@gmail.com>2015-06-25 16:23:08 +0000
commitacc581081e84c93e878a678fbb3655aba253607a (patch)
tree10ad9f0c0195475d01f42d64509e0c6ef53abb79 /ui/gtk/packet_list.c
parentd4aa1a1c24e984339806c4ddb000ea9f9b352659 (diff)
downloadwireshark-acc581081e84c93e878a678fbb3655aba253607a.tar.gz
Plugin Interface: Add GUI callbacks
Rename ext_menubar to a more appropriate plugin_if. External menus can be implemented by plugins to present additional menus for deep-packet analysis. One side-effect of such menus being implemented as plugins is, that they are being executed in different threads and therefore can only use limited access to the main GUI. Also, there is no safe cross-gui (GTK and Qt) way for many features. This patch implements a first functionality, by which a plugin implemented using ext_menubar can apply a display filter to the main view. For now the implementation supports filtering, as well as saving a preference. Change-Id: Iffe4caa954bbeb8ce356352de4dae348a50efba9 Reviewed-on: https://code.wireshark.org/review/8773 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/gtk/packet_list.c')
-rw-r--r--ui/gtk/packet_list.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c
index f9a4f298e7..57ab4f95bb 100644
--- a/ui/gtk/packet_list.c
+++ b/ui/gtk/packet_list.c
@@ -34,6 +34,7 @@
#include <epan/packet.h>
#include <epan/column.h>
#include <epan/strutil.h>
+#include <epan/plugin_if.h>
#include "ui/main_statusbar.h"
#include "ui/packet_list_utils.h"
@@ -91,6 +92,7 @@ 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)
@@ -105,6 +107,8 @@ 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;
}
@@ -1730,6 +1734,26 @@ 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;
+ if ( g_hash_table_contains(dataSet, "pref_module" ) &&
+ g_hash_table_contains(dataSet, "pref_value" ) &&
+ g_hash_table_contains(dataSet, "pref_value" ) )
+ {
+ const char * module_name = (const char *)g_hash_table_lookup(dataSet, "pref_module");
+ const char * pref_name = (const char *)g_hash_table_lookup(dataSet, "pref_key");
+ const char * pref_value = (const char *)g_hash_table_lookup(dataSet, "pref_value");
+
+ if ( prefs_store_ext(module_name, pref_name, pref_value) )
+ packet_list_recreate();
+
+ }
+ }
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*