January 2018
Beginner to intermediate
454 pages
10h 8m
English
Let's talk more about this second parameter. It could be used to send data to the widget when we create it. Remember when we called run():
App::run(()).unwrap();
Here, we specified () as the model parameter because we don't need one. But we could have used a different value, such as 42, and this value would have been received in the second parameter of the model() method.
We're now ready to create the view:
use gtk;
use gtk::{TreeViewExt, WidgetExt};
use relm::Widget;
use relm_attributes::widget;
#[widget]
impl Widget for Playlist {
// …
view! {
#[name="treeview"]
gtk::TreeView {
hexpand: true,
model: &self.model.model,
vexpand: true,
}
}
}
It is really simple: we give it a name and set both the hexpand and vexpand properties ...