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

audio_list_artist: Display artwork

parent 65a2ff92
......@@ -51,6 +51,7 @@ artist_item_destroy(artist_item* p_item)
{
if (p_item == NULL)
return;
free(p_item->psz_artwork);
free(p_item->psz_name);
free(p_item);
}
......@@ -58,7 +59,12 @@ artist_item_destroy(artist_item* p_item)
artist_item*
artist_item_copy(const artist_item* p_item )
{
return artist_item_create( p_item->psz_name );
artist_item* p_new = artist_item_create( p_item->psz_name );
if (p_new == NULL)
return NULL;
if (p_item->psz_artwork != NULL)
p_new->psz_artwork = strdup(p_item->psz_artwork);
return p_new;
}
bool
......
......@@ -38,6 +38,7 @@ typedef struct artist_item
LIBRARY_ITEM_COMMON
char* psz_name;
char* psz_artwork;
} artist_item;
artist_item*
......
......@@ -28,6 +28,7 @@
#include "list_view_private.h"
#include "media/artist_item.h"
#include "controller/media_controller.h"
#include "ui/utils.h"
struct list_sys
{
......@@ -75,6 +76,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_artist_item->psz_artwork != NULL)
icon = create_image(layout, ali->p_artist_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)
{
......@@ -148,6 +174,7 @@ audio_list_artist_view_create(interface* p_intf, Evas_Object* p_parent, list_vie
/* 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_artist_view_append_item;
p_list_view->pf_get_item = &audio_list_artist_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