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