Mercurial > pidgin.yaz
annotate src/prefs.h @ 12488:40fada5b3d59
[gaim-migrate @ 14800]
return 0 when successful.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 15 Dec 2005 16:13:56 +0000 |
parents | fc464a0abccc |
children | 8ae981f2c9cb |
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 /** | |
10443 | 61 * Returns the prefs subsystem handle. |
62 * | |
63 * @return The prefs subsystem handle. | |
64 */ | |
65 void *gaim_prefs_get_handle(void); | |
66 | |
67 /** | |
5441 | 68 * Initialize core prefs |
69 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
70 void gaim_prefs_init(void); |
5441 | 71 |
72 /** | |
8235 | 73 * Uninitializes the prefs subsystem. |
74 */ | |
75 void gaim_prefs_uninit(void); | |
76 | |
77 /** | |
5441 | 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 /** | |
5561 | 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 /** | |
5441 | 117 * Remove a pref. |
118 * | |
119 * @param name The name of the pref | |
120 */ | |
121 void gaim_prefs_remove(const char *name); | |
122 | |
123 /** | |
6693 | 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 /** | |
8705 | 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 /** | |
5441 | 140 * Remove all prefs. |
141 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
142 void gaim_prefs_destroy(void); |
5441 | 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 */ | |
5451 | 174 void gaim_prefs_set_string(const char *name, const char *value); |
5441 | 175 |
176 /** | |
5561 | 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 /** | |
9611 | 185 * Check if a pref exists |
186 * | |
9619 | 187 * @param name The name of the pref |
188 * @return TRUE if the pref exists. Otherwise FALSE. | |
9611 | 189 */ |
190 gboolean gaim_prefs_exists(const char *name); | |
191 | |
192 /** | |
6538 | 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 /** | |
5441 | 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 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
222 const char *gaim_prefs_get_string(const char *name); |
5441 | 223 |
224 /** | |
10071 | 225 * Get string list pref value |
5561 | 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 /** | |
5441 | 233 * Add a callback to a pref (and its children) |
234 */ | |
10087 | 235 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb, |
5441 | 236 gpointer data); |
237 | |
238 /** | |
239 * Remove a callback to a pref | |
240 */ | |
241 void gaim_prefs_disconnect_callback(guint callback_id); | |
242 | |
243 /** | |
10087 | 244 * Remove all pref callbacks by handle |
245 */ | |
246 void gaim_prefs_disconnect_by_handle(void *handle); | |
247 | |
248 /** | |
5684 | 249 * Trigger callbacks as if the pref changed |
250 */ | |
251 void gaim_prefs_trigger_callback(const char *name); | |
252 | |
253 /** | |
5441 | 254 * Read preferences |
255 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
256 gboolean gaim_prefs_load(void); |
5441 | 257 |
258 /** | |
8900 | 259 * Rename legacy prefs and delete some that no longer exist. |
260 */ | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10443
diff
changeset
|
261 void gaim_prefs_update_old(void); |
8900 | 262 |
5441 | 263 /*@}*/ |
264 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
265 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
266 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
267 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
268 |
9713 | 269 #endif /* _GAIM_PREFS_H_ */ |