Skip to content

Commit

Permalink
Media: Refresh window also at QUIT event.
Browse files Browse the repository at this point in the history
* Since the Media preferences are always watching for media
  status, it's good to clean up the window when the media services
  are not running. This avoid the user try to use controls where
  services are down.
  • Loading branch information
Numerio committed Jul 30, 2015
1 parent 922d203 commit 7bdc7ee
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/preferences/media/MediaWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ MediaWindow::MediaWindow(BRect frame)
BMediaRoster* roster = BMediaRoster::Roster();
roster->StartWatching(BMessenger(this, this),
B_MEDIA_SERVER_STARTED);
roster->StartWatching(BMessenger(this, this),
B_MEDIA_SERVER_QUIT);
}


Expand All @@ -217,6 +219,8 @@ MediaWindow::~MediaWindow()
BMediaRoster* roster = BMediaRoster::CurrentRoster();
roster->StopWatching(BMessenger(this, this),
B_MEDIA_SERVER_STARTED);
roster->StartWatching(BMessenger(this, this),
B_MEDIA_SERVER_QUIT);
}


Expand Down Expand Up @@ -337,6 +341,7 @@ MediaWindow::MessageReceived(BMessage* message)
resume_thread(fRestartThread);
break;
}

case B_MEDIA_WEB_CHANGED:
case ML_SELECTED_NODE:
{
Expand All @@ -352,12 +357,15 @@ MediaWindow::MessageReceived(BMessage* message)
item->AlterWindow(this);
break;
}

case B_MEDIA_SERVER_STARTED:
case B_MEDIA_SERVER_QUIT:
{
PRINT_OBJECT(*message);
_InitMedia(false);
break;
}

default:
BWindow::MessageReceived(message);
break;
Expand Down

0 comments on commit 7bdc7ee

Please sign in to comment.