Move language selection to bottom bar, implement volume

This commit is contained in:
Jeremy Soller 2024-12-05 13:41:58 -07:00
parent 52a7697806
commit b26005d780
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 192 additions and 41 deletions

View file

@ -1,9 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::menu::{items as menu_items, root as menu_root, Item as MenuItem};
use cosmic::{
widget::menu::{ItemHeight, ItemWidth, MenuBar, Tree as MenuTree},
theme,
widget::menu::{self, key_bind::KeyBind, ItemHeight, ItemWidth, MenuBar},
Element,
};
use std::collections::HashMap;
@ -13,21 +12,21 @@ use crate::{fl, Action, Config, Message};
pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> Element<'a, Message> {
let mut recent_items = Vec::new();
MenuBar::new(vec![MenuTree::with_children(
menu_root(fl!("file")),
menu_items(
MenuBar::new(vec![menu::Tree::with_children(
menu::root(fl!("file")),
menu::items(
key_binds,
vec![
MenuItem::Button(fl!("open-media"), Action::FileOpen),
MenuItem::Folder(fl!("open-recent-media"), recent_items),
MenuItem::Button(fl!("close-file"), Action::FileClose),
MenuItem::Divider,
MenuItem::Button(fl!("quit"), Action::WindowClose),
menu::Item::Button(fl!("open-media"), Action::FileOpen),
menu::Item::Folder(fl!("open-recent-media"), recent_items),
menu::Item::Button(fl!("close-file"), Action::FileClose),
menu::Item::Divider,
menu::Item::Button(fl!("quit"), Action::WindowClose),
],
),
)])
.item_height(ItemHeight::Dynamic(40))
.item_width(ItemWidth::Uniform(240))
.spacing(4.0)
.spacing(theme::active().cosmic().spacing.space_xxxs.into())
.into()
}