2 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Copyright 2010, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>. All rightts reserved.
4 * Distributed under the terms of the MIT License.
8 #include <AboutWindow.h>
10 #include <Application.h>
16 #include "LocalePreflet.h"
17 #include "LocaleWindow.h"
20 #undef B_TRANSLATION_CONTEXT
21 #define B_TRANSLATION_CONTEXT "Locale Preflet"
24 const char* kAppName
= B_TRANSLATE("Locale");
25 const char* kSignature
= "application/x-vnd.Haiku-Locale";
28 class LocalePreflet
: public BApplication
{
31 virtual ~LocalePreflet();
33 virtual void MessageReceived(BMessage
* message
);
36 status_t
_RestartApp(const char* signature
) const;
38 LocaleWindow
* fLocaleWindow
;
45 LocalePreflet::LocalePreflet()
47 BApplication(kSignature
),
48 fLocaleWindow(new LocaleWindow())
50 fLocaleWindow
->Show();
54 LocalePreflet::~LocalePreflet()
60 LocalePreflet::MessageReceived(BMessage
* message
)
62 switch (message
->what
) {
63 case B_LOCALE_CHANGED
:
64 BLocaleRoster::Default()->Refresh();
65 fLocaleWindow
->PostMessage(message
);
68 case kMsgRestartTrackerAndDeskbar
:
69 if (message
->FindInt32("which") == 1) {
70 _RestartApp("application/x-vnd.Be-TRAK");
71 _RestartApp("application/x-vnd.Be-TSKB");
75 case B_ABOUT_REQUESTED
:
79 const char* authors
[] = {
86 window
= new BAboutWindow(kAppName
, kSignature
);
87 window
->AddCopyright(2005, "Haiku, Inc.");
88 window
->AddAuthors(authors
);
96 BApplication::MessageReceived(message
);
103 LocalePreflet::_RestartApp(const char* signature
) const
106 status_t status
= be_roster
->GetAppInfo(signature
, &info
);
110 BMessenger
application(signature
);
111 status
= application
.SendMessage(B_QUIT_REQUESTED
);
116 wait_for_thread(info
.thread
, &exit
);
118 return be_roster
->Launch(signature
);
126 main(int argc
, char** argv
)