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
|
|
27 /**
|
|
28 * Pref data types.
|
|
29 */
|
|
30 typedef enum _GaimPrefType
|
|
31 {
|
|
32 GAIM_PREF_NONE,
|
|
33 GAIM_PREF_BOOLEAN,
|
|
34 GAIM_PREF_INT,
|
|
35 GAIM_PREF_STRING
|
|
36 } GaimPrefType;
|
|
37
|
|
38 /**
|
|
39 * Pref change callback type
|
|
40 */
|
|
41
|
|
42 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
|
|
43 gpointer val, gpointer data);
|
|
44
|
|
45 /**************************************************************************/
|
|
46 /** @name Prefs API */
|
|
47 /**************************************************************************/
|
|
48 /*@{*/
|
|
49
|
|
50 /**
|
|
51 * Initialize core prefs
|
|
52 */
|
|
53 void gaim_prefs_init();
|
|
54
|
|
55 /**
|
|
56 * Add a new typeless pref.
|
|
57 *
|
|
58 * @param name The name of the pref
|
|
59 */
|
|
60 void gaim_prefs_add_none(const char *name);
|
|
61
|
|
62 /**
|
|
63 * Add a new boolean pref.
|
|
64 *
|
|
65 * @param name The name of the pref
|
|
66 * @param value The initial value to set
|
|
67 */
|
|
68 void gaim_prefs_add_bool(const char *name, gboolean value);
|
|
69
|
|
70 /**
|
|
71 * Add a new integer pref.
|
|
72 *
|
|
73 * @param name The name of the pref
|
|
74 * @param value The initial value to set
|
|
75 */
|
|
76 void gaim_prefs_add_int(const char *name, int value);
|
|
77
|
|
78 /**
|
|
79 * Add a new string pref.
|
|
80 *
|
|
81 * @param name The name of the pref
|
|
82 * @param value The initial value to set
|
|
83 */
|
|
84 void gaim_prefs_add_string(const char *name, const char *value);
|
|
85
|
|
86 /**
|
|
87 * Remove a pref.
|
|
88 *
|
|
89 * @param name The name of the pref
|
|
90 */
|
|
91 void gaim_prefs_remove(const char *name);
|
|
92
|
|
93 /**
|
|
94 * Remove all prefs.
|
|
95 */
|
|
96 void gaim_prefs_destroy();
|
|
97
|
|
98 /**
|
|
99 * Set raw pref value
|
|
100 *
|
|
101 * @param name The name of the pref
|
|
102 * @param value The value to set
|
|
103 */
|
|
104 void gaim_prefs_set_generic(const char *name, gpointer value);
|
|
105
|
|
106 /**
|
|
107 * Set boolean pref value
|
|
108 *
|
|
109 * @param name The name of the pref
|
|
110 * @param value The value to set
|
|
111 */
|
|
112 void gaim_prefs_set_bool(const char *name, gboolean value);
|
|
113
|
|
114 /**
|
|
115 * Set integer pref value
|
|
116 *
|
|
117 * @param name The name of the pref
|
|
118 * @param value The value to set
|
|
119 */
|
|
120 void gaim_prefs_set_int(const char *name, int value);
|
|
121
|
|
122 /**
|
|
123 * Set string pref value
|
|
124 *
|
|
125 * @param name The name of the pref
|
|
126 * @param value The value to set
|
|
127 */
|
5451
|
128 void gaim_prefs_set_string(const char *name, const char *value);
|
5441
|
129
|
|
130 /**
|
|
131 * Get boolean pref value
|
|
132 *
|
|
133 * @param name The name of the pref
|
|
134 * @return The value of the pref
|
|
135 */
|
|
136 gboolean gaim_prefs_get_bool(const char *name);
|
|
137
|
|
138 /**
|
|
139 * Get integer pref value
|
|
140 *
|
|
141 * @param name The name of the pref
|
|
142 * @return The value of the pref
|
|
143 */
|
|
144 int gaim_prefs_get_int(const char *name);
|
|
145
|
|
146 /**
|
|
147 * Get string pref value
|
|
148 *
|
|
149 * @param name The name of the pref
|
|
150 * @return The value of the pref
|
|
151 */
|
|
152 char *gaim_prefs_get_string(const char *name);
|
|
153
|
|
154 /**
|
|
155 * Add a callback to a pref (and its children)
|
|
156 */
|
|
157 guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb,
|
|
158 gpointer data);
|
|
159
|
|
160 /**
|
|
161 * Remove a callback to a pref
|
|
162 */
|
|
163 void gaim_prefs_disconnect_callback(guint callback_id);
|
|
164
|
|
165 /**
|
|
166 * Read preferences
|
|
167 */
|
|
168 void gaim_prefs_load();
|
|
169
|
|
170 /**
|
|
171 * Write preferences
|
|
172 */
|
|
173 void gaim_prefs_save();
|
|
174
|
|
175 /**
|
|
176 * Force an immediate write of preferences
|
|
177 */
|
|
178 void gaim_prefs_sync();
|
|
179
|
|
180 /*@}*/
|
|
181
|
|
182 #endif /* _PREFS_H_ */
|