chore: update iced

This commit is contained in:
Ashley Wulber 2026-03-20 16:17:24 -04:00
parent 5c1887fb07
commit 6c401d7030
7 changed files with 1502 additions and 915 deletions

View file

@ -1,8 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{
Element, theme,
widget::menu::{self, ItemHeight, ItemWidth, MenuBar, key_bind::KeyBind},
theme,
widget::{
menu::{self, key_bind::KeyBind, ItemHeight, ItemWidth, MenuBar},
RcElementWrapper,
},
Element,
};
use std::{collections::HashMap, path::PathBuf};
@ -39,6 +43,7 @@ pub fn menu_bar<'a>(
for (i, path) in config_state.recent_files.iter().enumerate() {
recent_files.push(menu::Item::Button(
format_url(path),
None,
Action::FileOpenRecent(i),
));
}
@ -46,6 +51,7 @@ pub fn menu_bar<'a>(
recent_files.push(menu::Item::Divider);
recent_files.push(menu::Item::Button(
fl!("clear-recent"),
None,
Action::FileClearRecents,
));
}
@ -59,6 +65,7 @@ pub fn menu_bar<'a>(
for (i, path) in config_state.recent_projects.iter().enumerate() {
recent_projects.push(menu::Item::Button(
format_path(path),
None,
Action::FolderOpenRecent(i),
));
}
@ -66,6 +73,7 @@ pub fn menu_bar<'a>(
recent_projects.push(menu::Item::Divider);
recent_projects.push(menu::Item::Button(
fl!("clear-recent"),
None,
Action::FolderClearRecents,
));
}
@ -74,24 +82,25 @@ pub fn menu_bar<'a>(
for (folder_i, (name, _path)) in projects.iter().enumerate() {
close_projects.push(menu::Item::Button(
name.clone(),
None,
Action::FolderClose(folder_i),
));
}
MenuBar::new(vec![menu::Tree::with_children(
menu::root(fl!("file")),
RcElementWrapper::new(Element::from(menu::root(fl!("file")))),
menu::items(
key_binds,
vec![
menu::Item::Button(fl!("open-media"), Action::FileOpen),
menu::Item::Button(fl!("open-media"), None, Action::FileOpen),
menu::Item::Folder(fl!("open-recent-media"), recent_files),
menu::Item::Button(fl!("close-file"), Action::FileClose),
menu::Item::Button(fl!("close-file"), None, Action::FileClose),
menu::Item::Divider,
menu::Item::Button(fl!("open-media-folder"), Action::FolderOpen),
menu::Item::Button(fl!("open-media-folder"), None, Action::FolderOpen),
menu::Item::Folder(fl!("open-recent-media-folder"), recent_projects),
menu::Item::Folder(fl!("close-media-folder"), close_projects),
menu::Item::Divider,
menu::Item::Button(fl!("quit"), Action::WindowClose),
menu::Item::Button(fl!("quit"), None, Action::WindowClose),
],
),
)])