Use trash-rs' is_empty more
Fixes two instances where enumerating trash items isn't needed.
This commit is contained in:
parent
3390ef7ea8
commit
35a9bd5347
2 changed files with 9 additions and 9 deletions
16
src/app.rs
16
src/app.rs
|
|
@ -2262,14 +2262,14 @@ impl Application for App {
|
|||
NavMenuAction::RemoveFromSidebar(entity),
|
||||
));
|
||||
}
|
||||
if matches!(location_opt, Some(Location::Trash)) {
|
||||
if tab::trash_entries() > 0 {
|
||||
items.push(cosmic::widget::menu::Item::Button(
|
||||
fl!("empty-trash"),
|
||||
None,
|
||||
NavMenuAction::EmptyTrash,
|
||||
));
|
||||
}
|
||||
if matches!(location_opt, Some(Location::Trash))
|
||||
&& !trash::os_limited::is_empty().unwrap_or(true)
|
||||
{
|
||||
items.push(cosmic::widget::menu::Item::Button(
|
||||
fl!("empty-trash"),
|
||||
None,
|
||||
NavMenuAction::EmptyTrash,
|
||||
));
|
||||
}
|
||||
|
||||
Some(cosmic::widget::menu::items(&HashMap::new(), items))
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ pub fn context_menu<'a>(
|
|||
) => {
|
||||
if selected_trash_only {
|
||||
children.push(menu_item(fl!("open"), Action::Open).into());
|
||||
if tab::trash_entries() > 0 {
|
||||
if !trash::os_limited::is_empty().unwrap_or(true) {
|
||||
children.push(menu_item(fl!("empty-trash"), Action::EmptyTrash).into());
|
||||
}
|
||||
} else if let Some(entry) = selected_desktop_entry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue