Mercurial > pidgin
annotate src/prefs.h @ 8622:ffed55cbdd67
[gaim-migrate @ 9373]
Any objections to this?
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Fri, 09 Apr 2004 02:49:30 +0000 |
| parents | 63c7a16a2c09 |
| children | 543b19a96ac5 |
| rev | line source |
|---|---|
| 5441 | 1 /** |
| 2 * @file prefs.h Prefs API | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 8046 | 6 * Gaim is the legal property of its developers, whose names are too numerous |
| 7 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 8 * source distribution. | |
| 5441 | 9 * |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
| 12 * the Free Software Foundation; either version 2 of the License, or | |
| 13 * (at your option) any later version. | |
| 14 * | |
| 15 * This program is distributed in the hope that it will be useful, | |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 * GNU General Public License for more details. | |
| 19 * | |
| 20 * You should have received a copy of the GNU General Public License | |
| 21 * along with this program; if not, write to the Free Software | |
| 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 * | |
| 24 */ | |
| 25 | |
| 26 #ifndef _PREFS_H_ | |
| 27 #define _PREFS_H_ | |
| 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 /** | |
| 5441 | 125 * Remove all prefs. |
| 126 */ | |
| 127 void gaim_prefs_destroy(); | |
| 128 | |
| 129 /** | |
| 130 * Set raw pref value | |
| 131 * | |
| 132 * @param name The name of the pref | |
| 133 * @param value The value to set | |
| 134 */ | |
| 135 void gaim_prefs_set_generic(const char *name, gpointer value); | |
| 136 | |
| 137 /** | |
| 138 * Set boolean pref value | |
| 139 * | |
| 140 * @param name The name of the pref | |
| 141 * @param value The value to set | |
| 142 */ | |
| 143 void gaim_prefs_set_bool(const char *name, gboolean value); | |
| 144 | |
| 145 /** | |
| 146 * Set integer pref value | |
| 147 * | |
| 148 * @param name The name of the pref | |
| 149 * @param value The value to set | |
| 150 */ | |
| 151 void gaim_prefs_set_int(const char *name, int value); | |
| 152 | |
| 153 /** | |
| 154 * Set string pref value | |
| 155 * | |
| 156 * @param name The name of the pref | |
| 157 * @param value The value to set | |
| 158 */ | |
| 5451 | 159 void gaim_prefs_set_string(const char *name, const char *value); |
| 5441 | 160 |
| 161 /** | |
| 5561 | 162 * Set string pref value |
| 163 * | |
| 164 * @param name The name of the pref | |
| 165 * @param value The value to set | |
| 166 */ | |
| 167 void gaim_prefs_set_string_list(const char *name, GList *value); | |
| 168 | |
| 169 /** | |
| 6538 | 170 * Get pref type |
| 171 * | |
| 172 * @param name The name of the pref | |
| 173 * @return The type of the pref | |
| 174 */ | |
| 175 GaimPrefType gaim_prefs_get_type(const char *name); | |
| 176 | |
| 177 /** | |
| 5441 | 178 * Get boolean pref value |
| 179 * | |
| 180 * @param name The name of the pref | |
| 181 * @return The value of the pref | |
| 182 */ | |
| 183 gboolean gaim_prefs_get_bool(const char *name); | |
| 184 | |
| 185 /** | |
| 186 * Get integer pref value | |
| 187 * | |
| 188 * @param name The name of the pref | |
| 189 * @return The value of the pref | |
| 190 */ | |
| 191 int gaim_prefs_get_int(const char *name); | |
| 192 | |
| 193 /** | |
| 194 * Get string pref value | |
| 195 * | |
| 196 * @param name The name of the pref | |
| 197 * @return The value of the pref | |
| 198 */ | |
|
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
199 const char *gaim_prefs_get_string(const char *name); |
| 5441 | 200 |
| 201 /** | |
| 5561 | 202 * Get string pref value |
| 203 * | |
| 204 * @param name The name of the pref | |
| 205 * @return The value of the pref | |
| 206 */ | |
| 207 GList *gaim_prefs_get_string_list(const char *name); | |
| 208 | |
| 209 /** | |
| 5441 | 210 * Add a callback to a pref (and its children) |
| 211 */ | |
| 212 guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
| 213 gpointer data); | |
| 214 | |
| 215 /** | |
| 216 * Remove a callback to a pref | |
| 217 */ | |
| 218 void gaim_prefs_disconnect_callback(guint callback_id); | |
| 219 | |
| 220 /** | |
| 5684 | 221 * Trigger callbacks as if the pref changed |
| 222 */ | |
| 223 void gaim_prefs_trigger_callback(const char *name); | |
| 224 | |
| 225 /** | |
| 5441 | 226 * Read preferences |
| 227 */ | |
|
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
228 gboolean gaim_prefs_load(); |
| 5441 | 229 |
| 230 /** | |
| 231 * Force an immediate write of preferences | |
| 232 */ | |
| 233 void gaim_prefs_sync(); | |
| 234 | |
| 6693 | 235 /** |
| 236 * Rename legacy prefs | |
| 237 */ | |
| 238 void gaim_prefs_rename_old(); | |
| 239 | |
| 5441 | 240 /*@}*/ |
| 241 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
242 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
243 } |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
244 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
245 |
| 5441 | 246 #endif /* _PREFS_H_ */ |
