1/* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2000-2001 Red Hat, Inc.
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef __G_SIGNAL_H__
20#define __G_SIGNAL_H__
21
22#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
23#error "Only <glib-object.h> can be included directly."
24#endif
25
26#include <gobject/gclosure.h>
27#include <gobject/gvalue.h>
28#include <gobject/gparam.h>
29#include <gobject/gmarshal.h>
30
31G_BEGIN_DECLS
32
33/* --- typedefs --- */
34typedef struct _GSignalQuery GSignalQuery;
35typedef struct _GSignalInvocationHint GSignalInvocationHint;
36/**
37 * GSignalCMarshaller:
38 *
39 * This is the signature of marshaller functions, required to marshall
40 * arrays of parameter values to signal emissions into C language callback
41 * invocations.
42 *
43 * It is merely an alias to #GClosureMarshal since the #GClosure mechanism
44 * takes over responsibility of actual function invocation for the signal
45 * system.
46 */
47typedef GClosureMarshal GSignalCMarshaller;
48/**
49 * GSignalCVaMarshaller:
50 *
51 * This is the signature of va_list marshaller functions, an optional
52 * marshaller that can be used in some situations to avoid
53 * marshalling the signal argument into GValues.
54 */
55typedef GVaClosureMarshal GSignalCVaMarshaller;
56/**
57 * GSignalEmissionHook:
58 * @ihint: Signal invocation hint, see #GSignalInvocationHint.
59 * @n_param_values: the number of parameters to the function, including
60 * the instance on which the signal was emitted.
61 * @param_values: (array length=n_param_values): the instance on which
62 * the signal was emitted, followed by the parameters of the emission.
63 * @data: user data associated with the hook.
64 *
65 * A simple function pointer to get invoked when the signal is emitted.
66 *
67 * Emission hooks allow you to tie a hook to the signal type, so that it will
68 * trap all emissions of that signal, from any object.
69 *
70 * You may not attach these to signals created with the %G_SIGNAL_NO_HOOKS flag.
71 *
72 * Returns: whether it wants to stay connected. If it returns %FALSE, the signal
73 * hook is disconnected (and destroyed).
74 */
75typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint,
76 guint n_param_values,
77 const GValue *param_values,
78 gpointer data);
79/**
80 * GSignalAccumulator:
81 * @ihint: Signal invocation hint, see #GSignalInvocationHint.
82 * @return_accu: Accumulator to collect callback return values in, this
83 * is the return value of the current signal emission.
84 * @handler_return: A #GValue holding the return value of the signal handler.
85 * @data: Callback data that was specified when creating the signal.
86 *
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.
90 *
91 * The signal accumulator is specified at signal creation time, if it is
92 * left %NULL, no accumulation of callback return values is performed.
93 * The return value of signal emissions is then the value returned by the
94 * last callback.
95 *
96 * Returns: The accumulator function returns whether the signal emission
97 * should be aborted. Returning %TRUE will continue with
98 * the signal emission. Returning %FALSE will abort the current emission.
99 * Since 2.62, returning %FALSE will skip to the CLEANUP stage. In this case,
100 * emission will occur as normal in the CLEANUP stage and the handler's
101 * return value will be accumulated.
102 */
103typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint,
104 GValue *return_accu,
105 const GValue *handler_return,
106 gpointer data);
107
108
109/* --- run, match and connect types --- */
110/**
111 * GSignalFlags:
112 * @G_SIGNAL_RUN_FIRST: Invoke the default signal handler in the first emission stage
113 * @G_SIGNAL_RUN_LAST: Invoke the default signal handler in the third emission stage
114 * @G_SIGNAL_RUN_CLEANUP: Invoke the default signal handler in the last emission stage
115 * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in
116 * emission for this very object will not be emitted recursively,
117 * but instead cause the first emission to be restarted.
118 * @G_SIGNAL_DETAILED: This signal supports `::detail` appendices to the signal name
119 * upon handler connections and emissions.
120 * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive
121 * objects from user code via [func@GObject.signal_emit] and friends, without
122 * the need of being embedded into extra code that performs pre or
123 * post emission adjustments on the object. They can also be thought
124 * of as object methods which can be called generically by
125 * third-party code.
126 * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal.
127 *
128 * The signal flags are used to specify a signal's behaviour.
129 */
130typedef enum
131{
132 G_SIGNAL_RUN_FIRST = 1 << 0,
133 G_SIGNAL_RUN_LAST = 1 << 1,
134 G_SIGNAL_RUN_CLEANUP = 1 << 2,
135 G_SIGNAL_NO_RECURSE = 1 << 3,
136 G_SIGNAL_DETAILED = 1 << 4,
137 G_SIGNAL_ACTION = 1 << 5,
138 G_SIGNAL_NO_HOOKS = 1 << 6,
139 G_SIGNAL_MUST_COLLECT = 1 << 7,
140 G_SIGNAL_DEPRECATED = 1 << 8,
141 /* normal signal flags until 1 << 16 */
142 G_SIGNAL_ACCUMULATOR_FIRST_RUN = 1 << 17,
143} G_GNUC_FLAG_ENUM GSignalFlags;
144
145/**
146 * G_SIGNAL_MUST_COLLECT:
147 *
148 * Varargs signal emission will always collect the arguments, even if there
149 * are no signal handlers connected.
150 *
151 * Since: 2.30
152 */
153
154/**
155 * G_SIGNAL_DEPRECATED:
156 *
157 * The signal is deprecated and will be removed in a future version.
158 *
159 * A warning will be generated if it is connected while running with
160 * `G_ENABLE_DIAGNOSTIC=1`.
161 *
162 * Since: 2.32
163 */
164
165/**
166 * G_SIGNAL_ACCUMULATOR_FIRST_RUN:
167 *
168 * The signal accumulator was invoked for the first time.
169 *
170 * This flag is only used in [callback@GObject.SignalAccumulator][accumulator functions]
171 * for the `run_type` field of the [struct@GObject.SignalInvocationHint], to
172 * mark the first call to the accumulator function for a signal emission.
173 *
174 * Since: 2.68
175 */
176
177/**
178 * G_SIGNAL_FLAGS_MASK:
179 *
180 * A mask for all #GSignalFlags bits.
181 */
182#define G_SIGNAL_FLAGS_MASK 0x1ff
183/**
184 * GConnectFlags:
185 * @G_CONNECT_AFTER: If set, the handler should be called after the
186 * default handler of the signal. Normally, the handler is called before
187 * the default handler.
188 * @G_CONNECT_SWAPPED: If set, the instance and data should be swapped when
189 * calling the handler; see g_signal_connect_swapped() for an example.
190 *
191 * The connection flags are used to specify the behaviour of a signal's
192 * connection.
193 */
194typedef enum
195{
196 /**
197 * G_CONNECT_DEFAULT:
198 *
199 * Default behaviour (no special flags).
200 *
201 * Since: 2.74
202 */
203 G_CONNECT_DEFAULT GOBJECT_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
204 G_CONNECT_AFTER = 1 << 0,
205 G_CONNECT_SWAPPED = 1 << 1
206} G_GNUC_FLAG_ENUM GConnectFlags;
207/**
208 * GSignalMatchType:
209 * @G_SIGNAL_MATCH_ID: The signal id must be equal.
210 * @G_SIGNAL_MATCH_DETAIL: The signal detail must be equal.
211 * @G_SIGNAL_MATCH_CLOSURE: The closure must be the same.
212 * @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same.
213 * @G_SIGNAL_MATCH_DATA: The closure data must be the same.
214 * @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may be matched.
215 *
216 * The match types specify what g_signal_handlers_block_matched(),
217 * g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
218 * match signals by.
219 */
220typedef enum
221{
222 G_SIGNAL_MATCH_ID = 1 << 0,
223 G_SIGNAL_MATCH_DETAIL = 1 << 1,
224 G_SIGNAL_MATCH_CLOSURE = 1 << 2,
225 G_SIGNAL_MATCH_FUNC = 1 << 3,
226 G_SIGNAL_MATCH_DATA = 1 << 4,
227 G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
228} G_GNUC_FLAG_ENUM GSignalMatchType;
229/**
230 * G_SIGNAL_MATCH_MASK:
231 *
232 * A mask for all #GSignalMatchType bits.
233 */
234#define G_SIGNAL_MATCH_MASK 0x3f
235/**
236 * G_SIGNAL_TYPE_STATIC_SCOPE:
237 *
238 * This macro flags signal argument types for which the signal system may
239 * assume that instances thereof remain persistent across all signal emissions
240 * they are used in. This is only useful for non ref-counted, value-copy types.
241 *
242 * To flag a signal argument in this way, add `| G_SIGNAL_TYPE_STATIC_SCOPE`
243 * to the corresponding argument of g_signal_new().
244 * |[
245 * g_signal_new ("size_request",
246 * G_TYPE_FROM_CLASS (gobject_class),
247 * G_SIGNAL_RUN_FIRST,
248 * G_STRUCT_OFFSET (GtkWidgetClass, size_request),
249 * NULL, NULL,
250 * _gtk_marshal_VOID__BOXED,
251 * G_TYPE_NONE, 1,
252 * GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
253 * ]|
254 */
255#define G_SIGNAL_TYPE_STATIC_SCOPE (G_TYPE_FLAG_RESERVED_ID_BIT)
256
257
258/* --- signal information --- */
259/**
260 * GSignalInvocationHint:
261 * @signal_id: The signal id of the signal invoking the callback
262 * @detail: The detail passed on for this emission
263 * @run_type: The stage the signal emission is currently in, this
264 * field will contain one of %G_SIGNAL_RUN_FIRST,
265 * %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP and %G_SIGNAL_ACCUMULATOR_FIRST_RUN.
266 * %G_SIGNAL_ACCUMULATOR_FIRST_RUN is only set for the first run of the accumulator
267 * function for a signal emission.
268 *
269 * The #GSignalInvocationHint structure is used to pass on additional information
270 * to callbacks during a signal emission.
271 */
272struct _GSignalInvocationHint
273{
274 guint signal_id;
275 GQuark detail;
276 GSignalFlags run_type;
277};
278/**
279 * GSignalQuery:
280 * @signal_id: The signal id of the signal being queried, or 0 if the
281 * signal to be queried was unknown.
282 * @signal_name: The signal name.
283 * @itype: The interface/instance type that this signal can be emitted for.
284 * @signal_flags: The signal flags as passed in to g_signal_new().
285 * @return_type: The return type for user callbacks.
286 * @n_params: The number of parameters that user callbacks take.
287 * @param_types: (array length=n_params): The individual parameter types for
288 * user callbacks, note that the effective callback signature is:
289 * |[<!-- language="C" -->
290 * @return_type callback (#gpointer data1,
291 * [param_types param_names,]
292 * gpointer data2);
293 * ]|
294 *
295 * A structure holding in-depth information for a specific signal.
296 *
297 * See also: g_signal_query()
298 */
299struct _GSignalQuery
300{
301 guint signal_id;
302 const gchar *signal_name;
303 GType itype;
304 GSignalFlags signal_flags;
305 GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
306 guint n_params;
307 const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
308};
309
310
311/* --- signals --- */
312GOBJECT_AVAILABLE_IN_ALL
313guint g_signal_newv (const gchar *signal_name,
314 GType itype,
315 GSignalFlags signal_flags,
316 GClosure *class_closure,
317 GSignalAccumulator accumulator,
318 gpointer accu_data,
319 GSignalCMarshaller c_marshaller,
320 GType return_type,
321 guint n_params,
322 GType *param_types);
323GOBJECT_AVAILABLE_IN_ALL
324guint g_signal_new_valist (const gchar *signal_name,
325 GType itype,
326 GSignalFlags signal_flags,
327 GClosure *class_closure,
328 GSignalAccumulator accumulator,
329 gpointer accu_data,
330 GSignalCMarshaller c_marshaller,
331 GType return_type,
332 guint n_params,
333 va_list args);
334GOBJECT_AVAILABLE_IN_ALL
335guint g_signal_new (const gchar *signal_name,
336 GType itype,
337 GSignalFlags signal_flags,
338 guint class_offset,
339 GSignalAccumulator accumulator,
340 gpointer accu_data,
341 GSignalCMarshaller c_marshaller,
342 GType return_type,
343 guint n_params,
344 ...);
345GOBJECT_AVAILABLE_IN_ALL
346guint g_signal_new_class_handler (const gchar *signal_name,
347 GType itype,
348 GSignalFlags signal_flags,
349 GCallback class_handler,
350 GSignalAccumulator accumulator,
351 gpointer accu_data,
352 GSignalCMarshaller c_marshaller,
353 GType return_type,
354 guint n_params,
355 ...);
356GOBJECT_AVAILABLE_IN_ALL
357void g_signal_set_va_marshaller (guint signal_id,
358 GType instance_type,
359 GSignalCVaMarshaller va_marshaller);
360
361GOBJECT_AVAILABLE_IN_ALL
362void g_signal_emitv (const GValue *instance_and_params,
363 guint signal_id,
364 GQuark detail,
365 GValue *return_value);
366GOBJECT_AVAILABLE_IN_ALL
367void g_signal_emit_valist (gpointer instance,
368 guint signal_id,
369 GQuark detail,
370 va_list var_args);
371GOBJECT_AVAILABLE_IN_ALL
372void g_signal_emit (gpointer instance,
373 guint signal_id,
374 GQuark detail,
375 ...);
376GOBJECT_AVAILABLE_IN_ALL
377void g_signal_emit_by_name (gpointer instance,
378 const gchar *detailed_signal,
379 ...);
380GOBJECT_AVAILABLE_IN_ALL
381guint g_signal_lookup (const gchar *name,
382 GType itype);
383GOBJECT_AVAILABLE_IN_ALL
384const gchar * g_signal_name (guint signal_id);
385GOBJECT_AVAILABLE_IN_ALL
386void g_signal_query (guint signal_id,
387 GSignalQuery *query);
388GOBJECT_AVAILABLE_IN_ALL
389guint* g_signal_list_ids (GType itype,
390 guint *n_ids);
391GOBJECT_AVAILABLE_IN_2_66
392gboolean g_signal_is_valid_name (const gchar *name);
393GOBJECT_AVAILABLE_IN_ALL
394gboolean g_signal_parse_name (const gchar *detailed_signal,
395 GType itype,
396 guint *signal_id_p,
397 GQuark *detail_p,
398 gboolean force_detail_quark);
399GOBJECT_AVAILABLE_IN_ALL
400GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance);
401
402
403/* --- signal emissions --- */
404GOBJECT_AVAILABLE_IN_ALL
405void g_signal_stop_emission (gpointer instance,
406 guint signal_id,
407 GQuark detail);
408GOBJECT_AVAILABLE_IN_ALL
409void g_signal_stop_emission_by_name (gpointer instance,
410 const gchar *detailed_signal);
411GOBJECT_AVAILABLE_IN_ALL
412gulong g_signal_add_emission_hook (guint signal_id,
413 GQuark detail,
414 GSignalEmissionHook hook_func,
415 gpointer hook_data,
416 GDestroyNotify data_destroy);
417GOBJECT_AVAILABLE_IN_ALL
418void g_signal_remove_emission_hook (guint signal_id,
419 gulong hook_id);
420
421
422/* --- signal handlers --- */
423GOBJECT_AVAILABLE_IN_ALL
424gboolean g_signal_has_handler_pending (gpointer instance,
425 guint signal_id,
426 GQuark detail,
427 gboolean may_be_blocked);
428GOBJECT_AVAILABLE_IN_ALL
429gulong g_signal_connect_closure_by_id (gpointer instance,
430 guint signal_id,
431 GQuark detail,
432 GClosure *closure,
433 gboolean after);
434GOBJECT_AVAILABLE_IN_ALL
435gulong g_signal_connect_closure (gpointer instance,
436 const gchar *detailed_signal,
437 GClosure *closure,
438 gboolean after);
439GOBJECT_AVAILABLE_IN_ALL
440gulong g_signal_connect_data (gpointer instance,
441 const gchar *detailed_signal,
442 GCallback c_handler,
443 gpointer data,
444 GClosureNotify destroy_data,
445 GConnectFlags connect_flags);
446GOBJECT_AVAILABLE_IN_ALL
447void g_signal_handler_block (gpointer instance,
448 gulong handler_id);
449GOBJECT_AVAILABLE_IN_ALL
450void g_signal_handler_unblock (gpointer instance,
451 gulong handler_id);
452GOBJECT_AVAILABLE_IN_ALL
453void g_signal_handler_disconnect (gpointer instance,
454 gulong handler_id);
455GOBJECT_AVAILABLE_IN_ALL
456gboolean g_signal_handler_is_connected (gpointer instance,
457 gulong handler_id);
458GOBJECT_AVAILABLE_IN_ALL
459gulong g_signal_handler_find (gpointer instance,
460 GSignalMatchType mask,
461 guint signal_id,
462 GQuark detail,
463 GClosure *closure,
464 gpointer func,
465 gpointer data);
466GOBJECT_AVAILABLE_IN_ALL
467guint g_signal_handlers_block_matched (gpointer instance,
468 GSignalMatchType mask,
469 guint signal_id,
470 GQuark detail,
471 GClosure *closure,
472 gpointer func,
473 gpointer data);
474GOBJECT_AVAILABLE_IN_ALL
475guint g_signal_handlers_unblock_matched (gpointer instance,
476 GSignalMatchType mask,
477 guint signal_id,
478 GQuark detail,
479 GClosure *closure,
480 gpointer func,
481 gpointer data);
482GOBJECT_AVAILABLE_IN_ALL
483guint g_signal_handlers_disconnect_matched (gpointer instance,
484 GSignalMatchType mask,
485 guint signal_id,
486 GQuark detail,
487 GClosure *closure,
488 gpointer func,
489 gpointer data);
490
491GOBJECT_AVAILABLE_IN_2_62
492void g_clear_signal_handler (gulong *handler_id_ptr,
493 gpointer instance);
494
495#define g_clear_signal_handler(handler_id_ptr, instance) \
496 G_STMT_START { \
497 gpointer const _instance = (instance); \
498 gulong *const _handler_id_ptr = (handler_id_ptr); \
499 const gulong _handler_id = *_handler_id_ptr; \
500 \
501 if (_handler_id > 0) \
502 { \
503 *_handler_id_ptr = 0; \
504 g_signal_handler_disconnect (_instance, _handler_id); \
505 } \
506 } G_STMT_END \
507 GOBJECT_AVAILABLE_MACRO_IN_2_62
508
509/* --- overriding and chaining --- */
510GOBJECT_AVAILABLE_IN_ALL
511void g_signal_override_class_closure (guint signal_id,
512 GType instance_type,
513 GClosure *class_closure);
514GOBJECT_AVAILABLE_IN_ALL
515void g_signal_override_class_handler (const gchar *signal_name,
516 GType instance_type,
517 GCallback class_handler);
518GOBJECT_AVAILABLE_IN_ALL
519void g_signal_chain_from_overridden (const GValue *instance_and_params,
520 GValue *return_value);
521GOBJECT_AVAILABLE_IN_ALL
522void g_signal_chain_from_overridden_handler (gpointer instance,
523 ...);
524
525
526/* --- convenience --- */
527/**
528 * g_signal_connect:
529 * @instance: the instance to connect to.
530 * @detailed_signal: a string of the form "signal-name::detail".
531 * @c_handler: the #GCallback to connect.
532 * @data: data to pass to @c_handler calls.
533 *
534 * Connects a [type@GObject.Callback] function to a signal for a particular object.
535 *
536 * The handler will be called synchronously, before the default handler of the signal.
537 * [func@GObject.signal_emit] will not return control until all handlers are called.
538 *
539 * See [memory management of signal handlers](signals.html#memory-management-of-signal-handlers) for
540 * details on how to handle the return value and memory management of @data.
541 *
542 * This function cannot fail. If the given signal name doesn’t exist,
543 * a critical warning is emitted. No validation is performed on the
544 * ‘detail’ string when specified in @detailed_signal, other than a
545 * non-empty check.
546 *
547 * Refer to the [signals documentation](signals.html) for more
548 * details.
549 *
550 * Returns: the handler ID, of type `gulong` (always greater than 0)
551 */
552/* Intentionally not using G_CONNECT_DEFAULT here to avoid deprecation
553 * warnings with older GLIB_VERSION_MAX_ALLOWED */
554#define g_signal_connect(instance, detailed_signal, c_handler, data) \
555 g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
556/**
557 * g_signal_connect_after:
558 * @instance: the instance to connect to.
559 * @detailed_signal: a string of the form "signal-name::detail".
560 * @c_handler: the #GCallback to connect.
561 * @data: data to pass to @c_handler calls.
562 *
563 * Connects a #GCallback function to a signal for a particular object.
564 *
565 * The handler will be called synchronously, after the default handler of the signal.
566 *
567 * This function cannot fail. If the given signal name doesn’t exist,
568 * a critical warning is emitted. No validation is performed on the
569 * ‘detail’ string when specified in @detailed_signal, other than a
570 * non-empty check.
571 *
572 * Refer to the [signals documentation](signals.html) for more
573 * details.
574 *
575 * Returns: the handler ID, of type `gulong` (always greater than 0)
576 */
577#define g_signal_connect_after(instance, detailed_signal, c_handler, data) \
578 g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER)
579/**
580 * g_signal_connect_swapped:
581 * @instance: the instance to connect to.
582 * @detailed_signal: a string of the form "signal-name::detail".
583 * @c_handler: the #GCallback to connect.
584 * @data: data to pass to @c_handler calls.
585 *
586 * Connects a #GCallback function to a signal for a particular object.
587 *
588 * The instance on which the signal is emitted and @data will be swapped when
589 * calling the handler. This is useful when calling pre-existing functions to
590 * operate purely on the @data, rather than the @instance: swapping the
591 * parameters avoids the need to write a wrapper function.
592 *
593 * For example, this allows the shorter code:
594 * |[<!-- language="C" -->
595 * g_signal_connect_swapped (button, "clicked",
596 * (GCallback) gtk_widget_hide, other_widget);
597 * ]|
598 *
599 * Rather than the cumbersome:
600 * |[<!-- language="C" -->
601 * static void
602 * button_clicked_cb (GtkButton *button, GtkWidget *other_widget)
603 * {
604 * gtk_widget_hide (other_widget);
605 * }
606 *
607 * ...
608 *
609 * g_signal_connect (button, "clicked",
610 * (GCallback) button_clicked_cb, other_widget);
611 * ]|
612 *
613 * This function cannot fail. If the given signal name doesn’t exist,
614 * a critical warning is emitted. No validation is performed on the
615 * ‘detail’ string when specified in @detailed_signal, other than a
616 * non-empty check.
617 *
618 * Refer to the [signals documentation](signals.html) for more
619 * details.
620 *
621 * Returns: the handler ID, of type `gulong` (always greater than 0)
622 */
623#define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \
624 g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED)
625/**
626 * g_signal_handlers_disconnect_by_func:
627 * @instance: The instance to remove handlers from.
628 * @func: The C closure callback of the handlers (useless for non-C closures).
629 * @data: The closure data of the handlers' closures.
630 *
631 * Disconnects all handlers on an instance that match @func and @data.
632 *
633 * Returns: The number of handlers that matched.
634 */
635#define g_signal_handlers_disconnect_by_func(instance, func, data) \
636 g_signal_handlers_disconnect_matched ((instance), \
637 (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
638 0, 0, NULL, (func), (data))
639
640/**
641 * g_signal_handlers_disconnect_by_data:
642 * @instance: The instance to remove handlers from
643 * @data: the closure data of the handlers' closures
644 *
645 * Disconnects all handlers on an instance that match @data.
646 *
647 * Returns: The number of handlers that matched.
648 *
649 * Since: 2.32
650 */
651#define g_signal_handlers_disconnect_by_data(instance, data) \
652 g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data))
653
654/**
655 * g_signal_handlers_block_by_func:
656 * @instance: The instance to block handlers from.
657 * @func: The C closure callback of the handlers (useless for non-C closures).
658 * @data: The closure data of the handlers' closures.
659 *
660 * Blocks all handlers on an instance that match @func and @data.
661 *
662 * Returns: The number of handlers that matched.
663 */
664#define g_signal_handlers_block_by_func(instance, func, data) \
665 g_signal_handlers_block_matched ((instance), \
666 (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
667 0, 0, NULL, (func), (data))
668/**
669 * g_signal_handlers_unblock_by_func:
670 * @instance: The instance to unblock handlers from.
671 * @func: The C closure callback of the handlers (useless for non-C closures).
672 * @data: The closure data of the handlers' closures.
673 *
674 * Unblocks all handlers on an instance that match @func and @data.
675 *
676 * Returns: The number of handlers that matched.
677 */
678#define g_signal_handlers_unblock_by_func(instance, func, data) \
679 g_signal_handlers_unblock_matched ((instance), \
680 (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
681 0, 0, NULL, (func), (data))
682
683
684GOBJECT_AVAILABLE_IN_ALL
685gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint,
686 GValue *return_accu,
687 const GValue *handler_return,
688 gpointer dummy);
689
690GOBJECT_AVAILABLE_IN_ALL
691gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint,
692 GValue *return_accu,
693 const GValue *handler_return,
694 gpointer dummy);
695
696/*< private >*/
697GOBJECT_AVAILABLE_IN_ALL
698void g_signal_handlers_destroy (gpointer instance);
699void _g_signals_destroy (GType itype);
700
701G_END_DECLS
702
703#endif /* __G_SIGNAL_H__ */
704