Glib::Ex::SignalObject -- object for Glib signal connection
use Glib::Ex::SignalObject; $signal = Glib::Ex::SignalObject->new (object => $my_obj, name => 'some-signal', callback => \&my_handler, userdata => 'some data'); $signal->disconnect; # explicit disconnect $signal->connect; # reconnect later $signal->set_connected ($bool); # or control connectedness $signal->set_object ($other_obj); # change origin object $signal->set_name ('diff-signal'); # change signal name $signal = undef; # disconnected by forgetting
Glib::Ex::SignalObject is an object-oriented way to manage a signal connection on a Glib object (including Gtk widgets). It features,
Automatic disconnect by just forgetting the object
Changable origin and name settings to move the connection to somewhere else, including undef to have no connection for a time.
A "connect" state to have a connection not made for a time.
Optional weakening of the userdata to avoid circular references (and disconnect when that target goes away).
Glib::Ex::SignalObject->new (key => value, ...)
Create and return a new signal object. The following parameters are taken in key/value style,
object originating object (Glib::Object etc), or undef name signal name (string), or undef callback handler function to call userdata data passed to the callback function weak_userdata flag to weaken userdata reference connect flag to not immediately connect