mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05: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
|
||||
///
|
||||
/// https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.TabView.get_menu_model.html
|
||||
pub struct Menu {
|
||||
pub main: gtk::gio::Menu,
|
||||
pub trait Menu {
|
||||
fn menu(window_action: &Rc<WindowAction>) -> Self;
|
||||
}
|
||||
|
||||
impl Menu {
|
||||
impl Menu for gtk::gio::Menu {
|
||||
// Constructors
|
||||
|
||||
/// Create new `Self`
|
||||
pub fn new(window_action: &Rc<WindowAction>) -> Self {
|
||||
fn menu(window_action: &Rc<WindowAction>) -> Self {
|
||||
let main = gtk::gio::Menu::new();
|
||||
|
||||
main.append(
|
||||
|
|
@ -135,6 +135,6 @@ impl Menu {
|
|||
|
||||
main.append_submenu(Some("Close"), &close);
|
||||
|
||||
Self { main }
|
||||
main
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue