14192
+ 鐃緒申 1 /**
+ 鐃緒申 2 * @file prefs.h Prefs API
+ 鐃緒申 3 * @ingroup core
+ 鐃緒申 4 *
+ 鐃緒申 5 * gaim
+ 鐃緒申 6 *
+ 鐃緒申 7 * Gaim is the legal property of its developers, whose names are too numerous
+ 鐃緒申 8 * to list here. Please refer to the COPYRIGHT file distributed with this
+ 鐃緒申 9 * source distribution.
+ 鐃緒申 10 *
+ 鐃緒申 11 * This program is free software; you can redistribute it and/or modify
+ 鐃緒申 12 * it under the terms of the GNU General Public License as published by
+ 鐃緒申 13 * the Free Software Foundation; either version 2 of the License, or
+ 鐃緒申 14 * (at your option) any later version.
+ 鐃緒申 15 *
+ 鐃緒申 16 * This program is distributed in the hope that it will be useful,
+ 鐃緒申 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 鐃緒申 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 鐃緒申 19 * GNU General Public License for more details.
+ 鐃緒申 20 *
+ 鐃緒申 21 * You should have received a copy of the GNU General Public License
+ 鐃緒申 22 * along with this program; if not, write to the Free Software
+ 鐃緒申 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 鐃緒申 24 *
+ 鐃緒申 25 */
+ 鐃緒申 26 #ifndef _GAIM_PREFS_H_
+ 鐃緒申 27 #define _GAIM_PREFS_H_
+ 鐃緒申 28
+ 鐃緒申 29 #include <glib.h>
+ 鐃緒申 30
+ 鐃緒申 31 /**
+ 鐃緒申 32 * String format for preferences.
+ 鐃緒申 33 */
+ 鐃緒申 34 typedef enum
+ 鐃緒申 35 {
+ 鐃緒申 36 GAIM_STRING_FORMAT_TYPE_NONE = 0,
+ 鐃緒申 37 GAIM_STRING_FORMAT_TYPE_MULTILINE = 1 << 0,
+ 鐃緒申 38 GAIM_STRING_FORMAT_TYPE_HTML = 1 << 1
+ 鐃緒申 39 } GaimStringFormatType;
+ 鐃緒申 40
+ 鐃緒申 41 /**
+ 鐃緒申 42 * Pref data types.
+ 鐃緒申 43 */
+ 鐃緒申 44 typedef enum _GaimPrefType
+ 鐃緒申 45 {
+ 鐃緒申 46 GAIM_PREF_NONE,
+ 鐃緒申 47 GAIM_PREF_BOOLEAN,
+ 鐃緒申 48 GAIM_PREF_INT,
+ 鐃緒申 49 GAIM_PREF_STRING,
+ 鐃緒申 50 GAIM_PREF_STRING_LIST
+ 鐃緒申 51
+ 鐃緒申 52 } GaimPrefType;
+ 鐃緒申 53
+ 鐃緒申 54 /**
+ 鐃緒申 55 * Pref change callback type
+ 鐃緒申 56 */
+ 鐃緒申 57
+ 鐃緒申 58 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
+ 鐃緒申 59 gconstpointer val, gpointer data);
+ 鐃緒申 60
+ 鐃緒申 61 #ifdef __cplusplus
+ 鐃緒申 62 extern "C" {
+ 鐃緒申 63 #endif
+ 鐃緒申 64
+ 鐃緒申 65 /**************************************************************************/
+ 鐃緒申 66 /** @name Prefs API */
+ 鐃緒申 67 /**************************************************************************/
+ 鐃緒申 68 /*@{*/
+ 鐃緒申 69
+ 鐃緒申 70 /**
+ 鐃緒申 71 * Returns the prefs subsystem handle.
+ 鐃緒申 72 *
+ 鐃緒申 73 * @return The prefs subsystem handle.
+ 鐃緒申 74 */
+ 鐃緒申 75 void *gaim_prefs_get_handle(void);
+ 鐃緒申 76
+ 鐃緒申 77 /**
+ 鐃緒申 78 * Initialize core prefs
+ 鐃緒申 79 */
+ 鐃緒申 80 void gaim_prefs_init(void);
+ 鐃緒申 81
+ 鐃緒申 82 /**
+ 鐃緒申 83 * Uninitializes the prefs subsystem.
+ 鐃緒申 84 */
+ 鐃緒申 85 void gaim_prefs_uninit(void);
+ 鐃緒申 86
+ 鐃緒申 87 /**
+ 鐃緒申 88 * Add a new typeless pref.
+ 鐃緒申 89 *
+ 鐃緒申 90 * @param name The name of the pref
+ 鐃緒申 91 */
+ 鐃緒申 92 void gaim_prefs_add_none(const char *name);
+ 鐃緒申 93
+ 鐃緒申 94 /**
+ 鐃緒申 95 * Add a new boolean pref.
+ 鐃緒申 96 *
+ 鐃緒申 97 * @param name The name of the pref
+ 鐃緒申 98 * @param value The initial value to set
+ 鐃緒申 99 */
+ 鐃緒申 100 void gaim_prefs_add_bool(const char *name, gboolean value);
+ 鐃緒申 101
+ 鐃緒申 102 /**
+ 鐃緒申 103 * Add a new integer pref.
+ 鐃緒申 104 *
+ 鐃緒申 105 * @param name The name of the pref
+ 鐃緒申 106 * @param value The initial value to set
+ 鐃緒申 107 */
+ 鐃緒申 108 void gaim_prefs_add_int(const char *name, int value);
+ 鐃緒申 109
+ 鐃緒申 110 /**
+ 鐃緒申 111 * Add a new string pref.
+ 鐃緒申 112 *
+ 鐃緒申 113 * @param name The name of the pref
+ 鐃緒申 114 * @param value The initial value to set
+ 鐃緒申 115 */
+ 鐃緒申 116 void gaim_prefs_add_string(const char *name, const char *value);
+ 鐃緒申 117
+ 鐃緒申 118 /**
+ 鐃緒申 119 * Add a new string list pref.
+ 鐃緒申 120 *
+ 鐃緒申 121 * @param name The name of the pref
+ 鐃緒申 122 * @param value The initial value to set
+ 鐃緒申 123 */
+ 鐃緒申 124 void gaim_prefs_add_string_list(const char *name, GList *value);
+ 鐃緒申 125
+ 鐃緒申 126 /**
+ 鐃緒申 127 * Remove a pref.
+ 鐃緒申 128 *
+ 鐃緒申 129 * @param name The name of the pref
+ 鐃緒申 130 */
+ 鐃緒申 131 void gaim_prefs_remove(const char *name);
+ 鐃緒申 132
+ 鐃緒申 133 /**
+ 鐃緒申 134 * Rename a pref
+ 鐃緒申 135 *
+ 鐃緒申 136 * @param oldname The old name of the pref
+ 鐃緒申 137 * @param newname The new name for the pref
+ 鐃緒申 138 */
+ 鐃緒申 139 void gaim_prefs_rename(const char *oldname, const char *newname);
+ 鐃緒申 140
+ 鐃緒申 141 /**
+ 鐃緒申 142 * Rename a boolean pref, toggling it's value
+ 鐃緒申 143 *
+ 鐃緒申 144 * @param oldname The old name of the pref
+ 鐃緒申 145 * @param newname The new name for the pref
+ 鐃緒申 146 */
+ 鐃緒申 147 void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
+ 鐃緒申 148
+ 鐃緒申 149 /**
+ 鐃緒申 150 * Remove all prefs.
+ 鐃緒申 151 */
+ 鐃緒申 152 void gaim_prefs_destroy(void);
+ 鐃緒申 153
+ 鐃緒申 154 /**
+ 鐃緒申 155 * Set raw pref value
+ 鐃緒申 156 *
+ 鐃緒申 157 * @param name The name of the pref
+ 鐃緒申 158 * @param value The value to set
+ 鐃緒申 159 */
+ 鐃緒申 160 void gaim_prefs_set_generic(const char *name, gpointer value);
+ 鐃緒申 161
+ 鐃緒申 162 /**
+ 鐃緒申 163 * Set boolean pref value
+ 鐃緒申 164 *
+ 鐃緒申 165 * @param name The name of the pref
+ 鐃緒申 166 * @param value The value to set
+ 鐃緒申 167 */
+ 鐃緒申 168 void gaim_prefs_set_bool(const char *name, gboolean value);
+ 鐃緒申 169
+ 鐃緒申 170 /**
+ 鐃緒申 171 * Set integer pref value
+ 鐃緒申 172 *
+ 鐃緒申 173 * @param name The name of the pref
+ 鐃緒申 174 * @param value The value to set
+ 鐃緒申 175 */
+ 鐃緒申 176 void gaim_prefs_set_int(const char *name, int value);
+ 鐃緒申 177
+ 鐃緒申 178 /**
+ 鐃緒申 179 * Set string pref value
+ 鐃緒申 180 *
+ 鐃緒申 181 * @param name The name of the pref
+ 鐃緒申 182 * @param value The value to set
+ 鐃緒申 183 */
+ 鐃緒申 184 void gaim_prefs_set_string(const char *name, const char *value);
+ 鐃緒申 185
+ 鐃緒申 186 /**
+ 鐃緒申 187 * Set string pref value
+ 鐃緒申 188 *
+ 鐃緒申 189 * @param name The name of the pref
+ 鐃緒申 190 * @param value The value to set
+ 鐃緒申 191 */
+ 鐃緒申 192 void gaim_prefs_set_string_list(const char *name, GList *value);
+ 鐃緒申 193
+ 鐃緒申 194 /**
+ 鐃緒申 195 * Check if a pref exists
+ 鐃緒申 196 *
+ 鐃緒申 197 * @param name The name of the pref
+ 鐃緒申 198 * @return TRUE if the pref exists. Otherwise FALSE.
+ 鐃緒申 199 */
+ 鐃緒申 200 gboolean gaim_prefs_exists(const char *name);
+ 鐃緒申 201
+ 鐃緒申 202 /**
+ 鐃緒申 203 * Get pref type
+ 鐃緒申 204 *
+ 鐃緒申 205 * @param name The name of the pref
+ 鐃緒申 206 * @return The type of the pref
+ 鐃緒申 207 */
+ 鐃緒申 208 GaimPrefType gaim_prefs_get_type(const char *name);
+ 鐃緒申 209
+ 鐃緒申 210 /**
+ 鐃緒申 211 * Get boolean pref value
+ 鐃緒申 212 *
+ 鐃緒申 213 * @param name The name of the pref
+ 鐃緒申 214 * @return The value of the pref
+ 鐃緒申 215 */
+ 鐃緒申 216 gboolean gaim_prefs_get_bool(const char *name);
+ 鐃緒申 217
+ 鐃緒申 218 /**
+ 鐃緒申 219 * Get integer pref value
+ 鐃緒申 220 *
+ 鐃緒申 221 * @param name The name of the pref
+ 鐃緒申 222 * @return The value of the pref
+ 鐃緒申 223 */
+ 鐃緒申 224 int gaim_prefs_get_int(const char *name);
+ 鐃緒申 225
+ 鐃緒申 226 /**
+ 鐃緒申 227 * Get string pref value
+ 鐃緒申 228 *
+ 鐃緒申 229 * @param name The name of the pref
+ 鐃緒申 230 * @return The value of the pref
+ 鐃緒申 231 */
+ 鐃緒申 232 const char *gaim_prefs_get_string(const char *name);
+ 鐃緒申 233
+ 鐃緒申 234 /**
+ 鐃緒申 235 * Get string list pref value
+ 鐃緒申 236 *
+ 鐃緒申 237 * @param name The name of the pref
+ 鐃緒申 238 * @return The value of the pref
+ 鐃緒申 239 */
+ 鐃緒申 240 GList *gaim_prefs_get_string_list(const char *name);
+ 鐃緒申 241
+ 鐃緒申 242 /**
+ 鐃緒申 243 * Add a callback to a pref (and its children)
+ 鐃緒申 244 */
+ 鐃緒申 245 guint gaim_prefs_connect_callback(void *handle, const char *name, GaimPrefCallback cb,
+ 鐃緒申 246 gpointer data);
+ 鐃緒申 247
+ 鐃緒申 248 /**
+ 鐃緒申 249 * Remove a callback to a pref
+ 鐃緒申 250 */
+ 鐃緒申 251 void gaim_prefs_disconnect_callback(guint callback_id);
+ 鐃緒申 252
+ 鐃緒申 253 /**
+ 鐃緒申 254 * Remove all pref callbacks by handle
+ 鐃緒申 255 */
+ 鐃緒申 256 void gaim_prefs_disconnect_by_handle(void *handle);
+ 鐃緒申 257
+ 鐃緒申 258 /**
+ 鐃緒申 259 * Trigger callbacks as if the pref changed
+ 鐃緒申 260 */
+ 鐃緒申 261 void gaim_prefs_trigger_callback(const char *name);
+ 鐃緒申 262
+ 鐃緒申 263 /**
+ 鐃緒申 264 * Read preferences
+ 鐃緒申 265 */
+ 鐃緒申 266 gboolean gaim_prefs_load(void);
+ 鐃緒申 267
+ 鐃緒申 268 /**
+ 鐃緒申 269 * Rename legacy prefs and delete some that no longer exist.
+ 鐃緒申 270 */
+ 鐃緒申 271 void gaim_prefs_update_old(void);
+ 鐃緒申 272
+ 鐃緒申 273 /*@}*/
+ 鐃緒申 274
+ 鐃緒申 275 #ifdef __cplusplus
+ 鐃緒申 276 }
+ 鐃緒申 277 #endif
+ 鐃緒申 278
+ 鐃緒申 279 #endif /* _GAIM_PREFS_H_ */