Mercurial > pidgin
annotate src/signals.c @ 8046:fa6395637e2c
[gaim-migrate @ 8730]
John Silverstri did this for me.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 10 Jan 2004 04:04:57 +0000 |
parents | 07dc83303503 |
children | fb0eab758560 |
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; |
6485 | 418 |
419 g_return_if_fail(instance != NULL); | |
420 g_return_if_fail(signal != NULL); | |
421 | |
422 instance_data = | |
423 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
424 | |
425 g_return_if_fail(instance_data != NULL); | |
426 | |
427 signal_data = | |
428 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
429 | |
430 if (signal_data == NULL) | |
431 { | |
432 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
433 "Signal data for %s not found!\n", signal); | |
434 return; | |
435 } | |
436 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
437 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 438 { |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
439 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
440 |
6485 | 441 handler_data = (GaimSignalHandlerData *)l->data; |
442 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
443 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
444 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
445 ((void (*)(va_list, void *))handler_data->cb)(args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
446 handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
447 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
448 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
449 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
450 signal_data->marshal(handler_data->cb, args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
451 handler_data->data, NULL); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
452 } |
6485 | 453 } |
454 } | |
455 | |
456 void * | |
457 gaim_signal_emit_return_1(void *instance, const char *signal, ...) | |
458 { | |
459 void *ret_val; | |
460 va_list args; | |
461 | |
7597
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
462 g_return_val_if_fail(instance != NULL, NULL); |
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
463 g_return_val_if_fail(signal != NULL, NULL); |
7585
404f4a4b81da
[gaim-migrate @ 8203]
Christian Hammond <chipx86@chipx86.com>
parents:
7584
diff
changeset
|
464 |
6485 | 465 va_start(args, signal); |
466 ret_val = gaim_signal_emit_vargs_return_1(instance, signal, args); | |
467 va_end(args); | |
468 | |
469 return ret_val; | |
470 } | |
471 | |
472 void * | |
473 gaim_signal_emit_vargs_return_1(void *instance, const char *signal, | |
474 va_list args) | |
475 { | |
476 GaimInstanceData *instance_data; | |
477 GaimSignalData *signal_data; | |
478 GaimSignalHandlerData *handler_data; | |
479 void *ret_val = NULL; | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
480 GList *l, *l_next; |
6485 | 481 |
482 g_return_val_if_fail(instance != NULL, NULL); | |
483 g_return_val_if_fail(signal != NULL, NULL); | |
484 | |
485 instance_data = | |
486 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
487 | |
488 g_return_val_if_fail(instance_data != NULL, NULL); | |
489 | |
490 signal_data = | |
491 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
492 | |
493 if (signal_data == NULL) | |
494 { | |
495 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
496 "Signal data for %s not found!\n", signal); | |
497 return 0; | |
498 } | |
499 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
500 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 501 { |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
502 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
503 |
6485 | 504 handler_data = (GaimSignalHandlerData *)l->data; |
505 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
506 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
507 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
508 ret_val = ((void *(*)(va_list, void *))handler_data->cb)( |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
509 args, handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
510 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
511 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
512 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
513 signal_data->marshal(handler_data->cb, args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
514 handler_data->data, &ret_val); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
515 } |
6485 | 516 } |
517 | |
518 return ret_val; | |
519 } | |
520 | |
521 void | |
522 gaim_signals_init() | |
523 { | |
524 g_return_if_fail(instance_table == NULL); | |
525 | |
526 instance_table = | |
527 g_hash_table_new_full(g_direct_hash, g_direct_equal, | |
528 NULL, (GDestroyNotify)destroy_instance_data); | |
529 } | |
530 | |
531 void | |
532 gaim_signals_uninit() | |
533 { | |
534 g_return_if_fail(instance_table != NULL); | |
535 | |
536 g_hash_table_destroy(instance_table); | |
537 instance_table = NULL; | |
538 } | |
539 | |
540 /************************************************************************** | |
541 * Marshallers | |
542 **************************************************************************/ | |
543 void | |
544 gaim_marshal_VOID(GaimCallback cb, va_list args, void *data, | |
545 void **return_val) | |
546 { | |
547 ((void (*)(void *))cb)(data); | |
548 } | |
549 | |
550 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
551 gaim_marshal_VOID__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
552 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
553 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
554 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
555 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
556 ((void (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
557 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
558 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
559 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
560 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
|
561 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
562 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
563 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
564 gint arg2 = 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, gint, void *))cb)(arg1, arg2, 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 |
6485 | 570 gaim_marshal_VOID__POINTER(GaimCallback cb, va_list args, void *data, |
571 void **return_val) | |
572 { | |
6505 | 573 void *arg1 = va_arg(args, void *); |
574 | |
575 ((void (*)(void *, void *))cb)(arg1, data); | |
6485 | 576 } |
577 | |
578 void | |
579 gaim_marshal_VOID__POINTER_POINTER(GaimCallback cb, va_list args, | |
580 void *data, void **return_val) | |
581 { | |
6505 | 582 void *arg1 = va_arg(args, void *); |
583 void *arg2 = va_arg(args, void *); | |
584 | |
585 ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); | |
6485 | 586 } |
587 | |
588 void | |
589 gaim_marshal_VOID__POINTER_POINTER_UINT(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 guint arg3 = va_arg(args, guint); | |
595 | |
596 ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 597 } |
598 | |
599 void | |
600 gaim_marshal_VOID__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, | |
601 void *data, void **return_val) | |
602 { | |
6505 | 603 void *arg1 = va_arg(args, void *); |
604 void *arg2 = va_arg(args, void *); | |
605 void *arg3 = va_arg(args, void *); | |
606 | |
607 ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 608 } |
609 | |
610 void | |
611 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
612 va_list args, | |
613 void *data, | |
614 void **return_val) | |
615 { | |
6505 | 616 void *arg1 = va_arg(args, void *); |
617 void *arg2 = va_arg(args, void *); | |
618 void *arg3 = va_arg(args, void *); | |
619 void *arg4 = va_arg(args, void *); | |
620 | |
621 ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); | |
6485 | 622 } |
6509 | 623 |
624 void | |
625 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb, | |
626 va_list args, | |
627 void *data, | |
628 void **return_val) | |
629 { | |
630 void *arg1 = va_arg(args, void *); | |
631 void *arg2 = va_arg(args, void *); | |
632 void *arg3 = va_arg(args, void *); | |
633 guint arg4 = va_arg(args, guint); | |
634 | |
635 ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); | |
636 } | |
637 | |
6485 | 638 void |
639 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb, | |
640 va_list args, | |
641 void *data, | |
642 void **return_val) | |
643 { | |
6505 | 644 void *arg1 = va_arg(args, void *); |
645 void *arg2 = va_arg(args, void *); | |
646 void *arg3 = va_arg(args, void *); | |
647 guint arg4 = va_arg(args, guint); | |
648 guint arg5 = va_arg(args, guint); | |
649 | |
6485 | 650 ((void (*)(void *, void *, void *, guint, guint, void *))cb)( |
6505 | 651 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 652 } |
653 | |
654 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
655 gaim_marshal_INT__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
656 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
657 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
658 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
659 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
660 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
661 ret_val = ((gint (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
662 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
663 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
664 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
665 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
666 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
667 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
668 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
|
669 void **return_val) |
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 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
672 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
673 gint arg2 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
674 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
675 ret_val = ((gint (*)(gint, gint, void *))cb)(arg1, arg2, data); |
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 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
678 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
679 } |
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 void |
6485 | 682 gaim_marshal_BOOLEAN__POINTER(GaimCallback cb, va_list args, void *data, |
683 void **return_val) | |
684 { | |
685 gboolean ret_val; | |
6505 | 686 void *arg1 = va_arg(args, void *); |
6485 | 687 |
6505 | 688 ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); |
6485 | 689 |
690 if (return_val != NULL) | |
691 *return_val = GINT_TO_POINTER(ret_val); | |
692 } | |
693 | |
694 void | |
695 gaim_marshal_BOOLEAN__POINTER_POINTER(GaimCallback cb, va_list args, | |
696 void *data, void **return_val) | |
697 { | |
698 gboolean ret_val; | |
6505 | 699 void *arg1 = va_arg(args, void *); |
700 void *arg2 = va_arg(args, void *); | |
6485 | 701 |
6505 | 702 ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); |
6485 | 703 |
704 if (return_val != NULL) | |
705 *return_val = GINT_TO_POINTER(ret_val); | |
706 } | |
707 | |
708 void | |
6509 | 709 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, |
710 void *data, void **return_val) | |
711 { | |
712 gboolean ret_val; | |
713 void *arg1 = va_arg(args, void *); | |
714 void *arg2 = va_arg(args, void *); | |
715 void *arg3 = va_arg(args, void *); | |
716 | |
717 ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, | |
718 arg3, data); | |
719 | |
720 if (return_val != NULL) | |
721 *return_val = GINT_TO_POINTER(ret_val); | |
722 } | |
723 | |
724 void | |
725 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb, | |
726 va_list args, | |
727 void *data, | |
728 void **return_val) | |
729 { | |
730 gboolean ret_val; | |
731 void *arg1 = va_arg(args, void *); | |
732 void *arg2 = va_arg(args, void *); | |
733 guint arg3 = va_arg(args, guint); | |
734 | |
735 ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( | |
736 arg1, arg2, arg3, data); | |
737 | |
738 if (return_val != NULL) | |
739 *return_val = GINT_TO_POINTER(ret_val); | |
740 } | |
741 | |
742 void | |
6485 | 743 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
744 va_list args, | |
745 void *data, | |
746 void **return_val) | |
747 { | |
748 gboolean ret_val; | |
6505 | 749 void *arg1 = va_arg(args, void *); |
750 void *arg2 = va_arg(args, void *); | |
751 void *arg3 = va_arg(args, void *); | |
752 guint arg4 = va_arg(args, guint); | |
6485 | 753 |
754 ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( | |
6505 | 755 arg1, arg2, arg3, arg4, data); |
6485 | 756 |
757 if (return_val != NULL) | |
758 *return_val = GINT_TO_POINTER(ret_val); | |
759 } | |
760 | |
761 void | |
762 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
763 va_list args, | |
764 void *data, | |
765 void **return_val) | |
766 { | |
767 gboolean ret_val; | |
6505 | 768 void *arg1 = va_arg(args, void *); |
769 void *arg2 = va_arg(args, void *); | |
770 void *arg3 = va_arg(args, void *); | |
771 void *arg4 = va_arg(args, void *); | |
6485 | 772 |
773 ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( | |
6505 | 774 arg1, arg2, arg3, arg4, data); |
6485 | 775 |
776 if (return_val != NULL) | |
777 *return_val = GINT_TO_POINTER(ret_val); | |
778 } | |
779 | |
780 void | |
781 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( | |
782 GaimCallback cb, va_list args, void *data, void **return_val) | |
783 { | |
784 gboolean ret_val; | |
6505 | 785 void *arg1 = va_arg(args, void *); |
786 void *arg2 = va_arg(args, void *); | |
787 void *arg3 = va_arg(args, void *); | |
788 void *arg4 = va_arg(args, void *); | |
789 void *arg5 = va_arg(args, void *); | |
6485 | 790 |
791 ret_val = | |
792 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( | |
6505 | 793 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 794 |
795 if (return_val != NULL) | |
796 *return_val = GINT_TO_POINTER(ret_val); | |
797 } |