From f90176ffee8edd1d26c0abe758c5a3a970fccbd3 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 29 Aug 2010 02:13:09 +0200 Subject: [PATCH] fix switching to artist info screen if one switched from artist info screen while artist info was being downloaded, {s,}he wouldn't be able to enter the screen again. --- src/lastfm.cpp | 2 +- src/lastfm.h | 1 + src/ncmpcpp.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lastfm.cpp b/src/lastfm.cpp index c8e1f730..1b5a02f7 100644 --- a/src/lastfm.cpp +++ b/src/lastfm.cpp @@ -214,7 +214,7 @@ void Lastfm::Refetch() bool Lastfm::SetArtistInfoArgs(const std::string &artist, const std::string &lang) { - if (isDownloadInProgress) + if (isDownloading()) return false; itsService.reset(new ArtistInfo); diff --git a/src/lastfm.h b/src/lastfm.h index d93c449f..4cccaa81 100644 --- a/src/lastfm.h +++ b/src/lastfm.h @@ -53,6 +53,7 @@ class Lastfm : public Screen void Refetch(); + bool isDownloading() { return isDownloadInProgress && !isReadyToTake; } bool SetArtistInfoArgs(const std::string &artist, const std::string &lang = ""); protected: diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index ade5cefb..0657eaeb 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -2142,7 +2142,7 @@ int main(int argc, char *argv[]) # ifdef HAVE_CURL_CURL_H else if (Keypressed(input, Key.ArtistInfo)) { - if (myScreen == myLastfm) + if (myScreen == myLastfm || myLastfm->isDownloading()) { myLastfm->SwitchTo(); continue;