mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Welcome: Save startup preference to user's SystemServer session
Off by default.
This commit is contained in:
parent
586a936fac
commit
5d09f4abce
4 changed files with 15 additions and 2 deletions
|
@ -7,10 +7,12 @@
|
|||
#include "WelcomeWidget.h"
|
||||
#include <AK/Random.h>
|
||||
#include <Applications/Welcome/WelcomeWindowGML.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/BitmapFont.h>
|
||||
|
@ -66,6 +68,13 @@ WelcomeWidget::WelcomeWidget()
|
|||
GUI::Application::the()->quit();
|
||||
};
|
||||
|
||||
auto exec_path = Config::read_string("SystemServer", "Welcome", "Executable", {});
|
||||
m_startup_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("startup_checkbox");
|
||||
m_startup_checkbox->set_checked(!exec_path.is_empty());
|
||||
m_startup_checkbox->on_checked = [](bool is_checked) {
|
||||
Config::write_string("SystemServer", "Welcome", "Executable", is_checked ? "/bin/Welcome" : "");
|
||||
};
|
||||
|
||||
open_and_parse_readme_file();
|
||||
open_and_parse_tips_file();
|
||||
set_random_tip();
|
||||
|
|
|
@ -29,6 +29,7 @@ private:
|
|||
RefPtr<GUI::Button> m_help_button;
|
||||
RefPtr<GUI::Button> m_new_button;
|
||||
RefPtr<GUI::Label> m_tip_label;
|
||||
RefPtr<GUI::CheckBox> m_startup_checkbox;
|
||||
RefPtr<Web::OutOfProcessWebView> m_web_view;
|
||||
|
||||
size_t m_initial_tip_index { 0 };
|
||||
|
|
|
@ -104,8 +104,8 @@
|
|||
|
||||
@GUI::CheckBox{
|
||||
name: "startup_checkbox"
|
||||
text: "Show this Welcome Screen next time SerenityOS starts"
|
||||
fixed_width: 315
|
||||
text: "Show Welcome the next time SerenityOS starts"
|
||||
autosize: true
|
||||
}
|
||||
|
||||
@GUI::Widget
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "WelcomeWidget.h"
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -19,6 +20,8 @@ int main(int argc, char** argv)
|
|||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
Config::pledge_domains("SystemServer");
|
||||
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue