From 40875b7a771ba26c528877eb13f80e476c86cc3a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 3 Oct 2008 11:53:28 +0200 Subject: [PATCH] screen_artist: fix reload in "All tracks" The variable "album" was set to _("All tracks") when it was empty. When reloading the songs, ncmpc was trying to find an album named "All tracks", which didn't seem to work. Leave "album" in its canonical form and generate the title text on demand. --- src/screen_artist.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/screen_artist.c b/src/screen_artist.c index 7d3a189..8c5636f 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -213,13 +213,12 @@ load_song_list(struct mpdclient *c) assert(album != NULL); assert(browser.filelist == NULL); - if (album[0] == 0) { - album = g_strdup(_("All tracks")); + if (album[0] == 0) browser.filelist = mpdclient_filelist_search_utf8(c, TRUE, MPD_TABLE_ARTIST, artist); - } else + else browser.filelist = mpdclient_filelist_search_utf8(c, TRUE, MPD_TABLE_ALBUM, @@ -373,22 +372,27 @@ paint(mpd_unused mpdclient_t *c) static const char * get_title(char *str, size_t size) { - char *s1 = artist ? utf8_to_locale(artist) : NULL; - char *s2 = album ? utf8_to_locale(album) : NULL; + char *s1, *s2; switch(mode) { case LIST_ARTISTS: g_snprintf(str, size, _("Artist: [db browser - EXPERIMENTAL]")); break; case LIST_ALBUMS: + s1 = utf8_to_locale(artist); g_snprintf(str, size, _("Artist: %s"), s1); + g_free(s1); break; case LIST_SONGS: + s1 = utf8_to_locale(artist); + s2 = *album == 0 + ? g_strdup(_("All tracks")) + : utf8_to_locale(album); g_snprintf(str, size, _("Artist: %s - %s"), s1, s2); + g_free(s1); + g_free(s2); break; } - g_free(s1); - g_free(s2); return str; } -- 2.30.2