mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:37:44 +00:00
About: Port to LibMain
This commit is contained in:
parent
61fed26400
commit
eec6ae0d07
2 changed files with 11 additions and 22 deletions
|
@ -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}")
|
add_definitions(-DGIT_COMMIT="${GIT_COMMIT}" -DGIT_BRANCH="${GIT_BRANCH}" -DGIT_CHANGES="${GIT_CHANGES}")
|
||||||
|
|
||||||
serenity_bin(About)
|
serenity_bin(About)
|
||||||
target_link_libraries(About LibGUI)
|
target_link_libraries(About LibGUI LibMain)
|
||||||
|
|
|
@ -1,37 +1,26 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2021, Julius Heijmen <julius.heijmen@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/AboutDialog.h>
|
#include <LibGUI/AboutDialog.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <stdio.h>
|
#include <LibMain/Main.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) {
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
|
||||||
perror("pledge");
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("ladyball"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
unveil(nullptr, nullptr);
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::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());
|
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();
|
return app->exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue