summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-09-23 09:57:56 -0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-10-01 13:39:10 +0330
commit929f31f5648de95d0f2043688127059f2ab0fd3a (patch)
treeaf72d723ae6634fe2197d89cd8031925a60fdd51
parentbe3cc756fcffd94badf37c9f8fba603776a746ac (diff)
downloadserenity-929f31f5648de95d0f2043688127059f2ab0fd3a.zip
Welcome: Add/remove SystemServer group entry to toggle startup
Previously Welcome relied on a bogus executable key value to disable startup. This always printed an error on login and littered the config file with a useless entry. Adding/removing the group as needed seems a bit nicer.
-rw-r--r--Userland/Applications/Welcome/WelcomeWidget.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp
index 5e327e944a..fed531ccb3 100644
--- a/Userland/Applications/Welcome/WelcomeWidget.cpp
+++ b/Userland/Applications/Welcome/WelcomeWidget.cpp
@@ -66,11 +66,14 @@ WelcomeWidget::WelcomeWidget()
GUI::Application::the()->quit();
};
- auto exec_path = Config::read_string("SystemServer"sv, "Welcome"sv, "Executable"sv, {});
- m_startup_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("startup_checkbox");
- m_startup_checkbox->set_checked(!exec_path.is_empty());
+ auto welcome = Config::list_groups("SystemServer"sv).first_matching([](auto& group) { return group == "Welcome"sv; });
+ m_startup_checkbox = find_descendant_of_type_named<GUI::CheckBox>("startup_checkbox");
+ m_startup_checkbox->set_checked(welcome.has_value());
m_startup_checkbox->on_checked = [](bool is_checked) {
- Config::write_string("SystemServer"sv, "Welcome"sv, "Executable"sv, is_checked ? "/bin/Welcome"sv : ""sv);
+ if (is_checked)
+ Config::add_group("SystemServer"sv, "Welcome"sv);
+ else
+ Config::remove_group("SystemServer"sv, "Welcome"sv);
};
open_and_parse_readme_file();