gallery: add video duration text 21/44121/1
authorJehun Lim <jehun.lim@samsung.com>
Thu, 16 Jul 2015 07:42:24 +0000 (16:42 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Fri, 17 Jul 2015 03:51:25 +0000 (12:51 +0900)
Change-Id: I362d81d63270be520e0975ab8bd59dc9289528c8
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
src/layout/gallery.c

index 8d396af..1a6f364 100644 (file)
@@ -54,6 +54,35 @@ struct _priv {
        Eina_List *media_list;
 };
 
+static char *_grid_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       app_media *am;
+       app_media_info *info;
+       char buf[32];
+
+       if (!data)
+               return NULL;
+
+       am = data;
+       info = app_media_get_info(am);
+       if (!info) {
+               _ERR("failed to get media info");
+               return NULL;
+       }
+
+       if (info->media_type != MEDIA_CONTENT_TYPE_VIDEO)
+               return NULL;
+
+       if (!strcmp(part, PART_ELM_TEXT_PLAYTIME)) {
+               util_time_string(buf, sizeof(buf),
+                                       info->video->duration, false);
+
+               return strdup(buf);
+       }
+
+       return NULL;
+}
+
 static Evas_Object *_grid_content_get(void *data,
                        Evas_Object *obj, const char *part)
 {
@@ -97,6 +126,7 @@ static Evas_Object *_grid_content_get(void *data,
 
 static struct grid_class _gclass = {
        .item_style = STYLE_GRID_GALLERY_ITEM,
+       .text_get = _grid_text_get,
        .content_get = _grid_content_get
 };