Move profile deletion code from profile_dlg.c to profile.c. Add left
[metze/wireshark/wip.git] / ui / profile.h
1 /* profile.h
2  * Definitions for dialog box for profiles editing.
3  * Stig Bjorlykke <stig@bjorlykke.org>, 2008
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26 #ifndef __PROFILE_H__
27 #define __PROFILE_H__
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 /** @file
34  * "Configuration Profiles" dialog box
35  * @ingroup dialog_group
36  */
37
38 #define PROF_STAT_DEFAULT  1
39 #define PROF_STAT_EXISTS   2
40 #define PROF_STAT_NEW      3
41 #define PROF_STAT_CHANGED  4
42 #define PROF_STAT_COPY     5
43
44 typedef struct {
45   char *name;           /* profile name */
46   char *reference;      /* profile reference */
47   int   status;
48   gboolean is_global;
49   gboolean from_global;
50 } profile_def;
51
52 /** @file
53  * "Configuration Profiles" utility routines
54  * @ingroup utility_group
55  */
56
57 /** Initialize the profile list. Can be called more than once.
58  */
59 void init_profile_list(void);
60
61 /** User requested the "Configuration Profiles" popup menu.
62  *
63  * @param name Profile name
64  * @param expression Parent profile name
65  * @param status Current status
66  * @param is_global Profile is in the global configuration directory
67  * @param from_global Profile is copied from the global configuration directory
68  *
69  * @return A pointer to the new profile list
70  */
71 GList * add_to_profile_list(const char *name, const char *parent, int status,
72         gboolean is_global, gboolean from_global);
73
74 /** Refresh the current (non-edited) profile list.
75  */
76 void copy_profile_list(void);
77
78 /** Clear out the profile list
79  *
80  * @param edit_list Remove edited entries
81  */
82 void empty_profile_list(gboolean edit_list);
83
84 /** Remove an entry from the profile list.
85  *
86  * @param fl_entry Profile list entry
87  */
88 void remove_from_profile_list(GList *fl_entry);
89
90 /** Current profile list
91  *
92  * @return The head of the current profile list
93  */
94 GList * current_profile_list(void);
95
96 /** Edited profile list
97  *
98  * @return The head of the edited profile list
99  */
100 GList * edited_profile_list(void);
101
102 /** Apply the changes in the edited profile list
103  * @return NULL if the operation was successful or an error message otherwise.
104  */
105 const gchar *apply_profile_changes(void);
106
107 /** Given a profile name, return the name of its parent profile.
108  *
109  * @param profilename Child profile name
110  *
111  * @return Parent profile name
112  */
113 const gchar *get_profile_parent (const gchar *profilename);
114
115 /** Check the validity of a profile name.
116  *
117  * @param name Profile name
118  * @return NULL if the name is valid or an error message otherwise.
119  */
120 const gchar *profile_name_is_valid(const gchar *name);
121
122 /** Remove the current profile.
123  *
124  * @return TRUE if the current profile exists and was successfully deleted
125  * or FALSE otherwise.
126  */
127 gboolean delete_current_profile(void);
128
129 #ifdef __cplusplus
130 }
131 #endif /* __cplusplus */
132
133 #endif /* __PROFILE_H__ */