now quits gracefully when no media roster is available
cosmetic changes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13095 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5fa7753230
commit
4dfe5b819b
@ -1,5 +1,9 @@
|
||||
SubDir OBOS_TOP src prefs media ;
|
||||
|
||||
if $(TARGET_PLATFORM) != haiku {
|
||||
SubDirC++Flags -fmultiple-symbol-spaces ;
|
||||
}
|
||||
|
||||
UsePrivateHeaders media ;
|
||||
|
||||
Preference Media :
|
||||
@ -8,7 +12,7 @@ Preference Media :
|
||||
MediaViews.cpp
|
||||
MediaListItem.cpp
|
||||
MediaAlert.cpp
|
||||
: libmedia.so be
|
||||
: libmedia.so be
|
||||
: media.rdef
|
||||
;
|
||||
|
||||
|
@ -68,6 +68,16 @@ Media::~Media()
|
||||
be_roster->StopWatching(BMessenger(this));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Media::InitCheck()
|
||||
{
|
||||
if (mWindow)
|
||||
return mWindow->InitCheck();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// Media::MessageReceived -- handles incoming messages
|
||||
void Media::MessageReceived (BMessage *message)
|
||||
{
|
||||
@ -88,7 +98,8 @@ void Media::MessageReceived (BMessage *message)
|
||||
int main(void)
|
||||
{
|
||||
Media theApp;
|
||||
theApp.Run();
|
||||
if (theApp.InitCheck() == B_OK)
|
||||
theApp.Run();
|
||||
return 0;
|
||||
}
|
||||
// end ------------------------------------------------------------------------------------------------------ //
|
||||
|
@ -29,6 +29,7 @@ class Media : public BApplication
|
||||
Media();
|
||||
~Media();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
status_t InitCheck();
|
||||
|
||||
private:
|
||||
MediaWindow *mWindow;
|
||||
|
@ -43,12 +43,20 @@ MediaWindow::MediaWindow(BRect frame)
|
||||
: BWindow (frame, "Media", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
||||
mCurrentNode(NULL),
|
||||
mParamWeb(NULL),
|
||||
mAlert(NULL)
|
||||
mAlert(NULL),
|
||||
mInitCheck(B_OK)
|
||||
{
|
||||
InitWindow();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MediaWindow::InitCheck()
|
||||
{
|
||||
return mInitCheck;
|
||||
}
|
||||
|
||||
|
||||
// MediaWindow - Destructor
|
||||
MediaWindow::~MediaWindow()
|
||||
{
|
||||
@ -80,6 +88,7 @@ MediaWindow::~MediaWindow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
|
||||
{
|
||||
@ -113,6 +122,7 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MediaListItem *
|
||||
MediaWindow::FindMediaListItem(dormant_node_info *info)
|
||||
{
|
||||
@ -126,6 +136,7 @@ MediaWindow::FindMediaListItem(dormant_node_info *info)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MediaWindow::AddNodes(BList &list, bool isVideo)
|
||||
{
|
||||
@ -136,8 +147,10 @@ MediaWindow::AddNodes(BList &list, bool isVideo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MediaWindow::InitWindow -- Initialization Commands here
|
||||
void MediaWindow::InitWindow(void)
|
||||
void
|
||||
MediaWindow::InitWindow(void)
|
||||
{
|
||||
// Bitmaps
|
||||
BRect iconRect(0,0,15,15);
|
||||
@ -200,11 +213,12 @@ void MediaWindow::InitWindow(void)
|
||||
|
||||
mBar = new BarView(barRect);
|
||||
mBox->AddChild(mBar);
|
||||
|
||||
if(InitMedia(true)!=B_OK)
|
||||
|
||||
mInitCheck = InitMedia(true);
|
||||
if (mInitCheck != B_OK) {
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
else {
|
||||
if(IsHidden())
|
||||
} else {
|
||||
if (IsHidden())
|
||||
Show();
|
||||
}
|
||||
}
|
||||
@ -349,6 +363,7 @@ MediaWindow::InitMedia(bool first)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// MediaWindow::QuitRequested -- Post a message to the app to quit
|
||||
bool
|
||||
MediaWindow::QuitRequested()
|
||||
|
@ -36,7 +36,8 @@ class MediaWindow : public BWindow
|
||||
~MediaWindow();
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void FrameResized(float width, float height);
|
||||
status_t InitCheck();
|
||||
private:
|
||||
status_t InitMedia(bool first);
|
||||
void FindNodes(media_type type, uint64 kind, BList &list);
|
||||
@ -64,6 +65,7 @@ class MediaWindow : public BWindow
|
||||
|
||||
BList mIcons;
|
||||
MediaAlert *mAlert;
|
||||
status_t mInitCheck;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user