I want to connect a handler to a custom signal. In my glade file I have a window with some buttons. The window is loaded like this in Rust:
let glade_src = include_str!("views/window.glade");
let builder = gtk::Builder::new_from_string(glade_src);
let window: gtk::ApplicationWindow = builder.get_object("Window").expect("Couldn't get window view");
window.set_application(Some(app));
A button in this window has this signal defined:
<signal name="clicked" handler="_on_start_clicked" swapped="no"/>
In Python I can connect using simple method annotations:
@Gtk.Template.Callback()
def _on_start_clicked(self, sender):
print("start clicked")
But how can I connect a function in Rust to this signal?
AFAIK I don't have such annotations in Rust. I'd need something like window.connect_signal("_on_start_clicked", handler);
I'm using Rust and the gtk crate.