| 22 */ |
22 */ |
| 23 #ifndef _GAIM_SIGNAL_H_ |
23 #ifndef _GAIM_SIGNAL_H_ |
| 24 #define _GAIM_SIGNAL_H_ |
24 #define _GAIM_SIGNAL_H_ |
| 25 |
25 |
| 26 #include <glib.h> |
26 #include <glib.h> |
| |
27 #include "value.h" |
| 27 |
28 |
| 28 #define GAIM_CALLBACK(func) ((GaimCallback)func) |
29 #define GAIM_CALLBACK(func) ((GaimCallback)func) |
| 29 |
30 |
| 30 typedef void (*GaimCallback)(void); |
31 typedef void (*GaimCallback)(void); |
| 31 typedef void (*GaimSignalMarshalFunc)(GaimCallback cb, va_list args, |
32 typedef void (*GaimSignalMarshalFunc)(GaimCallback cb, va_list args, |
| 41 /*@{*/ |
42 /*@{*/ |
| 42 |
43 |
| 43 /** |
44 /** |
| 44 * Registers a signal in an instance. |
45 * Registers a signal in an instance. |
| 45 * |
46 * |
| 46 * @param instance The instance to register the signal for. |
47 * @param instance The instance to register the signal for. |
| 47 * @param signal The signal name. |
48 * @param signal The signal name. |
| 48 * @param marshal The marshal function. |
49 * @param marshal The marshal function. |
| |
50 * @param ret_value The return value type, or NULL for no return value. |
| |
51 * @param num_types The number of values to be passed to the callbacks. |
| |
52 * @param ... The values to pass to the callbacks. |
| 49 * |
53 * |
| 50 * @return The signal ID local to that instance, or 0 if the signal |
54 * @return The signal ID local to that instance, or 0 if the signal |
| 51 * couldn't be registered. |
55 * couldn't be registered. |
| |
56 * |
| |
57 * @see GaimValue |
| 52 */ |
58 */ |
| 53 gulong gaim_signal_register(void *instance, const char *signal, |
59 gulong gaim_signal_register(void *instance, const char *signal, |
| 54 GaimSignalMarshalFunc marshal); |
60 GaimSignalMarshalFunc marshal, |
| |
61 GaimValue *ret_value, int num_values, ...); |
| 55 |
62 |
| 56 /** |
63 /** |
| 57 * Unregisters a signal in an instance. |
64 * Unregisters a signal in an instance. |
| 58 * |
65 * |
| 59 * @param instance The instance to unregister the signal for. |
66 * @param instance The instance to unregister the signal for. |
| 65 * Unregisters all signals in an instance. |
72 * Unregisters all signals in an instance. |
| 66 * |
73 * |
| 67 * @param instance The instance to unregister the signal for. |
74 * @param instance The instance to unregister the signal for. |
| 68 */ |
75 */ |
| 69 void gaim_signals_unregister_by_instance(void *instance); |
76 void gaim_signals_unregister_by_instance(void *instance); |
| |
77 |
| |
78 /** |
| |
79 * Returns a list of value types used for a signal. |
| |
80 * |
| |
81 * @param instance The instance the signal is registered to. |
| |
82 * @param signal The signal. |
| |
83 * @param num_values The returned number of values. |
| |
84 * @param values The returned list of values. |
| |
85 */ |
| |
86 void gaim_signal_get_values(void *instance, const char *signal, |
| |
87 GaimValue **ret_value, |
| |
88 int *num_values, GaimValue ***values); |
| 70 |
89 |
| 71 /** |
90 /** |
| 72 * Connects a signal handler to a signal for a particular object. |
91 * Connects a signal handler to a signal for a particular object. |
| 73 * |
92 * |
| 74 * Take care not to register a handler function twice. Gaim will |
93 * Take care not to register a handler function twice. Gaim will |