Skip to content

Commit

Permalink
style(volumes-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 14c67b0 commit 2acfc28
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/view/volumes_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,21 @@ mod imp {
view::VolumeRow::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 {
obj.imp().filter_stack.set_visible_child_name(
if model.n_items() > 0 || {
!obj.volume_list()
.as_ref()
.is_some_and(model::VolumeList::initialized)
} {
"list"
} else {
"empty"
});
},
);

if removed > 0 {
obj.deselect_hidden_volumes(model.upcast_ref());
Expand Down

0 comments on commit 2acfc28

Please sign in to comment.