[haiku-commits] r37305 - haiku/trunk/src/preferences/screensaver

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 30 Jun 2010 00:30:43 +0200 (CEST)

Author: korli
Date: 2010-06-30 00:30:42 +0200 (Wed, 30 Jun 2010)
New Revision: 37305
Changeset: http://dev.haiku-os.org/changeset/37305/haiku
Ticket: http://dev.haiku-os.org/ticket/5938

Modified:
   haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp
Log:
Applied idea from idefix (see bug #5938): try to launch screen_blanker by path 
when a launch by signature fails.


Modified: haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp       
2010-06-29 17:33:56 UTC (rev 37304)
+++ haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp       
2010-06-29 22:30:42 UTC (rev 37305)
@@ -365,6 +365,7 @@
                }
 
                case kMsgTestSaver:
+               {
                        SaveState();
                        fSettings.Save();
 
@@ -372,10 +373,25 @@
 
                        be_roster->StartWatching(BMessenger(this, 
this->Looper()),
                                B_REQUEST_QUIT);
-                       be_roster->Launch(SCREEN_BLANKER_SIG, 
&fSettings.Message(),
-                               &fScreenSaverTestTeamId);
+                       if (be_roster->Launch(SCREEN_BLANKER_SIG, 
&fSettings.Message(),
+                               &fScreenSaverTestTeamId) == B_OK)
+                               break;
+                       
+                       // Try really hard to launch it. It's very likely that 
this fails,
+                       // when we run from the CD and there is only an 
incomplete mime
+                       // database for example...
+                       BPath path;
+                       if (find_directory(B_SYSTEM_BIN_DIRECTORY, &path) != 
B_OK
+                               || path.Append("screen_blanker") != B_OK) {
+                               path.SetTo("/boot/system/bin/screen_blanker");
+                       }
+                       BEntry entry(path.Path());
+                       entry_ref ref;
+                       if (entry.GetRef(&ref) == B_OK)
+                               be_roster->Launch(&ref, &fSettings.Message(),
+                                       &fScreenSaverTestTeamId);
                        break;
-
+               }
                case kMsgAddSaver:
                        fFilePanel->Show();
                        break;


Other related posts: