aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_artist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-03 11:53:28 +0200
committerMax Kellermann <max@duempel.org>2008-10-03 11:53:28 +0200
commit40875b7a771ba26c528877eb13f80e476c86cc3a (patch)
treeb323719e0f0af6cf0120433b89ae46f95ebc08ee /src/screen_artist.c
parentf5b706fd865140da002f2e9f7af3b6f459aed115 (diff)
downloadmpd-40875b7a771ba26c528877eb13f80e476c86cc3a.tar.gz
mpd-40875b7a771ba26c528877eb13f80e476c86cc3a.tar.xz
mpd-40875b7a771ba26c528877eb13f80e476c86cc3a.zip
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.
Diffstat (limited to 'src/screen_artist.c')
-rw-r--r--src/screen_artist.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 7d3a18952..8c5636f57 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;
}