Skip to content

g_signal_handlers_block_by_func with gtk4-rs #2004

Closed Answered by d47081
d47081 asked this question in Q&A
Discussion options

You must be logged in to vote

Well, found the answer in using RefCell with None combination, e.g.

signal_handler_id: Rc<RefCell<Option<SignalHandlerId>>>

then,

use gtk::prelude::ObjectExt;
if let Some(signal_handler_id) =
    signal_handler_id.borrow().as_ref()
{
    request.block_signal(signal_handler_id);
}
request.set_text(
    // change something
);
if let Some(signal_handler_id) =
    signal_handler_id.borrow().as_ref()
{
    request.unblock_signal(signal_handler_id);
}
  • of course signal_handler_id should be captured somewhere outside, depending of app implementation.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by d47081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant