add close actions

This commit is contained in:
yggverse 2024-11-04 22:15:47 +02:00
parent ed3b4bcc84
commit dd1a4e6f3c
2 changed files with 18 additions and 1 deletions

View File

@ -39,6 +39,8 @@ impl Window {
) -> Self {
// Init components
let tab = Tab::new_arc(
action_page_close.clone(),
action_page_close_all.clone(),
action_page_home.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),

View File

@ -34,7 +34,8 @@ pub struct Tab {
impl Tab {
// Construct
pub fn new_arc(
// Actions
action_page_close: SimpleAction,
action_page_close_all: SimpleAction,
action_page_home: SimpleAction,
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
@ -56,6 +57,20 @@ impl Tab {
Some(&gformat!("win.{}", action_page_reload.name())),
); // @TODO resolve namespace outside
let close = Menu::new();
close.append(
Some("Current"),
Some(&gformat!("win.{}", action_page_close.name())),
);
close.append(
Some("All"),
Some(&gformat!("win.{}", action_page_close_all.name())),
);
menu.append_submenu(Some("Close"), &close);
// Init widget
let widget = Arc::new(Widget::new(&menu));