Add docs for g_signal_accumulator_true_handled.
[platform/upstream/glib.git] / docs / reference / gobject / tmpl / signals.sgml
1 <!-- ##### SECTION Title ##### -->
2 Signals
3
4 <!-- ##### SECTION Short_Description ##### -->
5 A means for customization of object behaviour and a general purpose notification mechanism
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 The basic concept of the signal system is that of the <emphasis>emission</emphasis>
10 of a signal.
11 Signals are introduced per-type and are identified through strings.
12 Signals introduced for a parent type are available in derived types as well,
13 so basically they are a per-type facility that is inherited.
14 A signal emission mainly involves invocation of a certain set of callbacks in
15 precisely defined manner. There are two main categories of such callbacks,
16 per-object
17         <footnote><para>Although signals can deal with any kind of instantiatable type,
18         i'm referring to those types as "object types" in the following, simply
19         because that is the context most users will encounter signals in.
20         </para></footnote>
21 ones and user provided ones.
22 The per-object callbacks are most often referred to as "object method
23 handler" or "default (signal) handler", while user provided callbacks are
24 usually just called "signal handler".
25 The object method handler is provided at signal creation time (this most
26 frequently happens at the end of an object class' creation), while user
27 provided handlers are frequently connected and disconnected to/from a certain
28 signal on certain object instances.
29 </para>
30 <para>
31 A signal emission consists of five stages, unless prematurely stopped:
32 <variablelist>
33   <varlistentry><term></term><listitem><para>
34         1 - Invocation of the object method handler for %G_SIGNAL_RUN_FIRST signals
35   </para></listitem></varlistentry>
36   <varlistentry><term></term><listitem><para>
37         2 - Invocation of normal user-provided signal handlers (<emphasis>after</emphasis> flag %FALSE)
38   </para></listitem></varlistentry>
39   <varlistentry><term></term><listitem><para>
40         3 - Invocation of the object method handler for %G_SIGNAL_RUN_LAST signals
41   </para></listitem></varlistentry>
42   <varlistentry><term></term><listitem><para>
43         4 - Invocation of user provided signal handlers, connected with an <emphasis>after</emphasis> flag of %TRUE
44   </para></listitem></varlistentry>
45   <varlistentry><term></term><listitem><para>
46         5 - Invocation of the object method handler for %G_SIGNAL_RUN_CLEANUP signals
47   </para></listitem></varlistentry>
48 </variablelist>
49 The user-provided signal handlers are called in the order they were
50 connected in.
51 All handlers may prematurely stop a signal emission, and any number of
52 handlers may be connected, disconnected, blocked or unblocked during
53 a signal emission.
54 There are certain criteria for skipping user handlers in stages 2 and 4
55 of a signal emission.
56 First, user handlers may be <emphasis>blocked</emphasis>, blocked handlers are omitted
57 during callback invocation, to return from the "blocked" state, a
58 handler has to get unblocked exactly the same amount of times
59 it has been blocked before.
60 Second, upon emission of a %G_SIGNAL_DETAILED signal, an additional
61 "detail" argument passed in to g_signal_emit() has to match the detail
62 argument of the signal handler currently subject to invocation.
63 Specification of no detail argument for signal handlers (omission of the
64 detail part of the signal specification upon connection) serves as a
65 wildcard and matches any detail argument passed in to emission.
66 </para>
67
68 <!-- ##### SECTION See_Also ##### -->
69 <para>
70
71 </para>
72
73 <!-- ##### STRUCT GSignalInvocationHint ##### -->
74 <para>
75 The #GSignalInvocationHint structure is used to pass on additional information
76 to callbacks during a signal emission.
77 </para>
78
79 @signal_id:     The signal id of the signal invoking the callback
80 @detail:        The detail passed on for this emission
81 @run_type:      The stage the signal emission is currently in, this
82                 field will contain one of %G_SIGNAL_RUN_FIRST,
83                 %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP.
84
85 <!-- ##### USER_FUNCTION GSignalAccumulator ##### -->
86 <para>
87 The signal accumulator is a special callback function that can be used
88 to collect return values of the various callbacks that are called
89 during a signal emission. The signal accumulator is specified at signal
90 creation time, if it is left %NULL, no accumulation of callback return
91 values is performed. The return value of signal emissions is then the
92 value returned by the last callback.
93 </para>
94
95 @ihint:         Signal invocation hint, see #GSignalInvocationHint.
96 @return_accu:   Accumulator to collect callback return values in, this
97                 is the return value of the current signal emission.
98 @handler_return: 
99 @data: 
100 @Returns:       The accumulator function returns whether the signal emission
101                 should be aborted. Returning %FALSE means to abort the
102                 current emission and %TRUE is returned for continuation.
103
104
105 <!-- ##### TYPEDEF GSignalCMarshaller ##### -->
106 <para>
107 This is the signature of marshaller functions, required to marshall
108 arrays of parameter values to signal emissions into C language callback
109 invocations. It is merely an alias to #GClosureMarshal since the #GClosure
110 mechanism takes over responsibility of actual function invocation for the
111 signal system.
112 </para>
113
114
115 <!-- ##### USER_FUNCTION GSignalEmissionHook ##### -->
116 <para>
117 A simple function pointer to get invoked when the signal is emitted. This 
118 allows you to tie a hook to the signal type, so that it will trap all 
119 emissions of that signal, from any object.
120 </para>
121 <para>
122 You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag.
123 </para>
124
125 @ihint: Signal invocation hint, see #GSignalInvocationHint.
126 @n_param_values: the number of parameters to the function, including
127                  the instance on which the signal was emitted.
128 @param_values: the instance on which the signal was emitted, followed by the 
129                parameters of the emission.
130 @data: user data associated with the hook.
131 @Returns: whether it wants to stay connected. If it returns %FALSE, the signal 
132           hook is disconnected (and destroyed).
133
134
135 <!-- ##### ENUM GSignalFlags ##### -->
136 <para>
137 The signal flags are used to specify a signal's behaviour, the overall
138 signal description outlines how especially the RUN flags control the
139 stages of a signal emission.
140 </para>
141
142 @G_SIGNAL_RUN_FIRST:   Invoke the object method handler in the first emission stage.
143 @G_SIGNAL_RUN_LAST:    Invoke the object method handler in the third emission stage.
144 @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage.
145 @G_SIGNAL_NO_RECURSE:  Signals being emitted for an object while currently being in
146                        emission for this very object will not be emitted recursively,
147                        but instead cause the first emission to be restarted.
148 @G_SIGNAL_DETAILED:    This signal supports "::detail" appendixes to the signal name
149                        upon handler connections and emissions.
150 @G_SIGNAL_ACTION:      Action signals are signals that may freely be emitted on alive
151                        objects from user code via g_signal_emit() and friends, without
152                        the need of being embedded into extra code that performs pre or
153                        post emission adjustments on the object. They can also be thought
154                        of as by third-party code generically callable object methods.
155 @G_SIGNAL_NO_HOOKS:    No emissions hooks are supported for this signal.
156
157 <!-- ##### ENUM GSignalMatchType ##### -->
158 <para>
159 The match types specify what g_signal_handlers_block_matched(),
160 g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
161 match signals by.
162 </para>
163
164 @G_SIGNAL_MATCH_ID: The signal id must be equal.
165 @G_SIGNAL_MATCH_DETAIL: The signal detail be equal.
166 @G_SIGNAL_MATCH_CLOSURE: The closure must be the same.
167 @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same.
168 @G_SIGNAL_MATCH_DATA: The closure data must be the same.
169 @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may matched.
170
171 <!-- ##### STRUCT GSignalQuery ##### -->
172 <para>
173 A structure holding in-depth information for a specific signal. It is
174 filled in by the g_signal_query() function.
175 </para>
176
177 @signal_id:     The signal id of the signal being queried, or 0 if the
178                 signal to be queried was unknown.
179 @signal_name:   The signal name.
180 @itype:         The interface/instance type that this signal can be emitted for.
181 @signal_flags:  The signal flags as passed in to g_signal_new().
182 @return_type:   The return type for user callbacks.
183 @n_params:      The number of parameters that user callbacks take.
184 @param_types:   The individual parameter types for user callbacks, note that the
185                 effective callback signature is:
186 <programlisting>
187 @return_type callback (#gpointer     data1,
188                       [#param_types param_names,]
189                        #gpointer     data2);
190 </programlisting>
191
192 <!-- ##### MACRO G_SIGNAL_TYPE_STATIC_SCOPE ##### -->
193 <para>
194 This macro flags signal argument types for which the signal system may 
195 assume that instances thereof remain persistent across all signal emissions
196 they are used in. This is only useful for non ref-counted, value-copy types.
197 </para>
198 <para>
199 To flag a signal argument in this way, add 
200 <literal>| G_SIGNAL_TYPE_STATIC_SCOPE</literal> to the corresponding argument
201 of g_signal_new().
202 </para>
203 <informalexample>
204 <programlisting>
205     g_signal_new ("size_request",
206                   G_TYPE_FROM_CLASS (gobject_class),
207                   G_SIGNAL_RUN_FIRST,
208                   G_STRUCT_OFFSET (GtkWidgetClass, size_request),
209                   NULL, NULL,
210                   _gtk_marshal_VOID__BOXED,
211                   G_TYPE_NONE, 1,
212                   GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
213 </programlisting>
214 </informalexample>
215
216
217
218 <!-- ##### MACRO G_SIGNAL_MATCH_MASK ##### -->
219 <para>
220
221 </para>
222
223
224
225 <!-- ##### MACRO G_SIGNAL_FLAGS_MASK ##### -->
226 <para>
227
228 </para>
229
230
231
232 <!-- ##### FUNCTION g_signal_new ##### -->
233 <para>
234 Creates a new signal. (This is usually done in the class initializer.)
235 </para>
236 <para>
237 A signal name consists of segments consisting of ASCII letters and
238 digits, separated by either the '-' or '_' character. The first
239 character of a signal name must be a letter. Names which violate these
240 rules lead to undefined behaviour of the GSignal system. 
241 </para>
242 <para>
243 When registering a signal and looking up a signal, either separator can
244 be used, but they cannot be mixed. 
245 </para>
246
247 @signal_name: the name for the signal
248 @itype: the type this signal pertains to. It will also pertain to 
249    types which are derived from this type.
250 @signal_flags: a combination of #GSignalFlags specifying detail of when 
251    the default handler is to be invoked. You should at least specify 
252    %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
253 @class_offset: The offset of the function pointer in the class structure 
254    for this type. Used to invoke a class method generically.
255 @accumulator: the accumulator for this signal; may be %NULL.
256 @accu_data: user data for the @accumulator.
257 @c_marshaller: the function to translate arrays of parameter values to 
258    signal emissions into C language callback invocations.
259 @return_type: the type of return value, or #G_TYPE_NONE for a signal 
260     without a return value.
261 @n_params: the number of parameter types to follow.
262 @Varargs: a list of types, one for each parameter.
263 @Returns: the signal id
264
265
266 <!-- ##### FUNCTION g_signal_newv ##### -->
267 <para>
268 Creates a new signal. (This is usually done in the class initializer.)
269 </para>
270 <para>
271 See g_signal_new() for details on allowed signal names.
272 </para>
273
274 @signal_name: the name for the signal
275 @itype: the type this signal pertains to. It will also pertain to 
276    types which are derived from this type.
277 @signal_flags: a combination of #GSignalFlags specifying detail of when 
278    the default handler is to be invoked. You should at least specify 
279    %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
280 @class_closure: The closure to invoke on signal emission.
281 @accumulator: the accumulator for this signal; may be %NULL.
282 @accu_data: user data for the @accumulator.
283 @c_marshaller: the function to translate arrays of parameter values to 
284     signal emissions into C language callback invocations.
285 @return_type: the type of return value, or #G_TYPE_NONE for a signal 
286     without a return value.
287 @n_params: the length of @param_types.
288 @param_types: an array types, one for each parameter.
289 @Returns: the signal id
290
291
292 <!-- ##### FUNCTION g_signal_new_valist ##### -->
293 <para>
294 Creates a new signal. (This is usually done in the class initializer.)
295 </para>
296 <para>
297 See g_signal_new() for details on allowed signal names.
298 </para>
299
300 @signal_name: the name for the signal
301 @itype: the type this signal pertains to. It will also pertain to 
302    types which are derived from this type.
303 @signal_flags: a combination of #GSignalFlags specifying detail of when 
304    the default handler is to be invoked. You should at least specify 
305    %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
306 @class_closure: The closure to invoke on signal emission.
307 @accumulator: the accumulator for this signal; may be %NULL.
308 @accu_data: user data for the @accumulator.
309 @c_marshaller: the function to translate arrays of parameter values to 
310    signal emissions into C language callback invocations.
311 @return_type: the type of return value, or #G_TYPE_NONE for a signal 
312    without a return value.
313 @n_params: the number of parameter types in @args.
314 @args: va_list of #GType, one for each parameter.
315 @Returns: the signal id
316
317
318 <!-- ##### FUNCTION g_signal_query ##### -->
319 <para>
320 Queries the signal system for in-depth information about a
321 specific signal. This function will fill in a user-provided
322 structure to hold signal-specific information. If an invalid
323 signal id is passed in, the @signal_id member of the #GSignalQuery
324 is 0. All members filled into the #GSignalQuery structure should
325 be considered constant and have to be left untouched.
326 </para>
327
328 @signal_id: The signal id of the signal to query information for.
329 @query: A user provided structure that is filled in with constant
330          values upon success.
331
332
333 <!-- ##### FUNCTION g_signal_lookup ##### -->
334 <para>
335 Given the name of the signal and the type of object it connects to, gets 
336 the signal's identifying integer. Emitting the signal by number is 
337 somewhat faster than using the name each time.
338 </para>
339 <para>
340 Also tries the ancestors of the given type.
341 </para>
342 <para>
343 See g_signal_new() for details on allowed signal names.
344 </para>
345
346 @name: the signal's name.
347 @itype: the type that the signal operates on.
348 @Returns: the signal's identifying number, or 0 if no signal was found.
349
350
351 <!-- ##### FUNCTION g_signal_name ##### -->
352 <para>
353 Given the signal's identifier, finds its name.
354 </para>
355 <para>
356 Two different signals may have the same name, if they have differing types.
357 </para>
358
359 @signal_id: the signal's identifying number.
360 @Returns: the signal name, or %NULL if the signal number was invalid.
361
362
363 <!-- ##### FUNCTION g_signal_list_ids ##### -->
364 <para>
365 Lists the signals by id that a certain instance or interface type
366 created. Further information about the signals can be acquired through
367 g_signal_query().
368 </para>
369
370 @itype: Instance or interface type.
371 @n_ids: Location to store the number of signal ids for @itype.
372 @Returns: Newly allocated array of signal IDs.
373
374
375 <!-- ##### FUNCTION g_signal_emit ##### -->
376 <para>
377 Emits a signal. 
378 </para>
379 <para>
380 Note that g_signal_emit() resets the return value to the default
381 if no handlers are connected, in contrast to g_signal_emitv().
382 </para>
383
384 @instance: the instance the signal is being emitted on.
385 @signal_id: the signal id
386 @detail: the detail
387 @Varargs: parameters to be passed to the signal, followed by a
388            location for the return value. If the return type of the signal
389            is #G_TYPE_NONE, the return value location can be omitted.
390
391
392 <!-- ##### FUNCTION g_signal_emit_by_name ##### -->
393 <para>
394 Emits a signal. 
395 </para>
396 <para>
397 Note that g_signal_emit_by_name() resets the return value to the default
398 if no handlers are connected, in contrast to g_signal_emitv().
399 </para>
400
401 @instance: the instance the signal is being emitted on.
402 @detailed_signal: a string of the form "signal-name::detail".
403 @Varargs: parameters to be passed to the signal, followed by a
404           location for the return value. If the return type of the signal
405           is #G_TYPE_NONE, the return value location can be omitted.
406
407
408 <!-- ##### FUNCTION g_signal_emitv ##### -->
409 <para>
410 Emits a signal. 
411 </para>
412 <para>
413 Note that g_signal_emitv() doesn't change @return_value if no handlers are
414 connected, in contrast to g_signal_emit() and g_signal_emit_valist().
415 </para>
416
417 @instance_and_params: argument list for the signal emission. The first 
418      element in the array is a #GValue for the instance the signal is 
419      being emitted on. The rest are any arguments to be passed to the 
420      signal.
421 @signal_id: the signal id
422 @detail: the detail
423 @return_value: Location to store the return value of the signal emission.
424
425
426 <!-- ##### FUNCTION g_signal_emit_valist ##### -->
427 <para>
428 Emits a signal. 
429 </para>
430 <para>
431 Note that g_signal_emit_valist() resets the return value to the default
432 if no handlers are connected, in contrast to g_signal_emitv().
433 </para>
434
435 @instance: the instance the signal is being emitted on.
436 @signal_id: the signal id
437 @detail: the detail
438 @var_args: a list of parameters to be passed to the signal, followed by a
439            location for the return value. If the return type of the signal
440            is #G_TYPE_NONE, the return value location can be omitted.
441
442
443 <!-- ##### MACRO g_signal_connect ##### -->
444 <para>
445 Connects a #GCallback function to a signal for a particular object.
446 </para>
447 <para>
448 The handler will be called before the default handler of the signal.
449 </para>
450
451 @instance: the instance to connect to.
452 @detailed_signal: a string of the form "signal-name::detail".
453 @c_handler: the #GCallback to connect.
454 @data: data to pass to @c_handler calls.
455 @Returns: the handler id
456
457
458 <!-- ##### MACRO g_signal_connect_after ##### -->
459 <para>
460 Connects a #GCallback function to a signal for a particular object.
461 </para>
462 <para>
463 The handler will be called after the default handler of the signal.
464 </para>
465
466 @instance: the instance to connect to.
467 @detailed_signal: a string of the form "signal-name::detail".
468 @c_handler: the #GCallback to connect.
469 @data: data to pass to @c_handler calls.
470 @Returns: the handler id
471
472
473 <!-- ##### MACRO g_signal_connect_swapped ##### -->
474 <para>
475 Connects a #GCallback function to a signal for a particular object.
476 </para>
477 <para>
478 The instance on which the signal is emitted and @data will be swapped when 
479 calling the handler.
480 </para>
481
482 @instance: the instance to connect to.
483 @detailed_signal: a string of the form "signal-name::detail".
484 @c_handler: the #GCallback to connect.
485 @data: data to pass to @c_handler calls.
486 @Returns: the handler id
487
488
489 <!-- ##### FUNCTION g_signal_connect_object ##### -->
490 <para>
491  This is similar to g_signal_connect_data(), but uses a closure which
492  ensures that the object stays alive during the call to @c_handler.
493 </para>
494
495 @instance: the instance to connect to.
496 @detailed_signal: a string of the form "signal-name::detail".
497 @c_handler: the #GCallback to connect.
498 @gobject: the object to pass as data to @c_handler.
499 @connect_flags: a combination of #GConnnectFlags.
500 @Returns: the handler id.
501
502
503 <!-- ##### ENUM GConnectFlags ##### -->
504 <para>
505 The connection flags are used to specify the behaviour of a signal's 
506 connection.
507 </para>
508
509 @G_CONNECT_AFTER: whether the handler should be called before or after the 
510                   default handler of the signal.
511 @G_CONNECT_SWAPPED: whether the instance and data should be swapped when
512                   calling the handler.
513
514 <!-- ##### FUNCTION g_signal_connect_data ##### -->
515 <para>
516 Connects a #GCallback function to a signal for a particular object.
517 </para>
518
519 @instance: the instance to connect to.
520 @detailed_signal: a string of the form "signal-name::detail".
521 @c_handler: the #GCallback to connect.
522 @data: data to pass to @c_handler calls.
523 @destroy_data: a #GDestroyNotify for @data.
524 @connect_flags: a combination of #GConnectFlags.
525 @Returns: the handler id
526
527
528 <!-- ##### FUNCTION g_signal_connect_closure ##### -->
529 <para>
530 Connects a closure to a signal for a particular object.
531 </para>
532
533 @instance: the instance to connect to.
534 @detailed_signal: a string of the form "signal-name::detail".
535 @closure: the closure to connect.
536 @after: whether the handler should be called before or after the 
537         default handler of the signal.
538 @Returns: the handler id
539
540
541 <!-- ##### FUNCTION g_signal_connect_closure_by_id ##### -->
542 <para>
543 Connects a closure to a signal for a particular object.
544 </para>
545
546 @instance: the instance to connect to.
547 @signal_id: the id of the signal.
548 @detail: the detail.
549 @closure: the closure to connect.
550 @after: whether the handler should be called before or after the 
551         default handler of the signal.
552 @Returns: the handler id
553
554
555 <!-- ##### FUNCTION g_signal_handler_block ##### -->
556 <para>
557 Blocks a handler of an instance so it will not be called during 
558 any signal emissions unless it is unblocked again. Thus "blocking" 
559 a signal handler means to temporarily deactive it, a signal handler 
560 has to be unblocked exactly the same amount of times it has been 
561 blocked before to become active again.
562 </para>
563 <para>
564 The @handler_id has to be a valid signal handler id, connected to a 
565 signal of @instance.
566 </para>
567
568 @instance: The instance to block the signal handler of.
569 @handler_id: Handler id of the handler to be blocked.
570
571
572 <!-- ##### FUNCTION g_signal_handler_unblock ##### -->
573 <para>
574 Undoes the effect of a previous g_signal_handler_block() call. 
575 A blocked handler is skipped during signal emissions and will not be 
576 invoked, unblocking it (for exactly the amount of times it has been 
577 blocked before) reverts its "blocked" state, so the handler will be 
578 recognized by the signal system and is called upon future or currently
579 ongoing signal emissions (since the order in which handlers are
580 called during signal emissions is deterministic, whether the
581 unblocked handler in question is called as part of a currently
582 ongoing emission depends on how far that emission has proceeded
583 yet).
584 </para>
585 <para>
586 The @handler_id has to be a valid id of a signal handler that is 
587 connected to a signal of @instance and is currently blocked.
588 </para>
589
590 @instance: The instance to unblock the signal handler of.
591 @handler_id: Handler id of the handler to be unblocked.
592
593
594 <!-- ##### FUNCTION g_signal_handler_disconnect ##### -->
595 <para>
596 Disconnects a handler from an instance so it will not be called during 
597 any future or currently ongoing emissions of the signal it has been 
598 connected to. The @handler_id becomes invalid and may be reused.
599 </para>
600 <para>
601 The @handler_id has to be a valid signal handler id, connected to a 
602 signal of @instance.
603 </para>
604
605 @instance: The instance to remove the signal handler from.
606 @handler_id: Handler id of the handler to be disconnected.
607
608
609 <!-- ##### FUNCTION g_signal_handler_find ##### -->
610 <para>
611 Finds the first signal handler that matches certain selection criteria.
612 The criteria mask is passed as an OR-ed combination of #GSignalMatchType
613 flags, and the criteria values are passed as arguments.
614 The match @mask has to be non-0 for successful matches.
615 If no handler was found, 0 is returned.
616 </para>
617
618 @instance: The instance owning the signal handler to be found.
619 @mask: Mask indicating which of @signal_id, @detail, @closure, @func 
620        and/or @data the handler has to match.
621 @signal_id: Signal the handler has to be connected to.
622 @detail: Signal detail the handler has to be connected to.
623 @closure: The closure the handler will invoke.
624 @func: The C closure callback of the handler (useless for non-C closures).
625 @data: The closure data of the handler's closure.
626 @Returns: A valid non-0 signal handler id for a successful match.
627
628
629 <!-- ##### FUNCTION g_signal_handlers_block_matched ##### -->
630 <para>
631 Blocks all handlers on an instance that match a certain selection criteria.
632 The criteria mask is passed as an OR-ed combination of #GSignalMatchType 
633 flags, and the criteria values are passed as arguments.
634 Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
635 or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
636 If no handlers were found, 0 is returned, the number of blocked handlers
637 otherwise.
638 </para>
639
640 @instance: The instance to block handlers from.
641 @mask: Mask indicating which of @signal_id, @detail, @closure, @func 
642        and/or @data the handlers have to match.
643 @signal_id: Signal the handlers have to be connected to.
644 @detail: Signal detail the handlers have to be connected to.
645 @closure: The closure the handlers will invoke.
646 @func: The C closure callback of the handlers (useless for non-C closures).
647 @data: The closure data of the handlers' closures.
648 @Returns: The amount of handlers that got blocked.
649
650
651 <!-- ##### FUNCTION g_signal_handlers_unblock_matched ##### -->
652 <para>
653 Unblocks all handlers on an instance that match a certain selection
654 criteria. The criteria mask is passed as an OR-ed combination of
655 #GSignalMatchType flags, and the criteria values are passed as arguments.
656 Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
657 or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
658 If no handlers were found, 0 is returned, the number of unblocked handlers
659 otherwise. The match criteria should not apply to any handlers that are
660 not currently blocked.
661 </para>
662
663 @instance: The instance to unblock handlers from.
664 @mask: Mask indicating which of @signal_id, @detail, @closure, @func 
665        and/or @data the handlers have to match.
666 @signal_id: Signal the handlers have to be connected to.
667 @detail: Signal detail the handlers have to be connected to.
668 @closure: The closure the handlers will invoke.
669 @func: The C closure callback of the handlers (useless for non-C closures).
670 @data: The closure data of the handlers' closures.
671 @Returns: The amount of handlers that got unblocked.
672
673
674 <!-- ##### FUNCTION g_signal_handlers_disconnect_matched ##### -->
675 <para>
676 Disconnects all handlers on an instance that match a certain selection 
677 criteria. The criteria mask is passed as an OR-ed combination of
678 #GSignalMatchType flags, and the criteria values are passed as arguments.
679 Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
680 or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
681 If no handlers were found, 0 is returned, the number of disconnected 
682 handlers otherwise.
683 </para>
684
685 @instance: The instance to remove handlers from.
686 @mask: Mask indicating which of @signal_id, @detail, @closure, @func 
687        and/or @data the handlers have to match.
688 @signal_id: Signal the handlers have to be connected to.
689 @detail: Signal detail the handlers have to be connected to.
690 @closure: The closure the handlers will invoke.
691 @func: The C closure callback of the handlers (useless for non-C closures).
692 @data: The closure data of the handlers' closures.
693 @Returns: The amount of handlers that got disconnected.
694
695
696 <!-- ##### FUNCTION g_signal_handler_is_connected ##### -->
697 <para>
698 Returns whether @handler_id is the id of a handler connected to @instance.
699 </para>
700
701 @instance: The instance where a signal handler is sought.
702 @handler_id: the handler id.
703 @Returns: whether @handler_id identifies a handler connected to @instance.
704
705
706 <!-- ##### MACRO g_signal_handlers_block_by_func ##### -->
707 <para>
708 Blocks all handlers on an instance that match @func and @data.
709 </para>
710
711 @instance: The instance to block handlers from.
712 @func: The C closure callback of the handlers (useless for non-C closures).
713 @data: The closure data of the handlers' closures.
714 @Returns: The number of handlers that got blocked.
715
716
717 <!-- ##### MACRO g_signal_handlers_unblock_by_func ##### -->
718 <para>
719 Unblocks all handlers on an instance that match @func and @data.
720 </para>
721
722 @instance: The instance to unblock handlers from.
723 @func: The C closure callback of the handlers (useless for non-C closures).
724 @data: The closure data of the handlers' closures.
725 @Returns: The number of handlers that got unblocked.
726
727
728 <!-- ##### MACRO g_signal_handlers_disconnect_by_func ##### -->
729 <para>
730 Disconnects all handlers on an instance that match @func and @data.
731 </para>
732
733 @instance: The instance to remove handlers from.
734 @func: The C closure callback of the handlers (useless for non-C closures).
735 @data: The closure data of the handlers' closures.
736 @Returns: The number of handlers that got disconnected.
737
738
739 <!-- ##### FUNCTION g_signal_has_handler_pending ##### -->
740 <para>
741 Returns whether there are any handlers connected to @instance for the
742 given signal id and detail.
743 </para>
744 <para>
745 One example of when you might use this is when the arguments to the 
746 signal are difficult to compute. A class implementor may opt to not emit 
747 the signal if no one is attached anyway, thus saving the cost of building
748 the arguments.
749 </para>
750
751 @instance: the object whose signal handlers are sought.
752 @signal_id: the signal id.
753 @detail: the detail.
754 @may_be_blocked: whether blocked handlers should count as match.
755 @Returns: %TRUE if a handler is connected to the signal, 
756           %FALSE otherwise.
757
758
759 <!-- ##### FUNCTION g_signal_stop_emission ##### -->
760 <para>
761 Stops a signal's current emission.
762 </para>
763 <para>
764 This will prevent the default method from running, if the signal was
765 %G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after" 
766 flag).
767 </para>
768 <para>
769 Prints a warning if used on a signal which isn't being emitted.
770 </para>
771
772 @instance: the object whose signal handlers you wish to stop.
773 @signal_id: the signal identifier, as returned by g_signal_lookup().
774 @detail: the detail which the signal was emitted with.
775
776
777 <!-- ##### FUNCTION g_signal_stop_emission_by_name ##### -->
778 <para>
779 Stops a signal's current emission.
780 </para>
781 <para>
782 This is just like g_signal_stop_emission() except it will look up the 
783 signal id for you.
784 </para>
785
786 @instance: the object whose signal handlers you wish to stop.
787 @detailed_signal: a string of the form "signal-name::detail".
788
789
790 <!-- ##### FUNCTION g_signal_override_class_closure ##### -->
791 <para>
792 Overrides the class closure (i.e. the default handler) for the given signal
793 for emissions on instances of @instance_type. @instance_type must be derived
794 from the type to which the signal belongs.
795 </para>
796
797 @signal_id: the signal id
798 @instance_type: the instance type on which to override the class closure 
799                 for the signal.
800 @class_closure: the closure.
801
802
803 <!-- ##### FUNCTION g_signal_chain_from_overridden ##### -->
804 <para>
805 Calls the original class closure of a signal. This function should only
806 be called from an overridden class closure; see 
807 g_signal_override_class_closure().
808 </para>
809
810 @instance_and_params:  the argument list of the signal emission. The first 
811   element in the array is a #GValue for the instance the signal is being 
812   emitted on. The rest are any arguments to be passed to the signal.
813 @return_value: Location for the return value.
814
815
816 <!-- ##### FUNCTION g_signal_add_emission_hook ##### -->
817 <para>
818 Adds an emission hook for a signal, which will get called for any emission
819 of that signal, independent of the instance.
820 </para>
821
822 @signal_id: the signal identifier, as returned by g_signal_lookup().
823 @detail: the detail on which to call the hook.
824 @hook_func: a #GSignalEmissionHook function.
825 @hook_data: user data for @hook_func.
826 @data_destroy: a #GDestroyNotify for @hook_data.
827 @Returns: the hook id, for later use with g_signal_remove_emission_hook().
828
829
830 <!-- ##### FUNCTION g_signal_remove_emission_hook ##### -->
831 <para>
832 Deletes an emission hook.
833 </para>
834
835 @signal_id: the id of the signal
836 @hook_id: the id of the emission hook, as returned by 
837 g_signal_add_emission_hook()
838
839
840 <!-- ##### FUNCTION g_signal_parse_name ##### -->
841 <para>
842 Internal function to parse a signal name into its @signal_id
843 and @detail quark.
844 </para>
845
846 @detailed_signal: a string of the form "signal-name::detail".
847 @itype: The interface/instance type that introduced "signal-name".
848 @signal_id_p: Location to store the signal id.
849 @detail_p: Location to store the detail quark.
850 @force_detail_quark: %TRUE forces creation of a #GQuark for the detail.
851 @Returns: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
852
853
854 <!-- ##### FUNCTION g_signal_get_invocation_hint ##### -->
855 <para>
856 Returns the invocation hint of the innermost signal emission of instance. 
857 </para>
858
859 @instance: the instance to query
860 @Returns: the invocation hint of the innermost signal emission.
861
862
863 <!-- ##### FUNCTION g_signal_type_cclosure_new ##### -->
864 <para>
865
866 </para>
867
868 @itype: 
869 @struct_offset: 
870 @Returns: 
871
872
873 <!-- ##### FUNCTION g_signal_accumulator_true_handled ##### -->
874 <para>
875 A predefined #GSignalAccumulator for signals that return a
876 boolean values. The behavior that this accumulator gives is
877 that a return of %TRUE stops the signal emission: no further
878 callbacks will be invokced, while a return of %FALSE allows
879 the emission to coninue. The idea here is that a %TRUE return
880 indicates that the callback <emphasis>handled</emphasis> the signal,
881 and no further handling is needed.
882 </para>
883
884 @ihint: standard #GSignalAccumulator parameter
885 @return_accu: standard #GSignalAccumulator parameter
886 @handler_return: standard #GSignalAccumulator parameter
887 @dummy: standard #GSignalAccumulator parameter
888 @Returns: standard #GSignalAccumulator result
889
890