Sat, 10 Jan 2004 06:06:02 +0000
[gaim-migrate @ 8749]
<b><i><u>what you see is what you get</u></i></b>
| 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
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 | */ | |
| 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
f19df037ac58
[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
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
51 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
52 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
53 | #endif |
|
f19df037ac58
[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 | /** | |
| 66 | * Add a new typeless pref. | |
| 67 | * | |
| 68 | * @param name The name of the pref | |
| 69 | */ | |
| 70 | void gaim_prefs_add_none(const char *name); | |
| 71 | ||
| 72 | /** | |
| 73 | * Add a new boolean pref. | |
| 74 | * | |
| 75 | * @param name The name of the pref | |
| 76 | * @param value The initial value to set | |
| 77 | */ | |
| 78 | void gaim_prefs_add_bool(const char *name, gboolean value); | |
| 79 | ||
| 80 | /** | |
| 81 | * Add a new integer pref. | |
| 82 | * | |
| 83 | * @param name The name of the pref | |
| 84 | * @param value The initial value to set | |
| 85 | */ | |
| 86 | void gaim_prefs_add_int(const char *name, int value); | |
| 87 | ||
| 88 | /** | |
| 89 | * Add a new string pref. | |
| 90 | * | |
| 91 | * @param name The name of the pref | |
| 92 | * @param value The initial value to set | |
| 93 | */ | |
| 94 | void gaim_prefs_add_string(const char *name, const char *value); | |
| 95 | ||
| 96 | /** | |
| 5561 | 97 | * Add a new string list pref. |
| 98 | * | |
| 99 | * @param name The name of the pref | |
| 100 | * @param value The initial value to set | |
| 101 | */ | |
| 102 | void gaim_prefs_add_string_list(const char *name, GList *value); | |
| 103 | ||
| 104 | /** | |
| 5441 | 105 | * Remove a pref. |
| 106 | * | |
| 107 | * @param name The name of the pref | |
| 108 | */ | |
| 109 | void gaim_prefs_remove(const char *name); | |
| 110 | ||
| 111 | /** | |
| 6693 | 112 | * Rename a pref |
| 113 | * | |
| 114 | * @param oldname The old name of the pref | |
| 115 | * @param newname The new name for the pref | |
| 116 | */ | |
| 117 | void gaim_prefs_rename(const char *oldname, const char *newname); | |
| 118 | ||
| 119 | /** | |
| 5441 | 120 | * Remove all prefs. |
| 121 | */ | |
| 122 | void gaim_prefs_destroy(); | |
| 123 | ||
| 124 | /** | |
| 125 | * Set raw pref value | |
| 126 | * | |
| 127 | * @param name The name of the pref | |
| 128 | * @param value The value to set | |
| 129 | */ | |
| 130 | void gaim_prefs_set_generic(const char *name, gpointer value); | |
| 131 | ||
| 132 | /** | |
| 133 | * Set boolean pref value | |
| 134 | * | |
| 135 | * @param name The name of the pref | |
| 136 | * @param value The value to set | |
| 137 | */ | |
| 138 | void gaim_prefs_set_bool(const char *name, gboolean value); | |
| 139 | ||
| 140 | /** | |
| 141 | * Set integer pref value | |
| 142 | * | |
| 143 | * @param name The name of the pref | |
| 144 | * @param value The value to set | |
| 145 | */ | |
| 146 | void gaim_prefs_set_int(const char *name, int value); | |
| 147 | ||
| 148 | /** | |
| 149 | * Set string pref value | |
| 150 | * | |
| 151 | * @param name The name of the pref | |
| 152 | * @param value The value to set | |
| 153 | */ | |
| 5451 | 154 | void gaim_prefs_set_string(const char *name, const char *value); |
| 5441 | 155 | |
| 156 | /** | |
| 5561 | 157 | * Set string pref value |
| 158 | * | |
| 159 | * @param name The name of the pref | |
| 160 | * @param value The value to set | |
| 161 | */ | |
| 162 | void gaim_prefs_set_string_list(const char *name, GList *value); | |
| 163 | ||
| 164 | /** | |
| 6538 | 165 | * Get pref type |
| 166 | * | |
| 167 | * @param name The name of the pref | |
| 168 | * @return The type of the pref | |
| 169 | */ | |
| 170 | GaimPrefType gaim_prefs_get_type(const char *name); | |
| 171 | ||
| 172 | /** | |
| 5441 | 173 | * Get boolean pref value |
| 174 | * | |
| 175 | * @param name The name of the pref | |
| 176 | * @return The value of the pref | |
| 177 | */ | |
| 178 | gboolean gaim_prefs_get_bool(const char *name); | |
| 179 | ||
| 180 | /** | |
| 181 | * Get integer pref value | |
| 182 | * | |
| 183 | * @param name The name of the pref | |
| 184 | * @return The value of the pref | |
| 185 | */ | |
| 186 | int gaim_prefs_get_int(const char *name); | |
| 187 | ||
| 188 | /** | |
| 189 | * Get string pref value | |
| 190 | * | |
| 191 | * @param name The name of the pref | |
| 192 | * @return The value of the pref | |
| 193 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
194 | const char *gaim_prefs_get_string(const char *name); |
| 5441 | 195 | |
| 196 | /** | |
| 5561 | 197 | * Get string pref value |
| 198 | * | |
| 199 | * @param name The name of the pref | |
| 200 | * @return The value of the pref | |
| 201 | */ | |
| 202 | GList *gaim_prefs_get_string_list(const char *name); | |
| 203 | ||
| 204 | /** | |
| 5441 | 205 | * Add a callback to a pref (and its children) |
| 206 | */ | |
| 207 | guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
| 208 | gpointer data); | |
| 209 | ||
| 210 | /** | |
| 211 | * Remove a callback to a pref | |
| 212 | */ | |
| 213 | void gaim_prefs_disconnect_callback(guint callback_id); | |
| 214 | ||
| 215 | /** | |
| 5684 | 216 | * Trigger callbacks as if the pref changed |
| 217 | */ | |
| 218 | void gaim_prefs_trigger_callback(const char *name); | |
| 219 | ||
| 220 | /** | |
| 5441 | 221 | * Read preferences |
| 222 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
223 | gboolean gaim_prefs_load(); |
| 5441 | 224 | |
| 225 | /** | |
| 226 | * Force an immediate write of preferences | |
| 227 | */ | |
| 228 | void gaim_prefs_sync(); | |
| 229 | ||
| 6693 | 230 | /** |
| 231 | * Rename legacy prefs | |
| 232 | */ | |
| 233 | void gaim_prefs_rename_old(); | |
| 234 | ||
| 5441 | 235 | /*@}*/ |
| 236 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
237 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
238 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
239 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
240 | |
| 5441 | 241 | #endif /* _PREFS_H_ */ |