From ddead4e870d896fa4e3064e337ba123c8411ce23 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 10 Nov 2024 12:13:52 +0200 Subject: [PATCH] enshort setup menu state match --- src/app/browser/window/tab.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index c14fec70..307c4a87 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -83,13 +83,10 @@ impl Tab { widget.gobject().connect_setup_menu({ let window_action = window_action.clone(); move |tab_view, tab_page| { - // Set state - let state = match tab_page { - // Context menu opened - Some(this) => Some(tab_view.page_position(this)), - // Context menu closed (reset state to defaults) - None => None, - }; + // Set new state for page selected on menu open + // * this action return default state (`None`) on menu close + let state = tab_page.map(|this| tab_view.page_position(this)); + // Update actions with new state value window_action.close_all().change_state(state); window_action.close().change_state(state);