annotate src/signals.c @ 6560:aeb5ee62debc

[gaim-migrate @ 7082] (14:16:38) Robot101: I've got a nice patch to stop the ticker from crashing the 2nd time you load it committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 21 Aug 2003 18:20:05 +0000
parents 9e4fa4853cfe
children 800ef4a51096
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
6488
e5e8d21bd4d8 [gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
2 * @file signals.c Signal API
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "internal.h"
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "debug.h"
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "signals.h"
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 typedef struct
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 void *instance;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 GHashTable *signals;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 size_t signal_count;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 gulong next_signal_id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 } GaimInstanceData;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 typedef struct
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 gulong id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 GaimSignalMarshalFunc marshal;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GList *handlers;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 size_t handler_count;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 gulong next_handler_id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 } GaimSignalData;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 typedef struct
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 gulong id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 GaimCallback cb;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 void *handle;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 void *data;
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
58 gboolean use_vargs;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 } GaimSignalHandlerData;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 static GHashTable *instance_table = NULL;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 static void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 destroy_instance_data(GaimInstanceData *instance_data)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 g_hash_table_destroy(instance_data->signals);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 g_free(instance_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 static void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 destroy_signal_data(GaimSignalData *signal_data)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 GList *l;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 for (l = signal_data->handlers; l != NULL; l = l->next)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 handler_data = (GaimSignalHandlerData *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 g_free(l->data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 g_list_free(signal_data->handlers);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 g_free(signal_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 gulong
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 gaim_signal_register(void *instance, const char *signal,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 GaimSignalMarshalFunc marshal)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 GaimSignalData *signal_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 g_return_val_if_fail(instance != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 g_return_val_if_fail(signal != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 g_return_val_if_fail(marshal != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 if (instance_data == NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 instance_data = g_new0(GaimInstanceData, 1);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 instance_data->instance = instance;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 instance_data->next_signal_id = 1;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 instance_data->signals =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 (GDestroyNotify)destroy_signal_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 g_hash_table_insert(instance_table, instance, instance_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 signal_data = g_new0(GaimSignalData, 1);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 signal_data->id = instance_data->next_signal_id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 signal_data->marshal = marshal;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 signal_data->next_handler_id = 1;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 g_hash_table_insert(instance_data->signals,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 g_strdup(signal), signal_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 instance_data->next_signal_id++;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 instance_data->signal_count++;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 return signal_data->id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 gaim_signal_unregister(void *instance, const char *signal)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 g_return_if_fail(instance != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 g_return_if_fail(signal != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 g_return_if_fail(instance_data != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 g_hash_table_remove(instance_data->signals, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 instance_data->signal_count--;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 if (instance_data->signal_count == 0)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 /* Unregister the instance. */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 g_hash_table_remove(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 gaim_signals_unregister_by_instance(void *instance)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 gboolean found;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 g_return_if_fail(instance != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 found = g_hash_table_remove(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 /*
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 * Makes things easier (more annoying?) for developers who don't have
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 * things registering and unregistering in the right order :)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 g_return_if_fail(found);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
172 static gulong
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
173 signal_connect_common(void *instance, const char *signal, void *handle,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
174 GaimCallback func, void *data, gboolean use_vargs)
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 GaimSignalData *signal_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 g_return_val_if_fail(instance != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 g_return_val_if_fail(signal != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 g_return_val_if_fail(handle != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 g_return_val_if_fail(func != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 /* Get the instance data */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 g_return_val_if_fail(instance_data != NULL, 0);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 /* Get the signal data */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 signal_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 if (signal_data == NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 gaim_debug(GAIM_DEBUG_ERROR, "signals",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 "Signal data for %s not found!\n", signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 return 0;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 /* Create the signal handler data */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 handler_data = g_new0(GaimSignalHandlerData, 1);
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
204 handler_data->id = signal_data->next_handler_id;
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
205 handler_data->cb = func;
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
206 handler_data->handle = handle;
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
207 handler_data->data = data;
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
208 handler_data->use_vargs = use_vargs;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 signal_data->handlers = g_list_append(signal_data->handlers, handler_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 signal_data->handler_count++;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 signal_data->next_handler_id++;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 return handler_data->id;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 }
6553
9e4fa4853cfe [gaim-migrate @ 7075]
Christian Hammond <chipx86@chipx86.com>
parents: 6547
diff changeset
216
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
217 gulong
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
218 gaim_signal_connect(void *instance, const char *signal, void *handle,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
219 GaimCallback func, void *data)
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
220 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
221 return signal_connect_common(instance, signal, handle, func, data, FALSE);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
222 }
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
223
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
224 gulong
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
225 gaim_signal_connect_vargs(void *instance, const char *signal, void *handle,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
226 GaimCallback func, void *data)
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
227 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
228 return signal_connect_common(instance, signal, handle, func, data, TRUE);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
229 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 gaim_signal_disconnect(void *instance, const char *signal,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 void *handle, GaimCallback func)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 GaimSignalData *signal_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 GList *l;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 gboolean found = FALSE;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 g_return_if_fail(instance != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 g_return_if_fail(signal != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 g_return_if_fail(handle != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 g_return_if_fail(func != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 /* Get the instance data */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 g_return_if_fail(instance_data != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 /* Get the signal data */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 signal_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 if (signal_data == NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 gaim_debug(GAIM_DEBUG_ERROR, "signals",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 "Signal data for %s not found!\n", signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 return;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 /* Find the handler data. */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 for (l = signal_data->handlers; l != NULL; l = l->next)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 handler_data = (GaimSignalHandlerData *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 if (handler_data->handle == handle && handler_data->cb == func)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 g_free(handler_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 signal_data->handlers = g_list_remove(signal_data->handlers,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 handler_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 signal_data->handler_count--;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 found = TRUE;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 break;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 /* See note somewhere about this actually helping developers.. */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 g_return_if_fail(found);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 /*
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 * TODO: Make this all more efficient by storing a list of handlers, keyed
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 * to a handle.
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 static void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 disconnect_handle_from_signals(const char *signal,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 GaimSignalData *signal_data, void *handle)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 GList *l, *l_next;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 for (l = signal_data->handlers; l != NULL; l = l_next)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 handler_data = (GaimSignalHandlerData *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 l_next = l->next;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 if (handler_data->handle == handle)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 g_free(handler_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 signal_data->handler_count--;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 signal_data->handlers = g_list_remove(signal_data->handlers,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 handler_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 static void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 disconnect_handle_from_instance(void *instance,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 GaimInstanceData *instance_data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 void *handle)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 g_hash_table_foreach(instance_data->signals,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 (GHFunc)disconnect_handle_from_signals, handle);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 gaim_signals_disconnect_by_handle(void *handle)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 g_return_if_fail(handle != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 g_hash_table_foreach(instance_table,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 (GHFunc)disconnect_handle_from_instance, handle);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 gaim_signal_emit(void *instance, const char *signal, ...)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 va_list args;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 va_start(args, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 gaim_signal_emit_vargs(instance, signal, args);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338 va_end(args);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 gaim_signal_emit_vargs(void *instance, const char *signal, va_list args)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 GaimSignalData *signal_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 GList *l;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 g_return_if_fail(instance != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 g_return_if_fail(signal != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 g_return_if_fail(instance_data != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 signal_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 if (signal_data == NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 gaim_debug(GAIM_DEBUG_ERROR, "signals",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 "Signal data for %s not found!\n", signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 return;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 for (l = signal_data->handlers; l != NULL; l = l->next)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 handler_data = (GaimSignalHandlerData *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
371 if (handler_data->use_vargs)
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
372 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
373 ((void (*)(va_list, void *))handler_data->cb)(args,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
374 handler_data->data);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
375 }
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
376 else
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
377 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
378 signal_data->marshal(handler_data->cb, args,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
379 handler_data->data, NULL);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
380 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 void *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 gaim_signal_emit_return_1(void *instance, const char *signal, ...)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 void *ret_val;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 va_list args;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 va_start(args, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 ret_val = gaim_signal_emit_vargs_return_1(instance, signal, args);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 va_end(args);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 return ret_val;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 void *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 gaim_signal_emit_vargs_return_1(void *instance, const char *signal,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 va_list args)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 GaimInstanceData *instance_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 GaimSignalData *signal_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 GaimSignalHandlerData *handler_data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 void *ret_val = NULL;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 GList *l;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 g_return_val_if_fail(instance != NULL, NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 g_return_val_if_fail(signal != NULL, NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 instance_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 g_return_val_if_fail(instance_data != NULL, NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 signal_data =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 if (signal_data == NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 gaim_debug(GAIM_DEBUG_ERROR, "signals",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 "Signal data for %s not found!\n", signal);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 return 0;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 for (l = signal_data->handlers; l != NULL; l = l->next)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 handler_data = (GaimSignalHandlerData *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428
6547
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
429 if (handler_data->use_vargs)
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
430 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
431 ret_val = ((void *(*)(va_list, void *))handler_data->cb)(
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
432 args, handler_data->data);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
433 }
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
434 else
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
435 {
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
436 signal_data->marshal(handler_data->cb, args,
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
437 handler_data->data, &ret_val);
adf168f002ad [gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
438 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 return ret_val;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 gaim_signals_init()
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 g_return_if_fail(instance_table == NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 instance_table =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 g_hash_table_new_full(g_direct_hash, g_direct_equal,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 NULL, (GDestroyNotify)destroy_instance_data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 gaim_signals_uninit()
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 g_return_if_fail(instance_table != NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 g_hash_table_destroy(instance_table);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 instance_table = NULL;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 /**************************************************************************
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 * Marshallers
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 **************************************************************************/
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 gaim_marshal_VOID(GaimCallback cb, va_list args, void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 ((void (*)(void *))cb)(data);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 gaim_marshal_VOID__POINTER(GaimCallback cb, va_list args, void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
477 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
478
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
479 ((void (*)(void *, void *))cb)(arg1, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 gaim_marshal_VOID__POINTER_POINTER(GaimCallback cb, va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 void *data, void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
486 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
487 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
488
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
489 ((void (*)(void *, void *, void *))cb)(arg1, arg2, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 gaim_marshal_VOID__POINTER_POINTER_UINT(GaimCallback cb, va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 void *data, void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
496 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
497 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
498 guint arg3 = va_arg(args, guint);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
499
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
500 ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 gaim_marshal_VOID__POINTER_POINTER_POINTER(GaimCallback cb, va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 void *data, void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
507 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
508 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
509 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
510
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
511 ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(GaimCallback cb,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
520 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
521 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
522 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
523 void *arg4 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
524
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
525 ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 }
6509
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
527
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
528 void
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
529 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
530 va_list args,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
531 void *data,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
532 void **return_val)
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
533 {
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
534 void *arg1 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
535 void *arg2 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
536 void *arg3 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
537 guint arg4 = va_arg(args, guint);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
538
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
539 ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
540 }
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
541
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 {
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
548 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
549 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
550 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
551 guint arg4 = va_arg(args, guint);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
552 guint arg5 = va_arg(args, guint);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
553
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 ((void (*)(void *, void *, void *, guint, guint, void *))cb)(
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
555 arg1, arg2, arg3, arg4, arg5, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 gaim_marshal_BOOLEAN__POINTER(GaimCallback cb, va_list args, void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 gboolean ret_val;
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
563 void *arg1 = va_arg(args, void *);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
565 ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 if (return_val != NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 *return_val = GINT_TO_POINTER(ret_val);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 gaim_marshal_BOOLEAN__POINTER_POINTER(GaimCallback cb, va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 void *data, void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 gboolean ret_val;
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
576 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
577 void *arg2 = va_arg(args, void *);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
579 ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 if (return_val != NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 *return_val = GINT_TO_POINTER(ret_val);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 void
6509
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
586 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
587 void *data, void **return_val)
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
588 {
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
589 gboolean ret_val;
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
590 void *arg1 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
591 void *arg2 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
592 void *arg3 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
593
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
594 ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
595 arg3, data);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
596
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
597 if (return_val != NULL)
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
598 *return_val = GINT_TO_POINTER(ret_val);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
599 }
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
600
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
601 void
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
602 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
603 va_list args,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
604 void *data,
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
605 void **return_val)
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
606 {
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
607 gboolean ret_val;
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
608 void *arg1 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
609 void *arg2 = va_arg(args, void *);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
610 guint arg3 = va_arg(args, guint);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
611
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
612 ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)(
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
613 arg1, arg2, arg3, data);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
614
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
615 if (return_val != NULL)
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
616 *return_val = GINT_TO_POINTER(ret_val);
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
617 }
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
618
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6505
diff changeset
619 void
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622 void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 gboolean ret_val;
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
626 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
627 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
628 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
629 guint arg4 = va_arg(args, guint);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)(
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
632 arg1, arg2, arg3, arg4, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634 if (return_val != NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 *return_val = GINT_TO_POINTER(ret_val);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(GaimCallback cb,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 va_list args,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641 void *data,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644 gboolean ret_val;
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
645 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
646 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
647 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
648 void *arg4 = va_arg(args, void *);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)(
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
651 arg1, arg2, arg3, arg4, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653 if (return_val != NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
654 *return_val = GINT_TO_POINTER(ret_val);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER(
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 GaimCallback cb, va_list args, void *data, void **return_val)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 gboolean ret_val;
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
662 void *arg1 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
663 void *arg2 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
664 void *arg3 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
665 void *arg4 = va_arg(args, void *);
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
666 void *arg5 = va_arg(args, void *);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 ret_val =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)(
6505
5ca59294698d [gaim-migrate @ 7021]
Ethan Blanton <elb@pidgin.im>
parents: 6488
diff changeset
670 arg1, arg2, arg3, arg4, arg5, data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
672 if (return_val != NULL)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673 *return_val = GINT_TO_POINTER(ret_val);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
674 }