mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
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.
This commit is contained in:
parent
be3cc756fc
commit
929f31f564
Notes:
sideshowbarker
2024-07-17 06:51:48 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/929f31f564 Pull-request: https://github.com/SerenityOS/serenity/pull/15329 Reviewed-by: https://github.com/alimpfard
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue