mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
SystemMenu: Move SystemDialog into SystemMenu and remove INI config
I probably would've done INI config removal in another commit, but it fit well here because I didn't want to pledge wpath for SystemMenu if I didn't need to. Frankly, that's something that I think should be done: allow ConfigFile to be used read-only.
This commit is contained in:
parent
9784ab99d2
commit
30556a0a93
8 changed files with 87 additions and 121 deletions
|
@ -40,6 +40,8 @@
|
|||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "PowerDialog.h"
|
||||
|
||||
//#define SYSTEM_MENU_DEBUG
|
||||
|
||||
struct AppMetadata {
|
||||
|
@ -88,6 +90,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/etc/PowerOptions.ini", "r")) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
return app.exec();
|
||||
|
@ -193,8 +200,13 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
}));
|
||||
system_menu->add_separator();
|
||||
system_menu->add_action(GUI::Action::create("Exit...", [](auto&) {
|
||||
Vector<char const*> command = PowerDialog::show();
|
||||
|
||||
if (command.size() == 0)
|
||||
return;
|
||||
|
||||
if (fork() == 0) {
|
||||
execl("/bin/SystemDialog", "/bin/SystemDialog", nullptr);
|
||||
execv(command[0], const_cast<char* const*>(command.data()));
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue