If we're going to fail because of a missing CD drive, never show the CD player window at all instead of flickering it briefly. This fixes ticket #2333.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28963 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2009-01-20 01:42:15 +00:00
parent bd98bd9555
commit 5d1e75d3cb
2 changed files with 17 additions and 6 deletions

View File

@ -85,7 +85,6 @@ CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask,
" drives on your computer or there is no system software to "
"support one. Sorry.", "OK");
alert->Go();
be_app->PostMessage(B_QUIT_REQUESTED);
}
fWindowState = fCDDrive.GetState();
@ -104,6 +103,13 @@ CDPlayer::~CDPlayer()
}
bool
CDPlayer::InitCheck()
{
return (fCDDrive.CountDrives() > 0);
}
void
CDPlayer::BuildGUI()
{
@ -638,10 +644,14 @@ CDPlayerApplication::CDPlayerApplication()
: BApplication("application/x-vnd.Haiku-CDPlayer")
{
BWindow *window = new CDPlayerWindow();
BView *view = new CDPlayer(window->Bounds(), "CD");
window->ResizeTo(view->Bounds().Width(), view->Bounds().Height());
window->AddChild(view);
window->Show();
CDPlayer *view = new CDPlayer(window->Bounds(), "CD");
if (view->InitCheck()) {
window->ResizeTo(view->Bounds().Width(), view->Bounds().Height());
window->AddChild(view);
window->Show();
}
else
PostMessage(B_QUIT_REQUESTED);
}

View File

@ -33,7 +33,8 @@ class CDPlayer : public BView {
virtual ~CDPlayer();
void BuildGUI();
bool InitCheck();
virtual void AttachedToWindow();
virtual void Pulse();
virtual void MessageReceived(BMessage *);