comparison libgaim/prefs.h @ 14192:60b1bc8dbf37

[gaim-migrate @ 16863] Renamed 'core' to 'libgaim' committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Sat, 19 Aug 2006 01:50:10 +0000
parents
children e68e20e6a653
comparison
equal deleted inserted replaced
14191:009db0b357b5 14192:60b1bc8dbf37
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 * String format for preferences.
33 */
34 typedef enum
35 {
36 GAIM_STRING_FORMAT_TYPE_NONE = 0,
37 GAIM_STRING_FORMAT_TYPE_MULTILINE = 1 << 0,
38 GAIM_STRING_FORMAT_TYPE_HTML = 1 << 1
39 } GaimStringFormatType;
40
41 /**
42 * Pref data types.
43 */
44 typedef enum _GaimPrefType
45 {
46 GAIM_PREF_NONE,
47 GAIM_PREF_BOOLEAN,
48 GAIM_PREF_INT,
49 GAIM_PREF_STRING,
50 GAIM_PREF_STRING_LIST
51
52 } GaimPrefType;
53
54 /**
55 * Pref change callback type
56 */
57
58 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
59 gconstpointer val, gpointer data);
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 /**************************************************************************/
66 /** @name Prefs API */
67 /**************************************************************************/
68 /*@{*/
69
70 /**
71 * Returns the prefs subsystem handle.
72 *
73 * @return The prefs subsystem handle.
74 */
75 void *gaim_prefs_get_handle(void);
76
77 /**
78 * Initialize core prefs
79 */
80 void gaim_prefs_init(void);
81
82 /**
83 * Uninitializes the prefs subsystem.
84 */
85 void gaim_prefs_uninit(void);
86
87 /**
88 * Add a new typeless pref.
89 *
90 * @param name The name of the pref
91 */
92 void gaim_prefs_add_none(const char *name);
93
94 /**
95 * Add a new boolean pref.
96 *
97 * @param name The name of the pref
98 * @param value The initial value to set
99 */
100 void gaim_prefs_add_bool(const char *name, gboolean value);
101
102 /**
103 * Add a new integer pref.
104 *
105 * @param name The name of the pref
106 * @param value The initial value to set
107 */
108 void gaim_prefs_add_int(const char *name, int value);
109
110 /**
111 * Add a new string 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(const char *name, const char *value);
117
118 /**
119 * Add a new string list pref.
120 *
121 * @param name The name of the pref
122 * @param value The initial value to set
123 */
124 void gaim_prefs_add_string_list(const char *name, GList *value);
125
126 /**
127 * Remove a pref.
128 *
129 * @param name The name of the pref
130 */
131 void gaim_prefs_remove(const char *name);
132
133 /**
134 * Rename a pref
135 *
136 * @param oldname The old name of the pref
137 * @param newname The new name for the pref
138 */
139 void gaim_prefs_rename(const char *oldname, const char *newname);
140
141 /**
142 * Rename a boolean pref, toggling it's value
143 *
144 * @param oldname The old name of the pref
145 * @param newname The new name for the pref
146 */
147 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
148
149 /**
150 * Remove all prefs.
151 */
152 void gaim_prefs_destroy(void);
153
154 /**
155 * Set raw pref value
156 *
157 * @param name The name of the pref
158 * @param value The value to set
159 */
160 void gaim_prefs_set_generic(const char *name, gpointer value);
161
162 /**
163 * Set boolean pref value
164 *
165 * @param name The name of the pref
166 * @param value The value to set
167 */
168 void gaim_prefs_set_bool(const char *name, gboolean value);
169
170 /**
171 * Set integer pref value
172 *
173 * @param name The name of the pref
174 * @param value The value to set
175 */
176 void gaim_prefs_set_int(const char *name, int value);
177
178 /**
179 * Set string pref value
180 *
181 * @param name The name of the pref
182 * @param value The value to set
183 */
184 void gaim_prefs_set_string(const char *name, const char *value);
185
186 /**
187 * Set string pref value
188 *
189 * @param name The name of the pref
190 * @param value The value to set
191 */
192 void gaim_prefs_set_string_list(const char *name, GList *value);
193
194 /**
195 * Check if a pref exists
196 *
197 * @param name The name of the pref
198 * @return TRUE if the pref exists. Otherwise FALSE.
199 */
200 gboolean gaim_prefs_exists(const char *name);
201
202 /**
203 * Get pref type
204 *
205 * @param name The name of the pref
206 * @return The type of the pref
207 */
208 GaimPrefType gaim_prefs_get_type(const char *name);
209
210 /**
211 * Get boolean pref value
212 *
213 * @param name The name of the pref
214 * @return The value of the pref
215 */
216 gboolean gaim_prefs_get_bool(const char *name);
217
218 /**
219 * Get integer pref value
220 *
221 * @param name The name of the pref
222 * @return The value of the pref
223 */
224 int gaim_prefs_get_int(const char *name);
225
226 /**
227 * Get string pref value
228 *
229 * @param name The name of the pref
230 * @return The value of the pref
231 */
232 const char *gaim_prefs_get_string(const char *name);
233
234 /**
235 * Get string list pref value
236 *
237 * @param name The name of the pref
238 * @return The value of the pref
239 */
240 GList *gaim_prefs_get_string_list(const char *name);
241
242 /**
243 * Add a callback to a pref (and its children)
244 */
245 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb,
246 gpointer data);
247
248 /**
249 * Remove a callback to a pref
250 */
251 void gaim_prefs_disconnect_callback(guint callback_id);
252
253 /**
254 * Remove all pref callbacks by handle
255 */
256 void gaim_prefs_disconnect_by_handle(void *handle);
257
258 /**
259 * Trigger callbacks as if the pref changed
260 */
261 void gaim_prefs_trigger_callback(const char *name);
262
263 /**
264 * Read preferences
265 */
266 gboolean gaim_prefs_load(void);
267
268 /**
269 * Rename legacy prefs and delete some that no longer exist.
270 */
271 void gaim_prefs_update_old(void);
272
273 /*@}*/
274
275 #ifdef __cplusplus
276 }
277 #endif
278
279 #endif /* _GAIM_PREFS_H_ */