* Copyright 2010, Stephan Aßmus <superstippi@gmx.de>
* Copyright 2020, Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "BootPrompt.h"
#include <stdlib.h>
#include <Catalog.h>
#include <LaunchRoster.h>
#include <Locale.h>
#include <syscalls.h>
static int sExitValue;
int
main(int, char **)
{
BootPromptApp app;
app.Run();
return sExitValue;
}
const char* kAppSignature = "application/x-vnd.Haiku-FirstBootPrompt";
const char* kDeskbarSignature = "application/x-vnd.Be-TSKB";
BootPromptApp::BootPromptApp()
:
BApplication(kAppSignature)
{
}
void
BootPromptApp::MessageReceived(BMessage* message)
{
switch (message->what) {
case MSG_BOOT_DESKTOP:
{
BLaunchRoster().Target("desktop");
sExitValue = 1;
PostMessage(B_QUIT_REQUESTED);
break;
}
case MSG_RUN_INSTALLER:
{
BLaunchRoster().Target("installer");
sExitValue = 0;
PostMessage(B_QUIT_REQUESTED);
break;
}
case MSG_REBOOT_REQUESTED:
{
_kern_shutdown(true);
sExitValue = -1;
break;
}
default:
BApplication::MessageReceived(message);
}
}
void
BootPromptApp::ReadyToRun()
{
new BootPromptWindow();
}
bool
BootPromptApp::QuitRequested()
{
return true;
}