implement menu as trait

This commit is contained in:
yggverse 2025-01-27 13:11:30 +02:00
parent 33f4454584
commit 6571468b4b

View file

@ -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
}
}