Commit 12af2c57 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

audio_album_view: Display artwork

parent 57924766
......@@ -51,6 +51,8 @@ album_item_copy(const album_item* p_item)
return NULL;
if (p_item->psz_summary != NULL)
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);
return p_new_item;
}
......@@ -66,6 +68,7 @@ album_item_destroy(album_item* p_item)
{
if (p_item == NULL)
return;
free(p_item->psz_artwork);
free(p_item->psz_summary);
free(p_item->psz_name);
free(p_item);
......
......@@ -39,7 +39,7 @@ typedef struct album_item {
char* psz_name;
char* psz_summary;
time_t i_release_date;
char* psz_artwork;
} 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->psz_artwork = path_from_url(album->artworkUrl().c_str());
return p_item;
}
......
......@@ -28,6 +28,7 @@
#include "list_view_private.h"
#include "media/album_item.h"
#include "controller/media_controller.h"
#include "ui/utils.h"
struct list_sys
{
......@@ -65,6 +66,31 @@ free_list_item_data(void *data, Evas_Object *obj, void *event_info)
free(p_view_item);
}
static Evas_Object*
genlist_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
list_view_item *ali = data;
const Elm_Genlist_Item_Class *itc = ali->itc;
Evas_Object *layout = NULL;
/* Check the item class style and add the object needed in the item class*/
/* Here, puts the icon in the item class to add it to genlist items */
if (itc->item_style && !strcmp(itc->item_style, "2line.top.3")) {
if (part && !strcmp(part, "elm.icon.1")) {
layout = elm_layout_add(obj);
elm_layout_theme_set(layout, "layout", "list/B/type.1", "default");
Evas_Object *icon;
if (ali->p_album_item->psz_artwork != NULL)
icon = create_image(layout, ali->p_album_item->psz_artwork);
else
icon = create_icon(layout, "background_cone.png");
elm_layout_content_set(layout, "elm.swallow.content", icon);
}
}
return layout;
}
static char *
genlist_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
......@@ -158,6 +184,7 @@ audio_list_album_view_create(interface* p_intf, Evas_Object* p_parent, const cha
/* Item Class */
p_list_sys->p_default_item_class->func.text_get = genlist_text_get_cb;
p_list_sys->p_default_item_class->func.content_get = genlist_content_get_cb;
p_list_view->pf_append_item = &audio_list_album_view_append_item;
p_list_view->pf_get_item = &audio_list_album_item_get_media_item;
......
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