The first method, block(), stops your signal
handler from being invoked until unblock() is called. The last method
lets you disconnect your slot destroying the signal connection. It is
not necessary to disconnect slots at program termination. GTK does this
for you automatically.
Inti::G::Signal's do not have an emit method (compare this with
Inti::Signals which do). This is because most GTK signals are not meant
to be emitted by the user. Rather, they are meant to be emitted by
widget implementations. There will be occasions however when you might
need to emit a signal. To emit a signal call an object's inherited
G::Object::emit_by_name() method:
Signal emission is the process whereby GTK runs
all handlers for a specific object and signal. The return value from a
signal emission is the return value of the last handler executed. Since
event signals are all of type GTK_RUN_LAST, this will be the default
(GTK supplied) handler, unless when connecting your slot you specify
true
for the after parameter. If
after is true your slot is
connected so that it calls the your signal handler after the other
handlers.
The way an event (say "button_press_event") is
handled, is:
- Start with the widget where the event occurred.
- Emit the generic "event" signal. If that signal handler returns a
value of true, stop all processing.
- Otherwise, emit a specific, "button_press_event" signal. If that
returns true, stop all processing.
- Otherwise, go to the widget's parent, and repeat the above two
steps.
- Continue until some signal handler returns true, or
until the top-level widget is reached.