summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e76297)
raw | patch | inline | side by side (parent: 2e76297)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 14 Jul 2010 14:33:26 +0000 (16:33 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 21 Jul 2010 21:37:30 +0000 (23:37 +0200) |
The `album' variable used to store a pointer to an empty string, which was
somewhere in memory, for the virtual album `All tracks', but this didn't allow
seeing all tracks without an album tag as one album.
Now, the address of the char array `ALL_TRACKS' is assigned to `album', when
`All Tracks' are viewed.
somewhere in memory, for the virtual album `All tracks', but this didn't allow
seeing all tracks without an album tag as one album.
Now, the address of the char array `ALL_TRACKS' is assigned to `album', when
`All Tracks' are viewed.
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 14d37a5a5a2e1fbfa9fddd2719478e44a7da9689..15103eb813d4670ddf9587cc5236ccda80a16a82 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
static GPtrArray *artist_list, *album_list;
static char *artist = NULL;
static char *album = NULL;
+static char ALL_TRACKS[] = "";
static struct screen_browser browser;
mpd_search_db_songs(connection, true);
mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT,
MPD_TAG_ARTIST, artist);
- if (album[0] != 0)
+ if (album != ALL_TRACKS)
mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT,
MPD_TAG_ALBUM, album);
mpd_search_commit(connection);
free_state(void)
{
g_free(artist);
- g_free(album);
+ if (album != ALL_TRACKS)
+ g_free(album);
artist = NULL;
album = NULL;
case LIST_SONGS:
s1 = utf8_to_locale(artist);
- if (*album != 0) {
- s2 = utf8_to_locale(album);
+
+ if (album == ALL_TRACKS)
g_snprintf(str, size,
- _("Album: %s - %s"), s1, s2);
+ _("All tracks of artist: %s"), s1);
+ else if (*album != 0) {
+ s2 = utf8_to_locale(album);
+ g_snprintf(str, size, _("Album: %s - %s"), s1, s2);
g_free(s2);
} else
g_snprintf(str, size,
- _("All tracks of artist: %s"), s1);
+ _("Tracks of no album of artist: %s"), s1);
g_free(s1);
break;
}
struct list_window_range range;
char *selected;
char *old;
+ char *old_ptr;
int idx;
switch(cmd) {
}
} else if (browser.lw->selected == album_list->len + 1) {
/* handle "show all" */
- open_song_list(c, g_strdup(artist), g_strdup("\0"));
+ open_song_list(c, g_strdup(artist), ALL_TRACKS);
list_window_reset(browser.lw);
} else {
/* select album */
if (browser.lw->selected == 0) {
/* handle ".." */
old = g_strdup(album);
+ old_ptr = album;
open_album_list(c, g_strdup(artist));
list_window_reset(browser.lw);
/* restore previous list window state */
- idx = *old == 0
+ idx = old_ptr == ALL_TRACKS
? (int)album_list->len
: string_array_find(album_list, old);
g_free(old);
case LIST_SONGS:
old = g_strdup(album);
+ old_ptr = album;
open_album_list(c, g_strdup(artist));
list_window_reset(browser.lw);
/* restore previous list window state */
- idx = *old == 0
+ idx = old_ptr == ALL_TRACKS
? (int)album_list->len
: string_array_find(album_list, old);
g_free(old);