1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

Applications: Port Assistant to LibMain

This commit is contained in:
Lenny Maiorani 2022-02-09 12:57:36 -07:00 committed by Linus Groh
parent 133a30c8b7
commit f0d2489254
2 changed files with 9 additions and 7 deletions

View file

@ -11,5 +11,5 @@ set(SOURCES
) )
serenity_app(Assistant ICON app-run) serenity_app(Assistant ICON app-run)
target_link_libraries(Assistant LibCore LibDesktop LibGUI LibJS LibThreading) target_link_libraries(Assistant LibCore LibDesktop LibGUI LibJS LibMain LibThreading)
link_with_unicode_data(Assistant) link_with_unicode_data(Assistant)

View file

@ -1,13 +1,17 @@
/* /*
* Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com> * Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com>
* Copyright (c) 2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include "Providers.h" #include "Providers.h"
#include <AK/Error.h>
#include <AK/QuickSort.h> #include <AK/QuickSort.h>
#include <AK/String.h> #include <AK/String.h>
#include <AK/Try.h>
#include <LibCore/LockFile.h> #include <LibCore/LockFile.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h> #include <LibGUI/BoxLayout.h>
#include <LibGUI/Event.h> #include <LibGUI/Event.h>
@ -17,6 +21,7 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/TextBox.h> #include <LibGUI/TextBox.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibMain/Main.h>
#include <LibThreading/Mutex.h> #include <LibThreading/Mutex.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -186,12 +191,9 @@ private:
static constexpr size_t MAX_SEARCH_RESULTS = 6; static constexpr size_t MAX_SEARCH_RESULTS = 6;
int main(int argc, char** argv) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
if (pledge("stdio recvfd sendfd rpath cpath unix proc exec thread", nullptr) < 0) { TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath unix proc exec thread", nullptr));
perror("pledge");
return 1;
}
Core::LockFile lockfile("/tmp/lock/assistant.lock"); Core::LockFile lockfile("/tmp/lock/assistant.lock");
@ -205,7 +207,7 @@ int main(int argc, char** argv)
return 0; return 0;
} }
auto app = GUI::Application::construct(argc, argv); auto app = GUI::Application::construct(arguments);
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_minimizable(false); window->set_minimizable(false);