mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement main menu as trait
This commit is contained in:
parent
099bba0173
commit
0f89b526f7
2 changed files with 7 additions and 10 deletions
|
|
@ -8,7 +8,7 @@ use tab::Tab;
|
|||
|
||||
use super::{BrowserAction, Profile, WindowAction};
|
||||
use adw::{TabBar, TabView};
|
||||
use gtk::{prelude::BoxExt, Box, Orientation};
|
||||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub trait Bar {
|
||||
|
|
@ -34,7 +34,7 @@ impl Bar for Box {
|
|||
.build();
|
||||
|
||||
g_box.append(&TabBar::tab(window_action, view));
|
||||
g_box.append(&Menu::build((browser_action, window_action), profile).menu_button);
|
||||
g_box.append(&MenuButton::menu((browser_action, window_action), profile));
|
||||
g_box.append(&Control::new().window_controls);
|
||||
g_box
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ use std::rc::Rc;
|
|||
// Config options
|
||||
|
||||
const LABEL_MAX_LENGTH: usize = 28;
|
||||
pub struct Menu {
|
||||
pub menu_button: MenuButton,
|
||||
pub trait Menu {
|
||||
fn menu(action: (&Rc<BrowserAction>, &Rc<WindowAction>), profile: &Rc<Profile>) -> Self;
|
||||
}
|
||||
|
||||
#[rustfmt::skip] // @TODO template builder?
|
||||
impl Menu {
|
||||
impl Menu for MenuButton {
|
||||
// Constructors
|
||||
|
||||
/// Build new `Self`
|
||||
pub fn build(
|
||||
fn menu(
|
||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||
profile: &Rc<Profile>,
|
||||
) -> Self {
|
||||
|
|
@ -252,10 +252,7 @@ impl Menu {
|
|||
}
|
||||
});
|
||||
|
||||
// Result
|
||||
Self {
|
||||
menu_button
|
||||
}
|
||||
menu_button
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue