Tue, 05 Nov 2019 21:22:01 -0500
Credit Evert Mouw for the portion of his PR that I accepted.
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* purple |
| 5639 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
6902
bf0a4376750f
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
6 | * |
| 5639 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5639 | 20 | */ |
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18190
diff
changeset
|
21 | #include "internal.h" |
|
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18190
diff
changeset
|
22 | |
|
39970
cc7d4ff5a205
rename accountopt.[ch] to purpleaccountoption.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39968
diff
changeset
|
23 | #include "purpleaccountoption.h" |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
24 | #include "prefs.h" |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
25 | #include "util.h" |
|
33369
4a43f6a6326b
Fix again, refs #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33267
diff
changeset
|
26 | #include "glibcompat.h" |
| 5639 | 27 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
28 | /* |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
29 | * An option for an account. |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
30 | * |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
33369
diff
changeset
|
31 | * This is set by protocols, and appears in the account settings |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
32 | * dialogs. |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
33 | */ |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
34 | struct _PurpleAccountOption |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
35 | { |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
36 | PurplePrefType type; /* The type of value. */ |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
37 | |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
38 | gchar *text; /* The text that will appear to the user. */ |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
39 | gchar *pref_name; /* The name of the associated preference. */ |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
40 | |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
41 | union |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
42 | { |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35458
diff
changeset
|
43 | gboolean boolean; /* The default boolean value. */ |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
44 | gint integer; /* The default integer value. */ |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
45 | gchar *string; /* The default string value. */ |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35458
diff
changeset
|
46 | GList *list; /* The default list value. */ |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
47 | |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
48 | } default_value; |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
49 | |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
50 | union |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
51 | { |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
52 | struct |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
53 | { |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35458
diff
changeset
|
54 | gboolean masked; /* Whether the value entered should |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
55 | * be obscured from view (for |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
56 | * passwords and similar options) |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
57 | */ |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35458
diff
changeset
|
58 | GSList *hints; /* List of hinted values */ |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
59 | } string; |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
60 | } params; |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
61 | }; |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27977
diff
changeset
|
62 | |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
63 | G_DEFINE_BOXED_TYPE( |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
64 | PurpleAccountOption, |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
65 | purple_account_option, |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
66 | purple_account_option_copy, |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
67 | purple_account_option_destroy |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
68 | ); |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
69 | |
| 15884 | 70 | PurpleAccountOption * |
| 71 | purple_account_option_new(PurplePrefType type, const char *text, | |
| 5639 | 72 | const char *pref_name) |
| 73 | { | |
| 15884 | 74 | PurpleAccountOption *option; |
| 5639 | 75 | |
| 15884 | 76 | g_return_val_if_fail(type != PURPLE_PREF_NONE, NULL); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
77 | g_return_val_if_fail(text != NULL, NULL); |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
78 | g_return_val_if_fail(pref_name != NULL, NULL); |
| 5639 | 79 | |
| 15884 | 80 | option = g_new0(PurpleAccountOption, 1); |
| 5639 | 81 | |
| 82 | option->type = type; | |
| 83 | option->text = g_strdup(text); | |
| 84 | option->pref_name = g_strdup(pref_name); | |
| 85 | ||
| 86 | return option; | |
| 87 | } | |
| 88 | ||
| 15884 | 89 | PurpleAccountOption * |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
90 | purple_account_option_copy(PurpleAccountOption *option) { |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
91 | PurpleAccountOption *opt = NULL; |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
92 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
93 | g_return_val_if_fail(option, NULL); |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
94 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
95 | opt = g_new0(PurpleAccountOption, 1); |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
96 | *opt = *option; |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
97 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
98 | opt->text = g_strdup(option->text); |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
99 | opt->pref_name = g_strdup(option->pref_name); |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
100 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
101 | if(opt->type == PURPLE_PREF_STRING) { |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
102 | opt->default_value.string = g_strdup(option->default_value.string); |
|
39980
54284ab06efd
Fix some minor new warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39972
diff
changeset
|
103 | opt->params.string.hints = g_slist_copy(option->params.string.hints); |
|
39972
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
104 | } |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
105 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
106 | return opt; |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
107 | } |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
108 | |
|
347a24c5363d
register PurpleAccountOption as a boxed type
Gary Kramlich <grim@reaperworld.com>
parents:
39970
diff
changeset
|
109 | PurpleAccountOption * |
| 15884 | 110 | purple_account_option_bool_new(const char *text, const char *pref_name, |
| 5639 | 111 | gboolean default_value) |
| 112 | { | |
| 15884 | 113 | PurpleAccountOption *option; |
|
6902
bf0a4376750f
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
114 | |
| 15884 | 115 | option = purple_account_option_new(PURPLE_PREF_BOOLEAN, text, pref_name); |
| 5639 | 116 | |
| 117 | if (option == NULL) | |
| 118 | return NULL; | |
| 119 | ||
| 120 | option->default_value.boolean = default_value; | |
| 121 | ||
| 122 | return option; | |
| 123 | } | |
| 124 | ||
| 15884 | 125 | PurpleAccountOption * |
| 126 | purple_account_option_int_new(const char *text, const char *pref_name, | |
| 5639 | 127 | int default_value) |
| 128 | { | |
| 15884 | 129 | PurpleAccountOption *option; |
|
6902
bf0a4376750f
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
130 | |
| 15884 | 131 | option = purple_account_option_new(PURPLE_PREF_INT, text, pref_name); |
| 5639 | 132 | |
| 133 | if (option == NULL) | |
| 134 | return NULL; | |
| 135 | ||
| 136 | option->default_value.integer = default_value; | |
| 137 | ||
| 138 | return option; | |
| 139 | } | |
| 140 | ||
| 15884 | 141 | PurpleAccountOption * |
| 142 | purple_account_option_string_new(const char *text, const char *pref_name, | |
| 5639 | 143 | const char *default_value) |
| 144 | { | |
| 15884 | 145 | PurpleAccountOption *option; |
|
6902
bf0a4376750f
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5663
diff
changeset
|
146 | |
| 15884 | 147 | option = purple_account_option_new(PURPLE_PREF_STRING, text, pref_name); |
| 5639 | 148 | |
| 149 | if (option == NULL) | |
| 150 | return NULL; | |
| 151 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
152 | option->default_value.string = g_strdup(default_value); |
| 5639 | 153 | |
| 154 | return option; | |
| 155 | } | |
| 156 | ||
| 15884 | 157 | PurpleAccountOption * |
| 158 | purple_account_option_list_new(const char *text, const char *pref_name, | |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
159 | GList *list) |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
160 | { |
| 15884 | 161 | PurpleAccountOption *option; |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
162 | |
| 15884 | 163 | option = purple_account_option_new(PURPLE_PREF_STRING_LIST, text, pref_name); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
164 | |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
165 | if (option == NULL) |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
166 | return NULL; |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
167 | |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
168 | option->default_value.list = list; |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
169 | |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
170 | return option; |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
171 | } |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
172 | |
|
27977
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
173 | static void |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
174 | purple_account_option_list_free(gpointer data, gpointer user_data) |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
175 | { |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
176 | PurpleKeyValuePair *kvp = data; |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
177 | |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
178 | g_free(kvp->value); |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
179 | g_free(kvp->key); |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
180 | g_free(kvp); |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
181 | } |
|
79edf3aeaac1
Free the KeyValuePairs associated with accountopt lists. Closes #9115.
Stefan Becker <stefan.becker@nokia.com>
parents:
20147
diff
changeset
|
182 | |
| 5639 | 183 | void |
| 15884 | 184 | purple_account_option_destroy(PurpleAccountOption *option) |
| 5639 | 185 | { |
| 186 | g_return_if_fail(option != NULL); | |
| 187 | ||
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12172
diff
changeset
|
188 | g_free(option->text); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12172
diff
changeset
|
189 | g_free(option->pref_name); |
| 5639 | 190 | |
| 15884 | 191 | if (option->type == PURPLE_PREF_STRING) |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
192 | { |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12172
diff
changeset
|
193 | g_free(option->default_value.string); |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
194 | g_slist_free_full(option->params.string.hints, &g_free); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
195 | } |
| 15884 | 196 | else if (option->type == PURPLE_PREF_STRING_LIST) |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
197 | { |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37144
diff
changeset
|
198 | g_list_free_full(option->default_value.list, |
|
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37144
diff
changeset
|
199 | (GDestroyNotify)purple_account_option_list_free); |
| 5639 | 200 | } |
| 201 | ||
| 202 | g_free(option); | |
| 203 | } | |
| 204 | ||
| 205 | void | |
| 15884 | 206 | purple_account_option_set_default_bool(PurpleAccountOption *option, |
| 5639 | 207 | gboolean value) |
| 208 | { | |
| 209 | g_return_if_fail(option != NULL); | |
| 15884 | 210 | g_return_if_fail(option->type == PURPLE_PREF_BOOLEAN); |
| 5639 | 211 | |
| 212 | option->default_value.boolean = value; | |
| 213 | } | |
| 214 | ||
| 215 | void | |
| 15884 | 216 | purple_account_option_set_default_int(PurpleAccountOption *option, int value) |
| 5639 | 217 | { |
| 218 | g_return_if_fail(option != NULL); | |
| 15884 | 219 | g_return_if_fail(option->type == PURPLE_PREF_INT); |
| 5639 | 220 | |
| 221 | option->default_value.integer = value; | |
| 222 | } | |
| 223 | ||
| 224 | void | |
| 15884 | 225 | purple_account_option_set_default_string(PurpleAccountOption *option, |
| 5639 | 226 | const char *value) |
| 227 | { | |
| 228 | g_return_if_fail(option != NULL); | |
| 15884 | 229 | g_return_if_fail(option->type == PURPLE_PREF_STRING); |
| 5639 | 230 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
231 | g_free(option->default_value.string); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
232 | option->default_value.string = g_strdup(value); |
| 5639 | 233 | } |
| 234 | ||
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
235 | void |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
236 | purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked) |
| 10658 | 237 | { |
| 238 | g_return_if_fail(option != NULL); | |
| 15884 | 239 | g_return_if_fail(option->type == PURPLE_PREF_STRING); |
| 10658 | 240 | |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
241 | option->params.string.masked = masked; |
| 10658 | 242 | } |
| 243 | ||
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
244 | void |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
245 | purple_account_option_string_set_hints(PurpleAccountOption *option, GSList *hints) |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
246 | { |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
247 | g_return_if_fail(option != NULL); |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
248 | g_return_if_fail(option->type == PURPLE_PREF_STRING); |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
249 | |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
250 | g_slist_free_full(option->params.string.hints, &g_free); |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
251 | option->params.string.hints = hints; |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
252 | } |
| 10658 | 253 | |
| 254 | void | |
| 15884 | 255 | purple_account_option_set_list(PurpleAccountOption *option, GList *values) |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
256 | { |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
257 | g_return_if_fail(option != NULL); |
| 15884 | 258 | g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
259 | |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37144
diff
changeset
|
260 | g_list_free_full(option->default_value.list, |
|
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37144
diff
changeset
|
261 | (GDestroyNotify)purple_account_option_list_free); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
262 | |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
263 | option->default_value.list = values; |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
264 | } |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
265 | |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
266 | void |
| 15884 | 267 | purple_account_option_add_list_item(PurpleAccountOption *option, |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
268 | const char *key, const char *value) |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
269 | { |
| 15884 | 270 | PurpleKeyValuePair *kvp; |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
271 | |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
272 | g_return_if_fail(option != NULL); |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
273 | g_return_if_fail(key != NULL); |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
274 | g_return_if_fail(value != NULL); |
| 15884 | 275 | g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
276 | |
| 15884 | 277 | kvp = g_new0(PurpleKeyValuePair, 1); |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
278 | kvp->key = g_strdup(key); |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
279 | kvp->value = g_strdup(value); |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
280 | |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
281 | option->default_value.list = g_list_append(option->default_value.list, |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
282 | kvp); |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
283 | } |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
284 | |
| 15884 | 285 | PurplePrefType |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
33369
diff
changeset
|
286 | purple_account_option_get_pref_type(const PurpleAccountOption *option) |
| 5639 | 287 | { |
| 15884 | 288 | g_return_val_if_fail(option != NULL, PURPLE_PREF_NONE); |
| 5639 | 289 | |
| 290 | return option->type; | |
| 291 | } | |
| 292 | ||
| 293 | const char * | |
| 15884 | 294 | purple_account_option_get_text(const PurpleAccountOption *option) |
| 5639 | 295 | { |
| 296 | g_return_val_if_fail(option != NULL, NULL); | |
| 297 | ||
| 298 | return option->text; | |
| 299 | } | |
| 300 | ||
|
5660
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
301 | const char * |
| 15884 | 302 | purple_account_option_get_setting(const PurpleAccountOption *option) |
|
5660
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
303 | { |
|
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
304 | g_return_val_if_fail(option != NULL, NULL); |
|
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
305 | |
|
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
306 | return option->pref_name; |
|
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
307 | } |
|
90787278c739
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
308 | |
| 5639 | 309 | gboolean |
| 15884 | 310 | purple_account_option_get_default_bool(const PurpleAccountOption *option) |
| 5639 | 311 | { |
| 312 | g_return_val_if_fail(option != NULL, FALSE); | |
| 15884 | 313 | g_return_val_if_fail(option->type == PURPLE_PREF_BOOLEAN, FALSE); |
| 5639 | 314 | |
| 315 | return option->default_value.boolean; | |
| 316 | } | |
| 317 | ||
| 318 | int | |
| 15884 | 319 | purple_account_option_get_default_int(const PurpleAccountOption *option) |
| 5639 | 320 | { |
| 321 | g_return_val_if_fail(option != NULL, -1); | |
| 15884 | 322 | g_return_val_if_fail(option->type == PURPLE_PREF_INT, -1); |
| 5639 | 323 | |
| 324 | return option->default_value.integer; | |
| 325 | } | |
| 326 | ||
| 327 | const char * | |
| 15884 | 328 | purple_account_option_get_default_string(const PurpleAccountOption *option) |
| 5639 | 329 | { |
| 330 | g_return_val_if_fail(option != NULL, NULL); | |
| 15884 | 331 | g_return_val_if_fail(option->type == PURPLE_PREF_STRING, NULL); |
| 5639 | 332 | |
| 333 | return option->default_value.string; | |
| 334 | } | |
| 335 | ||
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
336 | const char * |
| 15884 | 337 | purple_account_option_get_default_list_value(const PurpleAccountOption *option) |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
338 | { |
| 15884 | 339 | PurpleKeyValuePair *kvp; |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
340 | |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
341 | g_return_val_if_fail(option != NULL, NULL); |
| 15884 | 342 | g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); |
|
12172
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
343 | |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
344 | if (option->default_value.list == NULL) |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
345 | return NULL; |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
346 | |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
347 | kvp = option->default_value.list->data; |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
348 | |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
349 | return (kvp ? kvp->value : NULL); |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
350 | } |
|
717fa0ec02c4
[gaim-migrate @ 14474]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10658
diff
changeset
|
351 | |
| 10658 | 352 | gboolean |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
353 | purple_account_option_string_get_masked(const PurpleAccountOption *option) |
| 10658 | 354 | { |
| 355 | g_return_val_if_fail(option != NULL, FALSE); | |
| 15884 | 356 | g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE); |
| 10658 | 357 | |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
358 | return option->params.string.masked; |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
359 | } |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
360 | |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
361 | const GSList * |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
362 | purple_account_option_string_get_hints(const PurpleAccountOption *option) |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
363 | { |
|
39980
54284ab06efd
Fix some minor new warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39972
diff
changeset
|
364 | g_return_val_if_fail(option != NULL, NULL); |
|
54284ab06efd
Fix some minor new warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39972
diff
changeset
|
365 | g_return_val_if_fail(option->type == PURPLE_PREF_STRING, NULL); |
|
33267
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
366 | |
|
c3ee96290bfd
Account Options: hinted string options; fix perl plugins compilation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
367 | return option->params.string.hints; |
| 10658 | 368 | } |
| 369 | ||
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18099
diff
changeset
|
370 | GList * |
| 15884 | 371 | purple_account_option_get_list(const PurpleAccountOption *option) |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
372 | { |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
373 | g_return_val_if_fail(option != NULL, NULL); |
| 15884 | 374 | g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); |
| 5639 | 375 | |
|
8570
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
376 | return option->default_value.list; |
|
bce05cb55dbc
[gaim-migrate @ 9318]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
377 | } |