Skip to content

Commit

Permalink
examples/list_box_model: Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
felinira authored and bilelmoussaoui committed Oct 25, 2024
1 parent 3359452 commit 453237c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions examples/list_box_model/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,13 @@ fn build_ui(application: &gtk::Application) {
// The gtk::ListBoxRow can contain any possible widgets.

let listbox = gtk::ListBox::new();
listbox.bind_model(
Some(&model),
clone!(
#[weak]
window,
#[upgrade_or_panic]
move |item| {
ListBoxRow::new(
item.downcast_ref::<RowData>()
.expect("RowData is of wrong type"),
)
.upcast::<gtk::Widget>()
}
),
);
listbox.bind_model(Some(&model), move |item| {
ListBoxRow::new(
item.downcast_ref::<RowData>()
.expect("RowData is of wrong type"),
)
.upcast::<gtk::Widget>()
});

let scrolled_window = gtk::ScrolledWindow::builder()
.hscrollbar_policy(gtk::PolicyType::Never) // Disable horizontal scrolling
Expand Down

0 comments on commit 453237c

Please sign in to comment.