Ross McFarland > Glib-1.043 > GSignal.xs

Download:
Gtk2-Perl/Glib-1.043.tar.gz

Annotate this POD

CPAN RT

New  3
Open  3
View/Report Bugs
Source  

GSignal

void gperl_signal_set_marshaller_for (GType instance_type, char * detailed_signal, GClosureMarshal marshaller)

You need this function only in rare cases, usually as workarounds for bad signal parameter types or to implement writable arguments. Use the given marshaller to marshal all handlers for detailed_signal on instance_type. gperl_signal_connect will look for marshallers registered here, and apply them to the GPerlClosure it creates for the given callback being connected.

Use the helper macros in gperl_marshal.h to help write your marshaller function. That header, which is installed with the Glib module but not #included through gperl.h, includes commentary and examples which you should follow closely to avoid nasty bugs. Use the Source, Luke.

WARNING: Bend over backwards and turn your head around 720 degrees before attempting to write a GPerlClosure marshaller without using the macros in gperl_marshal.h. If you absolutely cannot use those macros, be certain to understand what those macros do so you can get the semantics correct, and keep your code synchronized with them, or you may miss very important bugfixes.

gulong gperl_signal_connect (SV * instance, char * detailed_signal, SV * callback, SV * data, GConnectFlags flags)

The actual workhorse behind GObject::signal_connect, the binding for g_signal_connect, for use from within XS. This creates a GPerlClosure wrapper for the given callback and data, and connects that closure to the signal named detailed_signal on the given GObject instance. This is only good for named signals. flags is the same as for g_signal_connect(). data may be NULL, but callback must not be.

Returns the id of the installed callback.

Emit the signal name on $object. The number and types of additional arguments in ... are determined by the signal; similarly, the presence and type of return value depends on the signal being emitted.

Register callback to be called on each emission of $detailed_signal. Returns an identifier that may be used to remove this handler with $object->signal_handler_disconnect.

Like signal_connect, except that $callback will be run after the default handler.

Like signal_connect, except that $data and $object will be swapped on invocation of $callback.

Chain up to an overridden class closure; it is only valid to call this from a class closure override.

Translation: because of various details in how GObjects are implemented, the way to override a virtual method on a GObject is to provide a new "class closure", or default handler for a signal. This happens when a class is registered with the type system (see Glib::Type::register and Glib::Object::Subclass). When called from inside such an override, this method runs the overridden class closure. This is equivalent to calling $self->SUPER::$method (@_) in normal Perl objects.

syntax highlighting: