static void _grid_selected_cb(void *data, Elm_Object_Item *it)
{
app_media *am;
- struct view_data *vdata;
+ struct view_update_data vdata;
struct _priv *priv;
if (!data || !it) {
return;
}
- vdata = calloc(1, sizeof(*vdata));
- if (!vdata) {
- _ERR("failed to allocate view data");
- return;
- }
-
- vdata->list = mediadata_get_medialist(priv->md);
- vdata->index = util_get_media_index(vdata->list, am);
+ vdata.list = mediadata_get_medialist(priv->md);
+ vdata.index = util_get_media_index(vdata.list, am);
- viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata);
+ viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata);
viewmgr_push_view(VIEW_VIEWER);
}
static void _grid_selected_cb(void *data, Elm_Object_Item *it)
{
app_media *am;
- struct view_data *vdata;
+ struct view_update_data vdata;
struct _priv *priv;
if (!data || !it) {
return;
}
- vdata = calloc(1, sizeof(*vdata));
- if (!vdata) {
- _ERR("failed to allocate view data");
- return;
- }
-
- vdata->list = mediadata_get_medialist(priv->md);
- vdata->index = util_get_media_index(vdata->list, am);
+ vdata.list = mediadata_get_medialist(priv->md);
+ vdata.index = util_get_media_index(vdata.list, am);
- viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata);
+ viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata);
viewmgr_push_view(VIEW_VIEWER);
}
#include <app_media.h>
#include "define.h"
+#include "view.h"
#include "util/controller.h"
#include "util/timeout_handler.h"
#include "util/playermgr.h"
},
};
-/* FIXME: test function */
-static bool _media(media_info_h media_h, void *dt)
-{
- struct _priv *priv;
- app_media *am;
-
- priv = dt;
-
- am = app_media_create(media_h);
-
- priv->playlist.list = eina_list_append(priv->playlist.list, am);
-
- return true;
-}
-
-static void _media_test(struct _priv *priv, int mode)
-{
- char *path = "/home/owner/content/Videos/Xmen-Days_of_Future_Past.mp4";
- filter_h filter;
- char buf[1024];
- int r;
-
- r = media_filter_create(&filter);
- if (r != MEDIA_CONTENT_ERROR_NONE) {
- _ERR("Media Filter Creation Failed");
- return;
- }
-
- if (mode)
- snprintf(buf, sizeof(buf), "MEDIA_PATH = \"%s\"", path);
- else
- snprintf(buf, sizeof(buf), "MEDIA_TYPE=0 OR MEDIA_TYPE=1");
-
- r = media_filter_set_condition(filter, buf,
- MEDIA_CONTENT_COLLATE_DEFAULT);
- if (r != MEDIA_CONTENT_ERROR_NONE) {
- _ERR("Fail to set filter condition");
- media_filter_destroy(filter);
- return;
- }
-
- media_content_connect();
-
- r = media_info_foreach_media_from_db(filter, _media, priv);
- if (r != MEDIA_CONTENT_ERROR_NONE) {
- _ERR("MEDIA CONTENT ERROR: %d", r);
- media_filter_destroy(filter);
- media_content_disconnect();
- return;
- }
-
- media_filter_destroy(filter);
- media_content_disconnect();
-}
-/* FIXME: test function end */
-
/*
* NOTE: Workaround
* we assumed that if video content have the copyright then it's a movie.
elm_object_part_text_set(priv->base,
PART_VIEWER_TITLE, mi->title);
} else {
- strftime(date, sizeof(date), "%d %b", mi->content_time);
+ strftime(date, sizeof(date), "%d %b, %Y", mi->content_time);
strftime(day, sizeof(day), "%a", mi->content_time);
util_up_string(day);
return NULL;
}
- /* FIXME: test code */
- _media_test(priv, 0);
-
viewmgr_set_view_data(VIEW_VIEWER, priv);
return base;
priv = view_data;
- /* FIXME: test code */
_viewer_show(priv, DIR_NONE);
timeout_handler_reset(priv->timeout);
evas_object_hide(priv->base);
}
+static void _update(void *view_data, int update_type, void *data)
+{
+ struct _priv *priv;
+ struct view_update_data *vdata;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ if (!data) {
+ _ERR("invalid parameter");
+ return;
+ }
+
+ priv = view_data;
+ vdata = data;
+
+ priv->playlist.list = vdata->list;
+ priv->playlist.cur = vdata->index;
+}
+
static void _destroy(void *view_data)
{
struct _priv *priv;
- app_media *am;
if (!view_data) {
_ERR("failed to get view data");
_viewer_delete(priv);
- EINA_LIST_FREE(priv->playlist.list, am)
- app_media_destroy(am);
-
timeout_handler_fini(priv->timeout);
playermgr_destroy(priv->player);
.create = _create,
.show = _show,
.hide = _hide,
+ .update = _update,
.destroy = _destroy,
};