From 6dde2c7f4799110e7bf2c9e3315fe04545490da7 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sat, 25 Apr 2020 03:25:11 +0000 Subject: [PATCH] Browser: Add Browser.ini configuration file The Browser can now load a home page URL from the user's Browser.ini configuration file rather than using a hard-coded URL. --- Applications/Browser/main.cpp | 6 ++++-- Base/home/anon/Browser.ini | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Base/home/anon/Browser.ini diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index 423c9772db..3003e4823c 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -27,6 +27,7 @@ #include "InspectorWidget.h" #include "Tab.h" #include "WindowActions.h" +#include #include #include #include @@ -38,8 +39,6 @@ #include #include -static const char* home_url = "file:///home/anon/www/welcome.html"; - int main(int argc, char** argv) { if (getuid() == 0) { @@ -74,6 +73,9 @@ int main(int argc, char** argv) unveil(nullptr, nullptr); + auto m_config = Core::ConfigFile::get_for_app("Browser"); + auto home_url = m_config->read_entry("Preferences", "Home", "file:///home/anon/www/welcome.html"); + 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")); diff --git a/Base/home/anon/Browser.ini b/Base/home/anon/Browser.ini new file mode 100644 index 0000000000..fb8a443d70 --- /dev/null +++ b/Base/home/anon/Browser.ini @@ -0,0 +1,2 @@ +[Preferences] +Home=file:///home/anon/www/welcome.html