|
@@ -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);
|