1.29 <GSignalGroup>

Class: <GSignalGroup>

It derives from <GObject>.

<GSignalGroup> manages a collection of signals on a <GObject>.

<GSignalGroup> simplifies the process of connecting many signals to a <GObject> 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 text-view:buffer property to signal-group:target and connect all the signals you need. When the text-view:buffer property changes all of the signals will be transitioned correctly.

Properties

Property: signal-group:target self

The target instance used when connecting signals.

Its value is a <GObject>, or #f.

Set it with (set! (signal-group:target self) value).

Property: signal-group:target-type self

The GType of the target property.

Its value is a class, or a GType number.

It can only be set when the object is made, with #:target-type.

Procedures

Method: signal-group:block self
Method: block self

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.

self

Passed: a <GSignalGroup>.

the <GSignalGroup>

Method: signal-group:connect-closure self detailed-signal closure after
Method: connect-closure self detailed-signal closure after

Connects closure to the signal detailed-signal on signal-group:target.

You cannot connect a signal handler after signal-group:target has been set.

self

Passed: a <GSignalGroup>.

a <GSignalGroup>

detailed-signal

Passed: a string.

a string of the form signal-name with optional ::signal-detail

closure

Passed: a <GClosure>.

the closure to connect.

after

Passed: a boolean.

whether the handler should be called before or after the default handler of the signal.

Method: signal-group:connect-data self detailed-signal c-handler flags
Method: connect-data self detailed-signal c-handler flags

Connects c-handler to the signal detailed-signal on the target instance of self.

You cannot connect a signal handler after signal-group:target has been set.

self

Passed: a <GSignalGroup>.

a <GSignalGroup>

detailed-signal

Passed: a string.

a string of the form "signal-name::detail"

c-handler

Passed: a procedure.

the GCallback to connect

See GCallback for how it is called.

flags

Passed: a <%GConnectFlags>, or a list of its symbols, or one of them.

the flags used to create the signal connection

data

Not passed: guile-gi supplies it.

the data to pass to c-handler calls

notify

Not passed: guile-gi supplies it.

function to be called when disposing of self

See GClosureNotify for how it is called.

Method: signal-group:connect-swapped self detailed-signal c-handler
Method: connect-swapped self detailed-signal c-handler

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 signal-group:target has been set.

self

Passed: a <GSignalGroup>.

a <GSignalGroup>

detailed-signal

Passed: a string.

a string of the form "signal-name::detail"

c-handler

Passed: a procedure.

the GCallback to connect

See GCallback for how it is called.

data

Not passed: guile-gi supplies it.

the data to pass to c-handler calls

Method: signal-group:dup-target self ⇒ %return
Method: dup-target self ⇒ %return

Gets the target instance used when connecting signals.

self

Passed: a <GSignalGroup>.

the <GSignalGroup>

%return

Returned: a <GObject>, or #f.

The target instance

Procedure: signal-group:new target-type ⇒ %return

Creates a new <GSignalGroup> for target instances of target-type.

target-type

Passed: a class, or a GType number.

the GType of the target instance.

%return

Returned: a <GSignalGroup>.

a new <GSignalGroup>

Method: signal-group:set-target self [target]
Method: set-target self [target]

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.

self

Passed: a <GSignalGroup>.

the <GSignalGroup>.

target

Passed, or left out: a <GObject>, or #f.

The target instance used when connecting signals.

Method: signal-group:unblock self
Method: unblock self

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.

self

Passed: a <GSignalGroup>.

the <GSignalGroup>

Signals

Signal: signal-group:bind

Connect a handler with (connect object signal-group:bind handler). It is called as (handler self instance).

This signal is emitted when signal-group:target is set to a new value other than #f. It is similar to object:notify on target except it will not emit when signal-group:target is #f and also allows for receiving the <GObject> without a data-race.

self

Passed: a <GSignalGroup>.

instance

Passed: a <GObject>.

a <GObject> containing the new value for signal-group:target

Signal: signal-group:unbind

Connect a handler with (connect object signal-group:unbind handler). It is called as (handler self).

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

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

self

Passed: a <GSignalGroup>.