perf: Only enumerate trash items when necessary (#604)

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.
This commit is contained in:
Joshua Megnauth 2025-04-21 15:33:03 -04:00 committed by GitHub
parent 387b364e58
commit bc1b68153b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -289,7 +289,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"
@ -299,7 +299,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"