Closed DBLouis closed 4 years ago
The connect_blablabla()
functions return the SignalHandlerId
that you can use for this.
Ok but this kind of a vicious circle because I need the SignalHandlerId in the closure that I connect.
Those things are annoying. You could store it in a Rc<RefCell<Option<SignalHandlerId>>>
outside the closure (or in some other way in your application state), and pass a reference to that into the signal handler closure to get access to it.
I guess there is no other way. Is g_signal_handlers_block_by_func
could be made available eventually?
No as you don't have access to the function parameter you'd pass there. It's a private function specific to the closure you pass in, your closure (but boxed) becomes the user data.
Ok thank you
How would you implement input validation on an entry widget? I found an this example in C and try to do the same in Rust. I am struggling with signal_handler_block and signal_handler_unblock because I don't know how to get the SignalHandlerId.