Remove invalid items from desktop mode context menu, part of #547

This commit is contained in:
Jeremy Soller 2024-10-03 13:06:58 -06:00
parent 8615157ec8
commit 08e872a6f1
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 8 additions and 4 deletions

View file

@ -147,7 +147,9 @@ impl Action {
Action::Copy => Message::Copy(entity_opt),
Action::Cut => Message::Cut(entity_opt),
Action::EditHistory => Message::ToggleContextPage(ContextPage::EditHistory),
Action::EditLocation => Message::TabMessage(entity_opt, tab::Message::EditLocationToggle),
Action::EditLocation => {
Message::TabMessage(entity_opt, tab::Message::EditLocationToggle)
}
Action::ExtractHere => Message::ExtractHere(entity_opt),
Action::Gallery => Message::TabMessage(entity_opt, tab::Message::GalleryToggle),
Action::HistoryNext => Message::TabMessage(entity_opt, tab::Message::GoNext),

View file

@ -114,7 +114,7 @@ pub fn context_menu<'a>(
);
}
// All selected items are directories
if selected == selected_dir {
if selected == selected_dir && matches!(tab.mode, tab::Mode::App) {
children.push(menu_item(fl!("open-in-new-tab"), Action::OpenInNewTab).into());
children
.push(menu_item(fl!("open-in-new-window"), Action::OpenInNewWindow).into());
@ -151,8 +151,10 @@ pub fn context_menu<'a>(
//TODO: Print?
children.push(menu_item(fl!("show-details"), Action::Preview).into());
children.push(divider::horizontal::light().into());
children.push(menu_item(fl!("add-to-sidebar"), Action::AddToSidebar).into());
if matches!(tab.mode, tab::Mode::App) {
children.push(divider::horizontal::light().into());
children.push(menu_item(fl!("add-to-sidebar"), Action::AddToSidebar).into());
}
children.push(divider::horizontal::light().into());
children.push(menu_item(fl!("move-to-trash"), Action::MoveToTrash).into());
} else {