summaryrefslogtreecommitdiff
path: root/Userland/Applications/About
diff options
context:
space:
mode:
authorAstraeus- <Astraeus-@users.noreply.github.com>2021-12-14 23:53:16 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-17 13:09:54 -0800
commiteec6ae0d07261ee01cb3f5d425597b745b10f395 (patch)
tree20e2a4960000938d6c52ff804c60f7c474125b8d /Userland/Applications/About
parent61fed26400b6f6f3d81ae9297fd936697a316acd (diff)
downloadserenity-eec6ae0d07261ee01cb3f5d425597b745b10f395.zip
About: Port to LibMain
Diffstat (limited to 'Userland/Applications/About')
-rw-r--r--Userland/Applications/About/CMakeLists.txt2
-rw-r--r--Userland/Applications/About/main.cpp31
2 files changed, 11 insertions, 22 deletions
diff --git a/Userland/Applications/About/CMakeLists.txt b/Userland/Applications/About/CMakeLists.txt
index eac81f96d1..e1e704f6c3 100644
--- a/Userland/Applications/About/CMakeLists.txt
+++ b/Userland/Applications/About/CMakeLists.txt
@@ -15,4 +15,4 @@ execute_process(COMMAND "git diff-index --quiet HEAD -- && echo tracked || echo
add_definitions(-DGIT_COMMIT="${GIT_COMMIT}" -DGIT_BRANCH="${GIT_BRANCH}" -DGIT_CHANGES="${GIT_CHANGES}")
serenity_bin(About)
-target_link_libraries(About LibGUI)
+target_link_libraries(About LibGUI LibMain)
diff --git a/Userland/Applications/About/main.cpp b/Userland/Applications/About/main.cpp
index e67b327b48..3065a2143e 100644
--- a/Userland/Applications/About/main.cpp
+++ b/Userland/Applications/About/main.cpp
@@ -1,37 +1,26 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2021, Julius Heijmen <julius.heijmen@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <LibCore/System.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>
-#include <stdio.h>
-#include <unistd.h>
+#include <LibMain/Main.h>
-int main(int argc, char** argv)
+ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- if (pledge("stdio recvfd sendfd rpath unix", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
+ auto app = TRY(GUI::Application::try_create(arguments));
- auto app = GUI::Application::construct(argc, argv);
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
+ TRY(Core::System::unveil("/res", "r"));
+ TRY(Core::System::unveil(nullptr, nullptr));
- if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
-
- if (unveil("/res", "r") < 0) {
- perror("unveil");
- return 1;
- }
-
- unveil(nullptr, nullptr);
-
- auto app_icon = GUI::Icon::default_icon("ladyball");
+ auto app_icon = TRY(GUI::Icon::try_create_default_icon("ladyball"));
GUI::AboutDialog::show("SerenityOS", app_icon.bitmap_for_size(32), nullptr, app_icon.bitmap_for_size(16), Core::Version::read_long_version_string());
return app->exec();
}