mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
Browser: Share one BookmarksBarWidget between all Tabs
This commit is contained in:
parent
dc6b61dbcc
commit
bd45b2b8d3
7 changed files with 93 additions and 50 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "BookmarksBarWidget.h"
|
||||
#include "InspectorWidget.h"
|
||||
#include "Tab.h"
|
||||
#include "WindowActions.h"
|
||||
|
@ -39,6 +40,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const char* bookmarks_filename = "/home/anon/bookmarks.json";
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (getuid() == 0) {
|
||||
|
@ -76,6 +79,9 @@ int main(int argc, char** argv)
|
|||
auto m_config = Core::ConfigFile::get_for_app("Browser");
|
||||
auto home_url = m_config->read_entry("Preferences", "Home", "file:///home/anon/www/welcome.html");
|
||||
|
||||
bool bookmarksbar_enabled = true;
|
||||
auto bookmarks_bar = Browser::BookmarksBarWidget::construct(bookmarks_filename, bookmarksbar_enabled);
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_rect(100, 100, 640, 480);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"));
|
||||
|
@ -161,6 +167,11 @@ int main(int argc, char** argv)
|
|||
GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window);
|
||||
};
|
||||
|
||||
window_actions.on_show_bookmarks_bar = [&](auto& action) {
|
||||
Browser::BookmarksBarWidget::the().set_visible(action.is_checked());
|
||||
};
|
||||
window_actions.show_bookmarks_bar_action().set_checked(bookmarksbar_enabled);
|
||||
|
||||
create_new_tab(default_url, true);
|
||||
window->show();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue