Re: Fwd: Re: stopping signals





Gus Koppel <gtk spamkiller bytechase cx> wrote:

dave walters wrote:

> I tried g_signal_handlers_block_by_func() but it
> didn't work either. I think stopping the signal would
> be best but I can't get it to work inside the
> callback.
>
>
You don't need to stop signal emission. Just make your signal handlers
pay attention to a flag variable of your own, like "dont_set_values". If
set the signal handler of your spinbutton should simply return without
fixing any values. The order would basically be:

1. 1st spinbutton handler is being invoked by user changing value.
2. Handler sets flag.
3. Handler changes values of other spinbuttons as needed.
4. Other handlers are invoked but do nothing because of the flag.
5. 1st handler clears flag and exits.

This is infinite recursion avoidance, the easy way.

Yes, this would work. I didn't think of it. I was still trying to get g_signal_handlers_block to work. It would be more straight forward without

the extra logic or global variable.

Thanks for the suggestion!

Walt


Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]