annotate src/request.c @ 12190:ffedae3d3156

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