Mercurial > pidgin
annotate src/signals.c @ 11098:df3b825c1b46
[gaim-migrate @ 13136]
" I was playing with some new versions of gettext and
friends at debconf, and found some horrific bugs in the
.po files. Here's the general summary of the problems
and their fixes:
* no.po should be called nb.po - renamed
* a Makevars is required for gettext 0.14.4 - added
* am.po was missing a plural form - added
* da.po had some mismatched C format types - marked as
fuzzy
* ka.po had "nplurals=INTEGER; plural=EXPRESSION;"
instead of the actual plural form - turns out nplural
is 1, so deleted the duplicate identical 2nd strings
* mk.po had the same problem, added the plural form but
nplural is 3 and the translations in the file only have
2 entries, so I marked them as fuzzy
* pl.po - fixed mismatched C format type
* ru.po - basically the same as mk.po. had a crap
plural form. added it and marked the wrongly-numbered
plurals as fuzzy
* sq.po - added plural form, but file looks correct
otherwise (nplurals=2)
* tr.po - tweaks to the header, and nplurals=1 so set
this and deleted pointless duplicate second forms
You need to move no.po to nb.po - it would be silly to
include that in the patch obviously.
Please apply to HEAD ASAP before it stops applying
(obviously if anyone changes the po files the patch
will break very easily) but also please leave this item
open until me or someone else has looked for and
corrected the same issues in oldstable.
Regards,
Rob"
I've been ignoring translations in HEAD as its really rather pointless for
now. I plan to continue doing so. but as I was less than clear talking to
robot101, i didn't think it was fair to penalize him.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 13 Jul 2005 00:59:44 +0000 |
parents | f54740547c95 |
children | 1c5398ccbeb0 |
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 | |
11080 | 27 #include "dbus-maybe.h" |
6485 | 28 #include "debug.h" |
29 #include "signals.h" | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
30 #include "value.h" |
6485 | 31 |
9127 | 32 /* must include this to use G_VA_COPY */ |
33 #include <string.h> | |
34 | |
6485 | 35 typedef struct |
36 { | |
37 void *instance; | |
38 | |
39 GHashTable *signals; | |
40 size_t signal_count; | |
41 | |
42 gulong next_signal_id; | |
43 | |
44 } GaimInstanceData; | |
45 | |
46 typedef struct | |
47 { | |
48 gulong id; | |
49 | |
50 GaimSignalMarshalFunc marshal; | |
51 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
52 int num_values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
53 GaimValue **values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
54 GaimValue *ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
55 |
6485 | 56 GList *handlers; |
57 size_t handler_count; | |
58 | |
59 gulong next_handler_id; | |
60 | |
11080 | 61 int dbus_id; |
6485 | 62 } GaimSignalData; |
63 | |
64 typedef struct | |
65 { | |
66 gulong id; | |
67 GaimCallback cb; | |
68 void *handle; | |
69 void *data; | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
70 gboolean use_vargs; |
10656 | 71 int priority; |
6485 | 72 |
73 } GaimSignalHandlerData; | |
74 | |
75 static GHashTable *instance_table = NULL; | |
76 | |
77 static void | |
78 destroy_instance_data(GaimInstanceData *instance_data) | |
79 { | |
80 g_hash_table_destroy(instance_data->signals); | |
81 | |
82 g_free(instance_data); | |
83 } | |
84 | |
85 static void | |
86 destroy_signal_data(GaimSignalData *signal_data) | |
87 { | |
88 GaimSignalHandlerData *handler_data; | |
89 GList *l; | |
90 | |
91 for (l = signal_data->handlers; l != NULL; l = l->next) | |
92 { | |
93 handler_data = (GaimSignalHandlerData *)l->data; | |
94 | |
95 g_free(l->data); | |
96 } | |
97 | |
98 g_list_free(signal_data->handlers); | |
99 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
100 if (signal_data->values != NULL) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
101 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
102 int i; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
103 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
104 for (i = 0; i < signal_data->num_values; i++) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
105 gaim_value_destroy((GaimValue *)signal_data->values[i]); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
106 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
107 g_free(signal_data->values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
108 } |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
109 |
10542 | 110 if (signal_data->ret_value != NULL) |
111 gaim_value_destroy(signal_data->ret_value); | |
6485 | 112 g_free(signal_data); |
113 } | |
114 | |
115 gulong | |
116 gaim_signal_register(void *instance, const char *signal, | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
117 GaimSignalMarshalFunc marshal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
118 GaimValue *ret_value, int num_values, ...) |
6485 | 119 { |
120 GaimInstanceData *instance_data; | |
121 GaimSignalData *signal_data; | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
122 va_list args; |
6485 | 123 |
124 g_return_val_if_fail(instance != NULL, 0); | |
125 g_return_val_if_fail(signal != NULL, 0); | |
126 g_return_val_if_fail(marshal != NULL, 0); | |
127 | |
128 instance_data = | |
129 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
130 | |
131 if (instance_data == NULL) | |
132 { | |
133 instance_data = g_new0(GaimInstanceData, 1); | |
134 | |
135 instance_data->instance = instance; | |
136 instance_data->next_signal_id = 1; | |
137 | |
138 instance_data->signals = | |
139 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, | |
140 (GDestroyNotify)destroy_signal_data); | |
141 | |
142 g_hash_table_insert(instance_table, instance, instance_data); | |
143 } | |
144 | |
145 signal_data = g_new0(GaimSignalData, 1); | |
146 signal_data->id = instance_data->next_signal_id; | |
147 signal_data->marshal = marshal; | |
148 signal_data->next_handler_id = 1; | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
149 signal_data->ret_value = ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
150 signal_data->num_values = 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 if (num_values > 0) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
153 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
154 int i; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
155 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
156 signal_data->values = g_new0(GaimValue *, num_values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
157 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
158 va_start(args, num_values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
159 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
160 for (i = 0; i < num_values; i++) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
161 signal_data->values[i] = va_arg(args, GaimValue *); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
162 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
163 va_end(args); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
164 } |
6485 | 165 |
166 g_hash_table_insert(instance_data->signals, | |
167 g_strdup(signal), signal_data); | |
168 | |
169 instance_data->next_signal_id++; | |
170 instance_data->signal_count++; | |
171 | |
11080 | 172 #ifdef HAVE_DBUS |
173 /* DBus messages are sent directly to the bus so the | |
174 marshalling function is never called. */ | |
175 signal_data->dbus_id = | |
176 gaim_dbus_signal_register_gaim(gaim_dbus_object, signal, | |
177 gaim_dbus_invalid_marshaller, | |
178 num_values, signal_data->values); | |
179 #endif /* HAVE_DBUS */ | |
180 | |
6485 | 181 return signal_data->id; |
182 } | |
183 | |
184 void | |
185 gaim_signal_unregister(void *instance, const char *signal) | |
186 { | |
187 GaimInstanceData *instance_data; | |
188 | |
189 g_return_if_fail(instance != NULL); | |
190 g_return_if_fail(signal != NULL); | |
191 | |
192 instance_data = | |
193 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
194 | |
195 g_return_if_fail(instance_data != NULL); | |
196 | |
197 g_hash_table_remove(instance_data->signals, signal); | |
198 | |
199 instance_data->signal_count--; | |
200 | |
201 if (instance_data->signal_count == 0) | |
202 { | |
203 /* Unregister the instance. */ | |
204 g_hash_table_remove(instance_table, instance); | |
205 } | |
206 } | |
207 | |
208 void | |
209 gaim_signals_unregister_by_instance(void *instance) | |
210 { | |
211 gboolean found; | |
212 | |
213 g_return_if_fail(instance != NULL); | |
214 | |
215 found = g_hash_table_remove(instance_table, instance); | |
216 | |
217 /* | |
218 * Makes things easier (more annoying?) for developers who don't have | |
219 * things registering and unregistering in the right order :) | |
220 */ | |
221 g_return_if_fail(found); | |
222 } | |
223 | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
224 void |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
225 gaim_signal_get_values(void *instance, const char *signal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
226 GaimValue **ret_value, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
227 int *num_values, GaimValue ***values) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
228 { |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
229 GaimInstanceData *instance_data; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
230 GaimSignalData *signal_data; |
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 g_return_if_fail(instance != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
233 g_return_if_fail(signal != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
234 g_return_if_fail(num_values != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
235 g_return_if_fail(values != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
236 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
237 /* Get the instance data */ |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
238 instance_data = |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
239 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
240 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
241 g_return_if_fail(instance_data != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
242 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
243 /* Get the signal data */ |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
244 signal_data = |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
245 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
246 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
247 g_return_if_fail(signal_data != NULL); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
248 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
249 *num_values = signal_data->num_values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
250 *values = signal_data->values; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
251 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
252 if (ret_value != NULL) |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
253 *ret_value = signal_data->ret_value; |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
254 } |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6553
diff
changeset
|
255 |
10656 | 256 static gint handler_priority(void * a, void * b) { |
257 GaimSignalHandlerData *ah = (GaimSignalHandlerData*)a; | |
258 GaimSignalHandlerData *bh = (GaimSignalHandlerData*)b; | |
259 if (ah->priority > bh->priority) return 1; | |
260 if (ah->priority < bh->priority) return -1; | |
261 return 0; | |
262 } | |
263 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
264 static gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
265 signal_connect_common(void *instance, const char *signal, void *handle, |
10656 | 266 GaimCallback func, void *data, int priority, gboolean use_vargs) |
6485 | 267 { |
268 GaimInstanceData *instance_data; | |
269 GaimSignalData *signal_data; | |
270 GaimSignalHandlerData *handler_data; | |
271 | |
272 g_return_val_if_fail(instance != NULL, 0); | |
273 g_return_val_if_fail(signal != NULL, 0); | |
274 g_return_val_if_fail(handle != NULL, 0); | |
275 g_return_val_if_fail(func != NULL, 0); | |
276 | |
277 /* Get the instance data */ | |
278 instance_data = | |
279 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
280 | |
281 g_return_val_if_fail(instance_data != NULL, 0); | |
282 | |
283 /* Get the signal data */ | |
284 signal_data = | |
285 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
286 | |
287 if (signal_data == NULL) | |
288 { | |
289 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
290 "Signal data for %s not found!\n", signal); | |
291 return 0; | |
292 } | |
293 | |
294 /* Create the signal handler data */ | |
295 handler_data = g_new0(GaimSignalHandlerData, 1); | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
296 handler_data->id = signal_data->next_handler_id; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
297 handler_data->cb = func; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
298 handler_data->handle = handle; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
299 handler_data->data = data; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
300 handler_data->use_vargs = use_vargs; |
10656 | 301 handler_data->priority = priority; |
10758 | 302 |
10656 | 303 signal_data->handlers = g_list_insert_sorted(signal_data->handlers, handler_data, (GCompareFunc)handler_priority); |
6485 | 304 signal_data->handler_count++; |
305 signal_data->next_handler_id++; | |
306 | |
307 return handler_data->id; | |
308 } | |
6553
9e4fa4853cfe
[gaim-migrate @ 7075]
Christian Hammond <chipx86@chipx86.com>
parents:
6547
diff
changeset
|
309 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
310 gulong |
10656 | 311 gaim_signal_connect_priority(void *instance, const char *signal, void *handle, |
312 GaimCallback func, void *data, int priority) | |
313 { | |
314 return signal_connect_common(instance, signal, handle, func, data, priority, FALSE); | |
315 } | |
316 | |
317 gulong | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
318 gaim_signal_connect(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
319 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
320 { |
10656 | 321 return signal_connect_common(instance, signal, handle, func, data, GAIM_SIGNAL_PRIORITY_DEFAULT, FALSE); |
322 } | |
323 | |
324 gulong | |
325 gaim_signal_connect_priority_vargs(void *instance, const char *signal, void *handle, | |
326 GaimCallback func, void *data, int priority) | |
327 { | |
328 return signal_connect_common(instance, signal, handle, func, data, priority, TRUE); | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
329 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
330 |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
331 gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
332 gaim_signal_connect_vargs(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
333 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
334 { |
10656 | 335 return signal_connect_common(instance, signal, handle, func, data, GAIM_SIGNAL_PRIORITY_DEFAULT, TRUE); |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
336 } |
6485 | 337 |
338 void | |
339 gaim_signal_disconnect(void *instance, const char *signal, | |
340 void *handle, GaimCallback func) | |
341 { | |
342 GaimInstanceData *instance_data; | |
343 GaimSignalData *signal_data; | |
344 GaimSignalHandlerData *handler_data; | |
345 GList *l; | |
346 gboolean found = FALSE; | |
347 | |
348 g_return_if_fail(instance != NULL); | |
349 g_return_if_fail(signal != NULL); | |
350 g_return_if_fail(handle != NULL); | |
351 g_return_if_fail(func != NULL); | |
352 | |
353 /* Get the instance data */ | |
354 instance_data = | |
355 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
356 | |
357 g_return_if_fail(instance_data != NULL); | |
358 | |
359 /* Get the signal data */ | |
360 signal_data = | |
361 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
362 | |
363 if (signal_data == NULL) | |
364 { | |
365 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
366 "Signal data for %s not found!\n", signal); | |
367 return; | |
368 } | |
369 | |
370 /* Find the handler data. */ | |
371 for (l = signal_data->handlers; l != NULL; l = l->next) | |
372 { | |
373 handler_data = (GaimSignalHandlerData *)l->data; | |
374 | |
375 if (handler_data->handle == handle && handler_data->cb == func) | |
376 { | |
377 g_free(handler_data); | |
378 | |
379 signal_data->handlers = g_list_remove(signal_data->handlers, | |
380 handler_data); | |
381 signal_data->handler_count--; | |
382 | |
383 found = TRUE; | |
384 | |
385 break; | |
386 } | |
387 } | |
388 | |
389 /* See note somewhere about this actually helping developers.. */ | |
390 g_return_if_fail(found); | |
391 } | |
392 | |
393 /* | |
394 * TODO: Make this all more efficient by storing a list of handlers, keyed | |
395 * to a handle. | |
396 */ | |
397 static void | |
398 disconnect_handle_from_signals(const char *signal, | |
399 GaimSignalData *signal_data, void *handle) | |
400 { | |
401 GList *l, *l_next; | |
402 GaimSignalHandlerData *handler_data; | |
403 | |
404 for (l = signal_data->handlers; l != NULL; l = l_next) | |
405 { | |
406 handler_data = (GaimSignalHandlerData *)l->data; | |
407 l_next = l->next; | |
408 | |
409 if (handler_data->handle == handle) | |
410 { | |
411 g_free(handler_data); | |
412 | |
413 signal_data->handler_count--; | |
414 signal_data->handlers = g_list_remove(signal_data->handlers, | |
415 handler_data); | |
416 } | |
417 } | |
418 } | |
419 | |
420 static void | |
421 disconnect_handle_from_instance(void *instance, | |
422 GaimInstanceData *instance_data, | |
423 void *handle) | |
424 { | |
425 g_hash_table_foreach(instance_data->signals, | |
426 (GHFunc)disconnect_handle_from_signals, handle); | |
427 } | |
428 | |
429 void | |
430 gaim_signals_disconnect_by_handle(void *handle) | |
431 { | |
432 g_return_if_fail(handle != NULL); | |
433 | |
434 g_hash_table_foreach(instance_table, | |
435 (GHFunc)disconnect_handle_from_instance, handle); | |
436 } | |
437 | |
438 void | |
439 gaim_signal_emit(void *instance, const char *signal, ...) | |
440 { | |
441 va_list args; | |
442 | |
7584
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
443 g_return_if_fail(instance != NULL); |
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
444 g_return_if_fail(signal != NULL); |
9e93a4bf1934
[gaim-migrate @ 8202]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
445 |
6485 | 446 va_start(args, signal); |
447 gaim_signal_emit_vargs(instance, signal, args); | |
448 va_end(args); | |
449 } | |
450 | |
451 void | |
452 gaim_signal_emit_vargs(void *instance, const char *signal, va_list args) | |
453 { | |
454 GaimInstanceData *instance_data; | |
455 GaimSignalData *signal_data; | |
456 GaimSignalHandlerData *handler_data; | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
457 GList *l, *l_next; |
8090 | 458 va_list tmp; |
6485 | 459 |
460 g_return_if_fail(instance != NULL); | |
461 g_return_if_fail(signal != NULL); | |
462 | |
463 instance_data = | |
464 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
465 | |
466 g_return_if_fail(instance_data != NULL); | |
467 | |
468 signal_data = | |
469 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
470 | |
471 if (signal_data == NULL) | |
472 { | |
473 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
474 "Signal data for %s not found!\n", signal); | |
475 return; | |
476 } | |
477 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
478 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 479 { |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
480 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
481 |
6485 | 482 handler_data = (GaimSignalHandlerData *)l->data; |
483 | |
8090 | 484 /* This is necessary because a va_list may only be |
485 * evaluated once */ | |
8142 | 486 G_VA_COPY(tmp, args); |
8090 | 487 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
488 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
489 { |
8090 | 490 ((void (*)(va_list, void *))handler_data->cb)(tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
491 handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
492 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
493 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
494 { |
8090 | 495 signal_data->marshal(handler_data->cb, tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
496 handler_data->data, NULL); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
497 } |
8090 | 498 |
499 va_end(tmp); | |
6485 | 500 } |
11080 | 501 |
502 #ifdef HAVE_DBUS | |
503 gaim_dbus_signal_emit_gaim(gaim_dbus_object, signal_data->dbus_id, | |
504 signal_data->num_values, | |
505 signal_data->values, args); | |
506 #endif /* HAVE_DBUS */ | |
507 | |
6485 | 508 } |
509 | |
510 void * | |
511 gaim_signal_emit_return_1(void *instance, const char *signal, ...) | |
512 { | |
513 void *ret_val; | |
514 va_list args; | |
515 | |
7597
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
516 g_return_val_if_fail(instance != NULL, NULL); |
191e5b9a249b
[gaim-migrate @ 8218]
Christian Hammond <chipx86@chipx86.com>
parents:
7585
diff
changeset
|
517 g_return_val_if_fail(signal != NULL, NULL); |
7585
404f4a4b81da
[gaim-migrate @ 8203]
Christian Hammond <chipx86@chipx86.com>
parents:
7584
diff
changeset
|
518 |
6485 | 519 va_start(args, signal); |
520 ret_val = gaim_signal_emit_vargs_return_1(instance, signal, args); | |
521 va_end(args); | |
522 | |
523 return ret_val; | |
524 } | |
525 | |
526 void * | |
527 gaim_signal_emit_vargs_return_1(void *instance, const char *signal, | |
528 va_list args) | |
529 { | |
530 GaimInstanceData *instance_data; | |
531 GaimSignalData *signal_data; | |
532 GaimSignalHandlerData *handler_data; | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
533 GList *l, *l_next; |
8140 | 534 va_list tmp; |
6485 | 535 |
536 g_return_val_if_fail(instance != NULL, NULL); | |
537 g_return_val_if_fail(signal != NULL, NULL); | |
538 | |
539 instance_data = | |
540 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
541 | |
542 g_return_val_if_fail(instance_data != NULL, NULL); | |
543 | |
544 signal_data = | |
545 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
546 | |
547 if (signal_data == NULL) | |
548 { | |
549 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
550 "Signal data for %s not found!\n", signal); | |
551 return 0; | |
552 } | |
553 | |
11080 | 554 #ifdef HAVE_DBUS |
555 gaim_dbus_signal_emit_gaim(gaim_dbus_object, signal_data->dbus_id, | |
556 signal_data->num_values, | |
557 signal_data->values, args); | |
558 #endif /* HAVE_DBUS */ | |
559 | |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
560 for (l = signal_data->handlers; l != NULL; l = l_next) |
6485 | 561 { |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
562 void *ret_val = NULL; |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
563 |
8004
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
564 l_next = l->next; |
07dc83303503
[gaim-migrate @ 8681]
Christian Hammond <chipx86@chipx86.com>
parents:
7597
diff
changeset
|
565 |
6485 | 566 handler_data = (GaimSignalHandlerData *)l->data; |
567 | |
8142 | 568 G_VA_COPY(tmp, args); |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
569 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
570 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
571 ret_val = ((void *(*)(va_list, void *))handler_data->cb)( |
8140 | 572 tmp, handler_data->data); |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
573 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
574 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
575 { |
8140 | 576 signal_data->marshal(handler_data->cb, tmp, |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
577 handler_data->data, &ret_val); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
578 } |
8140 | 579 va_end(tmp); |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
580 |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
581 if (ret_val != NULL) |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
582 return ret_val; |
6485 | 583 } |
584 | |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10758
diff
changeset
|
585 return NULL; |
6485 | 586 } |
587 | |
588 void | |
589 gaim_signals_init() | |
590 { | |
591 g_return_if_fail(instance_table == NULL); | |
592 | |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10789
diff
changeset
|
593 gaim_debug_register_category("signals"); |
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10789
diff
changeset
|
594 |
6485 | 595 instance_table = |
596 g_hash_table_new_full(g_direct_hash, g_direct_equal, | |
597 NULL, (GDestroyNotify)destroy_instance_data); | |
598 } | |
599 | |
600 void | |
601 gaim_signals_uninit() | |
602 { | |
603 g_return_if_fail(instance_table != NULL); | |
604 | |
605 g_hash_table_destroy(instance_table); | |
606 instance_table = NULL; | |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10789
diff
changeset
|
607 |
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10789
diff
changeset
|
608 gaim_debug_unregister_category("signals"); |
6485 | 609 } |
610 | |
611 /************************************************************************** | |
612 * Marshallers | |
613 **************************************************************************/ | |
614 void | |
615 gaim_marshal_VOID(GaimCallback cb, va_list args, void *data, | |
616 void **return_val) | |
617 { | |
618 ((void (*)(void *))cb)(data); | |
619 } | |
620 | |
621 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
622 gaim_marshal_VOID__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
623 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
624 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
625 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
626 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
627 ((void (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
628 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
629 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
630 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
631 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
|
632 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
633 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
634 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
635 gint arg2 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
636 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
637 ((void (*)(gint, gint, void *))cb)(arg1, arg2, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
638 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
639 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
640 void |
6485 | 641 gaim_marshal_VOID__POINTER(GaimCallback cb, va_list args, void *data, |
642 void **return_val) | |
643 { | |
6505 | 644 void *arg1 = va_arg(args, void *); |
645 | |
646 ((void (*)(void *, void *))cb)(arg1, data); | |
6485 | 647 } |
648 | |
649 void | |
9734 | 650 gaim_marshal_VOID__POINTER_UINT(GaimCallback cb, va_list args, |
651 void *data, void **return_val) | |
652 { | |
653 void *arg1 = va_arg(args, void *); | |
654 guint arg2 = va_arg(args, guint); | |
655 | |
656 ((void (*)(void *, guint, void *))cb)(arg1, arg2, data); | |
657 } | |
658 | |
659 void | |
6485 | 660 gaim_marshal_VOID__POINTER_POINTER(GaimCallback cb, va_list args, |
661 void *data, void **return_val) | |
662 { | |
6505 | 663 void *arg1 = va_arg(args, void *); |
664 void *arg2 = va_arg(args, void *); | |
665 | |
666 ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); | |
6485 | 667 } |
668 | |
669 void | |
670 gaim_marshal_VOID__POINTER_POINTER_UINT(GaimCallback cb, va_list args, | |
671 void *data, void **return_val) | |
672 { | |
6505 | 673 void *arg1 = va_arg(args, void *); |
674 void *arg2 = va_arg(args, void *); | |
675 guint arg3 = va_arg(args, guint); | |
676 | |
677 ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 678 } |
679 | |
680 void | |
9554 | 681 gaim_marshal_VOID__POINTER_POINTER_UINT_UINT(GaimCallback cb, va_list args, |
682 void *data, void **return_val) | |
683 { | |
684 void *arg1 = va_arg(args, void *); | |
685 void *arg2 = va_arg(args, void *); | |
686 guint arg3 = va_arg(args, guint); | |
687 guint arg4 = va_arg(args, guint); | |
688 | |
689 ((void (*)(void *, void *, guint, guint, void *))cb)(arg1, arg2, arg3, arg4, data); | |
690 } | |
691 | |
692 void | |
6485 | 693 gaim_marshal_VOID__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, |
694 void *data, void **return_val) | |
695 { | |
6505 | 696 void *arg1 = va_arg(args, void *); |
697 void *arg2 = va_arg(args, void *); | |
698 void *arg3 = va_arg(args, void *); | |
699 | |
700 ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 701 } |
702 | |
703 void | |
704 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
705 va_list args, | |
706 void *data, | |
707 void **return_val) | |
708 { | |
6505 | 709 void *arg1 = va_arg(args, void *); |
710 void *arg2 = va_arg(args, void *); | |
711 void *arg3 = va_arg(args, void *); | |
712 void *arg4 = va_arg(args, void *); | |
713 | |
714 ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); | |
6485 | 715 } |
6509 | 716 |
717 void | |
9514 | 718 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(GaimCallback cb, |
719 va_list args, | |
720 void *data, | |
721 void **return_val) | |
722 { | |
723 void *arg1 = va_arg(args, void *); | |
724 void *arg2 = va_arg(args, void *); | |
725 void *arg3 = va_arg(args, void *); | |
726 void *arg4 = va_arg(args, void *); | |
727 void *arg5 = va_arg(args, void *); | |
728 | |
729 ((void (*)(void *, void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); | |
730 } | |
731 | |
732 void | |
6509 | 733 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
734 va_list args, | |
735 void *data, | |
736 void **return_val) | |
737 { | |
738 void *arg1 = va_arg(args, void *); | |
739 void *arg2 = va_arg(args, void *); | |
740 void *arg3 = va_arg(args, void *); | |
741 guint arg4 = va_arg(args, guint); | |
742 | |
743 ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); | |
744 } | |
745 | |
6485 | 746 void |
10104 | 747 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
748 va_list args, | |
749 void *data, | |
750 void **return_val) | |
751 { | |
752 void *arg1 = va_arg(args, void *); | |
753 void *arg2 = va_arg(args, void *); | |
754 void *arg3 = va_arg(args, void *); | |
755 void *arg4 = va_arg(args, void *); | |
756 guint arg5 = va_arg(args, guint); | |
757 | |
758 ((void (*)(void *, void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); | |
759 } | |
760 | |
761 void | |
6485 | 762 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb, |
763 va_list args, | |
764 void *data, | |
765 void **return_val) | |
766 { | |
6505 | 767 void *arg1 = va_arg(args, void *); |
768 void *arg2 = va_arg(args, void *); | |
769 void *arg3 = va_arg(args, void *); | |
770 guint arg4 = va_arg(args, guint); | |
771 guint arg5 = va_arg(args, guint); | |
772 | |
6485 | 773 ((void (*)(void *, void *, void *, guint, guint, void *))cb)( |
6505 | 774 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 775 } |
776 | |
777 void | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
778 gaim_marshal_INT__INT(GaimCallback cb, va_list args, void *data, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
779 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
780 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
781 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
782 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
783 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
784 ret_val = ((gint (*)(gint, void *))cb)(arg1, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
785 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
786 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
787 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
788 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
789 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
790 void |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
791 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
|
792 void **return_val) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
793 { |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
794 gint ret_val; |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
795 gint arg1 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
796 gint arg2 = va_arg(args, gint); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
797 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
798 ret_val = ((gint (*)(gint, gint, void *))cb)(arg1, arg2, data); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
799 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
800 if (return_val != NULL) |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
801 *return_val = GINT_TO_POINTER(ret_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
802 } |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
803 |
11064
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
804 |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
805 void |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
806 gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
807 GaimCallback cb, va_list args, void *data, void **return_val) |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
808 { |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
809 gint ret_val; |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
810 void *arg1 = va_arg(args, void *); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
811 void *arg2 = va_arg(args, void *); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
812 void *arg3 = va_arg(args, void *); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
813 void *arg4 = va_arg(args, void *); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
814 void *arg5 = va_arg(args, void *); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
815 |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
816 ret_val = |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
817 ((gint (*)(void *, void *, void *, void *, void *, void *))cb)( |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
818 arg1, arg2, arg3, arg4, arg5, data); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
819 |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
820 if (return_val != NULL) |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
821 *return_val = GINT_TO_POINTER(ret_val); |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
822 } |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
823 |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
824 void |
6485 | 825 gaim_marshal_BOOLEAN__POINTER(GaimCallback cb, va_list args, void *data, |
826 void **return_val) | |
827 { | |
828 gboolean ret_val; | |
6505 | 829 void *arg1 = va_arg(args, void *); |
6485 | 830 |
6505 | 831 ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); |
6485 | 832 |
833 if (return_val != NULL) | |
834 *return_val = GINT_TO_POINTER(ret_val); | |
835 } | |
836 | |
837 void | |
838 gaim_marshal_BOOLEAN__POINTER_POINTER(GaimCallback cb, va_list args, | |
839 void *data, void **return_val) | |
840 { | |
841 gboolean ret_val; | |
6505 | 842 void *arg1 = va_arg(args, void *); |
843 void *arg2 = va_arg(args, void *); | |
6485 | 844 |
6505 | 845 ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); |
6485 | 846 |
847 if (return_val != NULL) | |
848 *return_val = GINT_TO_POINTER(ret_val); | |
849 } | |
850 | |
851 void | |
6509 | 852 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, |
853 void *data, void **return_val) | |
854 { | |
855 gboolean ret_val; | |
856 void *arg1 = va_arg(args, void *); | |
857 void *arg2 = va_arg(args, void *); | |
858 void *arg3 = va_arg(args, void *); | |
859 | |
860 ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, | |
861 arg3, data); | |
862 | |
863 if (return_val != NULL) | |
864 *return_val = GINT_TO_POINTER(ret_val); | |
865 } | |
866 | |
867 void | |
868 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb, | |
869 va_list args, | |
870 void *data, | |
871 void **return_val) | |
872 { | |
873 gboolean ret_val; | |
874 void *arg1 = va_arg(args, void *); | |
875 void *arg2 = va_arg(args, void *); | |
876 guint arg3 = va_arg(args, guint); | |
877 | |
878 ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( | |
879 arg1, arg2, arg3, data); | |
880 | |
881 if (return_val != NULL) | |
882 *return_val = GINT_TO_POINTER(ret_val); | |
883 } | |
884 | |
885 void | |
6485 | 886 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
887 va_list args, | |
888 void *data, | |
889 void **return_val) | |
890 { | |
891 gboolean ret_val; | |
6505 | 892 void *arg1 = va_arg(args, void *); |
893 void *arg2 = va_arg(args, void *); | |
894 void *arg3 = va_arg(args, void *); | |
895 guint arg4 = va_arg(args, guint); | |
6485 | 896 |
897 ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( | |
6505 | 898 arg1, arg2, arg3, arg4, data); |
6485 | 899 |
900 if (return_val != NULL) | |
901 *return_val = GINT_TO_POINTER(ret_val); | |
902 } | |
903 | |
904 void | |
905 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
906 va_list args, | |
907 void *data, | |
908 void **return_val) | |
909 { | |
910 gboolean ret_val; | |
6505 | 911 void *arg1 = va_arg(args, void *); |
912 void *arg2 = va_arg(args, void *); | |
913 void *arg3 = va_arg(args, void *); | |
914 void *arg4 = va_arg(args, void *); | |
6485 | 915 |
916 ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( | |
6505 | 917 arg1, arg2, arg3, arg4, data); |
6485 | 918 |
919 if (return_val != NULL) | |
920 *return_val = GINT_TO_POINTER(ret_val); | |
921 } | |
922 | |
923 void | |
924 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( | |
925 GaimCallback cb, va_list args, void *data, void **return_val) | |
926 { | |
927 gboolean ret_val; | |
6505 | 928 void *arg1 = va_arg(args, void *); |
929 void *arg2 = va_arg(args, void *); | |
930 void *arg3 = va_arg(args, void *); | |
931 void *arg4 = va_arg(args, void *); | |
932 void *arg5 = va_arg(args, void *); | |
6485 | 933 |
934 ret_val = | |
935 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( | |
6505 | 936 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 937 |
938 if (return_val != NULL) | |
939 *return_val = GINT_TO_POINTER(ret_val); | |
940 } |