summaryrefslogtreecommitdiff
path: root/Userland/Applications/Calculator/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-23 23:45:55 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-24 00:25:23 +0100
commit973cb0a49e30d7fbecda82026e91b199e8ecb36d (patch)
tree98915ef398d49df1f8cd6769d707ffe5c4543666 /Userland/Applications/Calculator/main.cpp
parentb3d412d3c12c97cc7940c58ed00788d1fea040af (diff)
downloadserenity-973cb0a49e30d7fbecda82026e91b199e8ecb36d.zip
Calculator: Port to LibMain :^)
Diffstat (limited to 'Userland/Applications/Calculator/main.cpp')
-rw-r--r--Userland/Applications/Calculator/main.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp
index bf7d34a358..2ebc65f157 100644
--- a/Userland/Applications/Calculator/main.cpp
+++ b/Userland/Applications/Calculator/main.cpp
@@ -5,6 +5,7 @@
*/
#include "CalculatorWidget.h"
+#include <LibCore/System.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
@@ -13,33 +14,22 @@
#include <LibGUI/Menubar.h>
#include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h>
+#include <LibMain/Main.h>
#include <stdio.h>
#include <unistd.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", nullptr));
+ auto app = TRY(GUI::Application::try_create(arguments));
- auto app = GUI::Application::construct(argc, argv);
-
- if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
-
- if (unveil("/res", "r") < 0) {
- perror("unveil");
- return 1;
- }
-
- unveil(nullptr, nullptr);
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr));
+ TRY(Core::System::unveil("/res", "r"));
+ TRY(Core::System::unveil(nullptr, nullptr));
auto app_icon = GUI::Icon::default_icon("app-calculator");
- auto window = GUI::Window::construct();
+ auto window = TRY(GUI::Window::try_create());
window->set_title("Calculator");
window->set_resizable(false);
window->resize(250, 215);