Mercurial > pidgin.yaz
annotate src/signals.c @ 8759:184b8c3b6d09
[gaim-migrate @ 9514]
Patch by Stu Tomlinson to fix some screwups I made when moving things to
the new plugin API version.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 22 Apr 2004 17:15:56 +0000 |
parents | f2919ca98e78 |
children | f4d981c9c4ab |
rev | line source |
---|---|
6485 | 1 /** |
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2 * @file signals.c Signal API |
6485 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6485 | 10 * |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include "internal.h" | |
26 | |
27 #include "debug.h" | |
28 #include "signals.h" | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
29 #include "value.h" |
6485 | 30 |
31 typedef struct | |
32 { | |
33 void *instance; | |
34 | |
35 GHashTable *signals; | |
36 size_t signal_count; | |
37 | |
38 gulong next_signal_id; | |
39 | |
40 } GaimInstanceData; | |
41 | |
42 typedef struct | |
43 { | |
44 gulong id; | |
45 | |
46 GaimSignalMarshalFunc marshal; | |
47 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
48 int num_values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
49 GaimValue **values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
50 GaimValue *ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
51 |
6485 | 52 GList *handlers; |
53 size_t handler_count; | |
54 | |
55 gulong next_handler_id; | |
56 | |
57 } GaimSignalData; | |
58 | |
59 typedef struct | |
60 { | |
61 gulong id; | |
62 GaimCallback cb; | |
63 void *handle; | |
64 void *data; | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
65 gboolean use_vargs; |
6485 | 66 |
67 } GaimSignalHandlerData; | |
68 | |
69 static GHashTable *instance_table = NULL; | |
70 | |
71 static void | |
72 destroy_instance_data(GaimInstanceData *instance_data) | |
73 { | |
74 g_hash_table_destroy(instance_data->signals); | |
75 | |
76 g_free(instance_data); | |
77 } | |
78 | |
79 static void | |
80 destroy_signal_data(GaimSignalData *signal_data) | |
81 { | |
82 GaimSignalHandlerData *handler_data; | |
83 GList *l; | |
84 | |
85 for (l = signal_data->handlers; l != NULL; l = l->next) | |
86 { | |
87 handler_data = (GaimSignalHandlerData *)l->data; | |
88 | |
89 g_free(l->data); | |
90 } | |
91 | |
92 g_list_free(signal_data->handlers); | |
93 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
94 if (signal_data->values != NULL) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
95 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
96 int i; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
97 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
98 for (i = 0; i < signal_data->num_values; i++) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
99 gaim_value_destroy((GaimValue *)signal_data->values[i]); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
100 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
101 g_free(signal_data->values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
102 } |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
103 |
6485 | 104 g_free(signal_data); |
105 } | |
106 | |
107 gulong | |
108 gaim_signal_register(void *instance, const char *signal, | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
109 GaimSignalMarshalFunc marshal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
110 GaimValue *ret_value, int num_values, ...) |
6485 | 111 { |
112 GaimInstanceData *instance_data; | |
113 GaimSignalData *signal_data; | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
114 va_list args; |
6485 | 115 |
116 g_return_val_if_fail(instance != NULL, 0); | |
117 g_return_val_if_fail(signal != NULL, 0); | |
118 g_return_val_if_fail(marshal != NULL, 0); | |
119 | |
120 instance_data = | |
121 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
122 | |
123 if (instance_data == NULL) | |
124 { | |
125 instance_data = g_new0(GaimInstanceData, 1); | |
126 | |
127 instance_data->instance = instance; | |
128 instance_data->next_signal_id = 1; | |
129 | |
130 instance_data->signals = | |
131 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, | |
132 (GDestroyNotify)destroy_signal_data); | |
133 | |
134 g_hash_table_insert(instance_table, instance, instance_data); | |
135 } | |
136 | |
137 signal_data = g_new0(GaimSignalData, 1); | |
138 signal_data->id = instance_data->next_signal_id; | |
139 signal_data->marshal = marshal; | |
140 signal_data->next_handler_id = 1; | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
141 signal_data->ret_value = ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
142 signal_data->num_values = num_values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
143 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
144 if (num_values > 0) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
145 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
146 int i; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
147 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
148 signal_data->values = g_new0(GaimValue *, num_values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
149 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
150 va_start(args, num_values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
151 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
152 for (i = 0; i < num_values; i++) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
153 signal_data->values[i] = va_arg(args, GaimValue *); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
154 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
155 va_end(args); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
156 } |
6485 | 157 |
158 g_hash_table_insert(instance_data->signals, | |
159 g_strdup(signal), signal_data); | |
160 | |
161 instance_data->next_signal_id++; | |
162 instance_data->signal_count++; | |
163 | |
164 return signal_data->id; | |
165 } | |
166 | |
167 void | |
168 gaim_signal_unregister(void *instance, const char *signal) | |
169 { | |
170 GaimInstanceData *instance_data; | |
171 | |
172 g_return_if_fail(instance != NULL); | |
173 g_return_if_fail(signal != NULL); | |
174 | |
175 instance_data = | |
176 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
177 | |
178 g_return_if_fail(instance_data != NULL); | |
179 | |
180 g_hash_table_remove(instance_data->signals, signal); | |
181 | |
182 instance_data->signal_count--; | |
183 | |
184 if (instance_data->signal_count == 0) | |
185 { | |
186 /* Unregister the instance. */ | |
187 g_hash_table_remove(instance_table, instance); | |
188 } | |
189 } | |
190 | |
191 void | |
192 gaim_signals_unregister_by_instance(void *instance) | |
193 { | |
194 gboolean found; | |
195 | |
196 g_return_if_fail(instance != NULL); | |
197 | |
198 found = g_hash_table_remove(instance_table, instance); | |
199 | |
200 /* | |
201 * Makes things easier (more annoying?) for developers who don't have | |
202 * things registering and unregistering in the right order :) | |
203 */ | |
204 g_return_if_fail(found); | |
205 } | |
206 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
207 void |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
208 gaim_signal_get_values(void *instance, const char *signal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
209 GaimValue **ret_value, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
210 int *num_values, GaimValue ***values) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
211 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
212 GaimInstanceData *instance_data; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
213 GaimSignalData *signal_data; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
214 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
215 g_return_if_fail(instance != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
216 g_return_if_fail(signal != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
217 g_return_if_fail(num_values != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
218 g_return_if_fail(values != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
219 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
220 /* Get the instance data */ |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
221 instance_data = |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
222 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
223 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
224 g_return_if_fail(instance_data != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
225 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
226 /* Get the signal data */ |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
227 signal_data = |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
228 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
229 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
230 g_return_if_fail(signal_data != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
231 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
232 *num_values = signal_data->num_values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
233 *values = signal_data->values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
234 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
235 if (ret_value != NULL) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
236 *ret_value = signal_data->ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
237 } |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
238 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
239 static gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
240 signal_connect_common(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
241 GaimCallback func, void *data, gboolean use_vargs) |
6485 | 242 { |
243 GaimInstanceData *instance_data; | |
244 GaimSignalData *signal_data; | |
245 GaimSignalHandlerData *handler_data; | |
246 | |
247 g_return_val_if_fail(instance != NULL, 0); | |
248 g_return_val_if_fail(signal != NULL, 0); | |
249 g_return_val_if_fail(handle != NULL, 0); | |
250 g_return_val_if_fail(func != NULL, 0); | |
251 | |
252 /* Get the instance data */ | |
253 instance_data = | |
254 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
255 | |
256 g_return_val_if_fail(instance_data != NULL, 0); | |
257 | |
258 /* Get the signal data */ | |
259 signal_data = | |
260 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
261 | |
262 if (signal_data == NULL) | |
263 { | |
264 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
265 "Signal data for %s not found!\n", signal); | |
266 return 0; | |
267 } | |
268 | |
269 /* Create the signal handler data */ | |
270 handler_data = g_new0(GaimSignalHandlerData, 1); | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
271 handler_data->id = signal_data->next_handler_id; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
272 handler_data->cb = func; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
273 handler_data->handle = handle; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
274 handler_data->data = data; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
275 handler_data->use_vargs = use_vargs; |
6485 | 276 |
277 signal_data->handlers = g_list_append(signal_data->handlers, handler_data); | |
278 signal_data->handler_count++; | |
279 signal_data->next_handler_id++; | |
280 | |
281 return handler_data->id; | |
282 } | |
6553
9e4fa4853cfe
[gaim-migrate @ 7075]
Christian Hammond <chipx86@chipx86.com>
parents:
6547
diff
changeset
|
283 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
284 gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
285 gaim_signal_connect(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
286 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
287 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
288 return signal_connect_common(instance, signal, handle, func, data, FALSE); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
289 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
290 |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
291 gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
292 gaim_signal_connect_vargs(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
293 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
294 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
295 return signal_connect_common(instance, signal, handle, func, data, TRUE); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
296 } |
6485 | 297 |
298 void | |
299 gaim_signal_disconnect(void *instance, const char *signal, | |
300 void *handle, GaimCallback func) | |
301 { | |
302 GaimInstanceData *instance_data; | |
303 GaimSignalData *signal_data; | |
304 GaimSignalHandlerData *handler_data; | |
305 GList *l; | |
306 gboolean found = FALSE; | |
307 | |
308 g_return_if_fail(instance != NULL); | |
309 g_return_if_fail(signal != NULL); | |
310 g_return_if_fail(handle != NULL); | |
311 g_return_if_fail(func != NULL); | |
312 | |
313 /* Get the instance data */ | |
314 instance_data = | |
315 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
316 | |
317 g_return_if_fail(instance_data != NULL); | |
318 | |
319 /* Get the signal data */ | |
320 signal_data = | |
321 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
322 | |
323 if (signal_data == NULL) | |
324 { | |
325 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
326 "Signal data for %s not found!\n", signal); | |
327 return; | |
328 } | |
329 | |
330 /* Find the handler data. */ | |
331 for (l = signal_data->handlers; l != NULL; l = l->next) | |
332 { | |
333 handler_data = (GaimSignalHandlerData *)l->data; | |
334 | |
335 if (handler_data->handle == handle && handler_data->cb == func) | |
336 { | |
337 g_free(handler_data); | |
338 | |
339 signal_data->handlers = g_list_remove(signal_data->handlers, | |
340 handler_data); | |
341 signal_data->handler_count--; | |
342 | |
343 found = TRUE; | |
344 | |
345 break; | |
346 } | |
347 } | |
348 | |
349 /* See note somewhere about this actually helping developers.. */ | |
350 g_return_if_fail(found); | |
351 } | |
352 | |
353 /* | |
354 * TODO: Make this all more efficient by storing a list of handlers, keyed | |
355 * to a handle. | |
356 */ | |
357 static void | |
358 disconnect_handle_from_signals(const char *signal, | |
359 GaimSignalData *signal_data, void *handle) | |
360 { | |
361 GList *l, *l_next; | |
362 GaimSignalHandlerData *handler_data; | |
363 | |
364 for (l = signal_data->handlers; l != NULL; l = l_next) | |
365 { | |
366 handler_data = (GaimSignalHandlerData *)l->data; | |
367 l_next = l->next; | |
368 | |
369 if (handler_data->handle == handle) | |
370 { | |
371 g_free(handler_data); | |
372 | |
373 signal_data->handler_count--; | |
374 signal_data->handlers = g_list_remove(signal_data->handlers, | |
375 handler_data); | |
376 } | |
377 } | |
378 } | |
379 | |
380 static void | |
381 disconnect_handle_from_instance(void *instance, | |
382 GaimInstanceData *instance_data, | |
383 void *handle) | |
384 { | |
385 g_hash_table_foreach(instance_data->signals, | |
386 (GHFunc)disconnect_handle_from_signals, handle); | |
387 } | |
388 | |
389 void | |
390 gaim_signals_disconnect_by_handle(void *handle) | |
391 { | |
392 g_return_if_fail(handle != NULL); | |
393 | |
394 g_hash_table_foreach(instance_table, | |
395 (GHFunc)disconnect_handle_from_instance, handle); | |
396 } | |
397 | |
398 void | |
399 gaim_signal_emit(void *instance, const char *signal, ...) | |
400 { | |
401 va_list args; | |
402 | |
7584
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
403 g_return_if_fail(instance != NULL); |
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
404 g_return_if_fail(signal != NULL); |
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
405 |
6485 | 406 va_start(args, signal); |
407 gaim_signal_emit_vargs(instance, signal, args); | |
408 va_end(args); | |
409 } | |
410 | |
411 void | |
412 gaim_signal_emit_vargs(void *instance, const char *signal, va_list args) | |
413 { | |
414 GaimInstanceData *instance_data; | |
415 GaimSignalData *signal_data; | |
416 GaimSignalHandlerData *handler_data; | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
417 GList *l, *l_next; |
8090 | 418 va_list tmp; |
6485 | 419 |
420 g_return_if_fail(instance != NULL); | |
421 g_return_if_fail(signal != NULL); | |
422 | |
423 instance_data = | |
424 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
425 | |
426 g_return_if_fail(instance_data != NULL); | |
427 | |
428 signal_data = | |
429 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
430 | |
431 if (signal_data == NULL) | |
432 { | |
433 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
434 "Signal data for %s not found!\n", signal); | |
435 return; | |
436 } | |
437 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
438 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 439 { |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
440 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
441 |
6485 | 442 handler_data = (GaimSignalHandlerData *)l->data; |
443 | |
8090 | 444 /* This is necessary because a va_list may only be |
445 * evaluated once */ | |
8142 | 446 G_VA_COPY(tmp, args); |
8090 | 447 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
448 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
449 { |
8090 | 450 ((void (*)(va_list, void *))handler_data->cb)(tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
451 handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
452 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
453 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
454 { |
8090 | 455 signal_data->marshal(handler_data->cb, tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
456 handler_data->data, NULL); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
457 } |
8090 | 458 |
459 va_end(tmp); | |
6485 | 460 } |
461 } | |
462 | |
463 void * | |
464 gaim_signal_emit_return_1(void *instance, const char *signal, ...) | |
465 { | |
466 void *ret_val; | |
467 va_list args; | |
468 | |
7597
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
469 g_return_val_if_fail(instance != NULL, NULL); |
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
470 g_return_val_if_fail(signal != NULL, NULL); |
7585
404f4a4b81da
[gaim-migrate @ 8203]
Christian Hammond <chipx86@chipx86.com>
parents:
7584
diff
changeset
|
471 |
6485 | 472 va_start(args, signal); |
473 ret_val = gaim_signal_emit_vargs_return_1(instance, signal, args); | |
474 va_end(args); | |
475 | |
476 return ret_val; | |
477 } | |
478 | |
479 void * | |
480 gaim_signal_emit_vargs_return_1(void *instance, const char *signal, | |
481 va_list args) | |
482 { | |
483 GaimInstanceData *instance_data; | |
484 GaimSignalData *signal_data; | |
485 GaimSignalHandlerData *handler_data; | |
486 void *ret_val = NULL; | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
487 GList *l, *l_next; |
8140 | 488 va_list tmp; |
6485 | 489 |
490 g_return_val_if_fail(instance != NULL, NULL); | |
491 g_return_val_if_fail(signal != NULL, NULL); | |
492 | |
493 instance_data = | |
494 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
495 | |
496 g_return_val_if_fail(instance_data != NULL, NULL); | |
497 | |
498 signal_data = | |
499 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
500 | |
501 if (signal_data == NULL) | |
502 { | |
503 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
504 "Signal data for %s not found!\n", signal); | |
505 return 0; | |
506 } | |
507 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
508 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 509 { |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
510 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
511 |
6485 | 512 handler_data = (GaimSignalHandlerData *)l->data; |
513 | |
8142 | 514 G_VA_COPY(tmp, args); |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
515 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
516 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
517 ret_val = ((void *(*)(va_list, void *))handler_data->cb)( |
8140 | 518 tmp, handler_data->data); |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
519 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
520 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
521 { |
8140 | 522 signal_data->marshal(handler_data->cb, tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
523 handler_data->data, &ret_val); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
524 } |
8140 | 525 va_end(tmp); |
6485 | 526 } |
527 | |
528 return ret_val; | |
529 } | |
530 | |
531 void | |
532 gaim_signals_init() | |
533 { | |
534 g_return_if_fail(instance_table == NULL); | |
535 | |
536 instance_table = | |
537 g_hash_table_new_full(g_direct_hash, g_direct_equal, | |
538 NULL, (GDestroyNotify)destroy_instance_data); | |
539 } | |
540 | |
541 void | |
542 gaim_signals_uninit() | |
543 { | |
544 g_return_if_fail(instance_table != NULL); | |
545 | |
546 g_hash_table_destroy(instance_table); | |
547 instance_table = NULL; | |
548 } | |
549 | |
550 /************************************************************************** | |
551 * Marshallers | |
552 **************************************************************************/ | |
553 void | |
554 gaim_marshal_VOID(GaimCallback cb, va_list args, void *data, | |
555 void **return_val) | |
556 { | |
557 ((void (*)(void *))cb)(data); | |
558 } | |
559 | |
560 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
561 gaim_marshal_VOID__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
562 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
563 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
564 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
565 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
566 ((void (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
567 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
568 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
569 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
570 gaim_marshal_VOID__INT_INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
571 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
572 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
573 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
574 gint arg2 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
575 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
576 ((void (*)(gint, gint, void *))cb)(arg1, arg2, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
577 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
578 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
579 void |
6485 | 580 gaim_marshal_VOID__POINTER(GaimCallback cb, va_list args, void *data, |
581 void **return_val) | |
582 { | |
6505 | 583 void *arg1 = va_arg(args, void *); |
584 | |
585 ((void (*)(void *, void *))cb)(arg1, data); | |
6485 | 586 } |
587 | |
588 void | |
589 gaim_marshal_VOID__POINTER_POINTER(GaimCallback cb, va_list args, | |
590 void *data, void **return_val) | |
591 { | |
6505 | 592 void *arg1 = va_arg(args, void *); |
593 void *arg2 = va_arg(args, void *); | |
594 | |
595 ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); | |
6485 | 596 } |
597 | |
598 void | |
599 gaim_marshal_VOID__POINTER_POINTER_UINT(GaimCallback cb, va_list args, | |
600 void *data, void **return_val) | |
601 { | |
6505 | 602 void *arg1 = va_arg(args, void *); |
603 void *arg2 = va_arg(args, void *); | |
604 guint arg3 = va_arg(args, guint); | |
605 | |
606 ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 607 } |
608 | |
609 void | |
610 gaim_marshal_VOID__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, | |
611 void *data, void **return_val) | |
612 { | |
6505 | 613 void *arg1 = va_arg(args, void *); |
614 void *arg2 = va_arg(args, void *); | |
615 void *arg3 = va_arg(args, void *); | |
616 | |
617 ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 618 } |
619 | |
620 void | |
621 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
622 va_list args, | |
623 void *data, | |
624 void **return_val) | |
625 { | |
6505 | 626 void *arg1 = va_arg(args, void *); |
627 void *arg2 = va_arg(args, void *); | |
628 void *arg3 = va_arg(args, void *); | |
629 void *arg4 = va_arg(args, void *); | |
630 | |
631 ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); | |
6485 | 632 } |
6509 | 633 |
634 void | |
635 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb, | |
636 va_list args, | |
637 void *data, | |
638 void **return_val) | |
639 { | |
640 void *arg1 = va_arg(args, void *); | |
641 void *arg2 = va_arg(args, void *); | |
642 void *arg3 = va_arg(args, void *); | |
643 guint arg4 = va_arg(args, guint); | |
644 | |
645 ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); | |
646 } | |
647 | |
6485 | 648 void |
649 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb, | |
650 va_list args, | |
651 void *data, | |
652 void **return_val) | |
653 { | |
6505 | 654 void *arg1 = va_arg(args, void *); |
655 void *arg2 = va_arg(args, void *); | |
656 void *arg3 = va_arg(args, void *); | |
657 guint arg4 = va_arg(args, guint); | |
658 guint arg5 = va_arg(args, guint); | |
659 | |
6485 | 660 ((void (*)(void *, void *, void *, guint, guint, void *))cb)( |
6505 | 661 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 662 } |
663 | |
664 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
665 gaim_marshal_INT__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
666 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
667 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
668 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
669 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
670 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
671 ret_val = ((gint (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
672 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
673 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
674 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
675 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
676 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
677 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
678 gaim_marshal_INT__INT_INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
679 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
680 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
681 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
682 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
683 gint arg2 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
684 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
685 ret_val = ((gint (*)(gint, gint, void *))cb)(arg1, arg2, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
686 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
687 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
688 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
689 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
690 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
691 void |
6485 | 692 gaim_marshal_BOOLEAN__POINTER(GaimCallback cb, va_list args, void *data, |
693 void **return_val) | |
694 { | |
695 gboolean ret_val; | |
6505 | 696 void *arg1 = va_arg(args, void *); |
6485 | 697 |
6505 | 698 ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); |
6485 | 699 |
700 if (return_val != NULL) | |
701 *return_val = GINT_TO_POINTER(ret_val); | |
702 } | |
703 | |
704 void | |
705 gaim_marshal_BOOLEAN__POINTER_POINTER(GaimCallback cb, va_list args, | |
706 void *data, void **return_val) | |
707 { | |
708 gboolean ret_val; | |
6505 | 709 void *arg1 = va_arg(args, void *); |
710 void *arg2 = va_arg(args, void *); | |
6485 | 711 |
6505 | 712 ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); |
6485 | 713 |
714 if (return_val != NULL) | |
715 *return_val = GINT_TO_POINTER(ret_val); | |
716 } | |
717 | |
718 void | |
6509 | 719 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, |
720 void *data, void **return_val) | |
721 { | |
722 gboolean ret_val; | |
723 void *arg1 = va_arg(args, void *); | |
724 void *arg2 = va_arg(args, void *); | |
725 void *arg3 = va_arg(args, void *); | |
726 | |
727 ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, | |
728 arg3, data); | |
729 | |
730 if (return_val != NULL) | |
731 *return_val = GINT_TO_POINTER(ret_val); | |
732 } | |
733 | |
734 void | |
735 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb, | |
736 va_list args, | |
737 void *data, | |
738 void **return_val) | |
739 { | |
740 gboolean ret_val; | |
741 void *arg1 = va_arg(args, void *); | |
742 void *arg2 = va_arg(args, void *); | |
743 guint arg3 = va_arg(args, guint); | |
744 | |
745 ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( | |
746 arg1, arg2, arg3, data); | |
747 | |
748 if (return_val != NULL) | |
749 *return_val = GINT_TO_POINTER(ret_val); | |
750 } | |
751 | |
752 void | |
6485 | 753 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
754 va_list args, | |
755 void *data, | |
756 void **return_val) | |
757 { | |
758 gboolean ret_val; | |
6505 | 759 void *arg1 = va_arg(args, void *); |
760 void *arg2 = va_arg(args, void *); | |
761 void *arg3 = va_arg(args, void *); | |
762 guint arg4 = va_arg(args, guint); | |
6485 | 763 |
764 ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( | |
6505 | 765 arg1, arg2, arg3, arg4, data); |
6485 | 766 |
767 if (return_val != NULL) | |
768 *return_val = GINT_TO_POINTER(ret_val); | |
769 } | |
770 | |
771 void | |
772 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
773 va_list args, | |
774 void *data, | |
775 void **return_val) | |
776 { | |
777 gboolean ret_val; | |
6505 | 778 void *arg1 = va_arg(args, void *); |
779 void *arg2 = va_arg(args, void *); | |
780 void *arg3 = va_arg(args, void *); | |
781 void *arg4 = va_arg(args, void *); | |
6485 | 782 |
783 ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( | |
6505 | 784 arg1, arg2, arg3, arg4, data); |
6485 | 785 |
786 if (return_val != NULL) | |
787 *return_val = GINT_TO_POINTER(ret_val); | |
788 } | |
789 | |
790 void | |
791 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( | |
792 GaimCallback cb, va_list args, void *data, void **return_val) | |
793 { | |
794 gboolean ret_val; | |
6505 | 795 void *arg1 = va_arg(args, void *); |
796 void *arg2 = va_arg(args, void *); | |
797 void *arg3 = va_arg(args, void *); | |
798 void *arg4 = va_arg(args, void *); | |
799 void *arg5 = va_arg(args, void *); | |
6485 | 800 |
801 ret_val = | |
802 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( | |
6505 | 803 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 804 |
805 if (return_val != NULL) | |
806 *return_val = GINT_TO_POINTER(ret_val); | |
807 } |