Sat, 14 Jun 2003 15:25:03 +0000
[gaim-migrate @ 6299]
assorted compile cleanups and fixes I came across
| 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 | |
| 5441 | 39 | } GaimPrefType; |
| 40 | ||
| 41 | /** | |
| 42 | * Pref change callback type | |
| 43 | */ | |
| 44 | ||
| 45 | typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type, | |
| 46 | gpointer val, gpointer data); | |
| 47 | ||
| 48 | /**************************************************************************/ | |
| 49 | /** @name Prefs API */ | |
| 50 | /**************************************************************************/ | |
| 51 | /*@{*/ | |
| 52 | ||
| 53 | /** | |
| 54 | * Initialize core prefs | |
| 55 | */ | |
| 56 | void gaim_prefs_init(); | |
| 57 | ||
| 58 | /** | |
| 59 | * Add a new typeless pref. | |
| 60 | * | |
| 61 | * @param name The name of the pref | |
| 62 | */ | |
| 63 | void gaim_prefs_add_none(const char *name); | |
| 64 | ||
| 65 | /** | |
| 66 | * Add a new boolean pref. | |
| 67 | * | |
| 68 | * @param name The name of the pref | |
| 69 | * @param value The initial value to set | |
| 70 | */ | |
| 71 | void gaim_prefs_add_bool(const char *name, gboolean value); | |
| 72 | ||
| 73 | /** | |
| 74 | * Add a new integer pref. | |
| 75 | * | |
| 76 | * @param name The name of the pref | |
| 77 | * @param value The initial value to set | |
| 78 | */ | |
| 79 | void gaim_prefs_add_int(const char *name, int value); | |
| 80 | ||
| 81 | /** | |
| 82 | * Add a new string pref. | |
| 83 | * | |
| 84 | * @param name The name of the pref | |
| 85 | * @param value The initial value to set | |
| 86 | */ | |
| 87 | void gaim_prefs_add_string(const char *name, const char *value); | |
| 88 | ||
| 89 | /** | |
| 5561 | 90 | * Add a new string list pref. |
| 91 | * | |
| 92 | * @param name The name of the pref | |
| 93 | * @param value The initial value to set | |
| 94 | */ | |
| 95 | void gaim_prefs_add_string_list(const char *name, GList *value); | |
| 96 | ||
| 97 | /** | |
| 5441 | 98 | * Remove a pref. |
| 99 | * | |
| 100 | * @param name The name of the pref | |
| 101 | */ | |
| 102 | void gaim_prefs_remove(const char *name); | |
| 103 | ||
| 104 | /** | |
| 105 | * Remove all prefs. | |
| 106 | */ | |
| 107 | void gaim_prefs_destroy(); | |
| 108 | ||
| 109 | /** | |
| 110 | * Set raw pref value | |
| 111 | * | |
| 112 | * @param name The name of the pref | |
| 113 | * @param value The value to set | |
| 114 | */ | |
| 115 | void gaim_prefs_set_generic(const char *name, gpointer value); | |
| 116 | ||
| 117 | /** | |
| 118 | * Set boolean pref value | |
| 119 | * | |
| 120 | * @param name The name of the pref | |
| 121 | * @param value The value to set | |
| 122 | */ | |
| 123 | void gaim_prefs_set_bool(const char *name, gboolean value); | |
| 124 | ||
| 125 | /** | |
| 126 | * Set integer pref value | |
| 127 | * | |
| 128 | * @param name The name of the pref | |
| 129 | * @param value The value to set | |
| 130 | */ | |
| 131 | void gaim_prefs_set_int(const char *name, int value); | |
| 132 | ||
| 133 | /** | |
| 134 | * Set string pref value | |
| 135 | * | |
| 136 | * @param name The name of the pref | |
| 137 | * @param value The value to set | |
| 138 | */ | |
| 5451 | 139 | void gaim_prefs_set_string(const char *name, const char *value); |
| 5441 | 140 | |
| 141 | /** | |
| 5561 | 142 | * Set string pref value |
| 143 | * | |
| 144 | * @param name The name of the pref | |
| 145 | * @param value The value to set | |
| 146 | */ | |
| 147 | void gaim_prefs_set_string_list(const char *name, GList *value); | |
| 148 | ||
| 149 | /** | |
| 5441 | 150 | * Get boolean pref value |
| 151 | * | |
| 152 | * @param name The name of the pref | |
| 153 | * @return The value of the pref | |
| 154 | */ | |
| 155 | gboolean gaim_prefs_get_bool(const char *name); | |
| 156 | ||
| 157 | /** | |
| 158 | * Get integer pref value | |
| 159 | * | |
| 160 | * @param name The name of the pref | |
| 161 | * @return The value of the pref | |
| 162 | */ | |
| 163 | int gaim_prefs_get_int(const char *name); | |
| 164 | ||
| 165 | /** | |
| 166 | * Get string pref value | |
| 167 | * | |
| 168 | * @param name The name of the pref | |
| 169 | * @return The value of the pref | |
| 170 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
171 | const char *gaim_prefs_get_string(const char *name); |
| 5441 | 172 | |
| 173 | /** | |
| 5561 | 174 | * Get string pref value |
| 175 | * | |
| 176 | * @param name The name of the pref | |
| 177 | * @return The value of the pref | |
| 178 | */ | |
| 179 | GList *gaim_prefs_get_string_list(const char *name); | |
| 180 | ||
| 181 | /** | |
| 5441 | 182 | * Add a callback to a pref (and its children) |
| 183 | */ | |
| 184 | guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
| 185 | gpointer data); | |
| 186 | ||
| 187 | /** | |
| 188 | * Remove a callback to a pref | |
| 189 | */ | |
| 190 | void gaim_prefs_disconnect_callback(guint callback_id); | |
| 191 | ||
| 192 | /** | |
| 5684 | 193 | * Trigger callbacks as if the pref changed |
| 194 | */ | |
| 195 | void gaim_prefs_trigger_callback(const char *name); | |
| 196 | ||
| 197 | /** | |
| 5441 | 198 | * Read preferences |
| 199 | */ | |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
200 | gboolean gaim_prefs_load(); |
| 5441 | 201 | |
| 202 | /** | |
| 203 | * Force an immediate write of preferences | |
| 204 | */ | |
| 205 | void gaim_prefs_sync(); | |
| 206 | ||
| 207 | /*@}*/ | |
| 208 | ||
| 209 | #endif /* _PREFS_H_ */ |