| 63 #define PURPLE_SIGNAL_PRIORITY_LOWEST -9999 |
63 #define PURPLE_SIGNAL_PRIORITY_LOWEST -9999 |
| 64 |
64 |
| 65 /** |
65 /** |
| 66 * Registers a signal in an instance. |
66 * Registers a signal in an instance. |
| 67 * |
67 * |
| 68 * @param instance The instance to register the signal for. |
68 * @instance: The instance to register the signal for. |
| 69 * @param signal The signal name. |
69 * @signal: The signal name. |
| 70 * @param marshal The marshal function. |
70 * @marshal: The marshal function. |
| 71 * @param ret_type The return type, or G_TYPE_NONE for no return type. |
71 * @ret_type: The return type, or G_TYPE_NONE for no return type. |
| 72 * @param num_values The number of values to be passed to the callbacks. |
72 * @num_values: The number of values to be passed to the callbacks. |
| 73 * @param ... The types of the parameters for the callbacks. |
73 * @...: The types of the parameters for the callbacks. |
| 74 * |
74 * |
| 75 * @return The signal ID local to that instance, or 0 if the signal |
75 * Returns: The signal ID local to that instance, or 0 if the signal |
| 76 * couldn't be registered. |
76 * couldn't be registered. |
| 77 */ |
77 */ |
| 78 gulong purple_signal_register(void *instance, const char *signal, |
78 gulong purple_signal_register(void *instance, const char *signal, |
| 79 PurpleSignalMarshalFunc marshal, |
79 PurpleSignalMarshalFunc marshal, |
| 80 GType ret_type, int num_values, ...); |
80 GType ret_type, int num_values, ...); |
| 81 |
81 |
| 82 /** |
82 /** |
| 83 * Unregisters a signal in an instance. |
83 * Unregisters a signal in an instance. |
| 84 * |
84 * |
| 85 * @param instance The instance to unregister the signal for. |
85 * @instance: The instance to unregister the signal for. |
| 86 * @param signal The signal name. |
86 * @signal: The signal name. |
| 87 */ |
87 */ |
| 88 void purple_signal_unregister(void *instance, const char *signal); |
88 void purple_signal_unregister(void *instance, const char *signal); |
| 89 |
89 |
| 90 /** |
90 /** |
| 91 * Unregisters all signals in an instance. |
91 * Unregisters all signals in an instance. |
| 92 * |
92 * |
| 93 * @param instance The instance to unregister the signal for. |
93 * @instance: The instance to unregister the signal for. |
| 94 */ |
94 */ |
| 95 void purple_signals_unregister_by_instance(void *instance); |
95 void purple_signals_unregister_by_instance(void *instance); |
| 96 |
96 |
| 97 /** |
97 /** |
| 98 * Returns a list of value types used for a signal. |
98 * Returns a list of value types used for a signal. |
| 99 * |
99 * |
| 100 * @param instance The instance the signal is registered to. |
100 * @instance: The instance the signal is registered to. |
| 101 * @param signal The signal. |
101 * @signal: The signal. |
| 102 * @param ret_type The return type. |
102 * @ret_type: The return type. |
| 103 * @param num_values The returned number of parameters. |
103 * @num_values: The returned number of parameters. |
| 104 * @param param_types The returned list of parameter types. |
104 * @param_types: The returned list of parameter types. |
| 105 */ |
105 */ |
| 106 void purple_signal_get_types(void *instance, const char *signal, |
106 void purple_signal_get_types(void *instance, const char *signal, |
| 107 GType *ret_type, int *num_values, |
107 GType *ret_type, int *num_values, |
| 108 GType **param_types); |
108 GType **param_types); |
| 109 |
109 |
| 111 * Connects a signal handler to a signal for a particular object. |
111 * Connects a signal handler to a signal for a particular object. |
| 112 * |
112 * |
| 113 * Take care not to register a handler function twice. Purple will |
113 * Take care not to register a handler function twice. Purple will |
| 114 * not correct any mistakes for you in this area. |
114 * not correct any mistakes for you in this area. |
| 115 * |
115 * |
| 116 * @param instance The instance to connect to. |
116 * @instance: The instance to connect to. |
| 117 * @param signal The name of the signal to connect. |
117 * @signal: The name of the signal to connect. |
| 118 * @param handle The handle of the receiver. |
118 * @handle: The handle of the receiver. |
| 119 * @param func The callback function. |
119 * @func: The callback function. |
| 120 * @param data The data to pass to the callback function. |
120 * @data: The data to pass to the callback function. |
| 121 * @param priority The priority with which the handler should be called. Signal |
121 * @priority: The priority with which the handler should be called. Signal |
| 122 * handlers are called in ascending numerical order of @a |
122 * handlers are called in ascending numerical order of @a |
| 123 * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to |
123 * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to |
| 124 * #PURPLE_SIGNAL_PRIORITY_HIGHEST. |
124 * #PURPLE_SIGNAL_PRIORITY_HIGHEST. |
| 125 * |
125 * |
| 126 * @return The signal handler ID. |
126 * Returns: The signal handler ID. |
| 127 * |
127 * |
| 128 * @see purple_signal_disconnect() |
128 * @see purple_signal_disconnect() |
| 129 */ |
129 */ |
| 130 gulong purple_signal_connect_priority(void *instance, const char *signal, |
130 gulong purple_signal_connect_priority(void *instance, const char *signal, |
| 131 void *handle, PurpleCallback func, void *data, int priority); |
131 void *handle, PurpleCallback func, void *data, int priority); |
| 135 * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) |
135 * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) |
| 136 * |
136 * |
| 137 * Take care not to register a handler function twice. Purple will |
137 * Take care not to register a handler function twice. Purple will |
| 138 * not correct any mistakes for you in this area. |
138 * not correct any mistakes for you in this area. |
| 139 * |
139 * |
| 140 * @param instance The instance to connect to. |
140 * @instance: The instance to connect to. |
| 141 * @param signal The name of the signal to connect. |
141 * @signal: The name of the signal to connect. |
| 142 * @param handle The handle of the receiver. |
142 * @handle: The handle of the receiver. |
| 143 * @param func The callback function. |
143 * @func: The callback function. |
| 144 * @param data The data to pass to the callback function. |
144 * @data: The data to pass to the callback function. |
| 145 * |
145 * |
| 146 * @return The signal handler ID. |
146 * Returns: The signal handler ID. |
| 147 * |
147 * |
| 148 * @see purple_signal_disconnect() |
148 * @see purple_signal_disconnect() |
| 149 */ |
149 */ |
| 150 gulong purple_signal_connect(void *instance, const char *signal, |
150 gulong purple_signal_connect(void *instance, const char *signal, |
| 151 void *handle, PurpleCallback func, void *data); |
151 void *handle, PurpleCallback func, void *data); |
| 157 * individual arguments. |
157 * individual arguments. |
| 158 * |
158 * |
| 159 * Take care not to register a handler function twice. Purple will |
159 * Take care not to register a handler function twice. Purple will |
| 160 * not correct any mistakes for you in this area. |
160 * not correct any mistakes for you in this area. |
| 161 * |
161 * |
| 162 * @param instance The instance to connect to. |
162 * @instance: The instance to connect to. |
| 163 * @param signal The name of the signal to connect. |
163 * @signal: The name of the signal to connect. |
| 164 * @param handle The handle of the receiver. |
164 * @handle: The handle of the receiver. |
| 165 * @param func The callback function. |
165 * @func: The callback function. |
| 166 * @param data The data to pass to the callback function. |
166 * @data: The data to pass to the callback function. |
| 167 * @param priority The priority with which the handler should be called. Signal |
167 * @priority: The priority with which the handler should be called. Signal |
| 168 * handlers are called in ascending numerical order of @a |
168 * handlers are called in ascending numerical order of @a |
| 169 * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to |
169 * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to |
| 170 * #PURPLE_SIGNAL_PRIORITY_HIGHEST. |
170 * #PURPLE_SIGNAL_PRIORITY_HIGHEST. |
| 171 * |
171 * |
| 172 * @return The signal handler ID. |
172 * Returns: The signal handler ID. |
| 173 * |
173 * |
| 174 * @see purple_signal_disconnect() |
174 * @see purple_signal_disconnect() |
| 175 */ |
175 */ |
| 176 gulong purple_signal_connect_priority_vargs(void *instance, const char *signal, |
176 gulong purple_signal_connect_priority_vargs(void *instance, const char *signal, |
| 177 void *handle, PurpleCallback func, void *data, int priority); |
177 void *handle, PurpleCallback func, void *data, int priority); |
| 184 * individual arguments. |
184 * individual arguments. |
| 185 * |
185 * |
| 186 * Take care not to register a handler function twice. Purple will |
186 * Take care not to register a handler function twice. Purple will |
| 187 * not correct any mistakes for you in this area. |
187 * not correct any mistakes for you in this area. |
| 188 * |
188 * |
| 189 * @param instance The instance to connect to. |
189 * @instance: The instance to connect to. |
| 190 * @param signal The name of the signal to connect. |
190 * @signal: The name of the signal to connect. |
| 191 * @param handle The handle of the receiver. |
191 * @handle: The handle of the receiver. |
| 192 * @param func The callback function. |
192 * @func: The callback function. |
| 193 * @param data The data to pass to the callback function. |
193 * @data: The data to pass to the callback function. |
| 194 * |
194 * |
| 195 * @return The signal handler ID. |
195 * Returns: The signal handler ID. |
| 196 * |
196 * |
| 197 * @see purple_signal_disconnect() |
197 * @see purple_signal_disconnect() |
| 198 */ |
198 */ |
| 199 gulong purple_signal_connect_vargs(void *instance, const char *signal, |
199 gulong purple_signal_connect_vargs(void *instance, const char *signal, |
| 200 void *handle, PurpleCallback func, void *data); |
200 void *handle, PurpleCallback func, void *data); |
| 201 |
201 |
| 202 /** |
202 /** |
| 203 * Disconnects a signal handler from a signal on an object. |
203 * Disconnects a signal handler from a signal on an object. |
| 204 * |
204 * |
| 205 * @param instance The instance to disconnect from. |
205 * @instance: The instance to disconnect from. |
| 206 * @param signal The name of the signal to disconnect. |
206 * @signal: The name of the signal to disconnect. |
| 207 * @param handle The handle of the receiver. |
207 * @handle: The handle of the receiver. |
| 208 * @param func The registered function to disconnect. |
208 * @func: The registered function to disconnect. |
| 209 * |
209 * |
| 210 * @see purple_signal_connect() |
210 * @see purple_signal_connect() |
| 211 */ |
211 */ |
| 212 void purple_signal_disconnect(void *instance, const char *signal, |
212 void purple_signal_disconnect(void *instance, const char *signal, |
| 213 void *handle, PurpleCallback func); |
213 void *handle, PurpleCallback func); |
| 214 |
214 |
| 215 /** |
215 /** |
| 216 * Removes all callbacks associated with a receiver handle. |
216 * Removes all callbacks associated with a receiver handle. |
| 217 * |
217 * |
| 218 * @param handle The receiver handle. |
218 * @handle: The receiver handle. |
| 219 */ |
219 */ |
| 220 void purple_signals_disconnect_by_handle(void *handle); |
220 void purple_signals_disconnect_by_handle(void *handle); |
| 221 |
221 |
| 222 /** |
222 /** |
| 223 * Emits a signal. |
223 * Emits a signal. |
| 224 * |
224 * |
| 225 * @param instance The instance emitting the signal. |
225 * @instance: The instance emitting the signal. |
| 226 * @param signal The signal being emitted. |
226 * @signal: The signal being emitted. |
| 227 * |
227 * |
| 228 * @see purple_signal_connect() |
228 * @see purple_signal_connect() |
| 229 * @see purple_signal_disconnect() |
229 * @see purple_signal_disconnect() |
| 230 */ |
230 */ |
| 231 void purple_signal_emit(void *instance, const char *signal, ...); |
231 void purple_signal_emit(void *instance, const char *signal, ...); |
| 232 |
232 |
| 233 /** |
233 /** |
| 234 * Emits a signal, using a va_list of arguments. |
234 * Emits a signal, using a va_list of arguments. |
| 235 * |
235 * |
| 236 * @param instance The instance emitting the signal. |
236 * @instance: The instance emitting the signal. |
| 237 * @param signal The signal being emitted. |
237 * @signal: The signal being emitted. |
| 238 * @param args The arguments list. |
238 * @args: The arguments list. |
| 239 * |
239 * |
| 240 * @see purple_signal_connect() |
240 * @see purple_signal_connect() |
| 241 * @see purple_signal_disconnect() |
241 * @see purple_signal_disconnect() |
| 242 */ |
242 */ |
| 243 void purple_signal_emit_vargs(void *instance, const char *signal, va_list args); |
243 void purple_signal_emit_vargs(void *instance, const char *signal, va_list args); |
| 246 * Emits a signal and returns the first non-NULL return value. |
246 * Emits a signal and returns the first non-NULL return value. |
| 247 * |
247 * |
| 248 * Further signal handlers are NOT called after a handler returns |
248 * Further signal handlers are NOT called after a handler returns |
| 249 * something other than NULL. |
249 * something other than NULL. |
| 250 * |
250 * |
| 251 * @param instance The instance emitting the signal. |
251 * @instance: The instance emitting the signal. |
| 252 * @param signal The signal being emitted. |
252 * @signal: The signal being emitted. |
| 253 * |
253 * |
| 254 * @return The first non-NULL return value |
254 * Returns: The first non-NULL return value |
| 255 */ |
255 */ |
| 256 void *purple_signal_emit_return_1(void *instance, const char *signal, ...); |
256 void *purple_signal_emit_return_1(void *instance, const char *signal, ...); |
| 257 |
257 |
| 258 /** |
258 /** |
| 259 * Emits a signal and returns the first non-NULL return value. |
259 * Emits a signal and returns the first non-NULL return value. |
| 260 * |
260 * |
| 261 * Further signal handlers are NOT called after a handler returns |
261 * Further signal handlers are NOT called after a handler returns |
| 262 * something other than NULL. |
262 * something other than NULL. |
| 263 * |
263 * |
| 264 * @param instance The instance emitting the signal. |
264 * @instance: The instance emitting the signal. |
| 265 * @param signal The signal being emitted. |
265 * @signal: The signal being emitted. |
| 266 * @param args The arguments list. |
266 * @args: The arguments list. |
| 267 * |
267 * |
| 268 * @return The first non-NULL return value |
268 * Returns: The first non-NULL return value |
| 269 */ |
269 */ |
| 270 void *purple_signal_emit_vargs_return_1(void *instance, const char *signal, |
270 void *purple_signal_emit_vargs_return_1(void *instance, const char *signal, |
| 271 va_list args); |
271 va_list args); |
| 272 |
272 |
| 273 /** |
273 /** |