gtk4-rs icon indicating copy to clipboard operation
gtk4-rs copied to clipboard

[HELP] Examples to use `block_signal` and `unblock_signal`

Open Doublonmousse opened this issue 1 year ago • 0 comments

The two fonctions block_signal and unblock_signal don't have examples and I can't seem to find any way to use them because of SignalHandlerId not implementing Clone.

I'd want to setup a spinbutton with a connect_value_changed signal handler and block/unblock this signal when changing the value programmatically to distinguish this from user input (and makind it easier to not have issues related to additional signals being triggered).

But adding custom methods (like a block and unblock)in my template won't work even using a RefCell from this lack of Clone. I failed to do the "take the Signal handler id -> convert to c_ulong -> reconstruct the signal handler ID" as well. But at this point it's more of a hacky workaround than anything else.

Doublonmousse avatar Aug 04 '24 09:08 Doublonmousse