3 * Routines for handling preferences
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __PREFERENCE_UTILS_H__
13 #define __PREFERENCE_UTILS_H__
19 #endif /* __cplusplus */
22 * Preference utility routines.
23 * @ingroup prefs_group
26 /** If autoscroll in live captures is active or not
28 extern bool auto_scroll_live
;
30 /** Fill in capture options with values from the preferences
32 extern void prefs_to_capture_opts(void);
34 /** Save all preferences
36 extern void prefs_main_write(void);
38 /** Convenient function for plugin_if
40 * Note: The preferences must exist, it is not possible to create entries
43 * @param module the module for the preference
44 * @param key the key for the preference
45 * @param value the new value as string for the preference
47 * @return flags of types of preferences changed, non-zero if the value has been stored successfully
49 extern unsigned int prefs_store_ext(const char * module
, const char * key
, const char * value
);
51 /** Convenient function for the writing of multiple preferences, without
52 * explicitly having prefs_t variables.
54 * Note: The preferences must exist, it is not possible to create entries
57 * @param module the module for the preference
58 * @param pref_values a hash table
60 * @return true if the value has been stored successfully
62 extern bool prefs_store_ext_multiple(const char * module
, GHashTable
* pref_values
);
64 /** Add a custom column.
66 * @param fmt column format
67 * @param title column title
68 * @param custom_field column custom field
69 * @param position the intended position of the insert
71 * @return The index of the inserted column
73 int column_prefs_add_custom(int fmt
, const char *title
,
74 const char *custom_field
,
77 /** Check if a custom column exists.
79 * @param custom_field column custom field
81 * @return The index of the column if existing, -1 if not existing
83 int column_prefs_has_custom(const char *custom_field
);
85 /** Check if a custom column's data can be displayed differently
86 * resolved or unresolved, e.g. it has a field with a value string.
88 * This is for when adding or editing custom columns. Compare with
89 * display_column_strings() in packet_list_utils.h, which is for columns
90 * that have already been added.
92 * @param custom_field column custom field
94 * @return true if a custom column with the field description
95 * would support being displayed differently resolved or unresolved,
98 bool column_prefs_custom_display_strings(const char *custom_field
);
100 /** Check if a custom column's data can be displayed with details,
101 * e.g. it has a field.
103 * This is for when adding or editing custom columns.
105 * @param custom_field column custom field
107 * @return true if a custom column has at least one single field.
109 bool column_prefs_custom_display_details(const char *custom_field
);
113 * @param col_link Column list entry
115 void column_prefs_remove_link(GList
* col_link
);
119 * @param col Column number
121 void column_prefs_remove_nth(int col
);
123 /** Save the UAT and complete migration of old preferences by writing the main
124 * preferences file (if necessary).
126 void save_migrated_uat(const char *uat_name
, bool *old_pref
);
130 #endif /* __cplusplus */
132 #endif /* __PREFERENCE_UTILS_H__ */