summaryrefslogtreecommitdiff
path: root/src/layout/movie.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/movie.c')
-rw-r--r--src/layout/movie.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/layout/movie.c b/src/layout/movie.c
index 20f623e..a9df8fc 100644
--- a/src/layout/movie.c
+++ b/src/layout/movie.c
@@ -14,9 +14,11 @@
* limitations under the License.
*/
+#include <glib.h>
#include <Elementary.h>
#include <media_content.h>
#include <app_debug.h>
+#include <app_contents.h>
#include <app_media.h>
#include <gridmgr.h>
#include <layoutmgr.h>
@@ -126,6 +128,7 @@ static bool _update_recent(void *data, Evas_Object *base)
{
Evas_Object *recent, *image;
app_media_info *info;
+ struct tm tm;
struct _priv *priv;
char buf[32];
@@ -161,7 +164,8 @@ static bool _update_recent(void *data, Evas_Object *base)
elm_object_part_text_set(recent, PART_RECENT_CONTENT_TITLE,
info->title);
- util_time_string(buf, sizeof(buf), info->played_time, false);
+ localtime_r(&info->played_time, &tm);
+ strftime(buf, sizeof(buf), "%Y.%m.%d", &tm);
elm_object_part_text_set(recent, PART_RECENT_CONTENT_DATE, buf);
progressbar_reset(priv->prog, info->video->position,
@@ -362,6 +366,51 @@ static void _update_content_list(struct _priv *priv)
priv->media_list = list;
}
+static void _update_recent_item(struct _priv *priv)
+{
+ GList *list;
+ app_media *am;
+ app_media_info *info;
+ struct recent_data *recent;
+ int r;
+
+ list = NULL;
+ info = NULL;
+
+ r = app_contents_get_recent_list(CONTENTS_MOVIE, 1, &list);
+ if (r != APP_CONTENTS_ERROR_NONE) {
+ _ERR("failed to get movie recent list");
+ return;
+ }
+
+ recent = (struct recent_data *)g_list_nth_data(list, 0);
+
+ if (recent) {
+ am = util_find_media_info(mediadata_get_medialist(priv->md),
+ recent->id);
+ if (!am) {
+ _ERR("failed to get app media");
+ g_list_free(list);
+ return;
+ }
+
+ info = app_media_get_info(am);
+ if (!info) {
+ _ERR("failed to get app media info");
+ g_list_free(list);
+ return;
+ }
+
+ priv->recent_info = am;
+ }
+
+ if (!listmgr_update_play_info(priv->listmgr, info))
+ _ERR("failed to update recently watched item");
+
+
+ g_list_free(list);
+}
+
static bool _create(layoutmgr *lmgr, void *data)
{
struct listmgr *listmgr;
@@ -523,6 +572,7 @@ static void _update(void *layout_data, int update_type, void *data)
switch (update_type) {
case UPDATE_CONTENT:
_update_content_list(priv);
+ _update_recent_item(priv);
break;
case UPDATE_FOCUS:
if (!data) {
@@ -533,6 +583,7 @@ static void _update(void *layout_data, int update_type, void *data)
index = *(int *)data;
listmgr_update_focus_item(priv->listmgr, index);
+ _update_recent_item(priv);
break;
default:
break;