diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2021-02-26 07:05:41 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-26 13:50:00 +0100 |
commit | fb5cdc670fc58543555fbf7e8bba038a67fe3f70 (patch) | |
tree | dc8e99606b3be5f0fc4bce4708e268f55b826f64 | |
parent | 38e70d2874660619b24aa5d3f3dba20f275791a0 (diff) | |
download | serenity-fb5cdc670fc58543555fbf7e8bba038a67fe3f70.zip |
Browser: Add Go menu and move Bookmarks bar toggle to View
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 16 | ||||
-rw-r--r-- | Userland/Applications/Browser/Tab.h | 1 | ||||
-rw-r--r-- | Userland/Applications/Browser/WindowActions.cpp | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index e150fe38bf..0d9b0e66eb 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -116,11 +116,12 @@ Tab::Tab(Type type) m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) { go_back(); }, this); m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) { go_forward(); }, this); + m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { load(g_home_url); }, this); toolbar.add_action(*m_go_back_action); toolbar.add_action(*m_go_forward_action); + toolbar.add_action(*m_go_home_action); - toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) { load(g_home_url); }, this)); m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) { reload(); }, this); toolbar.add_action(*m_reload_action); @@ -290,13 +291,14 @@ Tab::Tab(Type type) }, this)); - app_menu.add_action(*m_reload_action); app_menu.add_separator(); app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { GUI::Application::the()->quit(); })); auto& view_menu = m_menubar->add_menu("View"); + view_menu.add_action(WindowActions::the().show_bookmarks_bar_action()); + view_menu.add_separator(); view_menu.add_action(GUI::CommonActions::make_fullscreen_action( [this](auto&) { window()->set_fullscreen(!window()->is_fullscreen()); @@ -315,6 +317,13 @@ Tab::Tab(Type type) }, this)); + auto& go_menu = m_menubar->add_menu("Go"); + go_menu.add_action(*m_go_back_action); + go_menu.add_action(*m_go_forward_action); + go_menu.add_action(*m_go_home_action); + go_menu.add_separator(); + go_menu.add_action(*m_reload_action); + auto view_source_action = GUI::Action::create( "View source", { Mod_Ctrl, Key_U }, [this](auto&) { if (m_type == Type::InProcessWebView) { @@ -430,9 +439,6 @@ Tab::Tab(Type type) } })); - auto& bookmarks_menu = m_menubar->add_menu("Bookmarks"); - bookmarks_menu.add_action(WindowActions::the().show_bookmarks_bar_action()); - auto& help_menu = m_menubar->add_menu("Help"); help_menu.add_action(WindowActions::the().about_action()); diff --git a/Userland/Applications/Browser/Tab.h b/Userland/Applications/Browser/Tab.h index f99347ff21..8816c3643b 100644 --- a/Userland/Applications/Browser/Tab.h +++ b/Userland/Applications/Browser/Tab.h @@ -92,6 +92,7 @@ private: RefPtr<GUI::Action> m_go_back_action; RefPtr<GUI::Action> m_go_forward_action; + RefPtr<GUI::Action> m_go_home_action; RefPtr<GUI::Action> m_reload_action; RefPtr<GUI::TextBox> m_location_box; RefPtr<GUI::Button> m_bookmark_button; diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index 35eb205c1c..95b430d20a 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -70,8 +70,9 @@ WindowActions::WindowActions(GUI::Window& window) on_about(); }, &window); + m_show_bookmarks_bar_action = GUI::Action::create_checkable( - "Show bookmarks bar", + "Bookmarks bar", { Mod_Ctrl, Key_B }, [this](auto& action) { if (on_show_bookmarks_bar) on_show_bookmarks_bar(action); |