annotate src/request.c @ 7970:a6eb0e250417

[gaim-migrate @ 8647] fix the crash when chats are still open and an account signs off committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 01 Jan 2004 18:20:01 +0000
parents a5c70e43ee43
children fa6395637e2c
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 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
8 *
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * 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
11 * the Free Software Foundation; either version 2 of the License, or
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "request.h"
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
24 #include "debug.h"
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 static GaimRequestUiOps *request_ui_ops = NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 static GList *handles = NULL;
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 typedef struct
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 GaimRequestType type;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 void *handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 } GaimRequestInfo;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
38 GaimRequestFields *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
39 gaim_request_fields_new(void)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
40 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
41 GaimRequestFields *fields;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
42
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
43 fields = g_new0(GaimRequestFields, 1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
44
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
45 fields->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
46 g_free, NULL);
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 return fields;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
49 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
50
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
51 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
52 gaim_request_fields_destroy(GaimRequestFields *fields)
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 GList *l;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
55 GaimRequestFieldGroup *group;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
56
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
57 g_return_if_fail(fields != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
58
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
59 for (l = fields->groups; l != NULL; l = l->next) {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
60 group = l->data;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
61
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
62 gaim_request_field_group_destroy(group);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
63 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
64
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
65 g_list_free(fields->groups);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
66
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
67 g_hash_table_destroy(fields->fields);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
68
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
69 g_free(fields);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
70 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
71
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
72 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
73 gaim_request_fields_add_group(GaimRequestFields *fields,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
74 GaimRequestFieldGroup *group)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
75 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
76 GList *l;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
77 GaimRequestField *field;
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 g_return_if_fail(fields != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
80 g_return_if_fail(group != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
81
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
82 fields->groups = g_list_append(fields->groups, 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 group->fields_list = fields;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
85
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
86 for (l = gaim_request_field_group_get_fields(group);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
87 l != NULL;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
88 l = l->next) {
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 field = l->data;
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 g_hash_table_insert(fields->fields,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
93 g_strdup(gaim_request_field_get_id(field)), field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
94 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
95 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
96
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
97 GList *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
98 gaim_request_fields_get_groups(const GaimRequestFields *fields)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
99 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
100 g_return_val_if_fail(fields != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
101
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
102 return fields->groups;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
103 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
104
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
105 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
106 gaim_request_fields_get_field(const GaimRequestFields *fields, const char *id)
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 GaimRequestField *field;
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 g_return_val_if_fail(fields != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
111 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
112
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
113 field = g_hash_table_lookup(fields->fields, id);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
114
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
115 g_return_val_if_fail(field != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
116
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
117 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
118 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
119
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
120 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
121 gaim_request_fields_get_string(const GaimRequestFields *fields, const char *id)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
122 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
123 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
124
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
125 g_return_val_if_fail(fields != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
126 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
127
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
128 if ((field = gaim_request_fields_get_field(fields, id)) == NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
129 return NULL;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
130
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
131 return gaim_request_field_string_get_value(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
132 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
133
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
134 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
135 gaim_request_fields_get_integer(const GaimRequestFields *fields,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
136 const char *id)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
137 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
138 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
139
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
140 g_return_val_if_fail(fields != NULL, 0);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
141 g_return_val_if_fail(id != NULL, 0);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
142
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
143 if ((field = gaim_request_fields_get_field(fields, id)) == NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
144 return 0;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
145
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
146 return gaim_request_field_int_get_value(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
147 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
148
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
149 gboolean
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
150 gaim_request_fields_get_bool(const GaimRequestFields *fields, const char *id)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
151 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
152 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
153
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
154 g_return_val_if_fail(fields != NULL, FALSE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
155 g_return_val_if_fail(id != NULL, FALSE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
156
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
157 if ((field = gaim_request_fields_get_field(fields, id)) == NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
158 return FALSE;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
159
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
160 return gaim_request_field_bool_get_value(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
161 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
162
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
163 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
164 gaim_request_fields_get_choice(const GaimRequestFields *fields, const char *id)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
165 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
166 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
167
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
168 g_return_val_if_fail(fields != NULL, -1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
169 g_return_val_if_fail(id != NULL, -1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
170
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
171 if ((field = gaim_request_fields_get_field(fields, id)) == NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
172 return -1;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
173
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
174 return gaim_request_field_choice_get_value(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
175 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
176
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
177 GaimRequestFieldGroup *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
178 gaim_request_field_group_new(const char *title)
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 GaimRequestFieldGroup *group;
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 group = g_new0(GaimRequestFieldGroup, 1);
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 if (title != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
185 group->title = g_strdup(title);
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 return group;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
188 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
189
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
190 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
191 gaim_request_field_group_destroy(GaimRequestFieldGroup *group)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
192 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
193 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
194 GList *l;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
195
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
196 g_return_if_fail(group != 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 if (group->title != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
199 g_free(group->title);
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 for (l = group->fields; l != NULL; l = l->next) {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
202 field = l->data;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
203
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
204 gaim_request_field_destroy(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
205 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
206
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
207 g_list_free(group->fields);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
208
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
209 g_free(group);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
210 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
211
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
212 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
213 gaim_request_field_group_add_field(GaimRequestFieldGroup *group,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
214 GaimRequestField *field)
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 g_return_if_fail(group != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
217 g_return_if_fail(field != NULL);
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 group->fields = g_list_append(group->fields, 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 if (group->fields_list != NULL) {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
222 g_hash_table_insert(group->fields_list->fields,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
223 g_strdup(gaim_request_field_get_id(field)), field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
224 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
225 }
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 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
228 gaim_request_field_group_get_title(const GaimRequestFieldGroup *group)
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 g_return_val_if_fail(group != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
231
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
232 return group->title;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
233 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
234
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
235 GList *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
236 gaim_request_field_group_get_fields(const GaimRequestFieldGroup *group)
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 g_return_val_if_fail(group != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
239
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
240 return group->fields;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
241 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
242
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
243 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
244 gaim_request_field_new(const char *id, const char *text,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
245 GaimRequestFieldType type)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
246 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
247 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
248
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
249 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
250 g_return_val_if_fail(type != GAIM_REQUEST_FIELD_NONE, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
251
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
252 field = g_new0(GaimRequestField, 1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
253
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
254 field->id = g_strdup(id);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
255 field->type = type;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
256
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
257 gaim_request_field_set_label(field, text);
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
258 gaim_request_field_set_visible(field, TRUE);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
259
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
260 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
261 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
262
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
263 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
264 gaim_request_field_destroy(GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
265 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
266 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
267
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
268 if (field->id != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
269 g_free(field->id);
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 if (field->label != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
272 g_free(field->label);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
273
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
274 if (field->type == GAIM_REQUEST_FIELD_STRING)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
275 {
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
276 if (field->u.string.default_value != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
277 g_free(field->u.string.default_value);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
278
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
279 if (field->u.string.value != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
280 g_free(field->u.string.value);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
281 }
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
282 else if (field->type == GAIM_REQUEST_FIELD_CHOICE)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
283 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
284 if (field->u.choice.labels != NULL)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
285 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
286 g_list_foreach(field->u.choice.labels, (GFunc)g_free, NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
287 g_list_free(field->u.choice.labels);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
288 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
289 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
290 else if (field->type == GAIM_REQUEST_FIELD_LIST)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
291 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
292 if (field->u.list.items != NULL)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
293 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
294 g_list_foreach(field->u.list.items, (GFunc)g_free, NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
295 g_list_free(field->u.list.items);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
296 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
297
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
298 if (field->u.list.selected != NULL)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
299 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
300 g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
301 g_list_free(field->u.list.selected);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
302 }
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
303
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
304 g_hash_table_destroy(field->u.list.item_data);
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
305 g_hash_table_destroy(field->u.list.selected_table);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
306 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
307
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
308 g_free(field);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
309 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
310
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
311 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
312 gaim_request_field_set_label(GaimRequestField *field, const char *label)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
313 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
314 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
315
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
316 if (field->label != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
317 g_free(field->label);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
318
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
319 field->label = (label == NULL ? NULL : g_strdup(label));
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
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
322 void
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
323 gaim_request_field_set_visible(GaimRequestField *field, gboolean visible)
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
324 {
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
325 g_return_if_fail(field != NULL);
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
326
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
327 field->visible = visible;
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
328 }
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
329
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
330 GaimRequestFieldType
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
331 gaim_request_field_get_type(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
332 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
333 g_return_val_if_fail(field != NULL, GAIM_REQUEST_FIELD_NONE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
334
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
335 return field->type;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
336 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
337
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
338 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
339 gaim_request_field_get_id(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
340 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
341 g_return_val_if_fail(field != NULL, 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 return field->id;
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
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
346 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
347 gaim_request_field_get_label(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
348 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
349 g_return_val_if_fail(field != NULL, NULL);
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->label;
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
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
354 gboolean
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
355 gaim_request_field_is_visible(const GaimRequestField *field)
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
356 {
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
357 g_return_val_if_fail(field != NULL, FALSE);
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
358
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
359 return field->visible;
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
360 }
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7902
diff changeset
361
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
362 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
363 gaim_request_field_string_new(const char *id, const char *text,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
364 const char *default_value, gboolean multiline)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
365 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
366 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
367
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
368 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
369 g_return_val_if_fail(text != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
370
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
371 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_STRING);
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 field->u.string.multiline = multiline;
7048
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7047
diff changeset
374 field->u.string.editable = TRUE;
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
375
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
376 gaim_request_field_string_set_default_value(field, default_value);
7072
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7048
diff changeset
377 gaim_request_field_string_set_value(field, default_value);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
378
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
379 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
380 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
381
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
382 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
383 gaim_request_field_string_set_default_value(GaimRequestField *field,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
384 const char *default_value)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
385 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
386 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
387 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
388
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
389 if (field->u.string.default_value != NULL)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
390 g_free(field->u.string.default_value);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
391
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
392 field->u.string.default_value = (default_value == NULL
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
393 ? NULL : g_strdup(default_value));
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
394 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
395
5808
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
396 void
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
397 gaim_request_field_string_set_value(GaimRequestField *field, const char *value)
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
398 {
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
399 g_return_if_fail(field != NULL);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
400 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
401
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
402 if (field->u.string.value != NULL)
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
403 g_free(field->u.string.value);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
404
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
405 field->u.string.value = (value == NULL ? NULL : g_strdup(value));
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
406 }
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
407
7047
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
408 void
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
409 gaim_request_field_string_set_masked(GaimRequestField *field, gboolean masked)
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
410 {
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
411 g_return_if_fail(field != NULL);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
412 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
413
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
414 field->u.string.masked = masked;
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
415 }
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
416
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
417 void
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
418 gaim_request_field_string_set_editable(GaimRequestField *field,
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
419 gboolean editable)
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
420 {
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
421 g_return_if_fail(field != NULL);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
422 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
423
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
424 field->u.string.editable = editable;
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
425 }
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
426
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
427 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
428 gaim_request_field_string_get_default_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
429 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
430 g_return_val_if_fail(field != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
431 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
432
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
433 return field->u.string.default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
434 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
435
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
436 const char *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
437 gaim_request_field_string_get_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
438 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
439 g_return_val_if_fail(field != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
440 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
441
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
442 return field->u.string.value;
7047
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
443 }
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
444
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
445 gboolean
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
446 gaim_request_field_string_is_multiline(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
447 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
448 g_return_val_if_fail(field != NULL, FALSE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
449 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
450
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
451 return field->u.string.multiline;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
452 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
453
7047
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
454 gboolean
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
455 gaim_request_field_string_is_masked(const GaimRequestField *field)
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
456 {
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
457 g_return_val_if_fail(field != NULL, FALSE);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
458 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
459
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
460 return field->u.string.masked;
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
461 }
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
462
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
463 gboolean
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
464 gaim_request_field_string_is_editable(const GaimRequestField *field)
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
465 {
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
466 g_return_val_if_fail(field != NULL, FALSE);
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
467 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
468
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
469 return field->u.string.editable;
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
470 }
7d1909655fd0 [gaim-migrate @ 7610]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
471
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
472 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
473 gaim_request_field_int_new(const char *id, const char *text,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
474 int default_value)
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 GaimRequestField *field;
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 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
479 g_return_val_if_fail(text != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
480
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
481 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_INTEGER);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
482
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
483 gaim_request_field_int_set_default_value(field, default_value);
7072
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7048
diff changeset
484 gaim_request_field_int_set_value(field, default_value);
5807
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 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
487 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
488
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
489 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
490 gaim_request_field_int_set_default_value(GaimRequestField *field,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
491 int default_value)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
492 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
493 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
494 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
495
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
496 field->u.integer.default_value = default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
497 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
498
5808
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
499 void
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
500 gaim_request_field_int_set_value(GaimRequestField *field, int value)
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
501 {
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
502 g_return_if_fail(field != NULL);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
503 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
504
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
505 field->u.integer.value = value;
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
506 }
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
507
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
508 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
509 gaim_request_field_int_get_default_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
510 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
511 g_return_val_if_fail(field != NULL, 0);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
512 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
513
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
514 return field->u.integer.default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
515 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
516
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
517 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
518 gaim_request_field_int_get_value(const GaimRequestField *field)
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 g_return_val_if_fail(field != NULL, 0);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
521 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
522
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
523 return field->u.integer.value;
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
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
526 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
527 gaim_request_field_bool_new(const char *id, const char *text,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
528 gboolean default_value)
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 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
531
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
532 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
533 g_return_val_if_fail(text != NULL, NULL);
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 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_BOOLEAN);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
536
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
537 gaim_request_field_bool_set_default_value(field, default_value);
7072
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7048
diff changeset
538 gaim_request_field_bool_set_value(field, default_value);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
539
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
540 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
541 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
542
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
543 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
544 gaim_request_field_bool_set_default_value(GaimRequestField *field,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
545 gboolean default_value)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
546 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
547 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
548 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
549
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
550 field->u.boolean.default_value = default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
551 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
552
5808
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
553 void
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
554 gaim_request_field_bool_set_value(GaimRequestField *field, gboolean 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 g_return_if_fail(field != NULL);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
557 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
558
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
559 field->u.boolean.value = value;
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
560 }
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
561
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
562 gboolean
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
563 gaim_request_field_bool_get_default_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
564 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
565 g_return_val_if_fail(field != NULL, FALSE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
566 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
567
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
568 return field->u.boolean.default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
569 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
570
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
571 gboolean
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
572 gaim_request_field_bool_get_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
573 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
574 g_return_val_if_fail(field != NULL, FALSE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
575 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
576
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
577 return field->u.boolean.value;
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
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
580 GaimRequestField *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
581 gaim_request_field_choice_new(const char *id, const char *text,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
582 int default_value)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
583 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
584 GaimRequestField *field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
585
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
586 g_return_val_if_fail(id != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
587 g_return_val_if_fail(text != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
588
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
589 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_CHOICE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
590
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
591 gaim_request_field_choice_set_default_value(field, default_value);
7072
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7048
diff changeset
592 gaim_request_field_choice_set_value(field, default_value);
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
593
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
594 return field;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
595 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
596
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
597 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
598 gaim_request_field_choice_add(GaimRequestField *field, const char *label)
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 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
601 g_return_if_fail(label != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
602 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
603
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
604 field->u.choice.labels = g_list_append(field->u.choice.labels,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
605 g_strdup(label));
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
606 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
607
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
608 void
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
609 gaim_request_field_choice_set_default_value(GaimRequestField *field,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
610 int default_value)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
611 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
612 g_return_if_fail(field != NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
613 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
614
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
615 field->u.choice.default_value = default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
616 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
617
5808
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
618 void
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
619 gaim_request_field_choice_set_value(GaimRequestField *field,
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
620 int value)
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
621 {
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
622 g_return_if_fail(field != NULL);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
623 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE);
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
624
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
625 field->u.choice.value = value;
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
626 }
133e86584f4b [gaim-migrate @ 6238]
Christian Hammond <chipx86@chipx86.com>
parents: 5807
diff changeset
627
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
628 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
629 gaim_request_field_choice_get_default_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
630 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
631 g_return_val_if_fail(field != NULL, -1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
632 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
633
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
634 return field->u.choice.default_value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
635 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
636
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
637 int
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
638 gaim_request_field_choice_get_value(const GaimRequestField *field)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
639 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
640 g_return_val_if_fail(field != NULL, -1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
641 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
642
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
643 return field->u.choice.value;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
644 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
645
5809
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
646 GList *
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
647 gaim_request_field_choice_get_labels(const GaimRequestField *field)
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
648 {
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
649 g_return_val_if_fail(field != NULL, NULL);
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
650 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
651
5810
327bc2f78340 [gaim-migrate @ 6240]
Christian Hammond <chipx86@chipx86.com>
parents: 5809
diff changeset
652 return field->u.choice.labels;
5809
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
653 }
0a661f6d65e3 [gaim-migrate @ 6239]
Christian Hammond <chipx86@chipx86.com>
parents: 5808
diff changeset
654
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
655 GaimRequestField *
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
656 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
657 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
658 GaimRequestField *field;
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
659
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
660 g_return_val_if_fail(id != NULL, NULL);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
661 g_return_val_if_fail(text != NULL, NULL);
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
662
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
663 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_LIST);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
664
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
665 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
666 g_free, NULL);
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
667
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
668 field->u.list.selected_table =
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
669 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
670
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
671 return field;
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
672 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
673
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
674 void
7899
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
675 gaim_request_field_list_set_multi_select(GaimRequestField *field,
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
676 gboolean multi_select)
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
677 {
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
678 g_return_if_fail(field != NULL);
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
679 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
680
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
681 field->u.list.multiple_selection = multi_select;
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
682 }
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
683
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
684 gboolean
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
685 gaim_request_field_list_get_multi_select(const GaimRequestField *field)
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
686 {
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
687 g_return_val_if_fail(field != NULL, FALSE);
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
688 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
689
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
690 return field->u.list.multiple_selection;
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
691 }
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
692
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
693 void *
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
694 gaim_request_field_list_get_data(const GaimRequestField *field,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
695 const char *text)
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
696 {
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
697 g_return_val_if_fail(field != NULL, NULL);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
698 g_return_val_if_fail(text != NULL, NULL);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
699 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
700
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
701 return g_hash_table_lookup(field->u.list.item_data, text);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
702 }
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
703
7899
7b64108b8ae3 [gaim-migrate @ 8559]
Christian Hammond <chipx86@chipx86.com>
parents: 7898
diff changeset
704 void
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
705 gaim_request_field_list_add(GaimRequestField *field, const char *item,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
706 void *data)
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
707 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
708 g_return_if_fail(field != NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
709 g_return_if_fail(item != NULL);
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
710 g_return_if_fail(data != NULL);
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
711 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
712
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
713 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
714
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
715 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
716 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
717
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
718 void
7902
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
719 gaim_request_field_list_add_selected(GaimRequestField *field, const char *item)
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
720 {
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
721 g_return_if_fail(field != NULL);
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
722 g_return_if_fail(item != NULL);
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
723 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
724
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
725 if (!gaim_request_field_list_get_multi_select(field) &&
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
726 field->u.list.selected != NULL)
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
727 {
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
728 gaim_debug_warning("request",
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
729 "More than one item added to non-multi-select "
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
730 "field %s\n",
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
731 gaim_request_field_get_id(field));
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
732 return;
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
733 }
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
734
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
735 field->u.list.selected = g_list_append(field->u.list.selected,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
736 g_strdup(item));
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
737
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
738 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
739 }
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
740
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
741 void
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
742 gaim_request_field_list_clear_selected(GaimRequestField *field)
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
743 {
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
744 g_return_if_fail(field != NULL);
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
745 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
746
7962
cc77bd88cd72 [gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents: 7909
diff changeset
747 if (field->u.list.selected != NULL)
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
748 {
7962
cc77bd88cd72 [gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents: 7909
diff changeset
749 g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL);
cc77bd88cd72 [gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents: 7909
diff changeset
750 g_list_free(field->u.list.selected);
cc77bd88cd72 [gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents: 7909
diff changeset
751 field->u.list.selected = NULL;
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
752 }
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
753
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
754 g_hash_table_destroy(field->u.list.selected_table);
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
755
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
756 field->u.list.selected_table =
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
757 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
758 }
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
759
3ca501305ac5 [gaim-migrate @ 8562]
Christian Hammond <chipx86@chipx86.com>
parents: 7901
diff changeset
760 void
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
761 gaim_request_field_list_set_selected(GaimRequestField *field, GList *items)
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
762 {
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
763 GList *l;
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
764
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
765 g_return_if_fail(field != NULL);
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
766 g_return_if_fail(items != NULL);
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
767 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
768
7962
cc77bd88cd72 [gaim-migrate @ 8639]
Christian Hammond <chipx86@chipx86.com>
parents: 7909
diff changeset
769 gaim_request_field_list_clear_selected(field);
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
770
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
771 if (!gaim_request_field_list_get_multi_select(field) &&
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
772 g_list_length(items) > 1)
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
773 {
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
774 gaim_debug_warning("request",
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
775 "More than one item added to non-multi-select "
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
776 "field %s\n",
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
777 gaim_request_field_get_id(field));
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
778 return;
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
779 }
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
780
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
781 field->u.list.selected = items;
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
782
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
783 for (l = field->u.list.selected; l != NULL; l = l->next)
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
784 {
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
785 g_hash_table_insert(field->u.list.selected_table,
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
786 g_strdup((char *)l->data), NULL);
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
787 }
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
788 }
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
789
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
790 gboolean
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
791 gaim_request_field_list_is_selected(const GaimRequestField *field,
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
792 const char *item)
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
793 {
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
794 g_return_val_if_fail(field != NULL, FALSE);
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
795 g_return_val_if_fail(item != NULL, FALSE);
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
796 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
797
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
798 return g_hash_table_lookup_extended(field->u.list.selected_table,
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7962
diff changeset
799 item, NULL, NULL);
7901
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
800 }
4344f7fad009 [gaim-migrate @ 8561]
Christian Hammond <chipx86@chipx86.com>
parents: 7899
diff changeset
801
7898
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
802 const GList *
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
803 gaim_request_field_list_get_selected(const GaimRequestField *field)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
804 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
805 g_return_val_if_fail(field != NULL, NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
806 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
807
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
808 return field->u.list.selected;
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
809 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
810
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
811 const GList *
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
812 gaim_request_field_list_get_items(const GaimRequestField *field)
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
813 {
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
814 g_return_val_if_fail(field != NULL, NULL);
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
815 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
816
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
817 return field->u.list.items;
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
818 }
9c0ea21997a9 [gaim-migrate @ 8558]
Christian Hammond <chipx86@chipx86.com>
parents: 7843
diff changeset
819
7905
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
820 GaimRequestField *
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
821 gaim_request_field_label_new(const char *id, const char *text)
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
822 {
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
823 GaimRequestField *field;
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
824
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
825 g_return_val_if_fail(id != NULL, NULL);
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
826 g_return_val_if_fail(text != NULL, NULL);
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
827
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
828 field = gaim_request_field_new(id, text, GAIM_REQUEST_FIELD_LABEL);
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
829
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
830 return field;
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
831 }
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
832
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
833 /* -- */
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
834
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
835 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
836 gaim_request_input(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
837 const char *secondary, const char *default_value,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5810
diff changeset
838 gboolean multiline, gboolean masked,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
839 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
840 const char *cancel_text, GCallback cancel_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
841 void *user_data)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
842 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
843 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
844
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
845 g_return_val_if_fail(ok_text != NULL, NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
846 g_return_val_if_fail(ok_cb != NULL, NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
847
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
848 ops = gaim_request_get_ui_ops();
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
849
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
850 if (ops != NULL && ops->request_input != NULL) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
851 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
852
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
853 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
854 info->type = GAIM_REQUEST_INPUT;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
855 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
856 info->ui_handle = ops->request_input(title, primary, secondary,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5810
diff changeset
857 default_value,
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5810
diff changeset
858 multiline, masked,
5482
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
859 ok_text, ok_cb,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
860 cancel_text, cancel_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
861 user_data);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
862
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
863 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
864
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
865 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
866 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
867
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
868 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
869 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
870
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
871 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
872 gaim_request_choice(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
873 const char *secondary, unsigned int default_value,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
874 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
875 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
876 void *user_data, size_t choice_count, ...)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
877 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
878 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 va_list args;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
881 g_return_val_if_fail(ok_text != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
882 g_return_val_if_fail(ok_cb != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
883 g_return_val_if_fail(choice_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
884
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
885 va_start(args, choice_count);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
886 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
887 default_value, ok_text, ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
888 cancel_text, cancel_cb, user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
889 choice_count, args);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
890 va_end(args);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
891
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
892 return ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
893 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
894
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
895 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
896 gaim_request_choice_varg(void *handle, const char *title,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
897 const char *primary, const char *secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
898 unsigned int default_value,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
899 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
900 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
901 void *user_data, size_t choice_count,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
902 va_list choices)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
904 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
906 g_return_val_if_fail(ok_text != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
907 g_return_val_if_fail(ok_cb != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
908 g_return_val_if_fail(choice_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
909
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
910 ops = gaim_request_get_ui_ops();
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
911
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
912 if (ops != NULL && ops->request_choice != NULL) {
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
913 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
914
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
915 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
916 info->type = GAIM_REQUEST_CHOICE;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
917 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
918 info->ui_handle = ops->request_choice(title, primary, secondary,
5482
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
919 default_value,
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
920 ok_text, ok_cb,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
921 cancel_text, cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
922 user_data, choice_count,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
923 choices);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
924
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
925 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
926
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
927 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
928 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
929
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
930 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
931 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
932
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
933 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
934 gaim_request_action(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
935 const char *secondary, unsigned int default_action,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
936 void *user_data, size_t action_count, ...)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
937 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
938 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
939 va_list args;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
940
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
941 g_return_val_if_fail(action_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
942
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
943 va_start(args, action_count);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
944 ui_handle = gaim_request_action_varg(handle, title, primary, secondary,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
945 default_action, user_data,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
946 action_count, args);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
947 va_end(args);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
948
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
949 return ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
950 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
951
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
952 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
953 gaim_request_action_varg(void *handle, const char *title,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
954 const char *primary, const char *secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
955 unsigned int default_action, void *user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
956 size_t action_count, va_list actions)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
957 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
958 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
959
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
960 g_return_val_if_fail(action_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
961
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
962 ops = gaim_request_get_ui_ops();
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
963
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
964 if (ops != NULL && ops->request_action != NULL) {
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
965 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
966
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
967 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
968 info->type = GAIM_REQUEST_ACTION;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
969 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
970 info->ui_handle = ops->request_action(title, primary, secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
971 default_action, user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
972 action_count, actions);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
973
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
974 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
975
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
976 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
977 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
978
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
979 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
980 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
981
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
982 void *
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
983 gaim_request_fields(void *handle, const char *title, const char *primary,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
984 const char *secondary, GaimRequestFields *fields,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
985 const char *ok_text, GCallback ok_cb,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
986 const char *cancel_text, GCallback cancel_cb,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
987 void *user_data)
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
988 {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
989 GaimRequestUiOps *ops;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
990
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
991 g_return_val_if_fail(fields != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
992 g_return_val_if_fail(ok_text != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
993 g_return_val_if_fail(ok_cb != NULL, NULL);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
994
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
995 ops = gaim_request_get_ui_ops();
5807
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
996
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
997 if (ops != NULL && ops->request_fields != NULL) {
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
998 GaimRequestInfo *info;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
999
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1000 info = g_new0(GaimRequestInfo, 1);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1001 info->type = GAIM_REQUEST_FIELDS;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1002 info->handle = handle;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1003 info->ui_handle = ops->request_fields(title, primary, secondary,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1004 fields, ok_text, ok_cb,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1005 cancel_text, cancel_cb,
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1006 user_data);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1007
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1008 handles = g_list_append(handles, info);
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1009
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1010 return info->ui_handle;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1011 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1012
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1013 return NULL;
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1014 }
11001789cb22 [gaim-migrate @ 6237]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
1015
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1016 void
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1017 gaim_request_close(GaimRequestType type, void *ui_handle)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1018 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1019 GList *l;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1020 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1021
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1022 g_return_if_fail(ui_handle != NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1023
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1024 ops = gaim_request_get_ui_ops();
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1025
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1026 for (l = handles; l != NULL; l = l->next) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1027 GaimRequestInfo *info = l->data;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1028
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1029 if (info->ui_handle == ui_handle) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1030 handles = g_list_remove(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1031
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1032 if (ops != NULL && ops->close_request != NULL)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1033 ops->close_request(info->type, ui_handle);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1034
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1035 g_free(info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1036
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1037 break;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1038 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1039 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1040 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1041
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1042 void
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1043 gaim_request_close_with_handle(void *handle)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1044 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1045 GList *l, *l_next;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1046 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1047
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1048 g_return_if_fail(handle != NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1049
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1050 ops = gaim_request_get_ui_ops();
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1051
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1052 for (l = handles; l != NULL; l = l_next) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1053 GaimRequestInfo *info = l->data;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1054
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1055 l_next = l->next;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1056
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1057 if (info->handle == handle) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1058 handles = g_list_remove(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1059
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1060 if (ops != NULL && ops->close_request != NULL)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1061 ops->close_request(info->type, info->ui_handle);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1062
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1063 g_free(info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1064 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1065 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1066 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1067
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1068 void
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1069 gaim_request_set_ui_ops(GaimRequestUiOps *ops)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1070 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1071 request_ui_ops = ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1072 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1073
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074 GaimRequestUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1075 gaim_request_get_ui_ops(void)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1076 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1077 return request_ui_ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1078 }