When the media server is not running, display an alert and offer to start it.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31035 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-06-13 17:06:58 +00:00
parent 7d62dd099d
commit dc3d592369
+25 -9
View File
@@ -124,14 +124,6 @@ MainApp::PlayerCount() const
void
MainApp::ReadyToRun()
{
// make sure we have at least one window open
FirstWindow();
// setup the settings window now, we need to have it
fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520));
fSettingsWindow->Hide();
fSettingsWindow->Show();
// Now tell the application roster, that we're interested
// in getting notifications of apps being launched or quit.
// In this way we are going to detect a media_server restart.
@@ -139,8 +131,32 @@ MainApp::ReadyToRun()
B_REQUEST_LAUNCHED | B_REQUEST_QUIT);
// we will keep track of the status of media_server
// and media_addon_server
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
BAlert* alert = new BAlert("start_media_server",
"It appears the Media Server is not running.\n"
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 0) {
PostMessage(B_QUIT_REQUESTED);
return;
}
launch_media_server();
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
}
// make sure we have at least one window open
FirstWindow();
// setup the settings window now, we need to have it
fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520));
fSettingsWindow->Hide();
fSettingsWindow->Show();
}