From 2e84a26f7ee06668b33f9842bedc4177981c9134 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 30 Jan 2024 11:32:47 -0700 Subject: [PATCH] Add location to empty view, reverse sort operations --- src/main.rs | 6 +++--- src/tab.rs | 42 +++++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/main.rs b/src/main.rs index 310c096..3376caf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -385,7 +385,7 @@ impl App { if !self.pending_operations.is_empty() { let mut section = widget::settings::view_section(fl!("pending")); - for (id, (op, progress)) in self.pending_operations.iter() { + for (id, (op, progress)) in self.pending_operations.iter().rev() { section = section.add(widget::column::with_children(vec![ widget::text(format!("{:?}", op)).into(), widget::progress_bar(0.0..=100.0, *progress) @@ -398,7 +398,7 @@ impl App { if !self.failed_operations.is_empty() { let mut section = widget::settings::view_section(fl!("failed")); - for (id, (op, error)) in self.failed_operations.iter() { + for (id, (op, error)) in self.failed_operations.iter().rev() { section = section.add(widget::column::with_children(vec![ widget::text(format!("{:?}", op)).into(), widget::text(error).into(), @@ -409,7 +409,7 @@ impl App { if !self.complete_operations.is_empty() { let mut section = widget::settings::view_section(fl!("complete")); - for (id, op) in self.complete_operations.iter() { + for (id, op) in self.complete_operations.iter().rev() { section = section.add(widget::text(format!("{:?}", op))); } children.push(section.into()); diff --git a/src/tab.rs b/src/tab.rs index 4617711..2b5854b 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -804,26 +804,30 @@ impl Tab { pub fn empty_view(&self, has_hidden: bool, core: &Core) -> Element { let cosmic_theme::Spacing { space_xxs, .. } = core.system_theme().cosmic().spacing; - widget::container( - widget::column::with_children(vec![ - widget::icon::from_name("folder-symbolic") - .size(64) - .icon() + widget::column::with_children(vec![ + self.location_view(core), + widget::container( + widget::column::with_children(vec![ + widget::icon::from_name("folder-symbolic") + .size(64) + .icon() + .into(), + widget::text(if has_hidden { + fl!("empty-folder-hidden") + } else { + fl!("empty-folder") + }) .into(), - widget::text(if has_hidden { - fl!("empty-folder-hidden") - } else { - fl!("empty-folder") - }) - .into(), - ]) - .align_items(Alignment::Center) - .spacing(space_xxs), - ) - .align_x(Horizontal::Center) - .align_y(Vertical::Center) - .width(Length::Fill) - .height(Length::Fill) + ]) + .align_items(Alignment::Center) + .spacing(space_xxs), + ) + .align_x(Horizontal::Center) + .align_y(Vertical::Center) + .width(Length::Fill) + .height(Length::Fill) + .into(), + ]) .into() }