14192
|
1 /**
|
|
2 * @file prefs.h Prefs API
|
|
3 * @ingroup core
|
|
4 *
|
|
5 * gaim
|
|
6 *
|
|
7 * Gaim is the legal property of its developers, whose names are too numerous
|
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
9 * source distribution.
|
|
10 *
|
|
11 * This program is free software; you can redistribute it and/or modify
|
|
12 * it under the terms of the GNU General Public License as published by
|
|
13 * the Free Software Foundation; either version 2 of the License, or
|
|
14 * (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 *
|
|
25 */
|
|
26 #ifndef _GAIM_PREFS_H_
|
|
27 #define _GAIM_PREFS_H_
|
|
28
|
|
29 #include <glib.h>
|
|
30
|
|
31 /**
|
|
32 * Pref data types.
|
|
33 */
|
|
34 typedef enum _GaimPrefType
|
|
35 {
|
|
36 GAIM_PREF_NONE,
|
|
37 GAIM_PREF_BOOLEAN,
|
|
38 GAIM_PREF_INT,
|
|
39 GAIM_PREF_STRING,
|
|
40 GAIM_PREF_STRING_LIST
|
|
41
|
|
42 } GaimPrefType;
|
|
43
|
|
44 /**
|
|
45 * Pref change callback type
|
|
46 */
|
|
47
|
|
48 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
|
|
49 gconstpointer val, gpointer data);
|
|
50
|
|
51 #ifdef __cplusplus
|
|
52 extern "C" {
|
|
53 #endif
|
|
54
|
|
55 /**************************************************************************/
|
|
56 /** @name Prefs API */
|
|
57 /**************************************************************************/
|
|
58 /*@{*/
|
|
59
|
|
60 /**
|
|
61 * Returns the prefs subsystem handle.
|
|
62 *
|
|
63 * @return The prefs subsystem handle.
|
|
64 */
|
|
65 void *gaim_prefs_get_handle(void);
|
|
66
|
|
67 /**
|
|
68 * Initialize core prefs
|
|
69 */
|
|
70 void gaim_prefs_init(void);
|
|
71
|
|
72 /**
|
|
73 * Uninitializes the prefs subsystem.
|
|
74 */
|
|
75 void gaim_prefs_uninit(void);
|
|
76
|
|
77 /**
|
|
78 * Add a new typeless pref.
|
|
79 *
|
|
80 * @param name The name of the pref
|
|
81 */
|
|
82 void gaim_prefs_add_none(const char *name);
|
|
83
|
|
84 /**
|
|
85 * Add a new boolean pref.
|
|
86 *
|
|
87 * @param name The name of the pref
|
|
88 * @param value The initial value to set
|
|
89 */
|
|
90 void gaim_prefs_add_bool(const char *name, gboolean value);
|
|
91
|
|
92 /**
|
|
93 * Add a new integer pref.
|
|
94 *
|
|
95 * @param name The name of the pref
|
|
96 * @param value The initial value to set
|
|
97 */
|
|
98 void gaim_prefs_add_int(const char *name, int value);
|
|
99
|
|
100 /**
|
|
101 * Add a new string pref.
|
|
102 *
|
|
103 * @param name The name of the pref
|
|
104 * @param value The initial value to set
|
|
105 */
|
|
106 void gaim_prefs_add_string(const char *name, const char *value);
|
|
107
|
|
108 /**
|
|
109 * Add a new string list pref.
|
|
110 *
|
|
111 * @param name The name of the pref
|
|
112 * @param value The initial value to set
|
|
113 */
|
|
114 void gaim_prefs_add_string_list(const char *name, GList *value);
|
|
115
|
|
116 /**
|
|
117 * Remove a pref.
|
|
118 *
|
|
119 * @param name The name of the pref
|
|
120 */
|
|
121 void gaim_prefs_remove(const char *name);
|
|
122
|
|
123 /**
|
|
124 * Rename a pref
|
|
125 *
|
|
126 * @param oldname The old name of the pref
|
|
127 * @param newname The new name for the pref
|
|
128 */
|
|
129 void gaim_prefs_rename(const char *oldname, const char *newname);
|
|
130
|
|
131 /**
|
|
132 * Rename a boolean pref, toggling it's value
|
|
133 *
|
|
134 * @param oldname The old name of the pref
|
|
135 * @param newname The new name for the pref
|
|
136 */
|
|
137 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
|
|
138
|
|
139 /**
|
|
140 * Remove all prefs.
|
|
141 */
|
|
142 void gaim_prefs_destroy(void);
|
|
143
|
|
144 /**
|
|
145 * Set raw pref value
|
|
146 *
|
|
147 * @param name The name of the pref
|
|
148 * @param value The value to set
|
|
149 */
|
|
150 void gaim_prefs_set_generic(const char *name, gpointer value);
|
|
151
|
|
152 /**
|
|
153 * Set boolean pref value
|
|
154 *
|
|
155 * @param name The name of the pref
|
|
156 * @param value The value to set
|
|
157 */
|
|
158 void gaim_prefs_set_bool(const char *name, gboolean value);
|
|
159
|
|
160 /**
|
|
161 * Set integer pref value
|
|
162 *
|
|
163 * @param name The name of the pref
|
|
164 * @param value The value to set
|
|
165 */
|
|
166 void gaim_prefs_set_int(const char *name, int value);
|
|
167
|
|
168 /**
|
|
169 * Set string pref value
|
|
170 *
|
|
171 * @param name The name of the pref
|
|
172 * @param value The value to set
|
|
173 */
|
|
174 void gaim_prefs_set_string(const char *name, const char *value);
|
|
175
|
|
176 /**
|
|
177 * Set string pref value
|
|
178 *
|
|
179 * @param name The name of the pref
|
|
180 * @param value The value to set
|
|
181 */
|
|
182 void gaim_prefs_set_string_list(const char *name, GList *value);
|
|
183
|
|
184 /**
|
|
185 * Check if a pref exists
|
|
186 *
|
|
187 * @param name The name of the pref
|
|
188 * @return TRUE if the pref exists. Otherwise FALSE.
|
|
189 */
|
|
190 gboolean gaim_prefs_exists(const char *name);
|
|
191
|
|
192 /**
|
|
193 * Get pref type
|
|
194 *
|
|
195 * @param name The name of the pref
|
|
196 * @return The type of the pref
|
|
197 */
|
|
198 GaimPrefType gaim_prefs_get_type(const char *name);
|
|
199
|
|
200 /**
|
|
201 * Get boolean pref value
|
|
202 *
|
|
203 * @param name The name of the pref
|
|
204 * @return The value of the pref
|
|
205 */
|
|
206 gboolean gaim_prefs_get_bool(const char *name);
|
|
207
|
|
208 /**
|
|
209 * Get integer pref value
|
|
210 *
|
|
211 * @param name The name of the pref
|
|
212 * @return The value of the pref
|
|
213 */
|
|
214 int gaim_prefs_get_int(const char *name);
|
|
215
|
|
216 /**
|
|
217 * Get string pref value
|
|
218 *
|
|
219 * @param name The name of the pref
|
|
220 * @return The value of the pref
|
|
221 */
|
|
222 const char *gaim_prefs_get_string(const char *name);
|
|
223
|
|
224 /**
|
|
225 * Get string list pref value
|
|
226 *
|
|
227 * @param name The name of the pref
|
|
228 * @return The value of the pref
|
|
229 */
|
|
230 GList *gaim_prefs_get_string_list(const char *name);
|
|
231
|
|
232 /**
|
|
233 * Add a callback to a pref (and its children)
|
|
234 */
|
|
235 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb,
|
|
236 gpointer data);
|
|
237
|
|
238 /**
|
|
239 * Remove a callback to a pref
|
|
240 */
|
|
241 void gaim_prefs_disconnect_callback(guint callback_id);
|
|
242
|
|
243 /**
|
|
244 * Remove all pref callbacks by handle
|
|
245 */
|
|
246 void gaim_prefs_disconnect_by_handle(void *handle);
|
|
247
|
|
248 /**
|
|
249 * Trigger callbacks as if the pref changed
|
|
250 */
|
|
251 void gaim_prefs_trigger_callback(const char *name);
|
|
252
|
|
253 /**
|
|
254 * Read preferences
|
|
255 */
|
|
256 gboolean gaim_prefs_load(void);
|
|
257
|
|
258 /**
|
|
259 * Rename legacy prefs and delete some that no longer exist.
|
|
260 */
|
|
261 void gaim_prefs_update_old(void);
|
|
262
|
|
263 /*@}*/
|
|
264
|
|
265 #ifdef __cplusplus
|
|
266 }
|
|
267 #endif
|
|
268
|
|
269 #endif /* _GAIM_PREFS_H_ */
|