From dd1a4e6f3c9cc7a13ab9e29083ea54ca57b4bb69 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 4 Nov 2024 22:15:47 +0200 Subject: [PATCH] add close actions --- src/app/browser/window.rs | 2 ++ src/app/browser/window/tab.rs | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index b817aae6..6f4a8dd6 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -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(), diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 8c0781f2..b83d035b 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -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));