Mercurial > pidgin.yaz
annotate src/signals.h @ 11143:5c56223fa24f
[gaim-migrate @ 13207]
I think this gets rid of the last of the gcc4 -Wall warnings in the core
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 22 Jul 2005 02:06:15 +0000 |
parents | e4459e8ccfb5 |
children | 593749a4469c |
rev | line source |
---|---|
6485 | 1 /** |
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2 * @file signals.h 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 */ | |
9713 | 25 #ifndef _GAIM_SIGNALS_H_ |
26 #define _GAIM_SIGNALS_H_ | |
6485 | 27 |
28 #include <glib.h> | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
29 #include "value.h" |
6485 | 30 |
31 #define GAIM_CALLBACK(func) ((GaimCallback)func) | |
32 | |
33 typedef void (*GaimCallback)(void); | |
34 typedef void (*GaimSignalMarshalFunc)(GaimCallback cb, va_list args, | |
35 void *data, void **return_val); | |
36 | |
37 #ifdef __cplusplus | |
38 extern "C" { | |
39 #endif | |
40 | |
41 /**************************************************************************/ | |
42 /** @name Signal API */ | |
43 /**************************************************************************/ | |
44 /*@{*/ | |
45 | |
46 /** | |
10656 | 47 * Signal Connect Priorities |
48 */ | |
49 #define GAIM_SIGNAL_PRIORITY_DEFAULT 0 | |
50 #define GAIM_SIGNAL_PRIORITY_HIGHEST 9999 | |
51 #define GAIM_SIGNAL_PRIORITY_LOWEST -9999 | |
52 | |
53 /** | |
6485 | 54 * Registers a signal in an instance. |
55 * | |
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
56 * @param instance The instance to register the signal for. |
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
57 * @param signal The signal name. |
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
58 * @param marshal The marshal function. |
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
59 * @param ret_value The return value type, or NULL for no return value. |
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
60 * @param num_values The number of values to be passed to the callbacks. |
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
61 * @param ... The values to pass to the callbacks. |
6485 | 62 * |
63 * @return The signal ID local to that instance, or 0 if the signal | |
64 * couldn't be registered. | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
65 * |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
66 * @see GaimValue |
6485 | 67 */ |
68 gulong gaim_signal_register(void *instance, const char *signal, | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
69 GaimSignalMarshalFunc marshal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
70 GaimValue *ret_value, int num_values, ...); |
6485 | 71 |
72 /** | |
73 * Unregisters a signal in an instance. | |
74 * | |
75 * @param instance The instance to unregister the signal for. | |
76 * @param signal The signal name. | |
77 */ | |
78 void gaim_signal_unregister(void *instance, const char *signal); | |
79 | |
80 /** | |
81 * Unregisters all signals in an instance. | |
82 * | |
83 * @param instance The instance to unregister the signal for. | |
84 */ | |
85 void gaim_signals_unregister_by_instance(void *instance); | |
86 | |
87 /** | |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
88 * Returns a list of value types used for a signal. |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
89 * |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
90 * @param instance The instance the signal is registered to. |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
91 * @param signal The signal. |
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6564
diff
changeset
|
92 * @param ret_value The return value from the last signal handler. |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
93 * @param num_values The returned number of values. |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
94 * @param values The returned list of values. |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
95 */ |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
96 void gaim_signal_get_values(void *instance, const char *signal, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
97 GaimValue **ret_value, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
98 int *num_values, GaimValue ***values); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
99 |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6562
diff
changeset
|
100 /** |
6485 | 101 * Connects a signal handler to a signal for a particular object. |
102 * | |
103 * Take care not to register a handler function twice. Gaim will | |
104 * not correct any mistakes for you in this area. | |
105 * | |
106 * @param instance The instance to connect to. | |
107 * @param signal The name of the signal to connect. | |
108 * @param handle The handle of the receiver. | |
109 * @param func The callback function. | |
110 * @param data The data to pass to the callback function. | |
10656 | 111 * @param priority The order in which the signal should be added to the list |
112 * | |
113 * @return The signal handler ID. | |
114 * | |
115 * @see gaim_signal_disconnect() | |
116 */ | |
117 gulong gaim_signal_connect_priority(void *instance, const char *signal, | |
118 void *handle, GaimCallback func, void *data, int priority); | |
119 | |
120 /** | |
121 * Connects a signal handler to a signal for a particular object. | |
122 * (priority defaults to 0) | |
123 * | |
124 * Take care not to register a handler function twice. Gaim will | |
125 * not correct any mistakes for you in this area. | |
126 * | |
127 * @param instance The instance to connect to. | |
128 * @param signal The name of the signal to connect. | |
129 * @param handle The handle of the receiver. | |
130 * @param func The callback function. | |
131 * @param data The data to pass to the callback function. | |
6485 | 132 * |
133 * @return The signal handler ID. | |
134 * | |
135 * @see gaim_signal_disconnect() | |
136 */ | |
137 gulong gaim_signal_connect(void *instance, const char *signal, | |
138 void *handle, GaimCallback func, void *data); | |
139 | |
140 /** | |
6548
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
141 * Connects a signal handler to a signal for a particular object. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
142 * |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
143 * The signal handler will take a va_args of arguments, instead of |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
144 * individual arguments. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
145 * |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
146 * Take care not to register a handler function twice. Gaim will |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
147 * not correct any mistakes for you in this area. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
148 * |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
149 * @param instance The instance to connect to. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
150 * @param signal The name of the signal to connect. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
151 * @param handle The handle of the receiver. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
152 * @param func The callback function. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
153 * @param data The data to pass to the callback function. |
10656 | 154 * @param priority The order in which the signal should be added to the list |
155 * | |
156 * @return The signal handler ID. | |
157 * | |
158 * @see gaim_signal_disconnect() | |
159 */ | |
160 gulong gaim_signal_connect_priority_vargs(void *instance, const char *signal, | |
161 void *handle, GaimCallback func, void *data, int priority); | |
162 | |
163 /** | |
164 * Connects a signal handler to a signal for a particular object. | |
165 * (priority defaults to 0) | |
166 * The signal handler will take a va_args of arguments, instead of | |
167 * individual arguments. | |
168 * | |
169 * Take care not to register a handler function twice. Gaim will | |
170 * not correct any mistakes for you in this area. | |
171 * | |
172 * @param instance The instance to connect to. | |
173 * @param signal The name of the signal to connect. | |
174 * @param handle The handle of the receiver. | |
175 * @param func The callback function. | |
176 * @param data The data to pass to the callback function. | |
6548
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
177 * |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
178 * @return The signal handler ID. |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
179 * |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
180 * @see gaim_signal_disconnect() |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
181 */ |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
182 gulong gaim_signal_connect_vargs(void *instance, const char *signal, |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
183 void *handle, GaimCallback func, void *data); |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
184 |
d01ba50e3f3e
[gaim-migrate @ 7070]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
185 /** |
6485 | 186 * Disconnects a signal handler from a signal on an object. |
187 * | |
188 * @param instance The instance to disconnect from. | |
189 * @param signal The name of the signal to disconnect. | |
190 * @param handle The handle of the receiver. | |
191 * @param func The registered function to disconnect. | |
192 * | |
193 * @see gaim_signal_connect() | |
194 */ | |
195 void gaim_signal_disconnect(void *instance, const char *signal, | |
196 void *handle, GaimCallback func); | |
197 | |
198 /** | |
199 * Removes all callbacks associated with a receiver handle. | |
200 * | |
201 * @param handle The receiver handle. | |
202 */ | |
203 void gaim_signals_disconnect_by_handle(void *handle); | |
204 | |
205 /** | |
206 * Emits a signal. | |
207 * | |
208 * @param instance The instance emitting the signal. | |
209 * @param signal The signal being emitted. | |
210 * | |
211 * @see gaim_signal_connect() | |
212 * @see gaim_signal_disconnect() | |
213 */ | |
214 void gaim_signal_emit(void *instance, const char *signal, ...); | |
215 | |
216 /** | |
217 * Emits a signal, using a va_list of arguments. | |
218 * | |
219 * @param instance The instance emitting the signal. | |
220 * @param signal The signal being emitted. | |
221 * @param args The arguments list. | |
222 * | |
223 * @see gaim_signal_connect() | |
224 * @see gaim_signal_disconnect() | |
225 */ | |
226 void gaim_signal_emit_vargs(void *instance, const char *signal, va_list args); | |
227 | |
228 /** | |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
229 * Emits a signal and returns the first non-NULL return value. |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
230 * |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
231 * Further signal handlers are NOT called after a handler returns |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
232 * something other than NULL. |
6485 | 233 * |
234 * @param instance The instance emitting the signal. | |
235 * @param signal The signal being emitted. | |
236 * | |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
237 * @return The first non-NULL return value |
6485 | 238 */ |
239 void *gaim_signal_emit_return_1(void *instance, const char *signal, ...); | |
240 | |
241 /** | |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
242 * Emits a signal and returns the first non-NULL return value. |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
243 * |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
244 * Further signal handlers are NOT called after a handler returns |
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
245 * something other than NULL. |
6485 | 246 * |
247 * @param instance The instance emitting the signal. | |
248 * @param signal The signal being emitted. | |
249 * @param args The arguments list. | |
250 * | |
10789
0caa9827edf5
[gaim-migrate @ 12431]
Luke Schierer <lschiere@pidgin.im>
parents:
10656
diff
changeset
|
251 * @return The first non-NULL return value |
6485 | 252 */ |
253 void *gaim_signal_emit_vargs_return_1(void *instance, const char *signal, | |
254 va_list args); | |
255 | |
256 /** | |
257 * Initializes the signals subsystem. | |
258 */ | |
259 void gaim_signals_init(); | |
260 | |
261 /** | |
262 * Uninitializes the signals subsystem. | |
263 */ | |
264 void gaim_signals_uninit(); | |
265 | |
266 /*@}*/ | |
267 | |
268 /**************************************************************************/ | |
269 /** @name Marshal Functions */ | |
270 /**************************************************************************/ | |
271 /*@{*/ | |
272 | |
273 void gaim_marshal_VOID( | |
274 GaimCallback cb, va_list args, void *data, void **return_val); | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
275 void gaim_marshal_VOID__INT( |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
276 GaimCallback cb, va_list args, void *data, void **return_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
277 void gaim_marshal_VOID__INT_INT( |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
278 GaimCallback cb, va_list args, void *data, void **return_val); |
6485 | 279 void gaim_marshal_VOID__POINTER( |
280 GaimCallback cb, va_list args, void *data, void **return_val); | |
9734 | 281 void gaim_marshal_VOID__POINTER_UINT( |
282 GaimCallback cb, va_list args, void *data, void **return_val); | |
6485 | 283 void gaim_marshal_VOID__POINTER_POINTER( |
284 GaimCallback cb, va_list args, void *data, void **return_val); | |
285 void gaim_marshal_VOID__POINTER_POINTER_UINT( | |
286 GaimCallback cb, va_list args, void *data, void **return_val); | |
9554 | 287 void gaim_marshal_VOID__POINTER_POINTER_UINT_UINT( |
288 GaimCallback cb, va_list args, void *data, void **return_val); | |
6485 | 289 void gaim_marshal_VOID__POINTER_POINTER_POINTER( |
290 GaimCallback cb, va_list args, void *data, void **return_val); | |
291 void gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER( | |
292 GaimCallback cb, va_list args, void *data, void **return_val); | |
9514 | 293 void gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER( |
294 GaimCallback cb, va_list args, void *data, void **return_val); | |
6509 | 295 void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT( |
296 GaimCallback cb, va_list args, void *data, void **return_val); | |
10104 | 297 void gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT( |
298 GaimCallback cb, va_list args, void *data, void **return_val); | |
6485 | 299 void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT( |
300 GaimCallback cb, va_list args, void *data, void **return_val); | |
301 | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
302 void gaim_marshal_INT__INT( |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
303 GaimCallback cb, va_list args, void *data, void **return_val); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
304 void gaim_marshal_INT__INT_INT( |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
305 GaimCallback cb, va_list args, void *data, void **return_val); |
11064
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
10789
diff
changeset
|
306 void gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( |
e4459e8ccfb5
[gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents:
10789
diff
changeset
|
307 GaimCallback cb, va_list args, void *data, void **return_val); |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
308 |
6485 | 309 void gaim_marshal_BOOLEAN__POINTER( |
310 GaimCallback cb, va_list args, void *data, void **return_val); | |
311 void gaim_marshal_BOOLEAN__POINTER_POINTER( | |
312 GaimCallback cb, va_list args, void *data, void **return_val); | |
6509 | 313 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER( |
314 GaimCallback cb, va_list args, void *data, void **return_val); | |
315 void gaim_marshal_BOOLEAN__POINTER_POINTER_UINT( | |
316 GaimCallback cb, va_list args, void *data, void **return_val); | |
6485 | 317 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT( |
318 GaimCallback cb, va_list args, void *data, void **return_val); | |
319 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER( | |
320 GaimCallback cb, va_list args, void *data, void **return_val); | |
321 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( | |
322 GaimCallback cb, va_list args, void *data, void **return_val); | |
323 | |
324 /*@}*/ | |
325 | |
326 #ifdef __cplusplus | |
327 } | |
328 #endif | |
329 | |
9713 | 330 #endif /* _GAIM_SIGNALS_H_ */ |