comparison src/accountopt.h @ 5639:408fef845144

[gaim-migrate @ 6051] Forgot to add these files. Oops. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 01 Jun 2003 19:34:26 +0000
parents
children c52a97f3739e
comparison
equal deleted inserted replaced
5638:0bdfa28c678e 5639:408fef845144
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
65 /**************************************************************************/
66 /** @name Account Option API */
67 /**************************************************************************/
68 /*@{*/
69
70 /**
71 * Creates a new account option.
72 *
73 * @param type The type of option.
74 * @param text The text of the option.
75 * @param pref_name The account preference name for the option.
76 *
77 * @return The account option.
78 */
79 GaimAccountOption *gaim_account_option_new(GaimPrefType type, const char *text,
80 const char *pref_name);
81
82 /**
83 * Creates a new boolean account option.
84 *
85 * @param text The text of the option.
86 * @param pref_name The account preference name for the option.
87 * @param default_value The default value.
88 *
89 * @return The account option.
90 */
91 GaimAccountOption *gaim_account_option_bool_new(const char *text,
92 const char *pref_name,
93 gboolean default_value);
94
95 /**
96 * Creates a new integer account option.
97 *
98 * @param text The text of the option.
99 * @param pref_name The account preference name for the option.
100 * @param default_value The default value.
101 *
102 * @return The account option.
103 */
104 GaimAccountOption *gaim_account_option_int_new(const char *text,
105 const char *pref_name,
106 int default_value);
107
108 /**
109 * Creates a new string account option.
110 *
111 * @param text The text of the option.
112 * @param pref_name The account preference name for the option.
113 * @param default_value The default value.
114 *
115 * @return The account option.
116 */
117 GaimAccountOption *gaim_account_option_string_new(const char *text,
118 const char *pref_name,
119 const char *default_value);
120
121 /**
122 * Destroys an account option.
123 *
124 * @param option The option to destroy.
125 */
126 void gaim_account_option_destroy(GaimAccountOption *option);
127
128 /**
129 * Sets the default boolean value for an account option.
130 *
131 * @param option The account option.
132 * @param value The default boolean value.
133 */
134 void gaim_account_option_set_default_bool(GaimAccountOption *option,
135 gboolean value);
136
137 /**
138 * Sets the default integer value for an account option.
139 *
140 * @param option The account option.
141 * @param value The default integer value.
142 */
143 void gaim_account_option_set_default_int(GaimAccountOption *option,
144 int value);
145
146 /**
147 * Sets the default string value for an account option.
148 *
149 * @param option The account option.
150 * @param value The default string value.
151 */
152 void gaim_account_option_set_default_string(GaimAccountOption *option,
153 const char *value);
154
155 /**
156 * Returns the specified account option's type.
157 *
158 * @param option The account option.
159 *
160 * @return The account option's type.
161 */
162 GaimPrefType gaim_account_option_get_type(const GaimAccountOption *option);
163
164 /**
165 * Returns the text for an account option.
166 *
167 * @param option The accont option.
168 *
169 * @return The account option's text.
170 */
171 const char *gaim_account_option_get_text(const GaimAccountOption *option);
172
173 /**
174 * Returns the default boolean value for an account option.
175 *
176 * @param option The account option.
177 *
178 * @return The default boolean value.
179 */
180 gboolean gaim_account_option_get_default_bool(const GaimAccountOption *option);
181
182 /**
183 * Returns the default integer value for an account option.
184 *
185 * @param option The account option.
186 *
187 * @return The default integer value.
188 */
189 int gaim_account_option_get_default_int(const GaimAccountOption *option);
190
191 /**
192 * Returns the default string value for an account option.
193 *
194 * @param option The account option.
195 *
196 * @return The default string value.
197 */
198 const char *gaim_account_option_get_default_string(
199 const GaimAccountOption *option);
200
201 /*@}*/
202
203
204 /**************************************************************************/
205 /** @name Account User Split API */
206 /**************************************************************************/
207 /*@{*/
208
209 /**
210 * Creates a new account username split.
211 *
212 * @param text The text of the option.
213 * @param default_value The default value.
214 * @param sep The field separator.
215 *
216 * @return The new user split.
217 */
218 GaimAccountUserSplit *gaim_account_user_split_new(const char *text,
219 const char *default_value,
220 char sep);
221
222 /**
223 * Destroys an account username split.
224 *
225 * @param split The split to destroy.
226 */
227 void gaim_account_user_split_destroy(GaimAccountUserSplit *split);
228
229 /**
230 * Returns the default string value for an account split.
231 *
232 * @param split The account username split.
233 *
234 * @return The default string.
235 */
236 const char *gaim_account_split_get_default_value(
237 const GaimAccountUserSplit *split);
238
239 /**
240 * Returns the field separator for an account split.
241 *
242 * @param split The account username split.
243 *
244 * @return The field separator.
245 */
246 char gaim_account_split_get_separator(const GaimAccountUserSplit *split);
247
248 /*@}*/
249
250 #endif /* _GAIM_ACCOUNT_OPT_H_ */