Sat, 18 Aug 2007 05:54:49 +0000
- Add purple_certificate_display_x509
| 5441 | 1 | /** |
| 2 | * @file prefs.h Prefs API | |
|
10066
606927534c36
[gaim-migrate @ 11041]
Mark Doliner <markdoliner@pidgin.im>
parents:
9713
diff
changeset
|
3 | * @ingroup core |
| 5441 | 4 | * |
| 15884 | 5 | * purple |
| 5441 | 6 | * |
| 15884 | 7 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 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 | */ | |
| 15884 | 26 | #ifndef _PURPLE_PREFS_H_ |
| 27 | #define _PURPLE_PREFS_H_ | |
| 5441 | 28 | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
29 | #include <glib.h> |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
30 | |
| 5441 | 31 | /** |
| 32 | * Pref data types. | |
| 33 | */ | |
| 15884 | 34 | typedef enum _PurplePrefType |
| 5441 | 35 | { |
| 15884 | 36 | PURPLE_PREF_NONE, |
| 37 | PURPLE_PREF_BOOLEAN, | |
| 38 | PURPLE_PREF_INT, | |
| 39 | PURPLE_PREF_STRING, | |
| 40 | PURPLE_PREF_STRING_LIST, | |
| 41 | PURPLE_PREF_PATH, | |
| 42 | PURPLE_PREF_PATH_LIST | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
43 | |
| 15884 | 44 | } PurplePrefType; |
| 5441 | 45 | |
| 46 | /** | |
| 47 | * Pref change callback type | |
| 48 | */ | |
| 49 | ||
| 15884 | 50 | typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12712
diff
changeset
|
51 | gconstpointer val, gpointer data); |
| 5441 | 52 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
53 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
54 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
55 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
56 | |
| 5441 | 57 | /**************************************************************************/ |
|
17436
a3e9be0f17ef
- Added a description of preference grouping to the Prefs API code
William Ehlhardt <williamehlhardt@gmail.com>
parents:
15884
diff
changeset
|
58 | /** @name Prefs API |
|
a3e9be0f17ef
- Added a description of preference grouping to the Prefs API code
William Ehlhardt <williamehlhardt@gmail.com>
parents:
15884
diff
changeset
|
59 | Preferences are named according to a directory-like structure. |
|
a3e9be0f17ef
- Added a description of preference grouping to the Prefs API code
William Ehlhardt <williamehlhardt@gmail.com>
parents:
15884
diff
changeset
|
60 | Example: "/plugins/core/potato/is_from_idaho" (probably a boolean) */ |
| 5441 | 61 | /**************************************************************************/ |
| 62 | /*@{*/ | |
| 63 | ||
| 64 | /** | |
|
10443
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
65 | * Returns the prefs subsystem handle. |
|
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
66 | * |
|
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
67 | * @return The prefs subsystem handle. |
|
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
68 | */ |
| 15884 | 69 | void *purple_prefs_get_handle(void); |
|
10443
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
70 | |
|
aa7dcc1c796a
[gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
71 | /** |
| 5441 | 72 | * Initialize core prefs |
| 73 | */ | |
| 15884 | 74 | void purple_prefs_init(void); |
| 5441 | 75 | |
| 76 | /** | |
| 8235 | 77 | * Uninitializes the prefs subsystem. |
| 78 | */ | |
| 15884 | 79 | void purple_prefs_uninit(void); |
| 8235 | 80 | |
| 81 | /** | |
| 5441 | 82 | * Add a new typeless pref. |
| 83 | * | |
| 84 | * @param name The name of the pref | |
| 85 | */ | |
| 15884 | 86 | void purple_prefs_add_none(const char *name); |
| 5441 | 87 | |
| 88 | /** | |
| 89 | * Add a new boolean pref. | |
| 90 | * | |
| 91 | * @param name The name of the pref | |
| 92 | * @param value The initial value to set | |
| 93 | */ | |
| 15884 | 94 | void purple_prefs_add_bool(const char *name, gboolean value); |
| 5441 | 95 | |
| 96 | /** | |
| 97 | * Add a new integer pref. | |
| 98 | * | |
| 99 | * @param name The name of the pref | |
| 100 | * @param value The initial value to set | |
| 101 | */ | |
| 15884 | 102 | void purple_prefs_add_int(const char *name, int value); |
| 5441 | 103 | |
| 104 | /** | |
| 105 | * Add a new string pref. | |
| 106 | * | |
| 107 | * @param name The name of the pref | |
| 108 | * @param value The initial value to set | |
| 109 | */ | |
| 15884 | 110 | void purple_prefs_add_string(const char *name, const char *value); |
| 5441 | 111 | |
| 112 | /** | |
| 5561 | 113 | * Add a new string list pref. |
| 114 | * | |
| 115 | * @param name The name of the pref | |
| 116 | * @param value The initial value to set | |
| 117 | */ | |
| 15884 | 118 | void purple_prefs_add_string_list(const char *name, GList *value); |
| 5561 | 119 | |
| 120 | /** | |
| 15370 | 121 | * Add a new path pref. |
| 122 | * | |
| 123 | * @param name The name of the pref | |
| 124 | * @param value The initial value to set | |
| 125 | */ | |
| 15884 | 126 | void purple_prefs_add_path(const char *name, const char *value); |
| 15370 | 127 | |
| 128 | /** | |
| 129 | * Add a new path list pref. | |
| 130 | * | |
| 131 | * @param name The name of the pref | |
| 132 | * @param value The initial value to set | |
| 133 | */ | |
| 15884 | 134 | void purple_prefs_add_path_list(const char *name, GList *value); |
| 15370 | 135 | |
| 136 | ||
| 137 | /** | |
| 5441 | 138 | * Remove a pref. |
| 139 | * | |
| 140 | * @param name The name of the pref | |
| 141 | */ | |
| 15884 | 142 | void purple_prefs_remove(const char *name); |
| 5441 | 143 | |
| 144 | /** | |
| 6693 | 145 | * Rename a pref |
| 146 | * | |
| 147 | * @param oldname The old name of the pref | |
| 148 | * @param newname The new name for the pref | |
| 149 | */ | |
| 15884 | 150 | void purple_prefs_rename(const char *oldname, const char *newname); |
| 6693 | 151 | |
| 152 | /** | |
| 8705 | 153 | * Rename a boolean pref, toggling it's value |
| 154 | * | |
| 155 | * @param oldname The old name of the pref | |
| 156 | * @param newname The new name for the pref | |
| 157 | */ | |
| 15884 | 158 | void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname); |
| 8705 | 159 | |
| 160 | /** | |
| 5441 | 161 | * Remove all prefs. |
| 162 | */ | |
| 15884 | 163 | void purple_prefs_destroy(void); |
| 5441 | 164 | |
| 165 | /** | |
| 166 | * Set raw pref value | |
| 167 | * | |
| 168 | * @param name The name of the pref | |
| 169 | * @param value The value to set | |
| 170 | */ | |
| 15884 | 171 | void purple_prefs_set_generic(const char *name, gpointer value); |
| 5441 | 172 | |
| 173 | /** | |
| 174 | * Set boolean pref value | |
| 175 | * | |
| 176 | * @param name The name of the pref | |
| 177 | * @param value The value to set | |
| 178 | */ | |
| 15884 | 179 | void purple_prefs_set_bool(const char *name, gboolean value); |
| 5441 | 180 | |
| 181 | /** | |
| 182 | * Set integer pref value | |
| 183 | * | |
| 184 | * @param name The name of the pref | |
| 185 | * @param value The value to set | |
| 186 | */ | |
| 15884 | 187 | void purple_prefs_set_int(const char *name, int value); |
| 5441 | 188 | |
| 189 | /** | |
| 190 | * Set string pref value | |
| 191 | * | |
| 192 | * @param name The name of the pref | |
| 193 | * @param value The value to set | |
| 194 | */ | |
| 15884 | 195 | void purple_prefs_set_string(const char *name, const char *value); |
| 5441 | 196 | |
| 197 | /** | |
| 15370 | 198 | * Set string list pref value |
| 5561 | 199 | * |
| 200 | * @param name The name of the pref | |
| 201 | * @param value The value to set | |
| 202 | */ | |
| 15884 | 203 | void purple_prefs_set_string_list(const char *name, GList *value); |
| 5561 | 204 | |
| 205 | /** | |
| 15370 | 206 | * Set path pref value |
| 207 | * | |
| 208 | * @param name The name of the pref | |
| 209 | * @param value The value to set | |
| 210 | */ | |
| 15884 | 211 | void purple_prefs_set_path(const char *name, const char *value); |
| 15370 | 212 | |
| 213 | /** | |
| 214 | * Set path list pref value | |
| 215 | * | |
| 216 | * @param name The name of the pref | |
| 217 | * @param value The value to set | |
| 218 | */ | |
| 15884 | 219 | void purple_prefs_set_path_list(const char *name, GList *value); |
| 15370 | 220 | |
| 221 | ||
| 222 | /** | |
| 9611 | 223 | * Check if a pref exists |
| 224 | * | |
|
9619
2d8adb92f665
[gaim-migrate @ 10463]
Mark Doliner <markdoliner@pidgin.im>
parents:
9611
diff
changeset
|
225 | * @param name The name of the pref |
|
2d8adb92f665
[gaim-migrate @ 10463]
Mark Doliner <markdoliner@pidgin.im>
parents:
9611
diff
changeset
|
226 | * @return TRUE if the pref exists. Otherwise FALSE. |
| 9611 | 227 | */ |
| 15884 | 228 | gboolean purple_prefs_exists(const char *name); |
| 9611 | 229 | |
| 230 | /** | |
| 6538 | 231 | * Get pref type |
| 232 | * | |
| 233 | * @param name The name of the pref | |
| 234 | * @return The type of the pref | |
| 235 | */ | |
| 15884 | 236 | PurplePrefType purple_prefs_get_type(const char *name); |
| 6538 | 237 | |
| 238 | /** | |
| 5441 | 239 | * Get boolean pref value |
| 240 | * | |
| 241 | * @param name The name of the pref | |
| 242 | * @return The value of the pref | |
| 243 | */ | |
| 15884 | 244 | gboolean purple_prefs_get_bool(const char *name); |
| 5441 | 245 | |
| 246 | /** | |
| 247 | * Get integer pref value | |
| 248 | * | |
| 249 | * @param name The name of the pref | |
| 250 | * @return The value of the pref | |
| 251 | */ | |
| 15884 | 252 | int purple_prefs_get_int(const char *name); |
| 5441 | 253 | |
| 254 | /** | |
| 255 | * Get string pref value | |
| 256 | * | |
| 257 | * @param name The name of the pref | |
| 258 | * @return The value of the pref | |
| 259 | */ | |
| 15884 | 260 | const char *purple_prefs_get_string(const char *name); |
| 5441 | 261 | |
| 262 | /** | |
|
10071
d2ba11541693
[gaim-migrate @ 11047]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
10066
diff
changeset
|
263 | * Get string list pref value |
| 5561 | 264 | * |
| 265 | * @param name The name of the pref | |
| 266 | * @return The value of the pref | |
| 267 | */ | |
| 15884 | 268 | GList *purple_prefs_get_string_list(const char *name); |
| 5561 | 269 | |
| 270 | /** | |
| 15370 | 271 | * Get path pref value |
| 272 | * | |
| 273 | * @param name The name of the pref | |
| 274 | * @return The value of the pref | |
| 275 | */ | |
| 15884 | 276 | const char *purple_prefs_get_path(const char *name); |
| 15370 | 277 | |
| 278 | /** | |
| 279 | * Get path list pref value | |
| 280 | * | |
| 281 | * @param name The name of the pref | |
| 282 | * @return The value of the pref | |
| 283 | */ | |
| 15884 | 284 | GList *purple_prefs_get_path_list(const char *name); |
| 15370 | 285 | |
|
18714
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
286 | /* |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
287 | * Returns a list of children for a pref |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
288 | * |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
289 | * @param name The parent pref |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
290 | * @return A list of newly allocated strings denoting the names of the children. |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
291 | * Returns @c NULL if there are no children or if pref doesn't exist. |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
292 | * The caller must free all the strings and the list. |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
293 | */ |
|
65048af91a2c
Add purple_prefs_get_children_names in purple. And update Changelog.API
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
294 | GList *purple_prefs_get_children_names(const char *name); |
| 15370 | 295 | |
| 296 | /** | |
| 5441 | 297 | * Add a callback to a pref (and its children) |
| 298 | */ | |
| 15884 | 299 | guint purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback cb, |
| 5441 | 300 | gpointer data); |
| 301 | ||
| 302 | /** | |
| 303 | * Remove a callback to a pref | |
| 304 | */ | |
| 15884 | 305 | void purple_prefs_disconnect_callback(guint callback_id); |
| 5441 | 306 | |
| 307 | /** | |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10071
diff
changeset
|
308 | * Remove all pref callbacks by handle |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10071
diff
changeset
|
309 | */ |
| 15884 | 310 | void purple_prefs_disconnect_by_handle(void *handle); |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10071
diff
changeset
|
311 | |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10071
diff
changeset
|
312 | /** |
| 5684 | 313 | * Trigger callbacks as if the pref changed |
| 314 | */ | |
| 15884 | 315 | void purple_prefs_trigger_callback(const char *name); |
| 5684 | 316 | |
| 317 | /** | |
| 5441 | 318 | * Read preferences |
| 319 | */ | |
| 15884 | 320 | gboolean purple_prefs_load(void); |
| 5441 | 321 | |
| 322 | /** | |
|
8900
14f4b7ae958e
[gaim-migrate @ 9669]
Mark Doliner <markdoliner@pidgin.im>
parents:
8705
diff
changeset
|
323 | * Rename legacy prefs and delete some that no longer exist. |
|
14f4b7ae958e
[gaim-migrate @ 9669]
Mark Doliner <markdoliner@pidgin.im>
parents:
8705
diff
changeset
|
324 | */ |
| 15884 | 325 | void purple_prefs_update_old(void); |
|
8900
14f4b7ae958e
[gaim-migrate @ 9669]
Mark Doliner <markdoliner@pidgin.im>
parents:
8705
diff
changeset
|
326 | |
| 5441 | 327 | /*@}*/ |
| 328 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
329 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
330 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
331 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
332 | |
| 15884 | 333 | #endif /* _PURPLE_PREFS_H_ */ |