GObject.SignalGroup

g GObject.Object GObject.Object GObject.SignalGroup GObject.SignalGroup GObject.Object->GObject.SignalGroup

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (target_type)

block ()

connect_closure (detailed_signal, closure, after)

connect_data (detailed_signal, c_handler, data, flags)

connect_swapped (detailed_signal, c_handler, *data)

dup_target ()

set_target (target)

unblock ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

target

GObject.Object

r/w/en

The target instance used when connecting signals.

target-type

GObject.GType

r/w/co

The GObject.GType of the target property.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

bind

This signal is emitted when GObject.SignalGroup :target is set to a new value other than None.

unbind

This signal is emitted when the target instance of self is set to a new GObject.Object.

Fields

Inherited:

GObject.Object (1)

Class Details

class GObject.SignalGroup(**kwargs)
Bases:

GObject.Object

Abstract:

No

GObject.SignalGroup manages to simplify the process of connecting many signals to a GObject.Object as a group. As such there is no API to disconnect a signal from the group.

In particular, this allows you to:

  • Change the target instance, which automatically causes disconnection of the signals from the old instance and connecting to the new instance.

  • Block and unblock signals as a group

  • Ensuring that blocked state transfers across target instances.

One place you might want to use such a structure is with #GtkTextView and #GtkTextBuffer. Often times, you’ll need to connect to many signals on #GtkTextBuffer from a #GtkTextView subclass. This allows you to create a signal group during instance construction, simply bind the #GtkTextView:buffer property to GObject.SignalGroup :target and connect all the signals you need. When the #GtkTextView:buffer property changes all of the signals will be transitioned correctly.

New in version 2.72.

classmethod new(target_type)
Parameters:

target_type (GObject.GType) – the GObject.GType of the target instance.

Returns:

a new GObject.SignalGroup

Return type:

GObject.SignalGroup

Creates a new GObject.SignalGroup for target instances of target_type.

New in version 2.72.

block()

Blocks all signal handlers managed by self so they will not be called during any signal emissions. Must be unblocked exactly the same number of times it has been blocked to become active again.

This blocked state will be kept across changes of the target instance.

New in version 2.72.

connect_closure(detailed_signal, closure, after)
Parameters:
  • detailed_signal (str) – a string of the form signal-name with optional ::signal-detail

  • closure (GObject.Closure) – the closure to connect.

  • after (bool) – whether the handler should be called before or after the default handler of the signal.

Connects closure to the signal detailed_signal on GObject.SignalGroup :target.

You cannot connect a signal handler after GObject.SignalGroup :target has been set.

New in version 2.74.

connect_data(detailed_signal, c_handler, data, flags)
Parameters:

Connects c_handler to the signal detailed_signal on the target instance of self.

You cannot connect a signal handler after GObject.SignalGroup :target has been set.

New in version 2.72.

connect_swapped(detailed_signal, c_handler, *data)
Parameters:

Connects c_handler to the signal detailed_signal on the target instance of self.

The instance on which the signal is emitted and data will be swapped when calling c_handler.

You cannot connect a signal handler after GObject.SignalGroup :target has been set.

New in version 2.72.

dup_target()
Returns:

The target instance

Return type:

GObject.Object or None

Gets the target instance used when connecting signals.

New in version 2.72.

set_target(target)
Parameters:

target (GObject.Object or None) – The target instance used when connecting signals.

Sets the target instance used when connecting signals. Any signal that has been registered with g_signal_group_connect_object() or similar functions will be connected to this object.

If the target instance was previously set, signals will be disconnected from that object prior to connecting to target.

New in version 2.72.

unblock()

Unblocks all signal handlers managed by self so they will be called again during any signal emissions unless it is blocked again. Must be unblocked exactly the same number of times it has been blocked to become active again.

New in version 2.72.

Signal Details

GObject.SignalGroup.signals.bind(signal_group, instance)
Signal Name:

bind

Flags:

RUN_LAST

Parameters:

This signal is emitted when GObject.SignalGroup :target is set to a new value other than None. It is similar to GObject.Object ::notify on target except it will not emit when GObject.SignalGroup :target is None and also allows for receiving the GObject.Object without a data-race.

New in version 2.72.

GObject.SignalGroup.signals.unbind(signal_group)
Signal Name:

unbind

Flags:

RUN_LAST

Parameters:

signal_group (GObject.SignalGroup) – The object which received the signal

This signal is emitted when the target instance of self is set to a new GObject.Object.

This signal will only be emitted if the previous target of self is non-None.

New in version 2.72.

Property Details

GObject.SignalGroup.props.target
Name:

target

Type:

GObject.Object

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The target instance used when connecting signals.

New in version 2.72.

GObject.SignalGroup.props.target_type
Name:

target-type

Type:

GObject.GType

Default Value:

<GType GObject>

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The GObject.GType of the target property.

New in version 2.72.