Thu, 24 Jul 2003 06:12:55 +0000
[gaim-migrate @ 6796]
La la la, nobody saw that previous commit, la la la
| 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 | /** | |
| 110 | * Remove all prefs. | |
| 111 | */ | |
| 112 | void gaim_prefs_destroy(); | |
| 113 | ||
| 114 | /** | |
| 115 | * Set raw pref value | |
| 116 | * | |
| 117 | * @param name The name of the pref | |
| 118 | * @param value The value to set | |
| 119 | */ | |
| 120 | void gaim_prefs_set_generic(const char *name, gpointer value); | |
| 121 | ||
| 122 | /** | |
| 123 | * Set boolean pref value | |
| 124 | * | |
| 125 | * @param name The name of the pref | |
| 126 | * @param value The value to set | |
| 127 | */ | |
| 128 | void gaim_prefs_set_bool(const char *name, gboolean value); | |
| 129 | ||
| 130 | /** | |
| 131 | * Set integer pref value | |
| 132 | * | |
| 133 | * @param name The name of the pref | |
| 134 | * @param value The value to set | |
| 135 | */ | |
| 136 | void gaim_prefs_set_int(const char *name, int value); | |
| 137 | ||
| 138 | /** | |
| 139 | * Set string pref value | |
| 140 | * | |
| 141 | * @param name The name of the pref | |
| 142 | * @param value The value to set | |
| 143 | */ | |
| 5451 | 144 | void gaim_prefs_set_string(const char *name, const char *value); |
| 5441 | 145 | |
| 146 | /** | |
| 5561 | 147 | * Set string pref value |
| 148 | * | |
| 149 | * @param name The name of the pref | |
| 150 | * @param value The value to set | |
| 151 | */ | |
| 152 | void gaim_prefs_set_string_list(const char *name, GList *value); | |
| 153 | ||
| 154 | /** | |
| 5441 | 155 | * Get boolean pref value |
| 156 | * | |
| 157 | * @param name The name of the pref | |
| 158 | * @return The value of the pref | |
| 159 | */ | |
| 160 | gboolean gaim_prefs_get_bool(const char *name); | |
| 161 | ||
| 162 | /** | |
| 163 | * Get integer pref value | |
| 164 | * | |
| 165 | * @param name The name of the pref | |
| 166 | * @return The value of the pref | |
| 167 | */ | |
| 168 | int gaim_prefs_get_int(const char *name); | |
| 169 | ||
| 170 | /** | |
| 171 | * Get string pref value | |
| 172 | * | |
| 173 | * @param name The name of the pref | |
| 174 | * @return The value of the pref | |
| 175 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
176 | const char *gaim_prefs_get_string(const char *name); |
| 5441 | 177 | |
| 178 | /** | |
| 5561 | 179 | * Get string pref value |
| 180 | * | |
| 181 | * @param name The name of the pref | |
| 182 | * @return The value of the pref | |
| 183 | */ | |
| 184 | GList *gaim_prefs_get_string_list(const char *name); | |
| 185 | ||
| 186 | /** | |
| 5441 | 187 | * Add a callback to a pref (and its children) |
| 188 | */ | |
| 189 | guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
| 190 | gpointer data); | |
| 191 | ||
| 192 | /** | |
| 193 | * Remove a callback to a pref | |
| 194 | */ | |
| 195 | void gaim_prefs_disconnect_callback(guint callback_id); | |
| 196 | ||
| 197 | /** | |
| 5684 | 198 | * Trigger callbacks as if the pref changed |
| 199 | */ | |
| 200 | void gaim_prefs_trigger_callback(const char *name); | |
| 201 | ||
| 202 | /** | |
| 5441 | 203 | * Read preferences |
| 204 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
205 | gboolean gaim_prefs_load(); |
| 5441 | 206 | |
| 207 | /** | |
| 208 | * Force an immediate write of preferences | |
| 209 | */ | |
| 210 | void gaim_prefs_sync(); | |
| 211 | ||
| 212 | /*@}*/ | |
| 213 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
214 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
215 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
216 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
217 | |
| 5441 | 218 | #endif /* _PREFS_H_ */ |