prefs.h

Go to the documentation of this file.
00001 
00026 #ifndef _PURPLE_PREFS_H_
00027 #define _PURPLE_PREFS_H_
00028 
00029 #include <glib.h>
00030 
00034 typedef enum _PurplePrefType
00035 {
00036     PURPLE_PREF_NONE,
00037     PURPLE_PREF_BOOLEAN,
00038     PURPLE_PREF_INT,
00039     PURPLE_PREF_STRING,
00040     PURPLE_PREF_STRING_LIST,
00041     PURPLE_PREF_PATH,
00042     PURPLE_PREF_PATH_LIST
00043 
00044 } PurplePrefType;
00045 
00050 typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type,
00051         gconstpointer val, gpointer data);
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /**************************************************************************/
00059 /**************************************************************************/
00067 void *purple_prefs_get_handle(void);
00068 
00072 void purple_prefs_init(void);
00073 
00077 void purple_prefs_uninit(void);
00078 
00084 void purple_prefs_add_none(const char *name);
00085 
00092 void purple_prefs_add_bool(const char *name, gboolean value);
00093 
00100 void purple_prefs_add_int(const char *name, int value);
00101 
00108 void purple_prefs_add_string(const char *name, const char *value);
00109 
00116 void purple_prefs_add_string_list(const char *name, GList *value);
00117 
00124 void purple_prefs_add_path(const char *name, const char *value);
00125 
00132 void purple_prefs_add_path_list(const char *name, GList *value);
00133 
00134 
00140 void purple_prefs_remove(const char *name);
00141 
00148 void purple_prefs_rename(const char *oldname, const char *newname);
00149 
00156 void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname);
00157 
00161 void purple_prefs_destroy(void);
00162 
00169 void purple_prefs_set_generic(const char *name, gpointer value);
00170 
00177 void purple_prefs_set_bool(const char *name, gboolean value);
00178 
00185 void purple_prefs_set_int(const char *name, int value);
00186 
00193 void purple_prefs_set_string(const char *name, const char *value);
00194 
00201 void purple_prefs_set_string_list(const char *name, GList *value);
00202 
00209 void purple_prefs_set_path(const char *name, const char *value);
00210 
00217 void purple_prefs_set_path_list(const char *name, GList *value);
00218 
00219 
00226 gboolean purple_prefs_exists(const char *name);
00227 
00234 PurplePrefType purple_prefs_get_type(const char *name);
00235 
00242 gboolean purple_prefs_get_bool(const char *name);
00243 
00250 int purple_prefs_get_int(const char *name);
00251 
00258 const char *purple_prefs_get_string(const char *name);
00259 
00266 GList *purple_prefs_get_string_list(const char *name);
00267 
00274 const char *purple_prefs_get_path(const char *name);
00275 
00282 GList *purple_prefs_get_path_list(const char *name);
00283 
00284 /*
00285  * Returns a list of children for a pref
00286  *
00287  * @param name The parent pref
00288  * @return A list of newly allocated strings denoting the names of the children.
00289  *         Returns @c NULL if there are no children or if pref doesn't exist.
00290  *         The caller must free all the strings and the list.
00291  */
00292 GList *purple_prefs_get_children_names(const char *name);
00293 
00297 guint purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback cb,
00298         gpointer data);
00299 
00303 void purple_prefs_disconnect_callback(guint callback_id);
00304 
00308 void purple_prefs_disconnect_by_handle(void *handle);
00309 
00313 void purple_prefs_trigger_callback(const char *name);
00314 
00318 gboolean purple_prefs_load(void);
00319 
00323 void purple_prefs_update_old(void);
00324 
00327 #ifdef __cplusplus
00328 }
00329 #endif
00330 
00331 #endif /* _PURPLE_PREFS_H_ */