Sun, 21 Dec 2003 08:16:43 +0000
[gaim-migrate @ 8560]
Cleaned up the main function that builds the field request UI. It's a lot
easier to work with now.
| 5441 | 1 | /** |
| 2 | * @file prefs.h Prefs API | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | */ | |
| 23 | ||
| 24 | #ifndef _PREFS_H_ | |
| 25 | #define _PREFS_H_ | |
| 26 | ||
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
27 | #include <glib.h> |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
28 | |
| 5441 | 29 | /** |
| 30 | * Pref data types. | |
| 31 | */ | |
| 32 | typedef enum _GaimPrefType | |
| 33 | { | |
| 34 | GAIM_PREF_NONE, | |
| 35 | GAIM_PREF_BOOLEAN, | |
| 36 | GAIM_PREF_INT, | |
| 5561 | 37 | GAIM_PREF_STRING, |
| 38 | GAIM_PREF_STRING_LIST | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
39 | |
| 5441 | 40 | } GaimPrefType; |
| 41 | ||
| 42 | /** | |
| 43 | * Pref change callback type | |
| 44 | */ | |
| 45 | ||
| 46 | typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type, | |
| 47 | gpointer val, gpointer data); | |
| 48 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
49 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
50 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
51 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
52 | |
| 5441 | 53 | /**************************************************************************/ |
| 54 | /** @name Prefs API */ | |
| 55 | /**************************************************************************/ | |
| 56 | /*@{*/ | |
| 57 | ||
| 58 | /** | |
| 59 | * Initialize core prefs | |
| 60 | */ | |
| 61 | void gaim_prefs_init(); | |
| 62 | ||
| 63 | /** | |
| 64 | * Add a new typeless pref. | |
| 65 | * | |
| 66 | * @param name The name of the pref | |
| 67 | */ | |
| 68 | void gaim_prefs_add_none(const char *name); | |
| 69 | ||
| 70 | /** | |
| 71 | * Add a new boolean pref. | |
| 72 | * | |
| 73 | * @param name The name of the pref | |
| 74 | * @param value The initial value to set | |
| 75 | */ | |
| 76 | void gaim_prefs_add_bool(const char *name, gboolean value); | |
| 77 | ||
| 78 | /** | |
| 79 | * Add a new integer pref. | |
| 80 | * | |
| 81 | * @param name The name of the pref | |
| 82 | * @param value The initial value to set | |
| 83 | */ | |
| 84 | void gaim_prefs_add_int(const char *name, int value); | |
| 85 | ||
| 86 | /** | |
| 87 | * Add a new string pref. | |
| 88 | * | |
| 89 | * @param name The name of the pref | |
| 90 | * @param value The initial value to set | |
| 91 | */ | |
| 92 | void gaim_prefs_add_string(const char *name, const char *value); | |
| 93 | ||
| 94 | /** | |
| 5561 | 95 | * Add a new string list pref. |
| 96 | * | |
| 97 | * @param name The name of the pref | |
| 98 | * @param value The initial value to set | |
| 99 | */ | |
| 100 | void gaim_prefs_add_string_list(const char *name, GList *value); | |
| 101 | ||
| 102 | /** | |
| 5441 | 103 | * Remove a pref. |
| 104 | * | |
| 105 | * @param name The name of the pref | |
| 106 | */ | |
| 107 | void gaim_prefs_remove(const char *name); | |
| 108 | ||
| 109 | /** | |
| 6693 | 110 | * Rename a pref |
| 111 | * | |
| 112 | * @param oldname The old name of the pref | |
| 113 | * @param newname The new name for the pref | |
| 114 | */ | |
| 115 | void gaim_prefs_rename(const char *oldname, const char *newname); | |
| 116 | ||
| 117 | /** | |
| 5441 | 118 | * Remove all prefs. |
| 119 | */ | |
| 120 | void gaim_prefs_destroy(); | |
| 121 | ||
| 122 | /** | |
| 123 | * Set raw pref value | |
| 124 | * | |
| 125 | * @param name The name of the pref | |
| 126 | * @param value The value to set | |
| 127 | */ | |
| 128 | void gaim_prefs_set_generic(const char *name, gpointer value); | |
| 129 | ||
| 130 | /** | |
| 131 | * Set boolean pref value | |
| 132 | * | |
| 133 | * @param name The name of the pref | |
| 134 | * @param value The value to set | |
| 135 | */ | |
| 136 | void gaim_prefs_set_bool(const char *name, gboolean value); | |
| 137 | ||
| 138 | /** | |
| 139 | * Set integer pref value | |
| 140 | * | |
| 141 | * @param name The name of the pref | |
| 142 | * @param value The value to set | |
| 143 | */ | |
| 144 | void gaim_prefs_set_int(const char *name, int value); | |
| 145 | ||
| 146 | /** | |
| 147 | * Set string pref value | |
| 148 | * | |
| 149 | * @param name The name of the pref | |
| 150 | * @param value The value to set | |
| 151 | */ | |
| 5451 | 152 | void gaim_prefs_set_string(const char *name, const char *value); |
| 5441 | 153 | |
| 154 | /** | |
| 5561 | 155 | * Set string pref value |
| 156 | * | |
| 157 | * @param name The name of the pref | |
| 158 | * @param value The value to set | |
| 159 | */ | |
| 160 | void gaim_prefs_set_string_list(const char *name, GList *value); | |
| 161 | ||
| 162 | /** | |
| 6538 | 163 | * Get pref type |
| 164 | * | |
| 165 | * @param name The name of the pref | |
| 166 | * @return The type of the pref | |
| 167 | */ | |
| 168 | GaimPrefType gaim_prefs_get_type(const char *name); | |
| 169 | ||
| 170 | /** | |
| 5441 | 171 | * Get boolean pref value |
| 172 | * | |
| 173 | * @param name The name of the pref | |
| 174 | * @return The value of the pref | |
| 175 | */ | |
| 176 | gboolean gaim_prefs_get_bool(const char *name); | |
| 177 | ||
| 178 | /** | |
| 179 | * Get integer pref value | |
| 180 | * | |
| 181 | * @param name The name of the pref | |
| 182 | * @return The value of the pref | |
| 183 | */ | |
| 184 | int gaim_prefs_get_int(const char *name); | |
| 185 | ||
| 186 | /** | |
| 187 | * Get string pref value | |
| 188 | * | |
| 189 | * @param name The name of the pref | |
| 190 | * @return The value of the pref | |
| 191 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
192 | const char *gaim_prefs_get_string(const char *name); |
| 5441 | 193 | |
| 194 | /** | |
| 5561 | 195 | * Get string pref value |
| 196 | * | |
| 197 | * @param name The name of the pref | |
| 198 | * @return The value of the pref | |
| 199 | */ | |
| 200 | GList *gaim_prefs_get_string_list(const char *name); | |
| 201 | ||
| 202 | /** | |
| 5441 | 203 | * Add a callback to a pref (and its children) |
| 204 | */ | |
| 205 | guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
| 206 | gpointer data); | |
| 207 | ||
| 208 | /** | |
| 209 | * Remove a callback to a pref | |
| 210 | */ | |
| 211 | void gaim_prefs_disconnect_callback(guint callback_id); | |
| 212 | ||
| 213 | /** | |
| 5684 | 214 | * Trigger callbacks as if the pref changed |
| 215 | */ | |
| 216 | void gaim_prefs_trigger_callback(const char *name); | |
| 217 | ||
| 218 | /** | |
| 5441 | 219 | * Read preferences |
| 220 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
221 | gboolean gaim_prefs_load(); |
| 5441 | 222 | |
| 223 | /** | |
| 224 | * Force an immediate write of preferences | |
| 225 | */ | |
| 226 | void gaim_prefs_sync(); | |
| 227 | ||
| 6693 | 228 | /** |
| 229 | * Rename legacy prefs | |
| 230 | */ | |
| 231 | void gaim_prefs_rename_old(); | |
| 232 | ||
| 5441 | 233 | /*@}*/ |
| 234 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
235 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
236 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
237 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
238 | |
| 5441 | 239 | #endif /* _PREFS_H_ */ |