Mercurial > pidgin.yaz
comparison src/accountopt.c @ 12172:d5937f126c60
[gaim-migrate @ 14474]
Fix the bugs with the account option string lists that Pekka Riikonen
mentioned on gaim-devel
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 20 Nov 2005 17:29:09 +0000 |
parents | 61930cadca7c |
children | f09c6e8df82c |
comparison
equal
deleted
inserted
replaced
12171:ffdd2ccf3a53 | 12172:d5937f126c60 |
---|---|
21 * You should have received a copy of the GNU General Public License | 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 | 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 | 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 */ | 24 */ |
25 #include "accountopt.h" | 25 #include "accountopt.h" |
26 #include "util.h" | |
26 | 27 |
27 GaimAccountOption * | 28 GaimAccountOption * |
28 gaim_account_option_new(GaimPrefType type, const char *text, | 29 gaim_account_option_new(GaimPrefType type, const char *text, |
29 const char *pref_name) | 30 const char *pref_name) |
30 { | 31 { |
195 | 196 |
196 void | 197 void |
197 gaim_account_option_add_list_item(GaimAccountOption *option, | 198 gaim_account_option_add_list_item(GaimAccountOption *option, |
198 const char *key, const char *value) | 199 const char *key, const char *value) |
199 { | 200 { |
201 GaimKeyValuePair *kvp; | |
202 | |
200 g_return_if_fail(option != NULL); | 203 g_return_if_fail(option != NULL); |
201 g_return_if_fail(key != NULL); | 204 g_return_if_fail(key != NULL); |
202 g_return_if_fail(value != NULL); | 205 g_return_if_fail(value != NULL); |
203 g_return_if_fail(option->type == GAIM_PREF_STRING_LIST); | 206 g_return_if_fail(option->type == GAIM_PREF_STRING_LIST); |
204 | 207 |
208 kvp = g_new0(GaimKeyValuePair, 1); | |
209 kvp->key = g_strdup(key); | |
210 kvp->value = g_strdup(value); | |
211 | |
205 option->default_value.list = g_list_append(option->default_value.list, | 212 option->default_value.list = g_list_append(option->default_value.list, |
206 g_strdup(key)); | 213 kvp); |
207 option->default_value.list = g_list_append(option->default_value.list, | |
208 g_strdup(value)); | |
209 } | 214 } |
210 | 215 |
211 GaimPrefType | 216 GaimPrefType |
212 gaim_account_option_get_type(const GaimAccountOption *option) | 217 gaim_account_option_get_type(const GaimAccountOption *option) |
213 { | 218 { |
255 { | 260 { |
256 g_return_val_if_fail(option != NULL, NULL); | 261 g_return_val_if_fail(option != NULL, NULL); |
257 g_return_val_if_fail(option->type == GAIM_PREF_STRING, NULL); | 262 g_return_val_if_fail(option->type == GAIM_PREF_STRING, NULL); |
258 | 263 |
259 return option->default_value.string; | 264 return option->default_value.string; |
265 } | |
266 | |
267 const char * | |
268 gaim_account_option_get_default_list_value(const GaimAccountOption *option) | |
269 { | |
270 GaimKeyValuePair *kvp; | |
271 | |
272 g_return_val_if_fail(option != NULL, NULL); | |
273 g_return_val_if_fail(option->type == GAIM_PREF_STRING_LIST, NULL); | |
274 | |
275 if (option->default_value.list == NULL) | |
276 return NULL; | |
277 | |
278 kvp = option->default_value.list->data; | |
279 | |
280 return (kvp ? kvp->value : NULL); | |
260 } | 281 } |
261 | 282 |
262 gboolean | 283 gboolean |
263 gaim_account_option_get_masked(const GaimAccountOption *option) | 284 gaim_account_option_get_masked(const GaimAccountOption *option) |
264 { | 285 { |