prefs.h

Go to the documentation of this file.
00001 
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  *
00026  */
00027 #ifndef _PURPLE_PREFS_H_
00028 #define _PURPLE_PREFS_H_
00029 
00030 #include <glib.h>
00031 
00035 typedef enum _PurplePrefType
00036 {
00037     PURPLE_PREF_NONE,
00038     PURPLE_PREF_BOOLEAN,
00039     PURPLE_PREF_INT,
00040     PURPLE_PREF_STRING,
00041     PURPLE_PREF_STRING_LIST,
00042     PURPLE_PREF_PATH,
00043     PURPLE_PREF_PATH_LIST
00044 
00045 } PurplePrefType;
00046 
00051 typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type,
00052         gconstpointer val, gpointer data);
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 /**************************************************************************/
00062 /**************************************************************************/
00070 void *purple_prefs_get_handle(void);
00071 
00075 void purple_prefs_init(void);
00076 
00080 void purple_prefs_uninit(void);
00081 
00087 void purple_prefs_add_none(const char *name);
00088 
00095 void purple_prefs_add_bool(const char *name, gboolean value);
00096 
00103 void purple_prefs_add_int(const char *name, int value);
00104 
00111 void purple_prefs_add_string(const char *name, const char *value);
00112 
00119 void purple_prefs_add_string_list(const char *name, GList *value);
00120 
00127 void purple_prefs_add_path(const char *name, const char *value);
00128 
00135 void purple_prefs_add_path_list(const char *name, GList *value);
00136 
00137 
00143 void purple_prefs_remove(const char *name);
00144 
00151 void purple_prefs_rename(const char *oldname, const char *newname);
00152 
00159 void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
00160 
00164 void purple_prefs_destroy(void);
00165 
00172 void purple_prefs_set_generic(const char *name, gpointer value);
00173 
00180 void purple_prefs_set_bool(const char *name, gboolean value);
00181 
00188 void purple_prefs_set_int(const char *name, int value);
00189 
00196 void purple_prefs_set_string(const char *name, const char *value);
00197 
00204 void purple_prefs_set_string_list(const char *name, GList *value);
00205 
00212 void purple_prefs_set_path(const char *name, const char *value);
00213 
00220 void purple_prefs_set_path_list(const char *name, GList *value);
00221 
00222 
00229 gboolean purple_prefs_exists(const char *name);
00230 
00237 PurplePrefType purple_prefs_get_type(const char *name);
00238 
00245 gboolean purple_prefs_get_bool(const char *name);
00246 
00253 int purple_prefs_get_int(const char *name);
00254 
00261 const char *purple_prefs_get_string(const char *name);
00262 
00269 GList *purple_prefs_get_string_list(const char *name);
00270 
00277 const char *purple_prefs_get_path(const char *name);
00278 
00285 GList *purple_prefs_get_path_list(const char *name);
00286 
00287 /*
00288  * Returns a list of children for a pref
00289  *
00290  * @param name The parent pref
00291  * @return A list of newly allocated strings denoting the names of the children.
00292  *         Returns @c NULL if there are no children or if pref doesn't exist.
00293  *         The caller must free all the strings and the list.
00294  */
00295 GList *purple_prefs_get_children_names(const char *name);
00296 
00300 guint purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback cb,
00301         gpointer data);
00302 
00306 void purple_prefs_disconnect_callback(guint callback_id);
00307 
00311 void purple_prefs_disconnect_by_handle(void *handle);
00312 
00316 void purple_prefs_trigger_callback(const char *name);
00317 
00321 gboolean purple_prefs_load(void);
00322 
00326 void purple_prefs_update_old(void);
00327 
00330 #ifdef __cplusplus
00331 }
00332 #endif
00333 
00334 #endif /* _PURPLE_PREFS_H_ */