Mercurial > pidgin
annotate src/accountopt.h @ 13294:8cecf7929eb3
[gaim-migrate @ 15660]
Sean apparently doesn't build with dbus.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Thu, 16 Feb 2006 01:41:52 +0000 |
parents | d5937f126c60 |
children | 128324dcc821 |
rev | line source |
---|---|
5639 | 1 /** |
2 * @file accountopt.h Account Options API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 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. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
10 * |
5639 | 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 */ | |
9713 | 25 #ifndef _GAIM_ACCOUNTOPT_H_ |
26 #define _GAIM_ACCOUNTOPT_H_ | |
5639 | 27 |
28 #include "prefs.h" | |
29 | |
30 /** | |
31 * An option for an account. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
32 * |
5639 | 33 * This is set by protocol plugins, and appears in the account settings |
34 * dialogs. | |
35 */ | |
36 typedef struct | |
37 { | |
38 GaimPrefType type; /**< The type of value. */ | |
39 | |
40 char *text; /**< The text that will appear to the user. */ | |
41 char *pref_name; /**< The name of the associated preference. */ | |
42 | |
43 union | |
44 { | |
45 gboolean boolean; /**< The default boolean value. */ | |
46 int integer; /**< The default integer value. */ | |
47 char *string; /**< The default string value. */ | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
48 GList *list; /**< The default list value. */ |
5639 | 49 |
50 } default_value; | |
51 | |
10658 | 52 gboolean masked; |
53 | |
5639 | 54 } GaimAccountOption; |
55 | |
56 /** | |
57 * A username split. | |
58 * | |
59 * This is used by some protocols to separate the fields of the username | |
60 * into more human-readable components. | |
61 */ | |
62 typedef struct | |
63 { | |
64 char *text; /**< The text that will appear to the user. */ | |
65 char *default_value; /**< The default value. */ | |
66 char field_sep; /**< The field separator. */ | |
67 | |
68 } GaimAccountUserSplit; | |
69 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
70 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
71 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
72 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
73 |
5639 | 74 /**************************************************************************/ |
75 /** @name Account Option API */ | |
76 /**************************************************************************/ | |
77 /*@{*/ | |
78 | |
79 /** | |
80 * Creates a new account option. | |
81 * | |
82 * @param type The type of option. | |
83 * @param text The text of the option. | |
84 * @param pref_name The account preference name for the option. | |
85 * | |
86 * @return The account option. | |
87 */ | |
88 GaimAccountOption *gaim_account_option_new(GaimPrefType type, const char *text, | |
89 const char *pref_name); | |
90 | |
91 /** | |
92 * Creates a new boolean account option. | |
93 * | |
94 * @param text The text of the option. | |
95 * @param pref_name The account preference name for the option. | |
96 * @param default_value The default value. | |
97 * | |
98 * @return The account option. | |
99 */ | |
100 GaimAccountOption *gaim_account_option_bool_new(const char *text, | |
101 const char *pref_name, | |
102 gboolean default_value); | |
103 | |
104 /** | |
105 * Creates a new integer account option. | |
106 * | |
107 * @param text The text of the option. | |
108 * @param pref_name The account preference name for the option. | |
109 * @param default_value The default value. | |
110 * | |
111 * @return The account option. | |
112 */ | |
113 GaimAccountOption *gaim_account_option_int_new(const char *text, | |
114 const char *pref_name, | |
115 int default_value); | |
116 | |
117 /** | |
118 * Creates a new string account option. | |
119 * | |
120 * @param text The text of the option. | |
121 * @param pref_name The account preference name for the option. | |
122 * @param default_value The default value. | |
123 * | |
124 * @return The account option. | |
125 */ | |
126 GaimAccountOption *gaim_account_option_string_new(const char *text, | |
127 const char *pref_name, | |
128 const char *default_value); | |
129 | |
130 /** | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
131 * Creates a new list account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
132 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
133 * The list passed will be owned by the account option, and the |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
134 * strings inside will be freed automatically. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
135 * |
12106 | 136 * The list is a list of GaimKeyValuePair items. The key is the ID stored and |
137 * used internally, and the value is the label displayed. | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
138 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
139 * @param text The text of the option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
140 * @param pref_name The account preference name for the option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
141 * @param list The key, value list. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
142 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
143 * @return The account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
144 */ |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
145 GaimAccountOption *gaim_account_option_list_new(const char *text, |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
146 const char *pref_name, |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
147 GList *list); |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
148 |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
149 /** |
5639 | 150 * Destroys an account option. |
151 * | |
152 * @param option The option to destroy. | |
153 */ | |
154 void gaim_account_option_destroy(GaimAccountOption *option); | |
155 | |
156 /** | |
157 * Sets the default boolean value for an account option. | |
158 * | |
159 * @param option The account option. | |
160 * @param value The default boolean value. | |
161 */ | |
162 void gaim_account_option_set_default_bool(GaimAccountOption *option, | |
163 gboolean value); | |
164 | |
165 /** | |
166 * Sets the default integer value for an account option. | |
167 * | |
168 * @param option The account option. | |
169 * @param value The default integer value. | |
170 */ | |
171 void gaim_account_option_set_default_int(GaimAccountOption *option, | |
172 int value); | |
173 | |
174 /** | |
175 * Sets the default string value for an account option. | |
176 * | |
177 * @param option The account option. | |
178 * @param value The default string value. | |
179 */ | |
180 void gaim_account_option_set_default_string(GaimAccountOption *option, | |
181 const char *value); | |
182 | |
183 /** | |
10658 | 184 * Sets the masking for an account option. |
185 * | |
186 * @param option The account option. | |
187 * @param masked The masking. | |
188 */ | |
189 void | |
190 gaim_account_option_set_masked(GaimAccountOption *option, gboolean masked); | |
191 | |
192 /** | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
193 * Sets the list values for an account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
194 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
195 * The list passed will be owned by the account option, and the |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
196 * strings inside will be freed automatically. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
197 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
198 * The list is in key, value pairs. The key is the ID stored and used |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
199 * internally, and the value is the label displayed. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
200 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
201 * @param option The account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
202 * @param values The default list value. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
203 */ |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
204 void gaim_account_option_set_list(GaimAccountOption *option, GList *values); |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
205 |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
206 /** |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
207 * Adds an item to a list account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
208 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
209 * @param option The account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
210 * @param key The key. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
211 * @param value The value. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
212 */ |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
213 void gaim_account_option_add_list_item(GaimAccountOption *option, |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
214 const char *key, const char *value); |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
215 |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
216 /** |
5639 | 217 * Returns the specified account option's type. |
218 * | |
219 * @param option The account option. | |
220 * | |
221 * @return The account option's type. | |
222 */ | |
223 GaimPrefType gaim_account_option_get_type(const GaimAccountOption *option); | |
224 | |
225 /** | |
226 * Returns the text for an account option. | |
227 * | |
228 * @param option The accont option. | |
229 * | |
230 * @return The account option's text. | |
231 */ | |
232 const char *gaim_account_option_get_text(const GaimAccountOption *option); | |
233 | |
234 /** | |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
235 * Returns the account setting for an account option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
236 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
237 * @param option The accont option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
238 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
239 * @return The account setting. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
240 */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
241 const char *gaim_account_option_get_setting(const GaimAccountOption *option); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
242 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
243 /** |
5639 | 244 * Returns the default boolean value for an account option. |
245 * | |
246 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
247 * |
5639 | 248 * @return The default boolean value. |
249 */ | |
250 gboolean gaim_account_option_get_default_bool(const GaimAccountOption *option); | |
251 | |
252 /** | |
253 * Returns the default integer value for an account option. | |
254 * | |
255 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
256 * |
5639 | 257 * @return The default integer value. |
258 */ | |
259 int gaim_account_option_get_default_int(const GaimAccountOption *option); | |
260 | |
261 /** | |
262 * Returns the default string value for an account option. | |
263 * | |
264 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
265 * |
5639 | 266 * @return The default string value. |
267 */ | |
268 const char *gaim_account_option_get_default_string( | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
269 const GaimAccountOption *option); |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
270 |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
271 /** |
12172 | 272 * Returns the default string value for a list account option. |
273 * | |
274 * @param option The account option. | |
275 * | |
276 * @return The default list string value. | |
277 */ | |
278 const char *gaim_account_option_get_default_list_value( | |
279 const GaimAccountOption *option); | |
280 | |
281 /** | |
10658 | 282 * Returns the masking for an account option. |
283 * | |
284 * @param option The account option. | |
285 * | |
286 * @return The masking. | |
287 */ | |
288 gboolean | |
289 gaim_account_option_get_masked(const GaimAccountOption *option); | |
290 | |
291 /** | |
8570
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
292 * Returns the list values for an account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
293 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
294 * @param option The account option. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
295 * |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
296 * @return The list values. |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
297 */ |
1a62ab7225f3
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
298 const GList *gaim_account_option_get_list(const GaimAccountOption *option); |
5639 | 299 |
300 /*@}*/ | |
301 | |
302 | |
303 /**************************************************************************/ | |
304 /** @name Account User Split API */ | |
305 /**************************************************************************/ | |
306 /*@{*/ | |
307 | |
308 /** | |
309 * Creates a new account username split. | |
310 * | |
311 * @param text The text of the option. | |
312 * @param default_value The default value. | |
313 * @param sep The field separator. | |
314 * | |
315 * @return The new user split. | |
316 */ | |
317 GaimAccountUserSplit *gaim_account_user_split_new(const char *text, | |
318 const char *default_value, | |
319 char sep); | |
320 | |
321 /** | |
322 * Destroys an account username split. | |
323 * | |
324 * @param split The split to destroy. | |
325 */ | |
326 void gaim_account_user_split_destroy(GaimAccountUserSplit *split); | |
327 | |
328 /** | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
329 * Returns the text for an account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
330 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
331 * @param split The account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
332 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
333 * @return The account username split's text. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
334 */ |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
335 const char *gaim_account_user_split_get_text(const GaimAccountUserSplit *split); |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
336 |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
337 /** |
5639 | 338 * Returns the default string value for an account split. |
339 * | |
340 * @param split The account username split. | |
341 * | |
342 * @return The default string. | |
343 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
344 const char *gaim_account_user_split_get_default_value( |
5639 | 345 const GaimAccountUserSplit *split); |
346 | |
347 /** | |
348 * Returns the field separator for an account split. | |
349 * | |
350 * @param split The account username split. | |
351 * | |
352 * @return The field separator. | |
353 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
354 char gaim_account_user_split_get_separator(const GaimAccountUserSplit *split); |
5639 | 355 |
356 /*@}*/ | |
357 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
358 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
359 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
360 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
361 |
9713 | 362 #endif /* _GAIM_ACCOUNTOPT_H_ */ |