Commit 8b52348d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Album view: Display the amount of tracks

parent d633e02e
......@@ -53,6 +53,7 @@ album_item_copy(const album_item* p_item)
p_new_item->psz_summary = strdup(p_item->psz_summary);
if (p_item->psz_artwork != NULL)
p_new_item->psz_artwork = strdup(p_item->psz_artwork);
p_new_item->i_nb_tracks = p_item->i_nb_tracks;
p_new_item->i_release_date = p_item->i_release_date;
return p_new_item;
}
......
......@@ -40,6 +40,7 @@ typedef struct album_item {
char* psz_summary;
time_t i_release_date;
char* psz_artwork;
uint32_t i_nb_tracks;
} album_item;
album_item*
......
......@@ -143,6 +143,7 @@ albumToAlbumItem( AlbumPtr album )
if (p_item == nullptr)
return nullptr;
p_item->i_release_date = album->releaseDate();
p_item->i_nb_tracks = album->nbTracks();
p_item->psz_artwork = path_from_url(album->artworkUrl().c_str());
return p_item;
}
......
......@@ -96,13 +96,18 @@ genlist_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
list_view_item *p_view_item = data;
const Elm_Genlist_Item_Class *itc = p_view_item->itc;
char *buf;
char *buf = NULL;
if (itc->item_style && !strcmp(itc->item_style, "2line.top.3")) {
if (part && !strcmp(part, "elm.text.main.left.top")) {
asprintf(&buf, "<b>%s</b>", p_view_item->p_album_item->psz_name);
return buf;
}
else if (!strcmp(part, "elm.text.sub.right.bottom")) {
asprintf(&buf, "%d track%s", p_view_item->p_album_item->i_nb_tracks,
p_view_item->p_album_item->i_nb_tracks > 1 ? "s" : "" );
return buf;
}
}
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment