Music grid: Show the grid thumbnail and text 12/44012/1
authorHyojung Jo <hj903.jo@samsung.com>
Thu, 16 Jul 2015 07:06:00 +0000 (16:06 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Thu, 16 Jul 2015 07:06:00 +0000 (16:06 +0900)
Change-Id: I81a043048f4dcc3372a82f0120d7f40288e70935
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
src/grid/grid_music.c

index c3be79b..f2524e5 100644 (file)
 
 static char *_text_get(void *data, Evas_Object *obj, const char *part)
 {
-       /* It will be implemented later. */
+       app_media *am;
+
+       if (!data) {
+               _ERR("Data is NULL.");
+               return NULL;
+       }
+       am = data;
+
+       if (!strcmp(part, PART_THUMB_TEXT))
+               return strdup(get_media_artist(am));
+       else if (!strcmp(part, PART_THUMB_SUBTEXT))
+               return strdup(get_media_name(am));
 
        return NULL;
 }
 
 static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
 {
-       /* It will be implemented later. */
+       app_media *am;
+       Evas_Object *icon, *img;
+       char *thumbnail;
 
-       return NULL;
+       if (!data || !obj) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+       am = data;
+
+       thumbnail = get_media_thumbnail(am);
+
+       if (!thumbnail) {
+               icon = elm_icon_add(obj);
+               if (!icon) {
+                       _ERR("elm_icon_add failed.");
+                       return NULL;
+               }
+
+               elm_icon_thumb_set(icon, get_media_path(am), NULL);
+               elm_image_aspect_fixed_set(icon, EINA_FALSE);
+
+               return icon;
+       }
+
+       img = elm_image_add(obj);
+       if (!img) {
+               _ERR("elm_image_add failed.");
+               return NULL;
+       }
+
+       elm_image_file_set(img, thumbnail, NULL);
+       elm_image_aspect_fixed_set(img, EINA_FALSE);
+       evas_object_show(img);
+
+       return img;
 }
 
 static struct grid_class _gclass = {