comparison libpurple/prefs.h @ 15373:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15372:f79e0f4df793 15373:5fe8042783c1
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 GAIM_PREF_PATH,
42 GAIM_PREF_PATH_LIST
43
44 } GaimPrefType;
45
46 /**
47 * Pref change callback type
48 */
49
50 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
51 gconstpointer val, gpointer data);
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 /**************************************************************************/
58 /** @name Prefs API */
59 /**************************************************************************/
60 /*@{*/
61
62 /**
63 * Returns the prefs subsystem handle.
64 *
65 * @return The prefs subsystem handle.
66 */
67 void *gaim_prefs_get_handle(void);
68
69 /**
70 * Initialize core prefs
71 */
72 void gaim_prefs_init(void);
73
74 /**
75 * Uninitializes the prefs subsystem.
76 */
77 void gaim_prefs_uninit(void);
78
79 /**
80 * Add a new typeless pref.
81 *
82 * @param name The name of the pref
83 */
84 void gaim_prefs_add_none(const char *name);
85
86 /**
87 * Add a new boolean pref.
88 *
89 * @param name The name of the pref
90 * @param value The initial value to set
91 */
92 void gaim_prefs_add_bool(const char *name, gboolean value);
93
94 /**
95 * Add a new integer pref.
96 *
97 * @param name The name of the pref
98 * @param value The initial value to set
99 */
100 void gaim_prefs_add_int(const char *name, int value);
101
102 /**
103 * Add a new string pref.
104 *
105 * @param name The name of the pref
106 * @param value The initial value to set
107 */
108 void gaim_prefs_add_string(const char *name, const char *value);
109
110 /**
111 * Add a new string list pref.
112 *
113 * @param name The name of the pref
114 * @param value The initial value to set
115 */
116 void gaim_prefs_add_string_list(const char *name, GList *value);
117
118 /**
119 * Add a new path pref.
120 *
121 * @param name The name of the pref
122 * @param value The initial value to set
123 */
124 void gaim_prefs_add_path(const char *name, const char *value);
125
126 /**
127 * Add a new path list pref.
128 *
129 * @param name The name of the pref
130 * @param value The initial value to set
131 */
132 void gaim_prefs_add_path_list(const char *name, GList *value);
133
134
135 /**
136 * Remove a pref.
137 *
138 * @param name The name of the pref
139 */
140 void gaim_prefs_remove(const char *name);
141
142 /**
143 * Rename a pref
144 *
145 * @param oldname The old name of the pref
146 * @param newname The new name for the pref
147 */
148 void gaim_prefs_rename(const char *oldname, const char *newname);
149
150 /**
151 * Rename a boolean pref, toggling it's value
152 *
153 * @param oldname The old name of the pref
154 * @param newname The new name for the pref
155 */
156 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
157
158 /**
159 * Remove all prefs.
160 */
161 void gaim_prefs_destroy(void);
162
163 /**
164 * Set raw pref value
165 *
166 * @param name The name of the pref
167 * @param value The value to set
168 */
169 void gaim_prefs_set_generic(const char *name, gpointer value);
170
171 /**
172 * Set boolean pref value
173 *
174 * @param name The name of the pref
175 * @param value The value to set
176 */
177 void gaim_prefs_set_bool(const char *name, gboolean value);
178
179 /**
180 * Set integer pref value
181 *
182 * @param name The name of the pref
183 * @param value The value to set
184 */
185 void gaim_prefs_set_int(const char *name, int value);
186
187 /**
188 * Set string pref value
189 *
190 * @param name The name of the pref
191 * @param value The value to set
192 */
193 void gaim_prefs_set_string(const char *name, const char *value);
194
195 /**
196 * Set string list pref value
197 *
198 * @param name The name of the pref
199 * @param value The value to set
200 */
201 void gaim_prefs_set_string_list(const char *name, GList *value);
202
203 /**
204 * Set path pref value
205 *
206 * @param name The name of the pref
207 * @param value The value to set
208 */
209 void gaim_prefs_set_path(const char *name, const char *value);
210
211 /**
212 * Set path list pref value
213 *
214 * @param name The name of the pref
215 * @param value The value to set
216 */
217 void gaim_prefs_set_path_list(const char *name, GList *value);
218
219
220 /**
221 * Check if a pref exists
222 *
223 * @param name The name of the pref
224 * @return TRUE if the pref exists. Otherwise FALSE.
225 */
226 gboolean gaim_prefs_exists(const char *name);
227
228 /**
229 * Get pref type
230 *
231 * @param name The name of the pref
232 * @return The type of the pref
233 */
234 GaimPrefType gaim_prefs_get_type(const char *name);
235
236 /**
237 * Get boolean pref value
238 *
239 * @param name The name of the pref
240 * @return The value of the pref
241 */
242 gboolean gaim_prefs_get_bool(const char *name);
243
244 /**
245 * Get integer pref value
246 *
247 * @param name The name of the pref
248 * @return The value of the pref
249 */
250 int gaim_prefs_get_int(const char *name);
251
252 /**
253 * Get string pref value
254 *
255 * @param name The name of the pref
256 * @return The value of the pref
257 */
258 const char *gaim_prefs_get_string(const char *name);
259
260 /**
261 * Get string list pref value
262 *
263 * @param name The name of the pref
264 * @return The value of the pref
265 */
266 GList *gaim_prefs_get_string_list(const char *name);
267
268 /**
269 * Get path pref value
270 *
271 * @param name The name of the pref
272 * @return The value of the pref
273 */
274 const char *gaim_prefs_get_path(const char *name);
275
276 /**
277 * Get path list pref value
278 *
279 * @param name The name of the pref
280 * @return The value of the pref
281 */
282 GList *gaim_prefs_get_path_list(const char *name);
283
284
285 /**
286 * Add a callback to a pref (and its children)
287 */
288 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb,
289 gpointer data);
290
291 /**
292 * Remove a callback to a pref
293 */
294 void gaim_prefs_disconnect_callback(guint callback_id);
295
296 /**
297 * Remove all pref callbacks by handle
298 */
299 void gaim_prefs_disconnect_by_handle(void *handle);
300
301 /**
302 * Trigger callbacks as if the pref changed
303 */
304 void gaim_prefs_trigger_callback(const char *name);
305
306 /**
307 * Read preferences
308 */
309 gboolean gaim_prefs_load(void);
310
311 /**
312 * Rename legacy prefs and delete some that no longer exist.
313 */
314 void gaim_prefs_update_old(void);
315
316 /*@}*/
317
318 #ifdef __cplusplus
319 }
320 #endif
321
322 #endif /* _GAIM_PREFS_H_ */