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