Queue: add ContainsUri()
authorMax Kellermann <max@musicpd.org>
Tue, 4 Sep 2018 08:27:42 +0000 (10:27 +0200)
committerMax Kellermann <max@musicpd.org>
Tue, 4 Sep 2018 08:27:42 +0000 (10:27 +0200)
src/FileListPage.cxx
src/Queue.hxx

index e6e1e16..863c07b 100644 (file)
@@ -65,7 +65,7 @@ screen_browser_sync_highlights(FileList *fl, const MpdQueue *playlist)
                if (entity != nullptr && mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_SONG) {
                        const auto *song = mpd_entity_get_song(entity);
 
-                       if (playlist->FindByUri(mpd_song_get_uri(song)) >= 0)
+                       if (playlist->ContainsUri(mpd_song_get_uri(song)))
                                entry.flags |= HIGHLIGHT;
                        else
                                entry.flags &= ~HIGHLIGHT;
index ae6b1ee..e944987 100644 (file)
@@ -124,6 +124,11 @@ struct MpdQueue {
                        i = mpd_song_get_id(items[i].get());
                return i;
        }
+
+       gcc_pure
+       bool ContainsUri(const char *uri) const {
+               return FindByUri(uri) >= 0;
+       }
 };
 
 #endif