Next: , Previous: gnome gobject gclosure, Up: Top

7 (gnome gobject gsignal)

7.1 Overview

GSignal is a mechanism by which code, normally written in C, may expose extension points to which closures can be connected, much like Guile's hooks. Instantiatable types can have signals associated with them; for example, <gtk-widget> has an expose signal that will be “fired” at certain well-documented points.

Signals are typed. They specify the types of their return value, and the types of their arguments.

This module defines routines for introspecting, emitting, connecting to, disconnecting from, blocking, and unblocking signals. Additionally it defines routines to define new signal types on instantiatable types.

7.2 Usage

— Class: <gsignal>

A <gsignal> describes a signal on a <gtype-instance>: its name, and how it should be called.

— Primitive: gtype-class-get-signals class tail

Returns a list of signals belonging to class and all parent types.

— Function: gtype-class-get-signal-names class

Returns a vector of signal names belonging to class and all parent classes.

— Primitive: gtype-instance-signal-emit object name args

— Function: gtype-instance-signal-connect object name func . after?

Connects func as handler for the <gtype-instance> object's signal name.

name should be a symbol. after is boolean specifying whether the handler is run before (#f) or after (#t) the signal's default handler.

Returns an integer number which can be used as arugment of gsignal-handler-block, gsignal-handler-unblock, gsignal-handler-disconnect and gsignal-handler-connected?.

— Function: gtype-instance-signal-connect-after object name func

Convenience function for calling gtype-instance-signal-connect with after = #t.

— Primitive: gsignal-handler-block instance handler_id

— Primitive: gsignal-handler-unblock instance handler_id

— Primitive: gsignal-handler-disconnect instance handler_id

— Primitive: gsignal-handler-connected? instance handler_id

— Function: gtype-class-create-signal class name return-type param-types

Create a new signal associated with the <gtype-class> class.

name should be a symbol, the name of the signal. return-type should be a <gtype-class> object. param-types should be a list of <gtype-class> objects.

In a bit of an odd interface, this function will return a new generic function, which will be run as the signal's default handler, whose default method will silently return an unspecified value. The user may define new methods on this generic to provide alternative default handler implementations.