Stopping a signal from being called

Gary Kramlich grim at reaperworld.com
Sat Aug 11 11:55:29 EDT 2007


Prekshu Ajmera wrote:
> Basically, I have a function onSwitchPage() which is called when I 
> change the current active tab in the notebook .. To do this I use the 
> signal 'switch-page'. But in the function onSwitchPage() I also remove a 
> page using gtk_notebook_remove_page () which also results in a call to 
> onSwitchPage(). Thus infinite recursion occurs :(
> 
> Prekshu
> 

<snip>

If you're referring to the switch-page signal on the GtkNotebook, you 
can easily block your own handler if you hold onto the signal id, and 
then do something like the following in your callback:

g_signal_handler_block(notebook, signal_id);
gtk_notebook_remove_page(notebook, page);
g_signal_handler_unblock(notebook, signal_id);

You can block the signal entirely, but theres a bit more to that, and 
will probably cause issues that you don't want to happen ;)

-- 
Gary Kramlich <grim at reaperworld.com>




More information about the Devel mailing list