From 0db481c76351d34eac0d8bdc969715362bdda7cf Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Fri, 5 Aug 2022 00:57:00 +0200 Subject: [PATCH] Browser: Make the bookmark button use an action This merges 2 duplicated definitions (one for button, second just for the keyboard shortcut) which also makes the button 'react' on that shortcut. :^) --- Userland/Applications/Browser/Tab.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 6ef827ab73..9038c75936 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -186,22 +186,19 @@ Tab::Tab(BrowserWindow& window) m_location_box->on_return_pressed(); })); - m_bookmark_button = toolbar.add(); - m_bookmark_button->set_button_style(Gfx::ButtonStyle::Coolbar); - m_bookmark_button->set_focus_policy(GUI::FocusPolicy::TabFocus); - m_bookmark_button->set_icon(g_icon_bag.bookmark_contour); - m_bookmark_button->set_fixed_size(22, 22); - - m_bookmark_button->on_click = [this](auto) { - bookmark_current_url(); - }; - auto bookmark_action = GUI::Action::create( "Bookmark current URL", { Mod_Ctrl, Key_D }, [this](auto&) { bookmark_current_url(); }, this); + m_bookmark_button = toolbar.add(); + m_bookmark_button->set_action(bookmark_action); + m_bookmark_button->set_button_style(Gfx::ButtonStyle::Coolbar); + m_bookmark_button->set_focus_policy(GUI::FocusPolicy::TabFocus); + m_bookmark_button->set_icon(g_icon_bag.bookmark_contour); + m_bookmark_button->set_fixed_size(22, 22); + view().on_load_start = [this](auto& url) { m_navigating_url = url; m_loaded = false;