[Haiku-commits] r31035 - haiku/trunk/src/apps/mediaplayer

stippi at mail.berlios.de stippi at mail.berlios.de
Sat Jun 13 19:07:11 CEST 2009


Author: stippi
Date: 2009-06-13 19:06:58 +0200 (Sat, 13 Jun 2009)
New Revision: 31035
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31035&view=rev

Modified:
   haiku/trunk/src/apps/mediaplayer/MainApp.cpp
Log:
When the media server is not running, display an alert and offer to start it.


Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainApp.cpp	2009-06-13 16:48:12 UTC (rev 31034)
+++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp	2009-06-13 17:06:58 UTC (rev 31035)
@@ -124,14 +124,6 @@
 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 @@
 		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();
 }
 
 




More information about the Haiku-commits mailing list