aboutsummaryrefslogtreecommitdiffstats
path: root/ui/preference_utils.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/preference_utils.c
parentd4aa1a1c24e984339806c4ddb000ea9f9b352659 (diff)
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/preference_utils.c')
-rw-r--r--ui/preference_utils.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c
index 1e358bd7d0..0f80ef6742 100644
--- a/ui/preference_utils.c
+++ b/ui/preference_utils.c
@@ -273,6 +273,48 @@ prefs_main_write(void)
}
}
+gboolean
+prefs_store_ext(const char * module_name, const char *pref_name, const char *pref_value)
+{
+ module_t * module = NULL;
+ pref_t * pref = NULL;
+ gboolean pref_changed = TRUE;
+
+ if ( ! prefs_is_registered_protocol(module_name))
+ return FALSE;
+
+ module = prefs_find_module(module_name);
+ if ( ! module )
+ return FALSE;
+
+ pref = prefs_find_preference(module, pref_name);
+
+ if (!pref)
+ return FALSE;
+
+ if ( pref->type == PREF_STRING )
+ {
+ g_free((void *)pref->stashed_val.string);
+ pref->stashed_val.string = (gchar *) g_strdup(pref_value);
+ /* unstash - taken from preferences_util */
+ if (strcmp(*pref->varp.string, pref->stashed_val.string) != 0)
+ {
+ pref_changed = TRUE;
+ g_free((void *)*pref->varp.string);
+ *pref->varp.string = g_strdup(pref->stashed_val.string);
+ }
+ }
+
+ if ( pref_changed )
+ {
+ prefs_main_write();
+ prefs_apply_all();
+ prefs_to_capture_opts();
+ }
+
+ return TRUE;
+}
+
gint
column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_field, gint custom_occurrence)
{