update libcosmic
This commit is contained in:
parent
06150f7d44
commit
c6f6edbd5a
3 changed files with 286 additions and 288 deletions
504
Cargo.lock
generated
504
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1547,37 +1547,44 @@ impl Application for App {
|
||||||
{
|
{
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("open"),
|
fl!("open"),
|
||||||
|
None,
|
||||||
NavMenuAction::Open(entity),
|
NavMenuAction::Open(entity),
|
||||||
));
|
));
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("open-with"),
|
fl!("open-with"),
|
||||||
|
None,
|
||||||
NavMenuAction::OpenWith(entity),
|
NavMenuAction::OpenWith(entity),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("open-in-new-tab"),
|
fl!("open-in-new-tab"),
|
||||||
|
None,
|
||||||
NavMenuAction::OpenInNewTab(entity),
|
NavMenuAction::OpenInNewTab(entity),
|
||||||
));
|
));
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("open-in-new-window"),
|
fl!("open-in-new-window"),
|
||||||
|
None,
|
||||||
NavMenuAction::OpenInNewWindow(entity),
|
NavMenuAction::OpenInNewWindow(entity),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
items.push(cosmic::widget::menu::Item::Divider);
|
items.push(cosmic::widget::menu::Item::Divider);
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("show-details"),
|
fl!("show-details"),
|
||||||
|
None,
|
||||||
NavMenuAction::Preview(entity),
|
NavMenuAction::Preview(entity),
|
||||||
));
|
));
|
||||||
items.push(cosmic::widget::menu::Item::Divider);
|
items.push(cosmic::widget::menu::Item::Divider);
|
||||||
if favorite_index_opt.is_some() {
|
if favorite_index_opt.is_some() {
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("remove-from-sidebar"),
|
fl!("remove-from-sidebar"),
|
||||||
|
None,
|
||||||
NavMenuAction::RemoveFromSidebar(entity),
|
NavMenuAction::RemoveFromSidebar(entity),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if matches!(location_opt, Some(Location::Trash)) {
|
if matches!(location_opt, Some(Location::Trash)) {
|
||||||
items.push(cosmic::widget::menu::Item::Button(
|
items.push(cosmic::widget::menu::Item::Button(
|
||||||
fl!("empty-trash"),
|
fl!("empty-trash"),
|
||||||
|
None,
|
||||||
NavMenuAction::EmptyTrash,
|
NavMenuAction::EmptyTrash,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -2858,7 +2865,7 @@ impl Application for App {
|
||||||
let mut paths = Vec::with_capacity(recently_trashed.len());
|
let mut paths = Vec::with_capacity(recently_trashed.len());
|
||||||
let icon_sizes = self.config.tab.icon_sizes;
|
let icon_sizes = self.config.tab.icon_sizes;
|
||||||
|
|
||||||
return cosmic::command::future(async move {
|
return cosmic::task::future(async move {
|
||||||
match tokio::task::spawn_blocking(move || Location::Trash.scan(icon_sizes))
|
match tokio::task::spawn_blocking(move || Location::Trash.scan(icon_sizes))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
|
|
||||||
61
src/menu.rs
61
src/menu.rs
|
|
@ -42,9 +42,9 @@ fn menu_button_optional(
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
) -> menu::Item<Action, String> {
|
) -> menu::Item<Action, String> {
|
||||||
if enabled {
|
if enabled {
|
||||||
menu::Item::Button(label, action)
|
menu::Item::Button(label, None, action)
|
||||||
} else {
|
} else {
|
||||||
menu::Item::ButtonDisabled(label, action)
|
menu::Item::ButtonDisabled(label, None, action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,7 +338,7 @@ pub fn context_menu<'a>(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.width(Length::Fixed(280.0))
|
.width(Length::Fixed(360.0))
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,6 +351,7 @@ pub fn dialog_menu<'a>(
|
||||||
let sort_item = |label, sort, dir| {
|
let sort_item = |label, sort, dir| {
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
label,
|
label,
|
||||||
|
None,
|
||||||
sort_name == sort && sort_direction == dir,
|
sort_name == sort && sort_direction == dir,
|
||||||
Action::SetSort(sort, dir),
|
Action::SetSort(sort, dir),
|
||||||
)
|
)
|
||||||
|
|
@ -382,11 +383,13 @@ pub fn dialog_menu<'a>(
|
||||||
vec![
|
vec![
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("grid-view"),
|
fl!("grid-view"),
|
||||||
|
None,
|
||||||
matches!(tab.config.view, tab::View::Grid),
|
matches!(tab.config.view, tab::View::Grid),
|
||||||
Action::TabViewGrid,
|
Action::TabViewGrid,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("list-view"),
|
fl!("list-view"),
|
||||||
|
None,
|
||||||
matches!(tab.config.view, tab::View::List),
|
matches!(tab.config.view, tab::View::List),
|
||||||
Action::TabViewList,
|
Action::TabViewList,
|
||||||
),
|
),
|
||||||
|
|
@ -447,21 +450,23 @@ pub fn dialog_menu<'a>(
|
||||||
menu::items(
|
menu::items(
|
||||||
key_binds,
|
key_binds,
|
||||||
vec![
|
vec![
|
||||||
menu::Item::Button(fl!("zoom-in"), Action::ZoomIn),
|
menu::Item::Button(fl!("zoom-in"), None, Action::ZoomIn),
|
||||||
menu::Item::Button(fl!("default-size"), Action::ZoomDefault),
|
menu::Item::Button(fl!("default-size"), None, Action::ZoomDefault),
|
||||||
menu::Item::Button(fl!("zoom-out"), Action::ZoomOut),
|
menu::Item::Button(fl!("zoom-out"), None, Action::ZoomOut),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("show-hidden-files"),
|
fl!("show-hidden-files"),
|
||||||
|
None,
|
||||||
tab.config.show_hidden,
|
tab.config.show_hidden,
|
||||||
Action::ToggleShowHidden,
|
Action::ToggleShowHidden,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("list-directories-first"),
|
fl!("list-directories-first"),
|
||||||
|
None,
|
||||||
tab.config.folders_first,
|
tab.config.folders_first,
|
||||||
Action::ToggleFoldersFirst,
|
Action::ToggleFoldersFirst,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(fl!("show-details"), show_details, Action::Preview),
|
menu::Item::CheckBox(fl!("show-details"), None, show_details, Action::Preview),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu_button_optional(
|
menu_button_optional(
|
||||||
fl!("gallery-preview"),
|
fl!("gallery-preview"),
|
||||||
|
|
@ -487,6 +492,7 @@ pub fn menu_bar<'a>(
|
||||||
let sort_item = |label, sort, dir| {
|
let sort_item = |label, sort, dir| {
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
label,
|
label,
|
||||||
|
None,
|
||||||
sort_options.map_or(false, |(sort_name, sort_direction, _)| {
|
sort_options.map_or(false, |(sort_name, sort_direction, _)| {
|
||||||
sort_name == sort && sort_direction == dir
|
sort_name == sort && sort_direction == dir
|
||||||
}),
|
}),
|
||||||
|
|
@ -518,10 +524,10 @@ pub fn menu_bar<'a>(
|
||||||
menu::items(
|
menu::items(
|
||||||
key_binds,
|
key_binds,
|
||||||
vec![
|
vec![
|
||||||
menu::Item::Button(fl!("new-tab"), Action::TabNew),
|
menu::Item::Button(fl!("new-tab"), None, Action::TabNew),
|
||||||
menu::Item::Button(fl!("new-window"), Action::WindowNew),
|
menu::Item::Button(fl!("new-window"), None, Action::WindowNew),
|
||||||
menu::Item::Button(fl!("new-folder"), Action::NewFolder),
|
menu::Item::Button(fl!("new-folder"), None, Action::NewFolder),
|
||||||
menu::Item::Button(fl!("new-file"), Action::NewFile),
|
menu::Item::Button(fl!("new-file"), None, Action::NewFile),
|
||||||
menu_button_optional(
|
menu_button_optional(
|
||||||
fl!("open"),
|
fl!("open"),
|
||||||
Action::Open,
|
Action::Open,
|
||||||
|
|
@ -535,8 +541,8 @@ pub fn menu_bar<'a>(
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu_button_optional(fl!("move-to-trash"), Action::MoveToTrash, selected > 0),
|
menu_button_optional(fl!("move-to-trash"), Action::MoveToTrash, selected > 0),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Button(fl!("close-tab"), Action::TabClose),
|
menu::Item::Button(fl!("close-tab"), None, Action::TabClose),
|
||||||
menu::Item::Button(fl!("quit"), Action::WindowClose),
|
menu::Item::Button(fl!("quit"), None, Action::WindowClose),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -548,9 +554,9 @@ pub fn menu_bar<'a>(
|
||||||
menu_button_optional(fl!("cut"), Action::Cut, selected > 0),
|
menu_button_optional(fl!("cut"), Action::Cut, selected > 0),
|
||||||
menu_button_optional(fl!("copy"), Action::Copy, selected > 0),
|
menu_button_optional(fl!("copy"), Action::Copy, selected > 0),
|
||||||
menu_button_optional(fl!("paste"), Action::Paste, selected > 0),
|
menu_button_optional(fl!("paste"), Action::Paste, selected > 0),
|
||||||
menu::Item::Button(fl!("select-all"), Action::SelectAll),
|
menu::Item::Button(fl!("select-all"), None, Action::SelectAll),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Button(fl!("history"), Action::EditHistory),
|
menu::Item::Button(fl!("history"), None, Action::EditHistory),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -559,32 +565,41 @@ pub fn menu_bar<'a>(
|
||||||
menu::items(
|
menu::items(
|
||||||
key_binds,
|
key_binds,
|
||||||
vec![
|
vec![
|
||||||
menu::Item::Button(fl!("zoom-in"), Action::ZoomIn),
|
menu::Item::Button(fl!("zoom-in"), None, Action::ZoomIn),
|
||||||
menu::Item::Button(fl!("default-size"), Action::ZoomDefault),
|
menu::Item::Button(fl!("default-size"), None, Action::ZoomDefault),
|
||||||
menu::Item::Button(fl!("zoom-out"), Action::ZoomOut),
|
menu::Item::Button(fl!("zoom-out"), None, Action::ZoomOut),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("grid-view"),
|
fl!("grid-view"),
|
||||||
|
None,
|
||||||
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::Grid)),
|
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::Grid)),
|
||||||
Action::TabViewGrid,
|
Action::TabViewGrid,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("list-view"),
|
fl!("list-view"),
|
||||||
|
None,
|
||||||
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::List)),
|
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::List)),
|
||||||
Action::TabViewList,
|
Action::TabViewList,
|
||||||
),
|
),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("show-hidden-files"),
|
fl!("show-hidden-files"),
|
||||||
|
None,
|
||||||
tab_opt.map_or(false, |tab| tab.config.show_hidden),
|
tab_opt.map_or(false, |tab| tab.config.show_hidden),
|
||||||
Action::ToggleShowHidden,
|
Action::ToggleShowHidden,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(
|
menu::Item::CheckBox(
|
||||||
fl!("list-directories-first"),
|
fl!("list-directories-first"),
|
||||||
|
None,
|
||||||
tab_opt.map_or(false, |tab| tab.config.folders_first),
|
tab_opt.map_or(false, |tab| tab.config.folders_first),
|
||||||
Action::ToggleFoldersFirst,
|
Action::ToggleFoldersFirst,
|
||||||
),
|
),
|
||||||
menu::Item::CheckBox(fl!("show-details"), config.show_details, Action::Preview),
|
menu::Item::CheckBox(
|
||||||
|
fl!("show-details"),
|
||||||
|
None,
|
||||||
|
config.show_details,
|
||||||
|
Action::Preview,
|
||||||
|
),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu_button_optional(
|
menu_button_optional(
|
||||||
fl!("gallery-preview"),
|
fl!("gallery-preview"),
|
||||||
|
|
@ -592,9 +607,9 @@ pub fn menu_bar<'a>(
|
||||||
selected_gallery > 0,
|
selected_gallery > 0,
|
||||||
),
|
),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Button(fl!("menu-settings"), Action::Settings),
|
menu::Item::Button(fl!("menu-settings"), None, Action::Settings),
|
||||||
menu::Item::Divider,
|
menu::Item::Divider,
|
||||||
menu::Item::Button(fl!("menu-about"), Action::About),
|
menu::Item::Button(fl!("menu-about"), None, Action::About),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -639,7 +654,7 @@ pub fn menu_bar<'a>(
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
.item_height(ItemHeight::Dynamic(40))
|
.item_height(ItemHeight::Dynamic(40))
|
||||||
.item_width(ItemWidth::Uniform(240))
|
.item_width(ItemWidth::Uniform(360))
|
||||||
.spacing(theme::active().cosmic().spacing.space_xxxs.into())
|
.spacing(theme::active().cosmic().spacing.space_xxxs.into())
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
@ -688,6 +703,6 @@ pub fn location_context_menu<'a>(ancestor_index: usize) -> Element<'a, tab::Mess
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.width(Length::Fixed(240.0))
|
.width(Length::Fixed(360.0))
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue