From 07799ba8bfd9fe455e506fbdc39ae8b43b2b8f00 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 1 Nov 2024 02:09:51 +0200 Subject: [PATCH] reduce menu levels --- src/app/browser/window/header/bar/menu.rs | 58 +++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/app/browser/window/header/bar/menu.rs b/src/app/browser/window/header/bar/menu.rs index f7bba5a7..7c216dd0 100644 --- a/src/app/browser/window/header/bar/menu.rs +++ b/src/app/browser/window/header/bar/menu.rs @@ -29,48 +29,48 @@ impl Menu { action_tab_page_navigation_reload: SimpleAction, action_tab_pin: SimpleAction, ) -> Arc { - // Init model - let model = gio::Menu::new(); + // Main + let main = gio::Menu::new(); - let model_tab = gio::Menu::new(); - model_tab.append(Some("New"), Some(&detailed_action_name(action_tab_append))); - model_tab.append(Some("Pin"), Some(&detailed_action_name(action_tab_pin))); + // Main > Page + let main_page = gio::Menu::new(); + main_page.append(Some("New"), Some(&detailed_action_name(action_tab_append))); + main_page.append(Some("Pin"), Some(&detailed_action_name(action_tab_pin))); - let model_tab_page = gio::Menu::new(); + // Main > Page > Navigation + let main_page_navigation = gio::Menu::new(); + main_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_tab_page_navigation_base))); - let model_tab_page_navigation = gio::Menu::new(); - model_tab_page_navigation.append(Some("Base"), Some(&detailed_action_name(action_tab_page_navigation_base))); + // Main > Page > Navigation > History + let main_page_navigation_history = gio::Menu::new(); + main_page_navigation_history.append(Some("Back"), Some(&detailed_action_name(action_tab_page_navigation_history_back))); + main_page_navigation_history.append(Some("Forward"), Some(&detailed_action_name(action_tab_page_navigation_history_forward))); - let model_tab_page_navigation_history = gio::Menu::new(); - model_tab_page_navigation_history.append(Some("Back"), Some(&detailed_action_name(action_tab_page_navigation_history_back))); - model_tab_page_navigation_history.append(Some("Forward"), Some(&detailed_action_name(action_tab_page_navigation_history_forward))); + main_page_navigation.append_submenu(Some("History"), &main_page_navigation_history); + main_page_navigation.append(Some("Reload"), Some(&detailed_action_name(action_tab_page_navigation_reload))); - model_tab_page_navigation.append_submenu(Some("History"), &model_tab_page_navigation_history); - model_tab_page_navigation.append(Some("Reload"), Some(&detailed_action_name(action_tab_page_navigation_reload))); - // @TODO model_tab_page_navigation.append(Some("Bookmark"), Some("win.tab_page_bookmark")); + main_page.append_submenu(Some("Navigation"), &main_page_navigation); - model_tab_page.append_submenu(Some("Navigation"), &model_tab_page_navigation); + // Main > Page > Close + let main_page_close = gio::Menu::new(); + main_page_close.append(Some("Current"), Some(&detailed_action_name(action_tab_close))); + main_page_close.append(Some("All"), Some(&detailed_action_name(action_tab_close_all))); - model_tab.append_submenu(Some("Page"), &model_tab_page); + main_page.append_submenu(Some("Close"), &main_page_close); - let model_tab_close = gio::Menu::new(); - model_tab_close.append(Some("Current"), Some(&detailed_action_name(action_tab_close))); - model_tab_close.append(Some("All"), Some(&detailed_action_name(action_tab_close_all))); + main.append_submenu(Some("Page"), &main_page); - model_tab.append_submenu(Some("Close"), &model_tab_close); + // Main > Tool + let main_tool = gio::Menu::new(); + main_tool.append(Some("Debug"), Some(&detailed_action_name(action_tool_debug))); + main_tool.append(Some("Profile"), Some(&detailed_action_name(action_tool_profile))); - model.append_submenu(Some("Tab"), &model_tab); + main.append_submenu(Some("Tool"), &main_tool); - let model_tool = gio::Menu::new(); - model_tool.append(Some("Debug"), Some(&detailed_action_name(action_tool_debug))); - model_tool.append(Some("Profile"), Some(&detailed_action_name(action_tool_profile))); - - model.append_submenu(Some("Tool"), &model_tool); - - model.append(Some("Quit"), Some(&detailed_action_name(action_quit))); + main.append(Some("Quit"), Some(&detailed_action_name(action_quit))); // Result - Arc::new(Self { widget:Widget::new_arc(&model) }) + Arc::new(Self { widget:Widget::new_arc(&main) }) } // Getters