Dazzle.SignalGroup

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

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (target_type)

block ()

connect_data (detailed_signal, c_handler, data, flags)

connect_swapped (detailed_signal, c_handler, *data)

get_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 the target instance of self is set to a new GObject.Object.

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 Dazzle.SignalGroup(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dazzle.SignalGroupClass

Dazzle.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 Gtk.TextView and Gtk.TextBuffer. Often times, you’ll need to connect to many signals on Gtk.TextBuffer from a Gtk.TextView subclass. This allows you to create a signal group during instance construction, simply bind the Gtk.TextView :buffer property to Dazzle.SignalGroup :target and connect all the signals you need. When the Gtk.TextView :buffer property changes all of the signals will be transitioned correctly.

classmethod new(target_type)
Parameters:

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

Returns:

a new Dazzle.SignalGroup

Return type:

Dazzle.SignalGroup

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

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.

See: GObject.signal_handler_block().

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

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

See: g_signal_connect_data().

connect_swapped(detailed_signal, c_handler, *data)
Parameters:

Connects callback 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 callback.

See: g_signal_connect_swapped().

get_target()
Returns:

The target instance.

Return type:

GObject.Object or None

Gets the target instance used when connecting signals.

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 dzl_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.

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.

See: GObject.signal_handler_unblock().

Signal Details

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

bind

Flags:

RUN_LAST

Parameters:

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 target of self is non-None.

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

unbind

Flags:

RUN_LAST

Parameters:

signal_group (Dazzle.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.

Property Details

Dazzle.SignalGroup.props.target
Name:

target

Type:

GObject.Object

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The target instance used when connecting signals.

Dazzle.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.