From 421619fe2f5acff7e511f032e48643b0b818e34e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 25 Apr 2020 17:27:55 +0200 Subject: [PATCH] Browser: Rejig the "on_load_counter_change" hook when switching tabs This feels a little shoddy, but we need to make sure that updates end up on the right statusbar (since there is one statusbar per tab.) --- Applications/Browser/Tab.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index d388408a06..59db6309bb 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -163,14 +163,6 @@ Tab::Tab() m_statusbar->set_text(href); }; - Web::ResourceLoader::the().on_load_counter_change = [this] { - if (Web::ResourceLoader::the().pending_loads() == 0) { - m_statusbar->set_text(""); - return; - } - m_statusbar->set_text(String::format("Loading (%d pending resources...)", Web::ResourceLoader::the().pending_loads())); - }; - m_menubar = GUI::MenuBar::construct(); auto& app_menu = m_menubar->add_menu("Browser"); @@ -286,6 +278,14 @@ void Tab::update_bookmark_button(const String& url) void Tab::did_become_active() { + Web::ResourceLoader::the().on_load_counter_change = [this] { + if (Web::ResourceLoader::the().pending_loads() == 0) { + m_statusbar->set_text(""); + return; + } + m_statusbar->set_text(String::format("Loading (%d pending resources...)", Web::ResourceLoader::the().pending_loads())); + }; + BookmarksBarWidget::the().on_bookmark_click = [this](auto&, auto& url) { m_html_widget->load(url); };