wmem: allow wmem_destroy_list to ignore a NULL list.
[wireshark-sm.git] / ui / profile.h
blob9fc89834e0722d34dd510890d7b59386cc4800c0
1 /** @file
3 * Definitions for dialog box for profiles editing.
4 * Stig Bjorlykke <stig@bjorlykke.org>, 2008
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __PROFILE_H__
14 #define __PROFILE_H__
16 #include <glib.h>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
22 /** @file
23 * "Configuration Profiles" dialog box
24 * @ingroup dialog_group
27 #define PROF_STAT_DEFAULT 1
28 #define PROF_STAT_EXISTS 2
29 #define PROF_STAT_NEW 3
30 #define PROF_STAT_CHANGED 4
31 #define PROF_STAT_COPY 5
32 #define PROF_STAT_IMPORT 6
34 typedef struct {
35 char *name; /* profile name */
36 char *reference; /* profile reference */
37 int status;
38 bool is_global;
39 bool from_global;
40 bool is_import;
41 // Settings
42 bool prefs_changed;
43 char *auto_switch_filter;
44 } profile_def;
46 /** @file
47 * "Configuration Profiles" utility routines
48 * @ingroup utility_group
51 /** Initialize the profile list. Can be called more than once.
53 void init_profile_list(void);
55 /** User requested the "Configuration Profiles" popup menu.
57 * @param name Profile name
58 * @param parent Parent profile name
59 * @param status Current status
60 * @param is_global Profile is in the global configuration directory
61 * @param from_global Profile is copied from the global configuration directory
62 * @param is_import Profile has been imported and no directory has to be created
64 * @return A pointer to the new profile list
66 GList *add_to_profile_list(const char *name, const char *parent, int status,
67 bool is_global, bool from_global, bool is_import);
69 /** Refresh the current (non-edited) profile list.
71 void copy_profile_list(void);
73 /** Clear out the profile list
75 * @param edit_list Remove edited entries
77 void empty_profile_list(bool edit_list);
79 /** Remove an entry from the profile list.
81 * @param fl_entry Profile list entry
83 void remove_from_profile_list(GList *fl_entry);
85 /** Current profile list
87 * @return The head of the current profile list
89 GList *current_profile_list(void);
91 /** Edited profile list
93 * @return The head of the edited profile list
95 GList * edited_profile_list(void);
97 /** Apply the changes in the edited profile list
98 * @return NULL if the operation was successful or an error message otherwise.
99 * The error message must be freed by the caller.
101 char *apply_profile_changes(void);
103 /** Given a profile name, return the name of its parent profile.
105 * @param profilename Child profile name
107 * @return Parent profile name
109 const char *get_profile_parent(const char *profilename);
111 /** Check the validity of a profile name.
113 * @param name Profile name
114 * @return NULL if the name is valid or an error message otherwise.
116 char *profile_name_is_valid(const char *name);
118 /** Remove the current profile.
120 * @return true if the current profile exists and was successfully deleted
121 * or false otherwise.
123 bool delete_current_profile(void);
125 #ifdef __cplusplus
127 #endif /* __cplusplus */
129 #endif /* __PROFILE_H__ */