mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
TerminalSettings: Port to LibMain :^)
This commit is contained in:
parent
8359975ff3
commit
6b862d5063
2 changed files with 12 additions and 33 deletions
|
@ -15,4 +15,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(TerminalSettings ICON app-terminal)
|
serenity_app(TerminalSettings ICON app-terminal)
|
||||||
target_link_libraries(TerminalSettings LibGUI LibConfig)
|
target_link_libraries(TerminalSettings LibGUI LibConfig LibMain)
|
||||||
|
|
|
@ -5,51 +5,30 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TerminalSettingsWidget.h"
|
#include "TerminalSettingsWidget.h"
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/SettingsWindow.h>
|
#include <LibGUI/SettingsWindow.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
|
|
||||||
// Including this after to avoid LibIPC errors
|
// Including this after to avoid LibIPC errors
|
||||||
#include <LibConfig/Client.h>
|
#include <LibConfig/Client.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr));
|
||||||
perror("pledge");
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
|
||||||
Config::pledge_domains("Terminal");
|
Config::pledge_domains("Terminal");
|
||||||
|
|
||||||
if (pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr));
|
||||||
perror("pledge");
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
return 1;
|
TRY(Core::System::unveil("/bin/keymap", "x"));
|
||||||
}
|
TRY(Core::System::unveil("/proc/keymap", "r"));
|
||||||
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
if (unveil("/res", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/bin/keymap", "x") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/proc/keymap", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr)) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-terminal");
|
auto app_icon = GUI::Icon::default_icon("app-terminal");
|
||||||
|
|
||||||
auto window = GUI::SettingsWindow::construct("Terminal Settings");
|
auto window = TRY(GUI::SettingsWindow::try_create("Terminal Settings"));
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
window->add_tab<TerminalSettingsMainWidget>("Terminal");
|
window->add_tab<TerminalSettingsMainWidget>("Terminal");
|
||||||
window->add_tab<TerminalSettingsViewWidget>("View");
|
window->add_tab<TerminalSettingsViewWidget>("View");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue