From 9ae55ea489e398bcb178a79ef9aec43e99980cdf Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Wed, 9 Oct 2024 22:37:42 -0400 Subject: [PATCH] perf: Only enumerate trash items when necessary Closes: #310 Depends on Byron/trash-rs#120 which implements a function that only checks if the trash is empty or not instead of parsing each item. --- src/tab.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tab.rs b/src/tab.rs index bcc22e5a..00524186 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -204,7 +204,7 @@ pub fn trash_entries() -> usize { } pub fn trash_icon(icon_size: u16) -> widget::icon::Handle { - widget::icon::from_name(if trash_entries() > 0 { + widget::icon::from_name(if !trash::os_limited::is_empty() { "user-trash-full" } else { "user-trash" @@ -214,7 +214,7 @@ pub fn trash_icon(icon_size: u16) -> widget::icon::Handle { } pub fn trash_icon_symbolic(icon_size: u16) -> widget::icon::Handle { - widget::icon::from_name(if trash_entries() > 0 { + widget::icon::from_name(if !trash::os_limited::is_empty() { "user-trash-full-symbolic" } else { "user-trash-symbolic"