signals.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_SIGNALS_H_
27 #define _PURPLE_SIGNALS_H_
28
29 #include <glib.h>
30 #include "value.h"
31
32 #define PURPLE_CALLBACK(func) ((PurpleCallback)func)
33
34 typedef void (*PurpleCallback)(void);
35 typedef void (*PurpleSignalMarshalFunc)(PurpleCallback cb, va_list args,
36 void *data, void **return_val);
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /**************************************************************************/
44 /**************************************************************************/
51 #define PURPLE_SIGNAL_PRIORITY_DEFAULT 0
52
58 #define PURPLE_SIGNAL_PRIORITY_HIGHEST 9999
59
65 #define PURPLE_SIGNAL_PRIORITY_LOWEST -9999
66
82 gulong purple_signal_register(void *instance, const char *signal,
83 PurpleSignalMarshalFunc marshal,
84 PurpleValue *ret_value, int num_values, ...);
85
92 void purple_signal_unregister(void *instance, const char *signal);
93
99 void purple_signals_unregister_by_instance(void *instance);
100
110 void purple_signal_get_values(void *instance, const char *signal,
111 PurpleValue **ret_value,
112 int *num_values, PurpleValue ***values);
113
134 gulong purple_signal_connect_priority(void *instance, const char *signal,
135 void *handle, PurpleCallback func, void *data, int priority);
136
154 gulong purple_signal_connect(void *instance, const char *signal,
155 void *handle, PurpleCallback func, void *data);
156
180 gulong purple_signal_connect_priority_vargs(void *instance, const char *signal,
181 void *handle, PurpleCallback func, void *data, int priority);
182
203 gulong purple_signal_connect_vargs(void *instance, const char *signal,
204 void *handle, PurpleCallback func, void *data);
205
216 void purple_signal_disconnect(void *instance, const char *signal,
217 void *handle, PurpleCallback func);
218
224 void purple_signals_disconnect_by_handle(void *handle);
225
235 void purple_signal_emit(void *instance, const char *signal, ...);
236
247 void purple_signal_emit_vargs(void *instance, const char *signal, va_list args);
248
260 void *purple_signal_emit_return_1(void *instance, const char *signal, ...);
261
274 void *purple_signal_emit_vargs_return_1(void *instance, const char *signal,
275 va_list args);
276
280 void purple_signals_init(void);
281
285 void purple_signals_uninit(void);
286
289 /**************************************************************************/
291 /**************************************************************************/
294 void purple_marshal_VOID(
295 PurpleCallback cb, va_list args, void *data, void **return_val);
296 void purple_marshal_VOID__INT(
297 PurpleCallback cb, va_list args, void *data, void **return_val);
298 void purple_marshal_VOID__INT_INT(
299 PurpleCallback cb, va_list args, void *data, void **return_val);
300 void purple_marshal_VOID__POINTER(
301 PurpleCallback cb, va_list args, void *data, void **return_val);
302 void purple_marshal_VOID__POINTER_UINT(
303 PurpleCallback cb, va_list args, void *data, void **return_val);
304 void purple_marshal_VOID__POINTER_INT_INT(
305 PurpleCallback cb, va_list args, void *data, void **return_val);
306 void purple_marshal_VOID__POINTER_INT_POINTER(
307 PurpleCallback cb, va_list args, void *data, void **return_val);
308 void purple_marshal_VOID__POINTER_POINTER(
309 PurpleCallback cb, va_list args, void *data, void **return_val);
310 void purple_marshal_VOID__POINTER_POINTER_UINT(
311 PurpleCallback cb, va_list args, void *data, void **return_val);
312 void purple_marshal_VOID__POINTER_POINTER_UINT_UINT(
313 PurpleCallback cb, va_list args, void *data, void **return_val);
314 void purple_marshal_VOID__POINTER_POINTER_POINTER(
315 PurpleCallback cb, va_list args, void *data, void **return_val);
316 void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER(
317 PurpleCallback cb, va_list args, void *data, void **return_val);
318 void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(
319 PurpleCallback cb, va_list args, void *data, void **return_val);
320 void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT(
321 PurpleCallback cb, va_list args, void *data, void **return_val);
322 void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(
323 PurpleCallback cb, va_list args, void *data, void **return_val);
324 void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(
325 PurpleCallback cb, va_list args, void *data, void **return_val);
326
327 void purple_marshal_INT__INT(
328 PurpleCallback cb, va_list args, void *data, void **return_val);
329 void purple_marshal_INT__INT_INT(
330 PurpleCallback cb, va_list args, void *data, void **return_val);
331 void purple_marshal_INT__POINTER_POINTER(
332 PurpleCallback cb, va_list args, void *data, void **return_val);
333 void purple_marshal_INT__POINTER_POINTER_POINTER(
334 PurpleCallback cb, va_list args, void *data, void **return_val);
335 void purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER(
336 PurpleCallback cb, va_list args, void *data, void **return_val);
337
338 void purple_marshal_BOOLEAN__POINTER(
339 PurpleCallback cb, va_list args, void *data, void **return_val);
340 void purple_marshal_BOOLEAN__POINTER_POINTER(
341 PurpleCallback cb, va_list args, void *data, void **return_val);
342 void purple_marshal_BOOLEAN__POINTER_BOOLEAN(
343 PurpleCallback cb, va_list args, void *data, void **return_val);
344 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER(
345 PurpleCallback cb, va_list args, void *data, void **return_val);
346 void purple_marshal_BOOLEAN__POINTER_POINTER_UINT(
347 PurpleCallback cb, va_list args, void *data, void **return_val);
348 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(
349 PurpleCallback cb, va_list args, void *data, void **return_val);
350 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(
351 PurpleCallback cb, va_list args, void *data, void **return_val);
352 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER(
353 PurpleCallback cb, va_list args, void *data, void **return_val);
354 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT(
355 PurpleCallback cb, va_list args, void *data, void **return_val);
356 void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER(
357 PurpleCallback cb, va_list args, void *data, void **return_val);
358
359 void purple_marshal_BOOLEAN__INT_POINTER(
360 PurpleCallback cb, va_list args, void *data, void **return_val);
361
362 void purple_marshal_POINTER__POINTER(
363 PurpleCallback cb, va_list args, void *data, void **return_val);
364 void purple_marshal_POINTER__POINTER_INT(
365 PurpleCallback cb, va_list args, void *data, void **return_val);
366 void purple_marshal_POINTER__POINTER_INT64(
367 PurpleCallback cb, va_list args, void *data, void **return_val);
368 void purple_marshal_POINTER__POINTER_INT_BOOLEAN(
369 PurpleCallback cb, va_list args, void *data, void **return_val);
370 void purple_marshal_POINTER__POINTER_INT64_BOOLEAN(
371 PurpleCallback cb, va_list args, void *data, void **return_val);
372 void purple_marshal_POINTER__POINTER_POINTER(
373 PurpleCallback cb, va_list args, void *data, void **return_val);
376 #ifdef __cplusplus
377 }
378 #endif
379
380 #endif /* _PURPLE_SIGNALS_H_ */
purple_signal_connect_priority
gulong purple_signal_connect_priority(void *instance, const char *signal, void *handle, PurpleCallback func, void *data, int priority)
Connects a signal handler to a signal for a particular object.
purple_signal_register
gulong purple_signal_register(void *instance, const char *signal, PurpleSignalMarshalFunc marshal, PurpleValue *ret_value, int num_values,...)
Registers a signal in an instance.
purple_signals_init
void purple_signals_init(void)
Initializes the signals subsystem.
purple_signals_disconnect_by_handle
void purple_signals_disconnect_by_handle(void *handle)
Removes all callbacks associated with a receiver handle.
purple_signals_unregister_by_instance
void purple_signals_unregister_by_instance(void *instance)
Unregisters all signals in an instance.
purple_signal_connect_vargs
gulong purple_signal_connect_vargs(void *instance, const char *signal, void *handle, PurpleCallback func, void *data)
Connects a signal handler to a signal for a particular object.
purple_signal_get_values
void purple_signal_get_values(void *instance, const char *signal, PurpleValue **ret_value, int *num_values, PurpleValue ***values)
Returns a list of value types used for a signal.
purple_signal_emit_vargs_return_1
void * purple_signal_emit_vargs_return_1(void *instance, const char *signal, va_list args)
Emits a signal and returns the first non-NULL return value.
purple_signal_emit_return_1
void * purple_signal_emit_return_1(void *instance, const char *signal,...)
Emits a signal and returns the first non-NULL return value.
purple_signals_uninit
void purple_signals_uninit(void)
Uninitializes the signals subsystem.
purple_signal_connect
gulong purple_signal_connect(void *instance, const char *signal, void *handle, PurpleCallback func, void *data)
Connects a signal handler to a signal for a particular object.
purple_signal_unregister
void purple_signal_unregister(void *instance, const char *signal)
Unregisters a signal in an instance.
PurpleValue
A wrapper for a type, subtype, and specific type of value.
Definition: value.h:89
purple_signal_emit
void purple_signal_emit(void *instance, const char *signal,...)
Emits a signal.
purple_signal_disconnect
void purple_signal_disconnect(void *instance, const char *signal, void *handle, PurpleCallback func)
Disconnects a signal handler from a signal on an object.
value.h
Value wrapper API.
purple_signal_emit_vargs
void purple_signal_emit_vargs(void *instance, const char *signal, va_list args)
Emits a signal, using a va_list of arguments.
purple_signal_connect_priority_vargs
gulong purple_signal_connect_priority_vargs(void *instance, const char *signal, void *handle, PurpleCallback func, void *data, int priority)
Connects a signal handler to a signal for a particular object.