mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
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.)
This commit is contained in:
parent
9093625546
commit
421619fe2f
1 changed files with 8 additions and 8 deletions
|
@ -163,14 +163,6 @@ Tab::Tab()
|
||||||
m_statusbar->set_text(href);
|
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();
|
m_menubar = GUI::MenuBar::construct();
|
||||||
|
|
||||||
auto& app_menu = m_menubar->add_menu("Browser");
|
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()
|
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) {
|
BookmarksBarWidget::the().on_bookmark_click = [this](auto&, auto& url) {
|
||||||
m_html_widget->load(url);
|
m_html_widget->load(url);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue