Table of Contents
Let's take another look at the Glib::Object::signal_connect declaration:
unsigned Glib::Object->signal_connect($instance, $name, $func, $data=undef); |
Notice the unsigned integer return value? This is a tag that identifies your callback function. As stated above, you may have as many callbacks per signal and per object as you need, and each will be executed in turn, in the order they were attached.
This tag allows you to remove this callback from the list by using:
Glib::Object->signal_handler_disconnect($instance, $id); |
So, by passing in the widget you wish to remove the handler from, and the tag returned by one of the signal_connect functions, you can disconnect a signal handler.
You can also temporarily disable signal handlers with the Glib::Object::signal_handler_block() and Glib::Object::signal_handler_unblock() family of methods.
Glib::Object->signal_handler_block($instance, $id); Glib::Object->signal_handlers_block_by_func($instance, $func, $data); Glib::Object->signal_handler_unblock($instance, $id); Glib::Object->signal_handlers_unblock_by_func($instance, $func, $data); |