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