diff options
author | Karol Kosek <krkk@serenityos.org> | 2022-08-05 00:57:00 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-07 20:49:45 +0200 |
commit | 0db481c76351d34eac0d8bdc969715362bdda7cf (patch) | |
tree | 755504b36313be02c8f46e588defa09fbb23ff51 | |
parent | 3b5766d0781eff85f28d5add16222b61827939b2 (diff) | |
download | serenity-0db481c76351d34eac0d8bdc969715362bdda7cf.zip |
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. :^)
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 17 |
1 files 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<GUI::Button>(); - 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<GUI::Button>(); + 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; |