Mercurial > pidgin.yaz
annotate src/prefs.h @ 10232:292acc5ccf84
[gaim-migrate @ 11367]
NULL is valid here.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Nov 2004 04:59:40 +0000 |
parents | 9fdbfe832fac |
children | b6ca0e1b19d0 |
rev | line source |
---|---|
5441 | 1 /** |
2 * @file prefs.h Prefs API | |
10066 | 3 * @ingroup core |
5441 | 4 * |
5 * gaim | |
6 * | |
8046 | 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. | |
5441 | 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 */ | |
9713 | 26 #ifndef _GAIM_PREFS_H_ |
27 #define _GAIM_PREFS_H_ | |
5441 | 28 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
29 #include <glib.h> |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
30 |
5441 | 31 /** |
32 * Pref data types. | |
33 */ | |
34 typedef enum _GaimPrefType | |
35 { | |
36 GAIM_PREF_NONE, | |
37 GAIM_PREF_BOOLEAN, | |
38 GAIM_PREF_INT, | |
5561 | 39 GAIM_PREF_STRING, |
40 GAIM_PREF_STRING_LIST | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
41 |
5441 | 42 } GaimPrefType; |
43 | |
44 /** | |
45 * Pref change callback type | |
46 */ | |
47 | |
48 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type, | |
49 gpointer val, gpointer data); | |
50 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
51 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
52 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
53 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
54 |
5441 | 55 /**************************************************************************/ |
56 /** @name Prefs API */ | |
57 /**************************************************************************/ | |
58 /*@{*/ | |
59 | |
60 /** | |
61 * Initialize core prefs | |
62 */ | |
63 void gaim_prefs_init(); | |
64 | |
65 /** | |
8235 | 66 * Uninitializes the prefs subsystem. |
67 */ | |
68 void gaim_prefs_uninit(void); | |
69 | |
70 /** | |
5441 | 71 * Add a new typeless pref. |
72 * | |
73 * @param name The name of the pref | |
74 */ | |
75 void gaim_prefs_add_none(const char *name); | |
76 | |
77 /** | |
78 * Add a new boolean pref. | |
79 * | |
80 * @param name The name of the pref | |
81 * @param value The initial value to set | |
82 */ | |
83 void gaim_prefs_add_bool(const char *name, gboolean value); | |
84 | |
85 /** | |
86 * Add a new integer pref. | |
87 * | |
88 * @param name The name of the pref | |
89 * @param value The initial value to set | |
90 */ | |
91 void gaim_prefs_add_int(const char *name, int value); | |
92 | |
93 /** | |
94 * Add a new string pref. | |
95 * | |
96 * @param name The name of the pref | |
97 * @param value The initial value to set | |
98 */ | |
99 void gaim_prefs_add_string(const char *name, const char *value); | |
100 | |
101 /** | |
5561 | 102 * Add a new string list pref. |
103 * | |
104 * @param name The name of the pref | |
105 * @param value The initial value to set | |
106 */ | |
107 void gaim_prefs_add_string_list(const char *name, GList *value); | |
108 | |
109 /** | |
5441 | 110 * Remove a pref. |
111 * | |
112 * @param name The name of the pref | |
113 */ | |
114 void gaim_prefs_remove(const char *name); | |
115 | |
116 /** | |
6693 | 117 * Rename a pref |
118 * | |
119 * @param oldname The old name of the pref | |
120 * @param newname The new name for the pref | |
121 */ | |
122 void gaim_prefs_rename(const char *oldname, const char *newname); | |
123 | |
124 /** | |
8705 | 125 * Rename a boolean pref, toggling it's value |
126 * | |
127 * @param oldname The old name of the pref | |
128 * @param newname The new name for the pref | |
129 */ | |
130 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname); | |
131 | |
132 /** | |
5441 | 133 * Remove all prefs. |
134 */ | |
135 void gaim_prefs_destroy(); | |
136 | |
137 /** | |
138 * Set raw pref value | |
139 * | |
140 * @param name The name of the pref | |
141 * @param value The value to set | |
142 */ | |
143 void gaim_prefs_set_generic(const char *name, gpointer value); | |
144 | |
145 /** | |
146 * Set boolean pref value | |
147 * | |
148 * @param name The name of the pref | |
149 * @param value The value to set | |
150 */ | |
151 void gaim_prefs_set_bool(const char *name, gboolean value); | |
152 | |
153 /** | |
154 * Set integer pref value | |
155 * | |
156 * @param name The name of the pref | |
157 * @param value The value to set | |
158 */ | |
159 void gaim_prefs_set_int(const char *name, int value); | |
160 | |
161 /** | |
162 * Set string pref value | |
163 * | |
164 * @param name The name of the pref | |
165 * @param value The value to set | |
166 */ | |
5451 | 167 void gaim_prefs_set_string(const char *name, const char *value); |
5441 | 168 |
169 /** | |
5561 | 170 * Set string pref value |
171 * | |
172 * @param name The name of the pref | |
173 * @param value The value to set | |
174 */ | |
175 void gaim_prefs_set_string_list(const char *name, GList *value); | |
176 | |
177 /** | |
9611 | 178 * Check if a pref exists |
179 * | |
9619 | 180 * @param name The name of the pref |
181 * @return TRUE if the pref exists. Otherwise FALSE. | |
9611 | 182 */ |
183 gboolean gaim_prefs_exists(const char *name); | |
184 | |
185 /** | |
6538 | 186 * Get pref type |
187 * | |
188 * @param name The name of the pref | |
189 * @return The type of the pref | |
190 */ | |
191 GaimPrefType gaim_prefs_get_type(const char *name); | |
192 | |
193 /** | |
5441 | 194 * Get boolean pref value |
195 * | |
196 * @param name The name of the pref | |
197 * @return The value of the pref | |
198 */ | |
199 gboolean gaim_prefs_get_bool(const char *name); | |
200 | |
201 /** | |
202 * Get integer pref value | |
203 * | |
204 * @param name The name of the pref | |
205 * @return The value of the pref | |
206 */ | |
207 int gaim_prefs_get_int(const char *name); | |
208 | |
209 /** | |
210 * Get string pref value | |
211 * | |
212 * @param name The name of the pref | |
213 * @return The value of the pref | |
214 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
215 const char *gaim_prefs_get_string(const char *name); |
5441 | 216 |
217 /** | |
10071 | 218 * Get string list pref value |
5561 | 219 * |
220 * @param name The name of the pref | |
221 * @return The value of the pref | |
222 */ | |
223 GList *gaim_prefs_get_string_list(const char *name); | |
224 | |
225 /** | |
5441 | 226 * Add a callback to a pref (and its children) |
227 */ | |
10087 | 228 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb, |
5441 | 229 gpointer data); |
230 | |
231 /** | |
232 * Remove a callback to a pref | |
233 */ | |
234 void gaim_prefs_disconnect_callback(guint callback_id); | |
235 | |
236 /** | |
10087 | 237 * Remove all pref callbacks by handle |
238 */ | |
239 void gaim_prefs_disconnect_by_handle(void *handle); | |
240 | |
241 /** | |
5684 | 242 * Trigger callbacks as if the pref changed |
243 */ | |
244 void gaim_prefs_trigger_callback(const char *name); | |
245 | |
246 /** | |
5441 | 247 * Read preferences |
248 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
249 gboolean gaim_prefs_load(); |
5441 | 250 |
251 /** | |
252 * Force an immediate write of preferences | |
253 */ | |
254 void gaim_prefs_sync(); | |
255 | |
8900 | 256 /** |
257 * Rename legacy prefs and delete some that no longer exist. | |
258 */ | |
259 void gaim_prefs_update_old(); | |
260 | |
5441 | 261 /*@}*/ |
262 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
263 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
264 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
265 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
266 |
9713 | 267 #endif /* _GAIM_PREFS_H_ */ |