mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
WidgetGallery: Port to LibMain :^)
This commit is contained in:
parent
24bf74a177
commit
3d126fe921
2 changed files with 13 additions and 36 deletions
|
@ -27,4 +27,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(WidgetGallery ICON app-widget-gallery)
|
serenity_app(WidgetGallery ICON app-widget-gallery)
|
||||||
target_link_libraries(WidgetGallery LibGUI)
|
target_link_libraries(WidgetGallery LibGUI LibMain)
|
||||||
|
|
|
@ -1,53 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GalleryWidget.h"
|
#include "GalleryWidget.h"
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.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 thread", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix thread", nullptr));
|
||||||
perror("pledge");
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
|
||||||
|
|
||||||
if (pledge("stdio recvfd sendfd rpath thread", nullptr) < 0) {
|
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/home/anon", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/etc/FileIconProvider.ini", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath thread", nullptr));
|
||||||
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/home/anon", "r"));
|
||||||
|
TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r"));
|
||||||
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = TRY(GUI::Window::try_create());
|
||||||
window->resize(430, 480);
|
window->resize(430, 480);
|
||||||
window->set_title("Widget Gallery");
|
window->set_title("Widget Gallery");
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue