summaryrefslogtreecommitdiff
path: root/ui/preference_utils.h
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-01-18 00:50:14 +0000
committerGerald Combs <gerald@wireshark.org>2013-01-18 00:50:14 +0000
commitae7ee61e842f46d0e7a7a4dc64c848866a6d7afb (patch)
tree6e483f057cb06bc3c9a8ee68a6211bd4be557f6a /ui/preference_utils.h
parent7a9095ee15c9ef012f3c8fd77c8f8cd06bdaa37b (diff)
downloadwireshark-ae7ee61e842f46d0e7a7a4dc64c848866a6d7afb.tar.gz
Rename the "saved_val" preference element to "stashed_val" in order to
more clearly indicate that it's a copy of a preference value rather than something we've saved in the preferences file. Update prefs_pref_to_str() to handle default, stashed, and current prefs. Create ui/preference_utils.[ch] and move some common routines there. Use prefs_pref_type_name() in the GTK+ preferences dialog. Make the "OK" button in the Qt preferences dialog work. We simply write the prefs and redissect on "OK" and do nothing on "Cancel". This is intentionally different from the Apply/OK/Cancel behavior in the GTK+ version. Add a general "emitAppSignal" method to wsApp and use it for packet dissection and preference changes. Suggest that we might want to create a WsString class to make conversion between QStrings, gchar *s, and GStrings easier. svn path=/trunk/; revision=47139
Diffstat (limited to 'ui/preference_utils.h')
-rw-r--r--ui/preference_utils.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/ui/preference_utils.h b/ui/preference_utils.h
new file mode 100644
index 0000000000..c135b1d305
--- /dev/null
+++ b/ui/preference_utils.h
@@ -0,0 +1,88 @@
+/* preference_utils.h
+ * Routines for handling preferences
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PREFRENCE_UTILS_H__
+#define __PREFRENCE_UTILS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @file
+ * Preference utility routines.
+ * @ingroup prefs_group
+ */
+
+/** "Stash" a preference.
+ * Copy a preference to its stashed value. Can be called from prefs_pref_foreach().
+ *
+ * @param pref: A preference.
+ */
+extern guint pref_stash(pref_t *pref, gpointer unused _U_);
+
+/** "Untash" a preference.
+ * Set a preference to its stashed value. Can be called from prefs_pref_foreach().
+ *
+ * @param pref: A preference.
+ * @param changed_p: A pointer to a gboolean. Set to TRUE if the preference differs
+ * from its stashed value.
+ *
+ * @return Always returns 0.
+ */
+extern guint pref_unstash(pref_t *pref, gpointer changed_p);
+
+/** Clean up a stashed preference.
+ * Can be called from prefs_pref_foreach().
+ *
+ * @param pref A preference.
+ *
+ * @return Always returns 0.
+ */
+extern guint pref_clean_stash(pref_t *pref, gpointer unused _U_);
+
+/** Set a stashed preference to its default value.
+ *
+ *@pram pref A preference.
+ */
+extern void reset_stashed_pref(pref_t *pref);
+
+
+/** If autoscroll in live captures is active or not
+ */
+extern gboolean auto_scroll_live;
+
+/** Fill in capture options with values from the preferences
+ */
+extern void prefs_to_capture_opts(void);
+
+/** Save all preferences
+ */
+extern void prefs_main_write(void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __PREFRENCE_UTILS_H__ */