Mercurial > pidgin.yaz
annotate src/accountopt.h @ 6198:fcc28f5dd0c8
[gaim-migrate @ 6684]
Finish adding win32 files to dist
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Fri, 18 Jul 2003 01:34:45 +0000 |
parents | 158196b2db19 |
children | e30bedfb99db |
rev | line source |
---|---|
5639 | 1 /** |
2 * @file accountopt.h Account Options API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #ifndef _GAIM_ACCOUNT_OPT_H_ | |
24 #define _GAIM_ACCOUNT_OPT_H_ | |
25 | |
26 #include "prefs.h" | |
27 | |
28 /** | |
29 * An option for an account. | |
30 * | |
31 * This is set by protocol plugins, and appears in the account settings | |
32 * dialogs. | |
33 */ | |
34 typedef struct | |
35 { | |
36 GaimPrefType type; /**< The type of value. */ | |
37 | |
38 char *text; /**< The text that will appear to the user. */ | |
39 char *pref_name; /**< The name of the associated preference. */ | |
40 | |
41 union | |
42 { | |
43 gboolean boolean; /**< The default boolean value. */ | |
44 int integer; /**< The default integer value. */ | |
45 char *string; /**< The default string value. */ | |
46 | |
47 } default_value; | |
48 | |
49 } GaimAccountOption; | |
50 | |
51 /** | |
52 * A username split. | |
53 * | |
54 * This is used by some protocols to separate the fields of the username | |
55 * into more human-readable components. | |
56 */ | |
57 typedef struct | |
58 { | |
59 char *text; /**< The text that will appear to the user. */ | |
60 char *default_value; /**< The default value. */ | |
61 char field_sep; /**< The field separator. */ | |
62 | |
63 } GaimAccountUserSplit; | |
64 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
65 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
66 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
67 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
68 |
5639 | 69 /**************************************************************************/ |
70 /** @name Account Option API */ | |
71 /**************************************************************************/ | |
72 /*@{*/ | |
73 | |
74 /** | |
75 * Creates a new account option. | |
76 * | |
77 * @param type The type of option. | |
78 * @param text The text of the option. | |
79 * @param pref_name The account preference name for the option. | |
80 * | |
81 * @return The account option. | |
82 */ | |
83 GaimAccountOption *gaim_account_option_new(GaimPrefType type, const char *text, | |
84 const char *pref_name); | |
85 | |
86 /** | |
87 * Creates a new boolean account option. | |
88 * | |
89 * @param text The text of the option. | |
90 * @param pref_name The account preference name for the option. | |
91 * @param default_value The default value. | |
92 * | |
93 * @return The account option. | |
94 */ | |
95 GaimAccountOption *gaim_account_option_bool_new(const char *text, | |
96 const char *pref_name, | |
97 gboolean default_value); | |
98 | |
99 /** | |
100 * Creates a new integer account option. | |
101 * | |
102 * @param text The text of the option. | |
103 * @param pref_name The account preference name for the option. | |
104 * @param default_value The default value. | |
105 * | |
106 * @return The account option. | |
107 */ | |
108 GaimAccountOption *gaim_account_option_int_new(const char *text, | |
109 const char *pref_name, | |
110 int default_value); | |
111 | |
112 /** | |
113 * Creates a new string account option. | |
114 * | |
115 * @param text The text of the option. | |
116 * @param pref_name The account preference name for the option. | |
117 * @param default_value The default value. | |
118 * | |
119 * @return The account option. | |
120 */ | |
121 GaimAccountOption *gaim_account_option_string_new(const char *text, | |
122 const char *pref_name, | |
123 const char *default_value); | |
124 | |
125 /** | |
126 * Destroys an account option. | |
127 * | |
128 * @param option The option to destroy. | |
129 */ | |
130 void gaim_account_option_destroy(GaimAccountOption *option); | |
131 | |
132 /** | |
133 * Sets the default boolean value for an account option. | |
134 * | |
135 * @param option The account option. | |
136 * @param value The default boolean value. | |
137 */ | |
138 void gaim_account_option_set_default_bool(GaimAccountOption *option, | |
139 gboolean value); | |
140 | |
141 /** | |
142 * Sets the default integer value for an account option. | |
143 * | |
144 * @param option The account option. | |
145 * @param value The default integer value. | |
146 */ | |
147 void gaim_account_option_set_default_int(GaimAccountOption *option, | |
148 int value); | |
149 | |
150 /** | |
151 * Sets the default string value for an account option. | |
152 * | |
153 * @param option The account option. | |
154 * @param value The default string value. | |
155 */ | |
156 void gaim_account_option_set_default_string(GaimAccountOption *option, | |
157 const char *value); | |
158 | |
159 /** | |
160 * Returns the specified account option's type. | |
161 * | |
162 * @param option The account option. | |
163 * | |
164 * @return The account option's type. | |
165 */ | |
166 GaimPrefType gaim_account_option_get_type(const GaimAccountOption *option); | |
167 | |
168 /** | |
169 * Returns the text for an account option. | |
170 * | |
171 * @param option The accont option. | |
172 * | |
173 * @return The account option's text. | |
174 */ | |
175 const char *gaim_account_option_get_text(const GaimAccountOption *option); | |
176 | |
177 /** | |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
178 * Returns the account setting for an account option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
179 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
180 * @param option The accont option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
181 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
182 * @return The account setting. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
183 */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
184 const char *gaim_account_option_get_setting(const GaimAccountOption *option); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
185 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
186 /** |
5639 | 187 * Returns the default boolean value for an account option. |
188 * | |
189 * @param option The account option. | |
190 * | |
191 * @return The default boolean value. | |
192 */ | |
193 gboolean gaim_account_option_get_default_bool(const GaimAccountOption *option); | |
194 | |
195 /** | |
196 * Returns the default integer value for an account option. | |
197 * | |
198 * @param option The account option. | |
199 * | |
200 * @return The default integer value. | |
201 */ | |
202 int gaim_account_option_get_default_int(const GaimAccountOption *option); | |
203 | |
204 /** | |
205 * Returns the default string value for an account option. | |
206 * | |
207 * @param option The account option. | |
208 * | |
209 * @return The default string value. | |
210 */ | |
211 const char *gaim_account_option_get_default_string( | |
212 const GaimAccountOption *option); | |
213 | |
214 /*@}*/ | |
215 | |
216 | |
217 /**************************************************************************/ | |
218 /** @name Account User Split API */ | |
219 /**************************************************************************/ | |
220 /*@{*/ | |
221 | |
222 /** | |
223 * Creates a new account username split. | |
224 * | |
225 * @param text The text of the option. | |
226 * @param default_value The default value. | |
227 * @param sep The field separator. | |
228 * | |
229 * @return The new user split. | |
230 */ | |
231 GaimAccountUserSplit *gaim_account_user_split_new(const char *text, | |
232 const char *default_value, | |
233 char sep); | |
234 | |
235 /** | |
236 * Destroys an account username split. | |
237 * | |
238 * @param split The split to destroy. | |
239 */ | |
240 void gaim_account_user_split_destroy(GaimAccountUserSplit *split); | |
241 | |
242 /** | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
243 * Returns the text for an account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
244 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
245 * @param split The account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
246 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
247 * @return The account username split's text. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
248 */ |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
249 const char *gaim_account_user_split_get_text(const GaimAccountUserSplit *split); |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
250 |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
251 /** |
5639 | 252 * Returns the default string value for an account split. |
253 * | |
254 * @param split The account username split. | |
255 * | |
256 * @return The default string. | |
257 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
258 const char *gaim_account_user_split_get_default_value( |
5639 | 259 const GaimAccountUserSplit *split); |
260 | |
261 /** | |
262 * Returns the field separator for an account split. | |
263 * | |
264 * @param split The account username split. | |
265 * | |
266 * @return The field separator. | |
267 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
268 char gaim_account_user_split_get_separator(const GaimAccountUserSplit *split); |
5639 | 269 |
270 /*@}*/ | |
271 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
272 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
273 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
274 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
275 |
5639 | 276 #endif /* _GAIM_ACCOUNT_OPT_H_ */ |