fixed bug 2160, don't display album title and artist for mixed directories

fixed bug 2160, don't display album title and artist for mixed
	directories in music view.
This commit is contained in:
Andy Hertzfeld 2000-09-12 07:29:01 +00:00
parent fb2c1ca7d5
commit 69b71df37d
2 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2000-09-12 Andy Hertzfeld <andy@eazel.com>
* components/music/nautilus-music-view.c: (determine_attribute):
fixed bug 2160, don't display album title and artist for mixed
directories in music view.
2000-09-11 Andy Hertzfeld <andy@eazel.com>
* libnautilus-extensions/nautilus-icon-text-item.c:

View file

@ -662,24 +662,31 @@ sort_by_bitrate (gconstpointer ap, gconstpointer bp)
/* utility routine to determine most common attribute in song list. The passed in boolean selects
album or artist. Return NULL if no names or too heterogenous. This first cut just captures
the first one it can - soon, we'll use a hash table and count them up */
album or artist. Return NULL if they are heterogenous */
static char *
determine_attribute (GList *song_list, gboolean is_artist)
{
SongInfo *info;
GList *p;
char *current_attribute, *this_attribute;
current_attribute = NULL;
for (p = song_list; p != NULL; p = p->next) {
info = (SongInfo *) p->data;
if (is_artist && info->artist != NULL) {
return g_strdup (info->artist);
} else if (!is_artist && info->album) {
return g_strdup (info->album);
}
this_attribute = is_artist ? info->artist : info->album;
if (this_attribute && nautilus_strcmp (this_attribute, current_attribute)) {
if (current_attribute == NULL) {
current_attribute = g_strdup (this_attribute);
} else {
g_free (current_attribute);
return NULL;
}
}
}
return NULL;
return current_attribute;
}
/* utility routine to sort the song list */