Modified launching of applications. Should be able to launch Haiku, BeOS or Zeta RC3
Media Player, Media and Sounds preferences. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8581 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,7 +11,8 @@
|
|||||||
// Description: VolumeControl and link items in Deskbar
|
// Description: VolumeControl and link items in Deskbar
|
||||||
// Created : October 20, 2003
|
// Created : October 20, 2003
|
||||||
// Modified by: Jérome Duval
|
// Modified by: Jérome Duval
|
||||||
// Modified by: François Revol, 10/31/2003
|
// Modified by: François Revol, 10/31/2003
|
||||||
|
// Modified by: Marcus Overhagen, 15/08/2004
|
||||||
//
|
//
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *);
|
||||||
private:
|
private:
|
||||||
|
status_t LaunchByPath(const char *path);
|
||||||
|
status_t LaunchBySig(const char *sig);
|
||||||
void LoadSettings();
|
void LoadSettings();
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
BBitmap * segments;
|
BBitmap * segments;
|
||||||
@@ -168,15 +171,33 @@ MediaReplicant::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
case OPEN_MEDIA_PLAYER:
|
case OPEN_MEDIA_PLAYER:
|
||||||
// launch the media player app
|
// launch the media player app
|
||||||
be_roster->Launch("application/x-vnd.Be.MediaPlayer");
|
if (B_OK == LaunchBySig("application/x-vnd.Haiku.MediaPlayer"))
|
||||||
break;
|
break;
|
||||||
|
if (B_OK == LaunchBySig("application/x-vnd.Be.MediaPlayer"))
|
||||||
|
break;
|
||||||
|
if (B_OK == LaunchByPath("/boot/beos/apps/MediaPlayer"))
|
||||||
|
break;
|
||||||
|
(new BAlert("desklink", "Couldn't launch MediaPlayer", "OK"))->Go();
|
||||||
|
break;
|
||||||
case MEDIA_SETTINGS:
|
case MEDIA_SETTINGS:
|
||||||
// launch the media prefs app
|
// launch the media prefs app
|
||||||
be_roster->Launch("application/x-vnd.Be.MediaPrefs");
|
if (B_OK == LaunchBySig("application/x-vnd.Haiku.MediaPrefs"))
|
||||||
|
break;
|
||||||
|
if (B_OK == LaunchBySig("application/x-vnd.Be.MediaPrefs"))
|
||||||
|
break;
|
||||||
|
if (B_OK == LaunchByPath("/boot/home/config/be/Preferences/Media"))
|
||||||
|
break;
|
||||||
|
(new BAlert("desklink", "Couldn't launch Media Preferences", "OK"))->Go();
|
||||||
break;
|
break;
|
||||||
case SOUND_SETTINGS:
|
case SOUND_SETTINGS:
|
||||||
// launch the sounds prefs app
|
// launch the sounds prefs app
|
||||||
be_roster->Launch("application/x-vnd.Be.SoundsPrefs");
|
if (B_OK == LaunchBySig("application/x-vnd.Haiku.SoundsPrefs"))
|
||||||
|
break;
|
||||||
|
if (B_OK == LaunchBySig("application/x-vnd.Be.SoundsPrefs"))
|
||||||
|
break;
|
||||||
|
if (B_OK == LaunchByPath("/boot/home/config/be/Preferences/Sounds"))
|
||||||
|
break;
|
||||||
|
(new BAlert("desklink", "Couldn't launch Sounds Preferences", "OK"))->Go();
|
||||||
break;
|
break;
|
||||||
case TOGGLE_DONT_BEEP:
|
case TOGGLE_DONT_BEEP:
|
||||||
confDontBeep = !confDontBeep;
|
confDontBeep = !confDontBeep;
|
||||||
@@ -191,6 +212,46 @@ MediaReplicant::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
MediaReplicant::LaunchByPath(const char *path)
|
||||||
|
{
|
||||||
|
BEntry ent;
|
||||||
|
entry_ref ref;
|
||||||
|
app_info appInfo;
|
||||||
|
status_t err;
|
||||||
|
|
||||||
|
err = ent.SetTo(path);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
err = ent.GetRef(&ref);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
err = be_roster->Launch(&ref);
|
||||||
|
if (err != B_ALREADY_RUNNING)
|
||||||
|
return err; // should be B_OK or fatal error
|
||||||
|
err = be_roster->GetAppInfo(&ref, &appInfo);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
return be_roster->ActivateApp(appInfo.team);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
MediaReplicant::LaunchBySig(const char *sig)
|
||||||
|
{
|
||||||
|
app_info appInfo;
|
||||||
|
status_t err;
|
||||||
|
|
||||||
|
err = be_roster->Launch(sig);
|
||||||
|
if (err != B_ALREADY_RUNNING)
|
||||||
|
return err; // should be B_OK or fatal error
|
||||||
|
err = be_roster->GetAppInfo(sig, &appInfo);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
return be_roster->ActivateApp(appInfo.team);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaReplicant::Draw(BRect rect)
|
MediaReplicant::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user