Mercurial > pidgin
annotate src/prefs.h @ 6638:dbc3bdcc8861
[gaim-migrate @ 7163]
This will make Gaim and jabberd2 get along a little better
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 27 Aug 2003 20:34:12 +0000 |
parents | 4bc050b1af34 |
children | 8c1b5dd87fbf |
rev | line source |
---|---|
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
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5561
diff
changeset
|
27 #include <glib.h> |
0bdfa28c678e
[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 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
39 |
5441 | 40 } GaimPrefType; |
41 | |
42 /** | |
43 * Pref change callback type | |
44 */ | |
45 | |
46 typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type, | |
47 gpointer val, gpointer data); | |
48 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
49 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
50 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
51 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
52 |
5441 | 53 /**************************************************************************/ |
54 /** @name Prefs API */ | |
55 /**************************************************************************/ | |
56 /*@{*/ | |
57 | |
58 /** | |
59 * Initialize core prefs | |
60 */ | |
61 void gaim_prefs_init(); | |
62 | |
63 /** | |
64 * Add a new typeless pref. | |
65 * | |
66 * @param name The name of the pref | |
67 */ | |
68 void gaim_prefs_add_none(const char *name); | |
69 | |
70 /** | |
71 * Add a new boolean pref. | |
72 * | |
73 * @param name The name of the pref | |
74 * @param value The initial value to set | |
75 */ | |
76 void gaim_prefs_add_bool(const char *name, gboolean value); | |
77 | |
78 /** | |
79 * Add a new integer pref. | |
80 * | |
81 * @param name The name of the pref | |
82 * @param value The initial value to set | |
83 */ | |
84 void gaim_prefs_add_int(const char *name, int value); | |
85 | |
86 /** | |
87 * Add a new string pref. | |
88 * | |
89 * @param name The name of the pref | |
90 * @param value The initial value to set | |
91 */ | |
92 void gaim_prefs_add_string(const char *name, const char *value); | |
93 | |
94 /** | |
5561 | 95 * Add a new string list pref. |
96 * | |
97 * @param name The name of the pref | |
98 * @param value The initial value to set | |
99 */ | |
100 void gaim_prefs_add_string_list(const char *name, GList *value); | |
101 | |
102 /** | |
5441 | 103 * Remove a pref. |
104 * | |
105 * @param name The name of the pref | |
106 */ | |
107 void gaim_prefs_remove(const char *name); | |
108 | |
109 /** | |
110 * Remove all prefs. | |
111 */ | |
112 void gaim_prefs_destroy(); | |
113 | |
114 /** | |
115 * Set raw pref value | |
116 * | |
117 * @param name The name of the pref | |
118 * @param value The value to set | |
119 */ | |
120 void gaim_prefs_set_generic(const char *name, gpointer value); | |
121 | |
122 /** | |
123 * Set boolean pref value | |
124 * | |
125 * @param name The name of the pref | |
126 * @param value The value to set | |
127 */ | |
128 void gaim_prefs_set_bool(const char *name, gboolean value); | |
129 | |
130 /** | |
131 * Set integer pref value | |
132 * | |
133 * @param name The name of the pref | |
134 * @param value The value to set | |
135 */ | |
136 void gaim_prefs_set_int(const char *name, int value); | |
137 | |
138 /** | |
139 * Set string pref value | |
140 * | |
141 * @param name The name of the pref | |
142 * @param value The value to set | |
143 */ | |
5451 | 144 void gaim_prefs_set_string(const char *name, const char *value); |
5441 | 145 |
146 /** | |
5561 | 147 * Set string pref value |
148 * | |
149 * @param name The name of the pref | |
150 * @param value The value to set | |
151 */ | |
152 void gaim_prefs_set_string_list(const char *name, GList *value); | |
153 | |
154 /** | |
6538 | 155 * Get pref type |
156 * | |
157 * @param name The name of the pref | |
158 * @return The type of the pref | |
159 */ | |
160 GaimPrefType gaim_prefs_get_type(const char *name); | |
161 | |
162 /** | |
5441 | 163 * Get boolean pref value |
164 * | |
165 * @param name The name of the pref | |
166 * @return The value of the pref | |
167 */ | |
168 gboolean gaim_prefs_get_bool(const char *name); | |
169 | |
170 /** | |
171 * Get integer pref value | |
172 * | |
173 * @param name The name of the pref | |
174 * @return The value of the pref | |
175 */ | |
176 int gaim_prefs_get_int(const char *name); | |
177 | |
178 /** | |
179 * Get string pref value | |
180 * | |
181 * @param name The name of the pref | |
182 * @return The value of the pref | |
183 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
184 const char *gaim_prefs_get_string(const char *name); |
5441 | 185 |
186 /** | |
5561 | 187 * Get string pref value |
188 * | |
189 * @param name The name of the pref | |
190 * @return The value of the pref | |
191 */ | |
192 GList *gaim_prefs_get_string_list(const char *name); | |
193 | |
194 /** | |
5441 | 195 * Add a callback to a pref (and its children) |
196 */ | |
197 guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb, | |
198 gpointer data); | |
199 | |
200 /** | |
201 * Remove a callback to a pref | |
202 */ | |
203 void gaim_prefs_disconnect_callback(guint callback_id); | |
204 | |
205 /** | |
5684 | 206 * Trigger callbacks as if the pref changed |
207 */ | |
208 void gaim_prefs_trigger_callback(const char *name); | |
209 | |
210 /** | |
5441 | 211 * Read preferences |
212 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5534
diff
changeset
|
213 gboolean gaim_prefs_load(); |
5441 | 214 |
215 /** | |
216 * Force an immediate write of preferences | |
217 */ | |
218 void gaim_prefs_sync(); | |
219 | |
220 /*@}*/ | |
221 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
222 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
223 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
224 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
225 |
5441 | 226 #endif /* _PREFS_H_ */ |