Mercurial > pidgin.yaz
annotate src/request.c @ 9465:8a4797a608ae
[gaim-migrate @ 10290]
1) Fixes the parsing for Win32 clipboard format so that we more accurately
grab the right text
2) Revises our Win32 clipboard format conversion to act more like IE,
since this is as close as we will get to "the right way"
3) Makes clipboard pasting not paste HTML comments (this one effects
linux too, and fixes a problem i've seen pasting from oo.o)
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 01:35:27 +0000 |
parents | 1bbe99a07e36 |
children | 578986136bac |
rev | line source |
---|---|
5477 | 1 /** |
2 * @file request.c Request API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
10 * |
5477 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
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 | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include "request.h" | |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
26 #include "debug.h" |
5477 | 27 |
28 static GaimRequestUiOps *request_ui_ops = NULL; | |
29 static GList *handles = NULL; | |
30 | |
31 typedef struct | |
32 { | |
33 GaimRequestType type; | |
34 void *handle; | |
35 void *ui_handle; | |
36 | |
37 } GaimRequestInfo; | |
38 | |
39 | |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
40 GaimRequestFields * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
41 gaim_request_fields_new(void) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
42 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
43 GaimRequestFields *fields; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
44 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
45 fields = g_new0(GaimRequestFields, 1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
46 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
47 fields->fields = g_hash_table_new_full(g_str_hash, g_str_equal, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
48 g_free, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
49 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
50 return fields; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
51 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
52 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
53 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
54 gaim_request_fields_destroy(GaimRequestFields *fields) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
55 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
56 GList *l; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
57 GaimRequestFieldGroup *group; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
58 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
59 g_return_if_fail(fields != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
60 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
61 for (l = fields->groups; l != NULL; l = l->next) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
62 { |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
63 group = l->data; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
64 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
65 gaim_request_field_group_destroy(group); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
66 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
67 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
68 if (fields->groups != NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
69 g_list_free(fields->groups); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
70 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
71 if (fields->required_fields != NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
72 g_list_free(fields->required_fields); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
73 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
74 g_hash_table_destroy(fields->fields); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
75 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
76 g_free(fields); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
77 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
78 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
79 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
80 gaim_request_fields_add_group(GaimRequestFields *fields, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
81 GaimRequestFieldGroup *group) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
82 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
83 GList *l; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
84 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
85 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
86 g_return_if_fail(fields != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
87 g_return_if_fail(group != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
88 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
89 fields->groups = g_list_append(fields->groups, group); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
90 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
91 group->fields_list = fields; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
92 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
93 for (l = gaim_request_field_group_get_fields(group); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
94 l != NULL; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
95 l = l->next) { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
96 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
97 field = l->data; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
98 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
99 g_hash_table_insert(fields->fields, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
100 g_strdup(gaim_request_field_get_id(field)), field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
101 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
102 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
103 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
104 GList * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
105 gaim_request_fields_get_groups(const GaimRequestFields *fields) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
106 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
107 g_return_val_if_fail(fields != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
108 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
109 return fields->groups; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
110 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
111 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
112 gboolean |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
113 gaim_request_fields_exists(const GaimRequestFields *fields, const char *id) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
114 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
115 g_return_val_if_fail(fields != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
116 g_return_val_if_fail(id != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
117 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
118 return (g_hash_table_lookup(fields->fields, id) != NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
119 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
120 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
121 const GList * |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
122 gaim_request_fields_get_required(const GaimRequestFields *fields) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
123 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
124 g_return_val_if_fail(fields != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
125 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
126 return fields->required_fields; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
127 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
128 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
129 gboolean |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
130 gaim_request_fields_is_field_required(const GaimRequestFields *fields, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
131 const char *id) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
132 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
133 GaimRequestField *field; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
134 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
135 g_return_val_if_fail(fields != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
136 g_return_val_if_fail(id != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
137 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
138 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
139 return FALSE; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
140 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
141 return gaim_request_field_is_required(field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
142 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
143 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
144 gboolean |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
145 gaim_request_fields_all_required_filled(const GaimRequestFields *fields) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
146 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
147 GList *l; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
148 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
149 g_return_val_if_fail(fields != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
150 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
151 for (l = fields->required_fields; l != NULL; l = l->next) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
152 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
153 GaimRequestField *field = (GaimRequestField *)l->data; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
154 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
155 switch (gaim_request_field_get_type(field)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
156 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
157 case GAIM_REQUEST_FIELD_STRING: |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
158 if (gaim_request_field_string_get_value(field) == NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
159 return FALSE; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
160 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
161 break; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
162 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
163 default: |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
164 break; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
165 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
166 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
167 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
168 return TRUE; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
169 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
170 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
171 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
172 gaim_request_fields_get_field(const GaimRequestFields *fields, const char *id) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
173 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
174 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
175 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
176 g_return_val_if_fail(fields != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
177 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
178 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
179 field = g_hash_table_lookup(fields->fields, id); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
180 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
181 g_return_val_if_fail(field != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
182 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
183 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
184 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
185 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
186 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
187 gaim_request_fields_get_string(const GaimRequestFields *fields, const char *id) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
188 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
189 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
190 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
191 g_return_val_if_fail(fields != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
192 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
193 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
194 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
195 return NULL; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
196 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
197 return gaim_request_field_string_get_value(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
198 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
199 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
200 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
201 gaim_request_fields_get_integer(const GaimRequestFields *fields, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
202 const char *id) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
203 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
204 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
205 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
206 g_return_val_if_fail(fields != NULL, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
207 g_return_val_if_fail(id != NULL, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
208 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
209 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
210 return 0; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
211 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
212 return gaim_request_field_int_get_value(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
213 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
214 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
215 gboolean |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
216 gaim_request_fields_get_bool(const GaimRequestFields *fields, const char *id) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
217 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
218 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
219 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
220 g_return_val_if_fail(fields != NULL, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
221 g_return_val_if_fail(id != NULL, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
222 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
223 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
224 return FALSE; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
225 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
226 return gaim_request_field_bool_get_value(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
227 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
228 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
229 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
230 gaim_request_fields_get_choice(const GaimRequestFields *fields, const char *id) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
231 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
232 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
233 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
234 g_return_val_if_fail(fields != NULL, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
235 g_return_val_if_fail(id != NULL, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
236 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
237 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
238 return -1; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
239 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
240 return gaim_request_field_choice_get_value(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
241 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
242 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
243 GaimAccount * |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
244 gaim_request_fields_get_account(const GaimRequestFields *fields, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
245 const char *id) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
246 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
247 GaimRequestField *field; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
248 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
249 g_return_val_if_fail(fields != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
250 g_return_val_if_fail(id != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
251 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
252 if ((field = gaim_request_fields_get_field(fields, id)) == NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
253 return NULL; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
254 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
255 return gaim_request_field_account_get_value(field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
256 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
257 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
258 GaimRequestFieldGroup * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
259 gaim_request_field_group_new(const char *title) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
260 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
261 GaimRequestFieldGroup *group; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
262 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
263 group = g_new0(GaimRequestFieldGroup, 1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
264 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
265 if (title != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
266 group->title = g_strdup(title); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
267 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
268 return group; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
269 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
270 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
271 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
272 gaim_request_field_group_destroy(GaimRequestFieldGroup *group) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
273 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
274 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
275 GList *l; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
276 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
277 g_return_if_fail(group != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
278 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
279 if (group->title != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
280 g_free(group->title); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
281 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
282 for (l = group->fields; l != NULL; l = l->next) { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
283 field = l->data; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
284 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
285 gaim_request_field_destroy(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
286 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
287 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
288 g_list_free(group->fields); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
289 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
290 g_free(group); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
291 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
292 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
293 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
294 gaim_request_field_group_add_field(GaimRequestFieldGroup *group, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
295 GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
296 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
297 g_return_if_fail(group != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
298 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
299 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
300 group->fields = g_list_append(group->fields, field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
301 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
302 if (group->fields_list != NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
303 { |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
304 g_hash_table_insert(group->fields_list->fields, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
305 g_strdup(gaim_request_field_get_id(field)), field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
306 } |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
307 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
308 field->group = group; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
309 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
310 if (gaim_request_field_is_required(field)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
311 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
312 group->fields_list->required_fields = |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
313 g_list_append(group->fields_list->required_fields, field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
314 } |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
315 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
316 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
317 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
318 gaim_request_field_group_get_title(const GaimRequestFieldGroup *group) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
319 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
320 g_return_val_if_fail(group != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
321 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
322 return group->title; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
323 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
324 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
325 GList * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
326 gaim_request_field_group_get_fields(const GaimRequestFieldGroup *group) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
327 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
328 g_return_val_if_fail(group != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
329 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
330 return group->fields; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
331 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
332 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
333 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
334 gaim_request_field_new(const char *id, const char *text, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
335 GaimRequestFieldType type) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
336 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
337 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
338 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
339 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
340 g_return_val_if_fail(type != GAIM_REQUEST_FIELD_NONE, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
341 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
342 field = g_new0(GaimRequestField, 1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
343 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
344 field->id = g_strdup(id); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
345 field->type = type; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
346 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
347 gaim_request_field_set_label(field, text); |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
348 gaim_request_field_set_visible(field, TRUE); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
349 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
350 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
351 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
352 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
353 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
354 gaim_request_field_destroy(GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
355 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
356 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
357 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
358 if (field->id != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
359 g_free(field->id); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
360 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
361 if (field->label != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
362 g_free(field->label); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
363 |
8285
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
364 if (field->type_hint != NULL) |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
365 g_free(field->type_hint); |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
366 |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
367 if (field->type == GAIM_REQUEST_FIELD_STRING) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
368 { |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
369 if (field->u.string.default_value != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
370 g_free(field->u.string.default_value); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
371 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
372 if (field->u.string.value != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
373 g_free(field->u.string.value); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
374 } |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
375 else if (field->type == GAIM_REQUEST_FIELD_CHOICE) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
376 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
377 if (field->u.choice.labels != NULL) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
378 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
379 g_list_foreach(field->u.choice.labels, (GFunc)g_free, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
380 g_list_free(field->u.choice.labels); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
381 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
382 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
383 else if (field->type == GAIM_REQUEST_FIELD_LIST) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
384 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
385 if (field->u.list.items != NULL) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
386 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
387 g_list_foreach(field->u.list.items, (GFunc)g_free, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
388 g_list_free(field->u.list.items); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
389 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
390 |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
391 if (field->u.list.selected != NULL) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
392 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
393 g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
394 g_list_free(field->u.list.selected); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
395 } |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
396 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
397 g_hash_table_destroy(field->u.list.item_data); |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
398 g_hash_table_destroy(field->u.list.selected_table); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
399 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
400 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
401 g_free(field); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
402 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
403 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
404 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
405 gaim_request_field_set_label(GaimRequestField *field, const char *label) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
406 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
407 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
408 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
409 if (field->label != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
410 g_free(field->label); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
411 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
412 field->label = (label == NULL ? NULL : g_strdup(label)); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
413 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
414 |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
415 void |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
416 gaim_request_field_set_visible(GaimRequestField *field, gboolean visible) |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
417 { |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
418 g_return_if_fail(field != NULL); |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
419 |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
420 field->visible = visible; |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
421 } |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
422 |
8285
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
423 void |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
424 gaim_request_field_set_type_hint(GaimRequestField *field, |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
425 const char *type_hint) |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
426 { |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
427 g_return_if_fail(field != NULL); |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
428 |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
429 if (field->type_hint != NULL) |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
430 g_free(field->type_hint); |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
431 |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
432 field->type_hint = (type_hint == NULL ? NULL : g_strdup(type_hint)); |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
433 } |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
434 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
435 void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
436 gaim_request_field_set_required(GaimRequestField *field, gboolean required) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
437 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
438 g_return_if_fail(field != NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
439 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
440 if (field->required == required) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
441 return; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
442 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
443 field->required = required; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
444 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
445 if (field->group != NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
446 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
447 if (required) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
448 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
449 field->group->fields_list->required_fields = |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
450 g_list_append(field->group->fields_list->required_fields, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
451 field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
452 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
453 else |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
454 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
455 field->group->fields_list->required_fields = |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
456 g_list_remove(field->group->fields_list->required_fields, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
457 field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
458 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
459 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
460 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
461 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
462 GaimRequestFieldType |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
463 gaim_request_field_get_type(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
464 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
465 g_return_val_if_fail(field != NULL, GAIM_REQUEST_FIELD_NONE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
466 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
467 return field->type; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
468 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
469 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
470 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
471 gaim_request_field_get_id(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
472 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
473 g_return_val_if_fail(field != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
474 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
475 return field->id; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
476 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
477 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
478 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
479 gaim_request_field_get_label(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
480 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
481 g_return_val_if_fail(field != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
482 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
483 return field->label; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
484 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
485 |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
486 gboolean |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
487 gaim_request_field_is_visible(const GaimRequestField *field) |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
488 { |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
489 g_return_val_if_fail(field != NULL, FALSE); |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
490 |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
491 return field->visible; |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
492 } |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7902
diff
changeset
|
493 |
8285
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
494 const char * |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
495 gaim_request_field_get_type_hint(const GaimRequestField *field) |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
496 { |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
497 g_return_val_if_fail(field != NULL, NULL); |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
498 |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
499 return field->type_hint; |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
500 } |
d335cc7bca54
[gaim-migrate @ 9009]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
501 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
502 gboolean |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
503 gaim_request_field_is_required(const GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
504 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
505 g_return_val_if_fail(field != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
506 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
507 return field->required; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
508 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
509 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
510 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
511 gaim_request_field_string_new(const char *id, const char *text, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
512 const char *default_value, gboolean multiline) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
513 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
514 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
515 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
516 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
517 g_return_val_if_fail(text != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
518 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
519 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_STRING); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
520 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
521 field->u.string.multiline = multiline; |
7048
3f9e106dfeef
[gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents:
7047
diff
changeset
|
522 field->u.string.editable = TRUE; |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
523 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
524 gaim_request_field_string_set_default_value(field, default_value); |
7072 | 525 gaim_request_field_string_set_value(field, default_value); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
526 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
527 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
528 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
529 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
530 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
531 gaim_request_field_string_set_default_value(GaimRequestField *field, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
532 const char *default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
533 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
534 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
535 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
536 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
537 if (field->u.string.default_value != NULL) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
538 g_free(field->u.string.default_value); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
539 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
540 field->u.string.default_value = (default_value == NULL |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
541 ? NULL : g_strdup(default_value)); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
542 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
543 |
5808
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
544 void |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
545 gaim_request_field_string_set_value(GaimRequestField *field, const char *value) |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
546 { |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
547 g_return_if_fail(field != NULL); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
548 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
549 |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
550 if (field->u.string.value != NULL) |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
551 g_free(field->u.string.value); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
552 |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
553 field->u.string.value = (value == NULL ? NULL : g_strdup(value)); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
554 } |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
555 |
7047
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
556 void |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
557 gaim_request_field_string_set_masked(GaimRequestField *field, gboolean masked) |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
558 { |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
559 g_return_if_fail(field != NULL); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
560 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
561 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
562 field->u.string.masked = masked; |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
563 } |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
564 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
565 void |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
566 gaim_request_field_string_set_editable(GaimRequestField *field, |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
567 gboolean editable) |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
568 { |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
569 g_return_if_fail(field != NULL); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
570 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
571 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
572 field->u.string.editable = editable; |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
573 } |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
574 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
575 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
576 gaim_request_field_string_get_default_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
577 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
578 g_return_val_if_fail(field != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
579 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
580 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
581 return field->u.string.default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
582 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
583 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
584 const char * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
585 gaim_request_field_string_get_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
586 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
587 g_return_val_if_fail(field != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
588 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
589 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
590 return field->u.string.value; |
7047
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
591 } |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
592 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
593 gboolean |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
594 gaim_request_field_string_is_multiline(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
595 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
596 g_return_val_if_fail(field != NULL, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
597 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
598 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
599 return field->u.string.multiline; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
600 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
601 |
7047
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
602 gboolean |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
603 gaim_request_field_string_is_masked(const GaimRequestField *field) |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
604 { |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
605 g_return_val_if_fail(field != NULL, FALSE); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
606 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, FALSE); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
607 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
608 return field->u.string.masked; |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
609 } |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
610 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
611 gboolean |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
612 gaim_request_field_string_is_editable(const GaimRequestField *field) |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
613 { |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
614 g_return_val_if_fail(field != NULL, FALSE); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
615 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, FALSE); |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
616 |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
617 return field->u.string.editable; |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
618 } |
7d1909655fd0
[gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
619 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
620 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
621 gaim_request_field_int_new(const char *id, const char *text, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
622 int default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
623 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
624 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
625 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
626 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
627 g_return_val_if_fail(text != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
628 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
629 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_INTEGER); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
630 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
631 gaim_request_field_int_set_default_value(field, default_value); |
7072 | 632 gaim_request_field_int_set_value(field, default_value); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
633 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
634 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
635 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
636 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
637 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
638 gaim_request_field_int_set_default_value(GaimRequestField *field, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
639 int default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
640 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
641 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
642 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
643 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
644 field->u.integer.default_value = default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
645 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
646 |
5808
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
647 void |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
648 gaim_request_field_int_set_value(GaimRequestField *field, int value) |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
649 { |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
650 g_return_if_fail(field != NULL); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
651 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
652 |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
653 field->u.integer.value = value; |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
654 } |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
655 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
656 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
657 gaim_request_field_int_get_default_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
658 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
659 g_return_val_if_fail(field != NULL, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
660 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
661 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
662 return field->u.integer.default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
663 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
664 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
665 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
666 gaim_request_field_int_get_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
667 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
668 g_return_val_if_fail(field != NULL, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
669 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER, 0); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
670 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
671 return field->u.integer.value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
672 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
673 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
674 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
675 gaim_request_field_bool_new(const char *id, const char *text, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
676 gboolean default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
677 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
678 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
679 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
680 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
681 g_return_val_if_fail(text != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
682 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
683 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_BOOLEAN); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
684 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
685 gaim_request_field_bool_set_default_value(field, default_value); |
7072 | 686 gaim_request_field_bool_set_value(field, default_value); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
687 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
688 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
689 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
690 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
691 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
692 gaim_request_field_bool_set_default_value(GaimRequestField *field, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
693 gboolean default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
694 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
695 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
696 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
697 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
698 field->u.boolean.default_value = default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
699 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
700 |
5808
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
701 void |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
702 gaim_request_field_bool_set_value(GaimRequestField *field, gboolean value) |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
703 { |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
704 g_return_if_fail(field != NULL); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
705 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
706 |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
707 field->u.boolean.value = value; |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
708 } |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
709 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
710 gboolean |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
711 gaim_request_field_bool_get_default_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
712 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
713 g_return_val_if_fail(field != NULL, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
714 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
715 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
716 return field->u.boolean.default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
717 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
718 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
719 gboolean |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
720 gaim_request_field_bool_get_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
721 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
722 g_return_val_if_fail(field != NULL, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
723 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN, FALSE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
724 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
725 return field->u.boolean.value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
726 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
727 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
728 GaimRequestField * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
729 gaim_request_field_choice_new(const char *id, const char *text, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
730 int default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
731 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
732 GaimRequestField *field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
733 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
734 g_return_val_if_fail(id != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
735 g_return_val_if_fail(text != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
736 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
737 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_CHOICE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
738 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
739 gaim_request_field_choice_set_default_value(field, default_value); |
7072 | 740 gaim_request_field_choice_set_value(field, default_value); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
741 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
742 return field; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
743 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
744 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
745 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
746 gaim_request_field_choice_add(GaimRequestField *field, const char *label) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
747 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
748 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
749 g_return_if_fail(label != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
750 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
751 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
752 field->u.choice.labels = g_list_append(field->u.choice.labels, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
753 g_strdup(label)); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
754 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
755 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
756 void |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
757 gaim_request_field_choice_set_default_value(GaimRequestField *field, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
758 int default_value) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
759 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
760 g_return_if_fail(field != NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
761 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
762 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
763 field->u.choice.default_value = default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
764 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
765 |
5808
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
766 void |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
767 gaim_request_field_choice_set_value(GaimRequestField *field, |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
768 int value) |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
769 { |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
770 g_return_if_fail(field != NULL); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
771 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
772 |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
773 field->u.choice.value = value; |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
774 } |
133e86584f4b
[gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents:
5807
diff
changeset
|
775 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
776 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
777 gaim_request_field_choice_get_default_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
778 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
779 g_return_val_if_fail(field != NULL, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
780 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
781 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
782 return field->u.choice.default_value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
783 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
784 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
785 int |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
786 gaim_request_field_choice_get_value(const GaimRequestField *field) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
787 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
788 g_return_val_if_fail(field != NULL, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
789 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE, -1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
790 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
791 return field->u.choice.value; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
792 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
793 |
5809
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
794 GList * |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
795 gaim_request_field_choice_get_labels(const GaimRequestField *field) |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
796 { |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
797 g_return_val_if_fail(field != NULL, NULL); |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
798 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE, NULL); |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
799 |
5810
327bc2f78340
[gaim-migrate @ 6240]
Christian Hammond <chipx86@chipx86.com>
parents:
5809
diff
changeset
|
800 return field->u.choice.labels; |
5809
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
801 } |
0a661f6d65e3
[gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents:
5808
diff
changeset
|
802 |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
803 GaimRequestField * |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
804 gaim_request_field_list_new(const char *id, const char *text) |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
805 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
806 GaimRequestField *field; |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
807 |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
808 g_return_val_if_fail(id != NULL, NULL); |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
809 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
810 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_LIST); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
811 |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
812 field->u.list.item_data = g_hash_table_new_full(g_str_hash, g_str_equal, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
813 g_free, NULL); |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
814 |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
815 field->u.list.selected_table = |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
816 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
817 |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
818 return field; |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
819 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
820 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
821 void |
7899
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
822 gaim_request_field_list_set_multi_select(GaimRequestField *field, |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
823 gboolean multi_select) |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
824 { |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
825 g_return_if_fail(field != NULL); |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
826 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
827 |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
828 field->u.list.multiple_selection = multi_select; |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
829 } |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
830 |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
831 gboolean |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
832 gaim_request_field_list_get_multi_select(const GaimRequestField *field) |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
833 { |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
834 g_return_val_if_fail(field != NULL, FALSE); |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
835 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_LIST, FALSE); |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
836 |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
837 return field->u.list.multiple_selection; |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
838 } |
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
839 |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
840 void * |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
841 gaim_request_field_list_get_data(const GaimRequestField *field, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
842 const char *text) |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
843 { |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
844 g_return_val_if_fail(field != NULL, NULL); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
845 g_return_val_if_fail(text != NULL, NULL); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
846 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_LIST, NULL); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
847 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
848 return g_hash_table_lookup(field->u.list.item_data, text); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
849 } |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
850 |
7899
7b64108b8ae3
[gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents:
7898
diff
changeset
|
851 void |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
852 gaim_request_field_list_add(GaimRequestField *field, const char *item, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
853 void *data) |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
854 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
855 g_return_if_fail(field != NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
856 g_return_if_fail(item != NULL); |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
857 g_return_if_fail(data != NULL); |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
858 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
859 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
860 field->u.list.items = g_list_append(field->u.list.items, g_strdup(item)); |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
861 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
862 g_hash_table_insert(field->u.list.item_data, g_strdup(item), data); |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
863 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
864 |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
865 void |
7902
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
866 gaim_request_field_list_add_selected(GaimRequestField *field, const char *item) |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
867 { |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
868 g_return_if_fail(field != NULL); |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
869 g_return_if_fail(item != NULL); |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
870 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
871 |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
872 if (!gaim_request_field_list_get_multi_select(field) && |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
873 field->u.list.selected != NULL) |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
874 { |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
875 gaim_debug_warning("request", |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
876 "More than one item added to non-multi-select " |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
877 "field %s\n", |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
878 gaim_request_field_get_id(field)); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
879 return; |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
880 } |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
881 |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
882 field->u.list.selected = g_list_append(field->u.list.selected, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
883 g_strdup(item)); |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
884 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
885 g_hash_table_insert(field->u.list.selected_table, g_strdup(item), NULL); |
7902
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
886 } |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
887 |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
888 void |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
889 gaim_request_field_list_clear_selected(GaimRequestField *field) |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
890 { |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
891 g_return_if_fail(field != NULL); |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
892 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
893 |
7962
cc77bd88cd72
[gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents:
7909
diff
changeset
|
894 if (field->u.list.selected != NULL) |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
895 { |
7962
cc77bd88cd72
[gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents:
7909
diff
changeset
|
896 g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); |
cc77bd88cd72
[gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents:
7909
diff
changeset
|
897 g_list_free(field->u.list.selected); |
cc77bd88cd72
[gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents:
7909
diff
changeset
|
898 field->u.list.selected = NULL; |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
899 } |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
900 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
901 g_hash_table_destroy(field->u.list.selected_table); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
902 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
903 field->u.list.selected_table = |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
904 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
7902
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
905 } |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
906 |
3ca501305ac5
[gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents:
7901
diff
changeset
|
907 void |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
908 gaim_request_field_list_set_selected(GaimRequestField *field, GList *items) |
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
909 { |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
910 GList *l; |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
911 |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
912 g_return_if_fail(field != NULL); |
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
913 g_return_if_fail(items != NULL); |
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
914 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
915 |
7962
cc77bd88cd72
[gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents:
7909
diff
changeset
|
916 gaim_request_field_list_clear_selected(field); |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
917 |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
918 if (!gaim_request_field_list_get_multi_select(field) && |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
919 g_list_length(items) > 1) |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
920 { |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
921 gaim_debug_warning("request", |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
922 "More than one item added to non-multi-select " |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
923 "field %s\n", |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
924 gaim_request_field_get_id(field)); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
925 return; |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
926 } |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
927 |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
928 field->u.list.selected = items; |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
929 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
930 for (l = field->u.list.selected; l != NULL; l = l->next) |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
931 { |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
932 g_hash_table_insert(field->u.list.selected_table, |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
933 g_strdup((char *)l->data), NULL); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
934 } |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
935 } |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
936 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
937 gboolean |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
938 gaim_request_field_list_is_selected(const GaimRequestField *field, |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
939 const char *item) |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
940 { |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
941 g_return_val_if_fail(field != NULL, FALSE); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
942 g_return_val_if_fail(item != NULL, FALSE); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
943 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_LIST, FALSE); |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
944 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
945 return g_hash_table_lookup_extended(field->u.list.selected_table, |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7962
diff
changeset
|
946 item, NULL, NULL); |
7901
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
947 } |
4344f7fad009
[gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents:
7899
diff
changeset
|
948 |
7898
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
949 const GList * |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
950 gaim_request_field_list_get_selected(const GaimRequestField *field) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
951 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
952 g_return_val_if_fail(field != NULL, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
953 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_LIST, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
954 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
955 return field->u.list.selected; |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
956 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
957 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
958 const GList * |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
959 gaim_request_field_list_get_items(const GaimRequestField *field) |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
960 { |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
961 g_return_val_if_fail(field != NULL, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
962 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_LIST, NULL); |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
963 |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
964 return field->u.list.items; |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
965 } |
9c0ea21997a9
[gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents:
7843
diff
changeset
|
966 |
7905
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
967 GaimRequestField * |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
968 gaim_request_field_label_new(const char *id, const char *text) |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
969 { |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
970 GaimRequestField *field; |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
971 |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
972 g_return_val_if_fail(id != NULL, NULL); |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
973 g_return_val_if_fail(text != NULL, NULL); |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
974 |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
975 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_LABEL); |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
976 |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
977 return field; |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
978 } |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
979 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
980 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
981 GaimRequestField * |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
982 gaim_request_field_account_new(const char *id, const char *text, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
983 GaimAccount *account) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
984 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
985 GaimRequestField *field; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
986 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
987 g_return_val_if_fail(id != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
988 g_return_val_if_fail(text != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
989 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
990 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_ACCOUNT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
991 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
992 if (account == NULL && gaim_connections_get_all() != NULL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
993 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
994 account = gaim_connection_get_account( |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
995 (GaimConnection *)gaim_connections_get_all()->data); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
996 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
997 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
998 gaim_request_field_account_set_default_value(field, account); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
999 gaim_request_field_account_set_value(field, account); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1000 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1001 return field; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1002 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1003 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1004 void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1005 gaim_request_field_account_set_default_value(GaimRequestField *field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1006 GaimAccount *default_value) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1007 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1008 g_return_if_fail(field != NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1009 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1010 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1011 field->u.account.default_account = default_value; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1012 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1013 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1014 void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1015 gaim_request_field_account_set_value(GaimRequestField *field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1016 GaimAccount *value) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1017 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1018 g_return_if_fail(field != NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1019 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1020 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1021 field->u.account.account = value; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1022 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1023 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1024 void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1025 gaim_request_field_account_set_show_all(GaimRequestField *field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1026 gboolean show_all) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1027 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1028 g_return_if_fail(field != NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1029 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1030 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1031 if (field->u.account.show_all == show_all) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1032 return; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1033 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1034 field->u.account.show_all = show_all; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1035 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1036 if (!show_all) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1037 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1038 if (gaim_account_is_connected(field->u.account.default_account)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1039 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1040 gaim_request_field_account_set_default_value(field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1041 (GaimAccount *)gaim_connections_get_all()->data); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1042 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1043 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1044 if (gaim_account_is_connected(field->u.account.account)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1045 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1046 gaim_request_field_account_set_value(field, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1047 (GaimAccount *)gaim_connections_get_all()->data); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1048 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1049 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1050 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1051 |
8289
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1052 void |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1053 gaim_request_field_account_set_filter(GaimRequestField *field, |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1054 GaimFilterAccountFunc filter_func) |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1055 { |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1056 g_return_if_fail(field != NULL); |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1057 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT); |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1058 |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1059 field->u.account.filter_func = filter_func; |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1060 } |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1061 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1062 GaimAccount * |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1063 gaim_request_field_account_get_default_value(const GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1064 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1065 g_return_val_if_fail(field != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1066 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1067 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1068 return field->u.account.default_account; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1069 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1070 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1071 GaimAccount * |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1072 gaim_request_field_account_get_value(const GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1073 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1074 g_return_val_if_fail(field != NULL, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1075 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT, NULL); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1076 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1077 return field->u.account.account; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1078 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1079 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1080 gboolean |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1081 gaim_request_field_account_get_show_all(const GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1082 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1083 g_return_val_if_fail(field != NULL, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1084 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1085 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1086 return field->u.account.show_all; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1087 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8285
diff
changeset
|
1088 |
8289
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1089 GaimFilterAccountFunc |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1090 gaim_request_field_account_get_filter(const GaimRequestField *field) |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1091 { |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1092 g_return_val_if_fail(field != NULL, FALSE); |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1093 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_ACCOUNT, FALSE); |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1094 |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1095 return field->u.account.filter_func; |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1096 } |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
1097 |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1098 /* -- */ |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1099 |
5477 | 1100 void * |
1101 gaim_request_input(void *handle, const char *title, const char *primary, | |
1102 const char *secondary, const char *default_value, | |
8697 | 1103 gboolean multiline, gboolean masked, gchar *hint, |
5477 | 1104 const char *ok_text, GCallback ok_cb, |
1105 const char *cancel_text, GCallback cancel_cb, | |
1106 void *user_data) | |
1107 { | |
1108 GaimRequestUiOps *ops; | |
1109 | |
1110 g_return_val_if_fail(ok_text != NULL, NULL); | |
1111 g_return_val_if_fail(ok_cb != NULL, NULL); | |
1112 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1113 ops = gaim_request_get_ui_ops(); |
5477 | 1114 |
1115 if (ops != NULL && ops->request_input != NULL) { | |
1116 GaimRequestInfo *info; | |
1117 | |
1118 info = g_new0(GaimRequestInfo, 1); | |
1119 info->type = GAIM_REQUEST_INPUT; | |
1120 info->handle = handle; | |
1121 info->ui_handle = ops->request_input(title, primary, secondary, | |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
5810
diff
changeset
|
1122 default_value, |
8697 | 1123 multiline, masked, hint, |
5482
a41149ee8a29
[gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents:
5477
diff
changeset
|
1124 ok_text, ok_cb, |
5477 | 1125 cancel_text, cancel_cb, |
1126 user_data); | |
1127 | |
1128 handles = g_list_append(handles, info); | |
1129 | |
1130 return info->ui_handle; | |
1131 } | |
1132 | |
1133 return NULL; | |
1134 } | |
1135 | |
1136 void * | |
1137 gaim_request_choice(void *handle, const char *title, const char *primary, | |
1138 const char *secondary, unsigned int default_value, | |
1139 const char *ok_text, GCallback ok_cb, | |
1140 const char *cancel_text, GCallback cancel_cb, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1141 void *user_data, size_t choice_count, ...) |
5477 | 1142 { |
1143 void *ui_handle; | |
1144 va_list args; | |
1145 | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1146 g_return_val_if_fail(ok_text != NULL, NULL); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1147 g_return_val_if_fail(ok_cb != NULL, NULL); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1148 g_return_val_if_fail(choice_count > 0, NULL); |
5477 | 1149 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1150 va_start(args, choice_count); |
5477 | 1151 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary, |
1152 default_value, ok_text, ok_cb, | |
1153 cancel_text, cancel_cb, user_data, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1154 choice_count, args); |
5477 | 1155 va_end(args); |
1156 | |
1157 return ui_handle; | |
1158 } | |
1159 | |
1160 void * | |
1161 gaim_request_choice_varg(void *handle, const char *title, | |
1162 const char *primary, const char *secondary, | |
1163 unsigned int default_value, | |
1164 const char *ok_text, GCallback ok_cb, | |
1165 const char *cancel_text, GCallback cancel_cb, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1166 void *user_data, size_t choice_count, |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1167 va_list choices) |
5477 | 1168 { |
1169 GaimRequestUiOps *ops; | |
1170 | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1171 g_return_val_if_fail(ok_text != NULL, NULL); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1172 g_return_val_if_fail(ok_cb != NULL, NULL); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1173 g_return_val_if_fail(choice_count > 0, NULL); |
5477 | 1174 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1175 ops = gaim_request_get_ui_ops(); |
5477 | 1176 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1177 if (ops != NULL && ops->request_choice != NULL) { |
5477 | 1178 GaimRequestInfo *info; |
1179 | |
1180 info = g_new0(GaimRequestInfo, 1); | |
1181 info->type = GAIM_REQUEST_CHOICE; | |
1182 info->handle = handle; | |
1183 info->ui_handle = ops->request_choice(title, primary, secondary, | |
5482
a41149ee8a29
[gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents:
5477
diff
changeset
|
1184 default_value, |
a41149ee8a29
[gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents:
5477
diff
changeset
|
1185 ok_text, ok_cb, |
5477 | 1186 cancel_text, cancel_cb, |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1187 user_data, choice_count, |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1188 choices); |
5477 | 1189 |
1190 handles = g_list_append(handles, info); | |
1191 | |
1192 return info->ui_handle; | |
1193 } | |
1194 | |
1195 return NULL; | |
1196 } | |
1197 | |
1198 void * | |
1199 gaim_request_action(void *handle, const char *title, const char *primary, | |
1200 const char *secondary, unsigned int default_action, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1201 void *user_data, size_t action_count, ...) |
5477 | 1202 { |
1203 void *ui_handle; | |
1204 va_list args; | |
1205 | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1206 g_return_val_if_fail(action_count > 0, NULL); |
5477 | 1207 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1208 va_start(args, action_count); |
5477 | 1209 ui_handle = gaim_request_action_varg(handle, title, primary, secondary, |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1210 default_action, user_data, |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1211 action_count, args); |
5477 | 1212 va_end(args); |
1213 | |
1214 return ui_handle; | |
1215 } | |
1216 | |
1217 void * | |
1218 gaim_request_action_varg(void *handle, const char *title, | |
1219 const char *primary, const char *secondary, | |
1220 unsigned int default_action, void *user_data, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1221 size_t action_count, va_list actions) |
5477 | 1222 { |
1223 GaimRequestUiOps *ops; | |
1224 | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1225 g_return_val_if_fail(action_count > 0, NULL); |
5477 | 1226 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1227 ops = gaim_request_get_ui_ops(); |
5477 | 1228 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1229 if (ops != NULL && ops->request_action != NULL) { |
5477 | 1230 GaimRequestInfo *info; |
1231 | |
1232 info = g_new0(GaimRequestInfo, 1); | |
1233 info->type = GAIM_REQUEST_ACTION; | |
1234 info->handle = handle; | |
1235 info->ui_handle = ops->request_action(title, primary, secondary, | |
1236 default_action, user_data, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5482
diff
changeset
|
1237 action_count, actions); |
5477 | 1238 |
1239 handles = g_list_append(handles, info); | |
1240 | |
1241 return info->ui_handle; | |
1242 } | |
1243 | |
1244 return NULL; | |
1245 } | |
1246 | |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1247 void * |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1248 gaim_request_fields(void *handle, const char *title, const char *primary, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1249 const char *secondary, GaimRequestFields *fields, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1250 const char *ok_text, GCallback ok_cb, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1251 const char *cancel_text, GCallback cancel_cb, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1252 void *user_data) |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1253 { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1254 GaimRequestUiOps *ops; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1255 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1256 g_return_val_if_fail(fields != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1257 g_return_val_if_fail(ok_text != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1258 g_return_val_if_fail(ok_cb != NULL, NULL); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1259 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1260 ops = gaim_request_get_ui_ops(); |
5807
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1261 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1262 if (ops != NULL && ops->request_fields != NULL) { |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1263 GaimRequestInfo *info; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1264 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1265 info = g_new0(GaimRequestInfo, 1); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1266 info->type = GAIM_REQUEST_FIELDS; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1267 info->handle = handle; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1268 info->ui_handle = ops->request_fields(title, primary, secondary, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1269 fields, ok_text, ok_cb, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1270 cancel_text, cancel_cb, |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1271 user_data); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1272 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1273 handles = g_list_append(handles, info); |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1274 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1275 return info->ui_handle; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1276 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1277 |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1278 return NULL; |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1279 } |
11001789cb22
[gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
1280 |
5477 | 1281 void |
1282 gaim_request_close(GaimRequestType type, void *ui_handle) | |
1283 { | |
1284 GList *l; | |
1285 GaimRequestUiOps *ops; | |
1286 | |
1287 g_return_if_fail(ui_handle != NULL); | |
1288 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1289 ops = gaim_request_get_ui_ops(); |
5477 | 1290 |
1291 for (l = handles; l != NULL; l = l->next) { | |
1292 GaimRequestInfo *info = l->data; | |
1293 | |
1294 if (info->ui_handle == ui_handle) { | |
1295 handles = g_list_remove(handles, info); | |
1296 | |
1297 if (ops != NULL && ops->close_request != NULL) | |
1298 ops->close_request(info->type, ui_handle); | |
1299 | |
1300 g_free(info); | |
1301 | |
1302 break; | |
1303 } | |
1304 } | |
1305 } | |
1306 | |
1307 void | |
1308 gaim_request_close_with_handle(void *handle) | |
1309 { | |
1310 GList *l, *l_next; | |
1311 GaimRequestUiOps *ops; | |
1312 | |
1313 g_return_if_fail(handle != NULL); | |
1314 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1315 ops = gaim_request_get_ui_ops(); |
5477 | 1316 |
1317 for (l = handles; l != NULL; l = l_next) { | |
1318 GaimRequestInfo *info = l->data; | |
1319 | |
1320 l_next = l->next; | |
1321 | |
1322 if (info->handle == handle) { | |
1323 handles = g_list_remove(handles, info); | |
1324 | |
1325 if (ops != NULL && ops->close_request != NULL) | |
1326 ops->close_request(info->type, info->ui_handle); | |
1327 | |
1328 g_free(info); | |
1329 } | |
1330 } | |
1331 } | |
1332 | |
8843 | 1333 void * |
1334 gaim_request_file(void *handle, | |
1335 const char *title, const char *filename, | |
1336 GCallback ok_cb, GCallback cancel_cb, | |
1337 void *user_data) | |
1338 { | |
1339 GaimRequestUiOps *ops; | |
1340 | |
1341 ops = gaim_request_get_ui_ops(); | |
1342 | |
1343 if (ops != NULL && ops->request_file != NULL) { | |
1344 GaimRequestInfo *info; | |
1345 | |
1346 info = g_new0(GaimRequestInfo, 1); | |
1347 info->type = GAIM_REQUEST_INPUT; | |
1348 info->handle = handle; | |
1349 info->ui_handle = ops->request_file(title, filename, | |
1350 ok_cb, cancel_cb, user_data); | |
1351 handles = g_list_append(handles, info); | |
1352 return info->ui_handle; | |
1353 } | |
1354 | |
1355 return NULL; | |
1356 } | |
1357 | |
5477 | 1358 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1359 gaim_request_set_ui_ops(GaimRequestUiOps *ops) |
5477 | 1360 { |
1361 request_ui_ops = ops; | |
1362 } | |
1363 | |
1364 GaimRequestUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1365 gaim_request_get_ui_ops(void) |
5477 | 1366 { |
1367 return request_ui_ops; | |
1368 } |