feat: include permanent delete in menu_bar
This commit is contained in:
parent
95aba7c74e
commit
160ef5f414
2 changed files with 12 additions and 7 deletions
|
|
@ -5001,6 +5001,7 @@ impl Application for App {
|
|||
&self.core,
|
||||
self.tab_model.active_data::<Tab>(),
|
||||
&self.config,
|
||||
&self.modifiers,
|
||||
&self.key_binds,
|
||||
)]
|
||||
}
|
||||
|
|
|
|||
18
src/menu.rs
18
src/menu.rs
|
|
@ -499,6 +499,7 @@ pub fn menu_bar<'a>(
|
|||
core: &Core,
|
||||
tab_opt: Option<&Tab>,
|
||||
config: &Config,
|
||||
modifiers: &Modifiers,
|
||||
key_binds: &HashMap<KeyBind, Action>,
|
||||
) -> Element<'a, Message> {
|
||||
let sort_options = tab_opt.map(|tab| tab.sort_options());
|
||||
|
|
@ -531,6 +532,12 @@ pub fn menu_bar<'a>(
|
|||
}
|
||||
};
|
||||
|
||||
let (delete_item, delete_item_action) = if in_trash || modifiers.shift() {
|
||||
(fl!("delete-permanently"), Action::Delete)
|
||||
} else {
|
||||
(fl!("move-to-trash"), Action::Delete)
|
||||
};
|
||||
|
||||
responsive_menu_bar()
|
||||
.item_height(ItemHeight::Dynamic(40))
|
||||
.item_width(ItemWidth::Uniform(360))
|
||||
|
|
@ -569,14 +576,11 @@ pub fn menu_bar<'a>(
|
|||
),
|
||||
menu::Item::Divider,
|
||||
menu_button_optional(
|
||||
if in_trash {
|
||||
fl!("delete-permanently")
|
||||
} else {
|
||||
fl!("move-to-trash")
|
||||
},
|
||||
Action::Delete,
|
||||
selected > 0,
|
||||
fl!("restore-from-trash"),
|
||||
Action::RestoreFromTrash,
|
||||
selected > 0 && in_trash,
|
||||
),
|
||||
menu_button_optional(delete_item, delete_item_action, selected > 0),
|
||||
menu::Item::Divider,
|
||||
menu::Item::Button(fl!("close-tab"), None, Action::TabClose),
|
||||
menu::Item::Button(fl!("quit"), None, Action::WindowClose),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue