mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
implement menu as trait
This commit is contained in:
parent
33f4454584
commit
6571468b4b
1 changed files with 5 additions and 5 deletions
|
|
@ -5,15 +5,15 @@ use std::rc::Rc;
|
||||||
/// Context menu wrapper
|
/// Context menu wrapper
|
||||||
///
|
///
|
||||||
/// https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.TabView.get_menu_model.html
|
/// https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.TabView.get_menu_model.html
|
||||||
pub struct Menu {
|
pub trait Menu {
|
||||||
pub main: gtk::gio::Menu,
|
fn menu(window_action: &Rc<WindowAction>) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Menu {
|
impl Menu for gtk::gio::Menu {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create new `Self`
|
/// Create new `Self`
|
||||||
pub fn new(window_action: &Rc<WindowAction>) -> Self {
|
fn menu(window_action: &Rc<WindowAction>) -> Self {
|
||||||
let main = gtk::gio::Menu::new();
|
let main = gtk::gio::Menu::new();
|
||||||
|
|
||||||
main.append(
|
main.append(
|
||||||
|
|
@ -135,6 +135,6 @@ impl Menu {
|
||||||
|
|
||||||
main.append_submenu(Some("Close"), &close);
|
main.append_submenu(Some("Close"), &close);
|
||||||
|
|
||||||
Self { main }
|
main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue