Propagation for connect_activate_link in Rust

I have no problem with that in gtkmm, where I must just return true or false but in Rust this method requires Propagation I don’t understand how to implement

widget.connect_activate_link(|label, uri| {
    // some code
    // -> Propagation
});

Solution: Propagation::Proceed | Propagation::Stop

Link to the docs for more information. An actual enum is used here in the bindings to make the meaning of true and false clearer, which is a common source of confusion.

glib::ControlFlow is another example of the same. Used e.g. in glib::timeout_add() to decide if the callback should be called again in the future or not (G_SOURCE_CONTINUE / G_SOURCE_REMOVE in C terms, which are however not part of an enum but just bool constants).

1 Like