update libcosmic

This commit is contained in:
Vukašin Vojinović 2024-11-26 19:23:06 +01:00
parent 06150f7d44
commit c6f6edbd5a
3 changed files with 286 additions and 288 deletions

504
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1547,37 +1547,44 @@ impl Application for App {
{
items.push(cosmic::widget::menu::Item::Button(
fl!("open"),
None,
NavMenuAction::Open(entity),
));
items.push(cosmic::widget::menu::Item::Button(
fl!("open-with"),
None,
NavMenuAction::OpenWith(entity),
));
} else {
items.push(cosmic::widget::menu::Item::Button(
fl!("open-in-new-tab"),
None,
NavMenuAction::OpenInNewTab(entity),
));
items.push(cosmic::widget::menu::Item::Button(
fl!("open-in-new-window"),
None,
NavMenuAction::OpenInNewWindow(entity),
));
}
items.push(cosmic::widget::menu::Item::Divider);
items.push(cosmic::widget::menu::Item::Button(
fl!("show-details"),
None,
NavMenuAction::Preview(entity),
));
items.push(cosmic::widget::menu::Item::Divider);
if favorite_index_opt.is_some() {
items.push(cosmic::widget::menu::Item::Button(
fl!("remove-from-sidebar"),
None,
NavMenuAction::RemoveFromSidebar(entity),
));
}
if matches!(location_opt, Some(Location::Trash)) {
items.push(cosmic::widget::menu::Item::Button(
fl!("empty-trash"),
None,
NavMenuAction::EmptyTrash,
));
}
@ -2858,7 +2865,7 @@ impl Application for App {
let mut paths = Vec::with_capacity(recently_trashed.len());
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))
.await
{

View file

@ -42,9 +42,9 @@ fn menu_button_optional(
enabled: bool,
) -> menu::Item<Action, String> {
if enabled {
menu::Item::Button(label, action)
menu::Item::Button(label, None, action)
} else {
menu::Item::ButtonDisabled(label, action)
menu::Item::ButtonDisabled(label, None, action)
}
}
@ -338,7 +338,7 @@ pub fn context_menu<'a>(
..Default::default()
}
})
.width(Length::Fixed(280.0))
.width(Length::Fixed(360.0))
.into()
}
@ -351,6 +351,7 @@ pub fn dialog_menu<'a>(
let sort_item = |label, sort, dir| {
menu::Item::CheckBox(
label,
None,
sort_name == sort && sort_direction == dir,
Action::SetSort(sort, dir),
)
@ -382,11 +383,13 @@ pub fn dialog_menu<'a>(
vec![
menu::Item::CheckBox(
fl!("grid-view"),
None,
matches!(tab.config.view, tab::View::Grid),
Action::TabViewGrid,
),
menu::Item::CheckBox(
fl!("list-view"),
None,
matches!(tab.config.view, tab::View::List),
Action::TabViewList,
),
@ -447,21 +450,23 @@ pub fn dialog_menu<'a>(
menu::items(
key_binds,
vec![
menu::Item::Button(fl!("zoom-in"), Action::ZoomIn),
menu::Item::Button(fl!("default-size"), Action::ZoomDefault),
menu::Item::Button(fl!("zoom-out"), Action::ZoomOut),
menu::Item::Button(fl!("zoom-in"), None, Action::ZoomIn),
menu::Item::Button(fl!("default-size"), None, Action::ZoomDefault),
menu::Item::Button(fl!("zoom-out"), None, Action::ZoomOut),
menu::Item::Divider,
menu::Item::CheckBox(
fl!("show-hidden-files"),
None,
tab.config.show_hidden,
Action::ToggleShowHidden,
),
menu::Item::CheckBox(
fl!("list-directories-first"),
None,
tab.config.folders_first,
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_button_optional(
fl!("gallery-preview"),
@ -487,6 +492,7 @@ pub fn menu_bar<'a>(
let sort_item = |label, sort, dir| {
menu::Item::CheckBox(
label,
None,
sort_options.map_or(false, |(sort_name, sort_direction, _)| {
sort_name == sort && sort_direction == dir
}),
@ -518,10 +524,10 @@ pub fn menu_bar<'a>(
menu::items(
key_binds,
vec![
menu::Item::Button(fl!("new-tab"), Action::TabNew),
menu::Item::Button(fl!("new-window"), Action::WindowNew),
menu::Item::Button(fl!("new-folder"), Action::NewFolder),
menu::Item::Button(fl!("new-file"), Action::NewFile),
menu::Item::Button(fl!("new-tab"), None, Action::TabNew),
menu::Item::Button(fl!("new-window"), None, Action::WindowNew),
menu::Item::Button(fl!("new-folder"), None, Action::NewFolder),
menu::Item::Button(fl!("new-file"), None, Action::NewFile),
menu_button_optional(
fl!("open"),
Action::Open,
@ -535,8 +541,8 @@ pub fn menu_bar<'a>(
menu::Item::Divider,
menu_button_optional(fl!("move-to-trash"), Action::MoveToTrash, selected > 0),
menu::Item::Divider,
menu::Item::Button(fl!("close-tab"), Action::TabClose),
menu::Item::Button(fl!("quit"), Action::WindowClose),
menu::Item::Button(fl!("close-tab"), None, Action::TabClose),
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!("copy"), Action::Copy, 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::Button(fl!("history"), Action::EditHistory),
menu::Item::Button(fl!("history"), None, Action::EditHistory),
],
),
),
@ -559,32 +565,41 @@ pub fn menu_bar<'a>(
menu::items(
key_binds,
vec![
menu::Item::Button(fl!("zoom-in"), Action::ZoomIn),
menu::Item::Button(fl!("default-size"), Action::ZoomDefault),
menu::Item::Button(fl!("zoom-out"), Action::ZoomOut),
menu::Item::Button(fl!("zoom-in"), None, Action::ZoomIn),
menu::Item::Button(fl!("default-size"), None, Action::ZoomDefault),
menu::Item::Button(fl!("zoom-out"), None, Action::ZoomOut),
menu::Item::Divider,
menu::Item::CheckBox(
fl!("grid-view"),
None,
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::Grid)),
Action::TabViewGrid,
),
menu::Item::CheckBox(
fl!("list-view"),
None,
tab_opt.map_or(false, |tab| matches!(tab.config.view, tab::View::List)),
Action::TabViewList,
),
menu::Item::Divider,
menu::Item::CheckBox(
fl!("show-hidden-files"),
None,
tab_opt.map_or(false, |tab| tab.config.show_hidden),
Action::ToggleShowHidden,
),
menu::Item::CheckBox(
fl!("list-directories-first"),
None,
tab_opt.map_or(false, |tab| tab.config.folders_first),
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_button_optional(
fl!("gallery-preview"),
@ -592,9 +607,9 @@ pub fn menu_bar<'a>(
selected_gallery > 0,
),
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::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_width(ItemWidth::Uniform(240))
.item_width(ItemWidth::Uniform(360))
.spacing(theme::active().cosmic().spacing.space_xxxs.into())
.into()
}
@ -688,6 +703,6 @@ pub fn location_context_menu<'a>(ancestor_index: usize) -> Element<'a, tab::Mess
..Default::default()
}
})
.width(Length::Fixed(240.0))
.width(Length::Fixed(360.0))
.into()
}