annotate src/accountopt.c @ 12067:e859c1663a27

[gaim-migrate @ 14362] Revert GtkSpell dynamic loading. A GtkSpell plugin is a better idea, and nosnilmot says he has one that's close to fully functional. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 13 Nov 2005 01:44:11 +0000
parents 61930cadca7c
children d5937f126c60
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file accountopt.c Account Options API
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6902
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6902
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6902
diff changeset
9 * source distribution.
6902
e30bedfb99db [gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
10 *
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "accountopt.h"
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 GaimAccountOption *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 gaim_account_option_new(GaimPrefType type, const char *text,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 const char *pref_name)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 GaimAccountOption *option;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
33 g_return_val_if_fail(type != GAIM_PREF_NONE, NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
34 g_return_val_if_fail(text != NULL, NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
35 g_return_val_if_fail(pref_name != NULL, NULL);
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 option = g_new0(GaimAccountOption, 1);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 option->type = type;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 option->text = g_strdup(text);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 option->pref_name = g_strdup(pref_name);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 return option;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 GaimAccountOption *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 gaim_account_option_bool_new(const char *text, const char *pref_name,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 gboolean default_value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 GaimAccountOption *option;
6902
e30bedfb99db [gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
51
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 option = gaim_account_option_new(GAIM_PREF_BOOLEAN, text, pref_name);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 if (option == NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 return NULL;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 option->default_value.boolean = default_value;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 return option;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 GaimAccountOption *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 gaim_account_option_int_new(const char *text, const char *pref_name,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 int default_value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 GaimAccountOption *option;
6902
e30bedfb99db [gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
67
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 option = gaim_account_option_new(GAIM_PREF_INT, text, pref_name);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 if (option == NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 return NULL;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 option->default_value.integer = default_value;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 return option;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 GaimAccountOption *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 gaim_account_option_string_new(const char *text, const char *pref_name,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 const char *default_value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 GaimAccountOption *option;
6902
e30bedfb99db [gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents: 5663
diff changeset
83
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 option = gaim_account_option_new(GAIM_PREF_STRING, text, pref_name);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 if (option == NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 return NULL;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 if (default_value != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 option->default_value.string = g_strdup(default_value);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 return option;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
95 GaimAccountOption *
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
96 gaim_account_option_list_new(const char *text, const char *pref_name,
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
97 GList *list)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
98 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
99 GaimAccountOption *option;
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
100
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
101 option = gaim_account_option_new(GAIM_PREF_STRING_LIST, text, pref_name);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
102
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
103 if (option == NULL)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
104 return NULL;
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
105
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
106 option->default_value.list = list;
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
107
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
108 return option;
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
109 }
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
110
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 void
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 gaim_account_option_destroy(GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 g_return_if_fail(option != NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 if (option->text != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 g_free(option->text);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 if (option->pref_name != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 g_free(option->pref_name);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
122 if (option->type == GAIM_PREF_STRING)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
123 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
124 if (option->default_value.string != NULL)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
125 g_free(option->default_value.string);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
126 }
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
127 else if (option->type == GAIM_PREF_STRING_LIST)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
128 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
129 if (option->default_value.list != NULL)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
130 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
131 g_list_foreach(option->default_value.list, (GFunc)g_free, NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
132 g_list_free(option->default_value.list);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
133 }
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 g_free(option);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 void
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 gaim_account_option_set_default_bool(GaimAccountOption *option,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 gboolean value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 g_return_if_fail(option != NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 g_return_if_fail(option->type == GAIM_PREF_BOOLEAN);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 option->default_value.boolean = value;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 void
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 gaim_account_option_set_default_int(GaimAccountOption *option, int value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 g_return_if_fail(option != NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 g_return_if_fail(option->type == GAIM_PREF_INT);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 option->default_value.integer = value;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 void
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 gaim_account_option_set_default_string(GaimAccountOption *option,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 const char *value)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 g_return_if_fail(option != NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 g_return_if_fail(option->type == GAIM_PREF_STRING);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 if (option->default_value.string != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 g_free(option->default_value.string);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 option->default_value.string = (value == NULL ? NULL : g_strdup(value));
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
171 void
10658
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
172 gaim_account_option_set_masked(GaimAccountOption *option, gboolean masked)
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
173 {
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
174 g_return_if_fail(option != NULL);
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
175 g_return_if_fail(option->type == GAIM_PREF_STRING);
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
176
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
177 option->masked = masked;
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
178 }
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
179
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
180
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
181 void
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
182 gaim_account_option_set_list(GaimAccountOption *option, GList *values)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
183 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
184 g_return_if_fail(option != NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
185 g_return_if_fail(option->type == GAIM_PREF_STRING_LIST);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
186
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
187 if (option->default_value.list != NULL)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
188 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
189 g_list_foreach(option->default_value.list, (GFunc)g_free, NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
190 g_list_free(option->default_value.list);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
191 }
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
192
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
193 option->default_value.list = values;
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
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
196 void
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
197 gaim_account_option_add_list_item(GaimAccountOption *option,
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
198 const char *key, const char *value)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
199 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
200 g_return_if_fail(option != NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
201 g_return_if_fail(key != NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
202 g_return_if_fail(value != NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
203 g_return_if_fail(option->type == GAIM_PREF_STRING_LIST);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
204
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
205 option->default_value.list = g_list_append(option->default_value.list,
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
206 g_strdup(key));
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
207 option->default_value.list = g_list_append(option->default_value.list,
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
208 g_strdup(value));
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
209 }
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
210
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 GaimPrefType
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 gaim_account_option_get_type(const GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 g_return_val_if_fail(option != NULL, GAIM_PREF_NONE);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 return option->type;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 const char *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 gaim_account_option_get_text(const GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 g_return_val_if_fail(option != NULL, NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 return option->text;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226
5660
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
227 const char *
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
228 gaim_account_option_get_setting(const GaimAccountOption *option)
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
229 {
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
230 g_return_val_if_fail(option != NULL, NULL);
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
231
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
232 return option->pref_name;
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
233 }
1709a545a7bd [gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents: 5654
diff changeset
234
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 gboolean
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 gaim_account_option_get_default_bool(const GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 g_return_val_if_fail(option != NULL, FALSE);
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
239 g_return_val_if_fail(option->type == GAIM_PREF_BOOLEAN, FALSE);
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 return option->default_value.boolean;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 int
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 gaim_account_option_get_default_int(const GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 g_return_val_if_fail(option != NULL, -1);
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
248 g_return_val_if_fail(option->type == GAIM_PREF_INT, -1);
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 return option->default_value.integer;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 const char *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 gaim_account_option_get_default_string(const GaimAccountOption *option)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 g_return_val_if_fail(option != NULL, NULL);
5663
e9551e7d6f01 [gaim-migrate @ 6077]
Christian Hammond <chipx86@chipx86.com>
parents: 5660
diff changeset
257 g_return_val_if_fail(option->type == GAIM_PREF_STRING, NULL);
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 return option->default_value.string;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261
10658
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
262 gboolean
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
263 gaim_account_option_get_masked(const GaimAccountOption *option)
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
264 {
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
265 g_return_val_if_fail(option != NULL, FALSE);
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
266 g_return_val_if_fail(option->type == GAIM_PREF_STRING, FALSE);
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
267
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
268 return option->masked;
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
269 }
61930cadca7c [gaim-migrate @ 12190]
Mark Doliner <mark@kingant.net>
parents: 8570
diff changeset
270
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
271 const GList *
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
272 gaim_account_option_get_list(const GaimAccountOption *option)
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
273 {
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
274 g_return_val_if_fail(option != NULL, NULL);
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
275 g_return_val_if_fail(option->type == GAIM_PREF_STRING_LIST, NULL);
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276
8570
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
277 return option->default_value.list;
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
278 }
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
279
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
280 /**************************************************************************
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
281 * Account User Split API
1a62ab7225f3 [gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
282 **************************************************************************/
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 GaimAccountUserSplit *
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 gaim_account_user_split_new(const char *text, const char *default_value,
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 char sep)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 GaimAccountUserSplit *split;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 g_return_val_if_fail(text != NULL, NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 g_return_val_if_fail(sep != 0, NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 split = g_new0(GaimAccountUserSplit, 1);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 split->text = g_strdup(text);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 split->field_sep = sep;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296 split->default_value = (default_value == NULL
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 ? NULL : g_strdup(default_value));
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 return split;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 void
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 gaim_account_user_split_destroy(GaimAccountUserSplit *split)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 g_return_if_fail(split != NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 if (split->text != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 g_free(split->text);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 if (split->default_value != NULL)
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 g_free(split->default_value);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 g_free(split);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 const char *
5654
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
317 gaim_account_user_split_get_text(const GaimAccountUserSplit *split)
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
318 {
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
319 g_return_val_if_fail(split != NULL, NULL);
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
320
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
321 return split->text;
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
322 }
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
323
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
324 const char *
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
325 gaim_account_user_split_get_default_value(const GaimAccountUserSplit *split)
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 g_return_val_if_fail(split != NULL, NULL);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 return split->default_value;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 }
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 char
5654
c52a97f3739e [gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents: 5639
diff changeset
333 gaim_account_user_split_get_separator(const GaimAccountUserSplit *split)
5639
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 {
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 g_return_val_if_fail(split != NULL, 0);
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 return split->field_sep;
408fef845144 [gaim-migrate @ 6051]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338 }