desklink: Use early return, no functional change.

This commit is contained in:
Michael Lotz 2015-04-05 21:25:09 +02:00
parent 77c35db9a9
commit 5c7707fc34

View File

@ -302,31 +302,32 @@ VolumeControl::MessageReceived(BMessage* msg)
bool isMediaServer = !strcmp(signature, kMediaServerSignature); bool isMediaServer = !strcmp(signature, kMediaServerSignature);
bool isAddOnServer = !strcmp(signature, kAddOnServerSignature); bool isAddOnServer = !strcmp(signature, kAddOnServerSignature);
if (!isMediaServer && !isAddOnServer)
break;
if (isMediaServer) if (isMediaServer)
fMediaServerRunning = msg->what == B_SOME_APP_LAUNCHED; fMediaServerRunning = msg->what == B_SOME_APP_LAUNCHED;
if (isAddOnServer) if (isAddOnServer)
fAddOnServerRunning = msg->what == B_SOME_APP_LAUNCHED; fAddOnServerRunning = msg->what == B_SOME_APP_LAUNCHED;
if (isMediaServer || isAddOnServer) { if (!fMediaServerRunning && !fAddOnServerRunning) {
if (!fMediaServerRunning && !fAddOnServerRunning) { // No media server around
// No media server around SetLabel(B_TRANSLATE("No media server running"));
SetLabel(B_TRANSLATE("No media server running")); SetEnabled(false);
SetEnabled(false); } else if (fMediaServerRunning && fAddOnServerRunning) {
} else if (fMediaServerRunning && fAddOnServerRunning) { // HACK!
// HACK! // quit our now invalid instance of the media roster
// quit our now invalid instance of the media roster // so that before new nodes are created,
// so that before new nodes are created, // we get a new roster
// we get a new roster BMediaRoster* roster = BMediaRoster::CurrentRoster();
BMediaRoster* roster = BMediaRoster::CurrentRoster(); if (roster != NULL) {
if (roster != NULL) { roster->Lock();
roster->Lock(); roster->Quit();
roster->Quit();
}
BMessage reconnect(kMsgReconnectVolume);
BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
fConnectRetries = 3;
} }
BMessage reconnect(kMsgReconnectVolume);
BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
fConnectRetries = 3;
} }
break; break;
} }