mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 10:19:03 +03:00
Browser: Use "about:blank" as the default home page
This can be overridden in Browser.ini, but if there's no value there, we now use "about:blank"
This commit is contained in:
parent
fe0de26277
commit
5fcd25e8f6
Notes:
sideshowbarker
2024-07-19 06:46:21 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5fcd25e8f6b
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
namespace Browser {
|
namespace Browser {
|
||||||
|
|
||||||
static const char* home_url = "file:///home/anon/www/welcome.html";
|
extern String g_home_url;
|
||||||
|
|
||||||
Tab::Tab()
|
Tab::Tab()
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ Tab::Tab()
|
|||||||
toolbar.add_action(*m_go_forward_action);
|
toolbar.add_action(*m_go_forward_action);
|
||||||
|
|
||||||
toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) {
|
toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) {
|
||||||
m_html_widget->load(home_url);
|
m_html_widget->load(g_home_url);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
toolbar.add_action(GUI::CommonActions::make_reload_action([this](auto&) {
|
toolbar.add_action(GUI::CommonActions::make_reload_action([this](auto&) {
|
||||||
|
@ -40,7 +40,12 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
namespace Browser {
|
||||||
|
|
||||||
static const char* bookmarks_filename = "/home/anon/bookmarks.json";
|
static const char* bookmarks_filename = "/home/anon/bookmarks.json";
|
||||||
|
String g_home_url;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@ -82,10 +87,10 @@ int main(int argc, char** argv)
|
|||||||
unveil(nullptr, nullptr);
|
unveil(nullptr, nullptr);
|
||||||
|
|
||||||
auto m_config = Core::ConfigFile::get_for_app("Browser");
|
auto m_config = Core::ConfigFile::get_for_app("Browser");
|
||||||
auto home_url = m_config->read_entry("Preferences", "Home", "file:///home/anon/www/welcome.html");
|
Browser::g_home_url = m_config->read_entry("Preferences", "Home", "about:blank");
|
||||||
|
|
||||||
bool bookmarksbar_enabled = true;
|
bool bookmarksbar_enabled = true;
|
||||||
auto bookmarks_bar = Browser::BookmarksBarWidget::construct(bookmarks_filename, bookmarksbar_enabled);
|
auto bookmarks_bar = Browser::BookmarksBarWidget::construct(Browser::bookmarks_filename, bookmarksbar_enabled);
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_rect(100, 100, 640, 480);
|
window->set_rect(100, 100, 640, 480);
|
||||||
@ -154,12 +159,12 @@ int main(int argc, char** argv)
|
|||||||
tab_widget.set_active_widget(&new_tab);
|
tab_widget.set_active_widget(&new_tab);
|
||||||
};
|
};
|
||||||
|
|
||||||
URL default_url = home_url;
|
URL first_url = Browser::g_home_url;
|
||||||
if (app.args().size() >= 1)
|
if (app.args().size() >= 1)
|
||||||
default_url = URL::create_with_url_or_path(app.args()[0]);
|
first_url = URL::create_with_url_or_path(app.args()[0]);
|
||||||
|
|
||||||
window_actions.on_create_new_tab = [&] {
|
window_actions.on_create_new_tab = [&] {
|
||||||
create_new_tab(default_url, true);
|
create_new_tab(Browser::g_home_url, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
window_actions.on_next_tab = [&] {
|
window_actions.on_next_tab = [&] {
|
||||||
@ -179,7 +184,7 @@ int main(int argc, char** argv)
|
|||||||
};
|
};
|
||||||
window_actions.show_bookmarks_bar_action().set_checked(bookmarksbar_enabled);
|
window_actions.show_bookmarks_bar_action().set_checked(bookmarksbar_enabled);
|
||||||
|
|
||||||
create_new_tab(default_url, true);
|
create_new_tab(first_url, true);
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
Loading…
Reference in New Issue
Block a user