Skip to content

Commit

Permalink
style(images-panel): Avoid no-result-page on switching connection
Browse files Browse the repository at this point in the history
  • Loading branch information
marhkb committed Oct 12, 2024
1 parent de4b701 commit 7e56680
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/view/images_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,28 @@ mod imp {
view::ImageRow::from(item.downcast_ref().unwrap()).upcast()
});

self.filter_stack
.set_visible_child_name(if model.n_items() > 0 { "list" } else { "empty" });
model.connect_items_changed(clone!(@weak obj => move |model, _, removed, _| {
obj.imp()
.filter_stack
.set_visible_child_name(if model.n_items() > 0 { "list" } else { "empty" });

if removed > 0 {
obj.deselect_hidden_images(model.upcast_ref());
model.connect_items_changed(clone!(
#[weak]
obj,
move |model, _, removed, _| {
obj.imp().filter_stack.set_visible_child_name(
if model.n_items() > 0
|| !obj
.image_list()
.as_ref()
.is_some_and(model::ImageList::initialized)
{
"list"
} else {
"empty"
},
);

if removed > 0 {
obj.deselect_hidden_images(model.upcast_ref());
}
}
}));
));

obj.action_set_enabled(ACTION_DELETE_SELECTION, false);
value.connect_notify_local(
Expand Down

0 comments on commit 7e56680

Please sign in to comment.