2021-11-30 08:01:36 -05:00
|
|
|
/** @file
|
|
|
|
*
|
2013-01-18 00:50:14 +00:00
|
|
|
* Routines for handling preferences
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 12:26:45 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2013-01-18 00:50:14 +00:00
|
|
|
*/
|
|
|
|
|
2024-06-13 10:09:30 +01:00
|
|
|
#ifndef __PREFERENCE_UTILS_H__
|
|
|
|
#define __PREFERENCE_UTILS_H__
|
2013-01-18 00:50:14 +00:00
|
|
|
|
2024-04-02 10:17:30 -07:00
|
|
|
#include <glib.h>
|
|
|
|
|
2013-01-18 00:50:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
* Preference utility routines.
|
|
|
|
* @ingroup prefs_group
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** If autoscroll in live captures is active or not
|
|
|
|
*/
|
2024-03-29 18:08:09 -07:00
|
|
|
extern bool auto_scroll_live;
|
2013-01-18 00:50:14 +00:00
|
|
|
|
|
|
|
/** 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);
|
|
|
|
|
2015-06-05 11:19:37 +02:00
|
|
|
/** Convenient function for plugin_if
|
2016-01-21 13:41:42 +01:00
|
|
|
*
|
|
|
|
* Note: The preferences must exist, it is not possible to create entries
|
|
|
|
* using this function
|
2015-06-05 11:19:37 +02:00
|
|
|
*
|
|
|
|
* @param module the module for the preference
|
|
|
|
* @param key the key for the preference
|
|
|
|
* @param value the new value as string for the preference
|
|
|
|
*
|
2018-01-05 23:39:55 -05:00
|
|
|
* @return flags of types of preferences changed, non-zero if the value has been stored successfully
|
2015-06-05 11:19:37 +02:00
|
|
|
*/
|
2018-01-05 23:39:55 -05:00
|
|
|
extern unsigned int prefs_store_ext(const char * module, const char * key, const char * value);
|
2015-06-05 11:19:37 +02:00
|
|
|
|
2016-01-21 13:41:42 +01:00
|
|
|
/** Convenient function for the writing of multiple preferences, without
|
|
|
|
* explicitly having prefs_t variables.
|
|
|
|
*
|
|
|
|
* Note: The preferences must exist, it is not possible to create entries
|
|
|
|
* using this function
|
|
|
|
*
|
|
|
|
* @param module the module for the preference
|
|
|
|
* @param pref_values a hash table
|
|
|
|
*
|
|
|
|
* @return true if the value has been stored successfully
|
|
|
|
*/
|
2024-03-29 18:08:09 -07:00
|
|
|
extern bool prefs_store_ext_multiple(const char * module, GHashTable * pref_values);
|
2016-01-21 13:41:42 +01:00
|
|
|
|
2013-01-23 19:04:36 +00:00
|
|
|
/** Add a custom column.
|
|
|
|
*
|
|
|
|
* @param fmt column format
|
|
|
|
* @param title column title
|
|
|
|
* @param custom_field column custom field
|
2019-06-27 22:00:11 +02:00
|
|
|
* @param position the intended position of the insert
|
2015-03-09 08:11:13 +01:00
|
|
|
*
|
|
|
|
* @return The index of the inserted column
|
2013-01-23 19:04:36 +00:00
|
|
|
*/
|
2024-03-29 18:08:09 -07:00
|
|
|
int column_prefs_add_custom(int fmt, const char *title,
|
|
|
|
const char *custom_field,
|
|
|
|
int position);
|
2019-06-12 16:35:29 -07:00
|
|
|
|
2020-07-14 19:04:00 +02:00
|
|
|
/** Check if a custom column exists.
|
|
|
|
*
|
|
|
|
* @param custom_field column custom field
|
|
|
|
*
|
|
|
|
* @return The index of the column if existing, -1 if not existing
|
|
|
|
*/
|
2024-03-29 18:08:09 -07:00
|
|
|
int column_prefs_has_custom(const char *custom_field);
|
2020-07-14 19:04:00 +02:00
|
|
|
|
2022-06-28 00:36:39 -04:00
|
|
|
/** Check if a custom column's data can be displayed differently
|
|
|
|
* resolved or unresolved, e.g. it has a field with a value string.
|
|
|
|
*
|
|
|
|
* This is for when adding or editing custom columns. Compare with
|
2024-09-11 14:26:14 +02:00
|
|
|
* display_column_strings() in packet_list_utils.h, which is for columns
|
2022-06-28 00:36:39 -04:00
|
|
|
* that have already been added.
|
|
|
|
*
|
|
|
|
* @param custom_field column custom field
|
|
|
|
*
|
2024-03-29 18:08:09 -07:00
|
|
|
* @return true if a custom column with the field description
|
2022-06-28 00:36:39 -04:00
|
|
|
* would support being displayed differently resolved or unresolved,
|
2024-03-29 18:08:09 -07:00
|
|
|
* false otherwise.
|
2022-06-28 00:36:39 -04:00
|
|
|
*/
|
2024-09-11 14:26:14 +02:00
|
|
|
bool column_prefs_custom_display_strings(const char *custom_field);
|
|
|
|
|
|
|
|
/** Check if a custom column's data can be displayed with details,
|
|
|
|
* e.g. it has a field.
|
|
|
|
*
|
|
|
|
* This is for when adding or editing custom columns.
|
|
|
|
*
|
|
|
|
* @param custom_field column custom field
|
|
|
|
*
|
|
|
|
* @return true if a custom column has at least one single field.
|
|
|
|
*/
|
|
|
|
bool column_prefs_custom_display_details(const char *custom_field);
|
2022-06-28 00:36:39 -04:00
|
|
|
|
2013-01-23 19:04:36 +00:00
|
|
|
/** Remove a column.
|
|
|
|
*
|
|
|
|
* @param col_link Column list entry
|
|
|
|
*/
|
|
|
|
void column_prefs_remove_link(GList* col_link);
|
|
|
|
|
|
|
|
/** Remove a column.
|
|
|
|
*
|
|
|
|
* @param col Column number
|
|
|
|
*/
|
2024-03-29 18:08:09 -07:00
|
|
|
void column_prefs_remove_nth(int col);
|
2013-01-23 19:04:36 +00:00
|
|
|
|
2018-09-08 11:49:22 +02:00
|
|
|
/** Save the UAT and complete migration of old preferences by writing the main
|
|
|
|
* preferences file (if necessary).
|
|
|
|
*/
|
2024-03-30 10:28:47 -07:00
|
|
|
void save_migrated_uat(const char *uat_name, bool *old_pref);
|
2013-01-18 00:50:14 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2024-06-13 10:09:30 +01:00
|
|
|
#endif /* __PREFERENCE_UTILS_H__ */
|