xref: /haiku/src/apps/firstbootprompt/BootPrompt.cpp (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2010, Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "BootPrompt.h"
8 
9 #include <stdlib.h>
10 
11 #include <Catalog.h>
12 #include <LaunchRoster.h>
13 #include <Locale.h>
14 
15 #include "BootPromptWindow.h"
16 
17 
18 static int sExitValue;
19 
20 
21 int
22 main(int, char **)
23 {
24 	BootPromptApp app;
25 	app.Run();
26 	return sExitValue;
27 }
28 
29 
30 // #pragma mark -
31 
32 
33 const char* kAppSignature = "application/x-vnd.Haiku-FirstBootPrompt";
34 
35 
36 BootPromptApp::BootPromptApp()
37 	:
38 	BApplication(kAppSignature)
39 {
40 }
41 
42 
43 void
44 BootPromptApp::MessageReceived(BMessage* message)
45 {
46 	switch (message->what) {
47 		case MSG_BOOT_DESKTOP:
48 			BLaunchRoster().Target("desktop");
49 			sExitValue = 1;
50 			PostMessage(B_QUIT_REQUESTED);
51 			break;
52 		case MSG_RUN_INSTALLER:
53 			BLaunchRoster().Target("installer");
54 			sExitValue = 0;
55 			PostMessage(B_QUIT_REQUESTED);
56 			break;
57 
58 		default:
59 			BApplication::MessageReceived(message);
60 	}
61 }
62 
63 
64 void
65 BootPromptApp::ReadyToRun()
66 {
67 	// Prompt the user to select his preferred language.
68 	new BootPromptWindow();
69 }
70 
71