1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

Browser: Have BookmarksBarWidget signal bookmark changes for Tab

This fixes an issue with a tab not updating its bookmark button when
we either edit or delete a bookmark and the tab happens to be on the
same page associated with the bookmark URL. `BookmarksBarWidget`
"signals" a `Tab` object of any bookmark changes, where it will
update the bookmark button depending on if the current URL is an
existing bookmark or not.
This commit is contained in:
Kemal Zebari 2023-03-29 19:36:57 -07:00 committed by Andrew Kaster
parent 86781f0c08
commit 0060b8c4e5
3 changed files with 19 additions and 12 deletions

View file

@ -606,7 +606,6 @@ void Tab::bookmark_current_url()
} else {
BookmarksBarWidget::the().add_bookmark(url, m_title);
}
update_bookmark_button(url);
}
void Tab::update_bookmark_button(DeprecatedString const& url)
@ -635,10 +634,8 @@ void Tab::did_become_active()
m_statusbar->set_text(url);
};
BookmarksBarWidget::the().on_bookmark_add = [this](auto& url) {
auto current_url = this->url().to_deprecated_string();
if (current_url == url)
update_bookmark_button(current_url);
BookmarksBarWidget::the().on_bookmark_change = [this]() {
update_bookmark_button(url().to_deprecated_string());
};
BookmarksBarWidget::the().remove_from_parent();