actions: move isMPDMusicSet checks at the end of conditionals

This commit is contained in:
Andrzej Rybczak
2012-09-19 05:18:36 +02:00
parent ae5bbbe63b
commit de1ad6cff3

View File

@@ -1342,7 +1342,8 @@ void SetCrossfade::Run()
bool EditSong::canBeRun() const bool EditSong::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() && currentSong(myScreen); return currentSong(myScreen)
&& isMPDMusicDirSet();
# else # else
return false; return false;
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -1360,9 +1361,9 @@ void EditSong::Run()
bool EditLibraryTag::canBeRun() const bool EditLibraryTag::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() return myScreen->isActiveWindow(myLibrary->Tags)
&& myScreen->isActiveWindow(myLibrary->Tags) && !myLibrary->Tags.empty()
&& !myLibrary->Tags.empty(); && isMPDMusicDirSet();
# else # else
return false; return false;
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -1412,9 +1413,9 @@ void EditLibraryTag::Run()
bool EditLibraryAlbum::canBeRun() const bool EditLibraryAlbum::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() return myScreen->isActiveWindow(myLibrary->Albums)
&& myScreen->isActiveWindow(myLibrary->Albums) && !myLibrary->Albums.empty()
&& !myLibrary->Albums.empty(); && isMPDMusicDirSet();
# else # else
return false; return false;
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -1465,16 +1466,15 @@ void EditLibraryAlbum::Run()
bool EditDirectoryName::canBeRun() const bool EditDirectoryName::canBeRun() const
{ {
return isMPDMusicDirSet() return ((myScreen == myBrowser
&& ((myScreen == myBrowser
&& !myBrowser->main().empty() && !myBrowser->main().empty()
&& myBrowser->main().current().value().type == MPD::itDirectory) && myBrowser->main().current().value().type == MPD::itDirectory)
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
|| (myScreen->activeWindow() == myTagEditor->Dirs || (myScreen->activeWindow() == myTagEditor->Dirs
&& !myTagEditor->Dirs->empty() && !myTagEditor->Dirs->empty()
&& myTagEditor->Dirs->choice() > 0) && myTagEditor->Dirs->choice() > 0)
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
); ) && isMPDMusicDirSet();
} }
void EditDirectoryName::Run() void EditDirectoryName::Run()
@@ -1660,7 +1660,8 @@ void ToggleScreenLock::Run()
bool JumpToTagEditor::canBeRun() const bool JumpToTagEditor::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() && currentSong(myScreen); return currentSong(myScreen)
&& isMPDMusicDirSet();
# else # else
return false; return false;
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H