summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyuho Jo <kyuho.jo@samsung.com>2016-06-01 13:53:44 +0900
committerKyuho Jo <kyuho.jo@samsung.com>2016-06-01 14:04:39 +0900
commit02c513f007bb20edcc88199d3e4e13fb058d4c76 (patch)
treec4f1f5701fc995c6705004cdd4bb368434ac7ede /src
parentcf2ddf69a4487f2c0f9590add9dca90c20e1d6a5 (diff)
downloadair_mediahub-02c513f007bb20edcc88199d3e4e13fb058d4c76.tar.gz
air_mediahub-02c513f007bb20edcc88199d3e4e13fb058d4c76.tar.bz2
air_mediahub-02c513f007bb20edcc88199d3e4e13fb058d4c76.zip
Changes for supporting myfiles
1. Accept requests for opening media files from myfiles. 2. Place base-i18n with ICU library. 3. maps-service can be removed from dependencies. Change-Id: I444f03761f59ffca06da3129a4ebb7853c986b92 Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/data/albumdata.c98
-rw-r--r--src/data/mediadata.c66
-rw-r--r--src/layout/gallery.c11
-rw-r--r--src/main.c78
-rw-r--r--src/util/util.c56
-rw-r--r--src/view/action_menu.c4
-rw-r--r--src/view/base.c5
-rw-r--r--src/view/mplayer.c17
-rw-r--r--src/view/viewer.c15
9 files changed, 226 insertions, 124 deletions
diff --git a/src/data/albumdata.c b/src/data/albumdata.c
index ae9833a..9079260 100644
--- a/src/data/albumdata.c
+++ b/src/data/albumdata.c
@@ -18,7 +18,8 @@
#include <media_content.h>
#include <app_debug.h>
#include <app_media.h>
-#include <utils_i18n.h>
+#include <unicode/ustring.h>
+#include <unicode/uchar.h>
#include "data/datamgr.h"
#include "util/util.h"
@@ -81,65 +82,6 @@ static struct _group_info g_group_info[E_GROUP_ALBUM_MAX] = {
};
-static i18n_uchar* _convert_to_UTF16_string(const char *source_string)
-{
- int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
- i18n_uchar *converted_string = NULL;
-
- /* Calc buffer size for converted UTF16 string */
- i18n_ustring_from_UTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_i18n);
-
- converted_string = malloc((buffer_length + 2) * sizeof(i18n_uchar));
- if (converted_string == NULL) {
- _ERR("malloc failed");
- goto OUT;
- }
-
- /* Convert to i18n(UTF16) string */
- i18n_ustring_from_UTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_from_UTF8 returns [%d]", error_from_i18n);
- free(converted_string);
- goto OUT;
- }
- converted_string[buffer_length] = (i18n_uchar)0;
-
-OUT:
-
- return converted_string;
-}
-
-static char* _convert_to_UTF8_string(i18n_uchar *sourct_string)
-{
- int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
- char *converted_string = NULL;
-
- i18n_ustring_to_UTF8(NULL, 0, &buffer_length, sourct_string, -1, &error_from_i18n);
-
- converted_string = malloc((buffer_length + 2) * sizeof(char));
- if (converted_string == NULL) {
- _ERR("malloc failed");
- goto OUT;
- }
-
- /* Convert to UTF8 */
- i18n_ustring_to_UTF8(converted_string, buffer_length + 1, &buffer_length, sourct_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_to_UTF8 returns [%d]", error_from_i18n);
- free(converted_string);
- converted_string = NULL;
- goto OUT;
- }
- converted_string[buffer_length] = '\0';
-
-OUT:
-
- return converted_string;
-}
-
-
static bool _create_filter(struct albumdata *ad, filter_h *filter,
const char *cond, int filter_type)
{
@@ -194,14 +136,14 @@ static int _compare_name(struct group_info *gi, struct album_info *ai)
return -1;
int32_t result = -1;
- i18n_uchar *converted_group_name = NULL;
- i18n_uchar *converted_album_title = NULL;
+ UChar *converted_group_name = NULL;
+ UChar *converted_album_title = NULL;
converted_group_name = util_convert_to_UTF16_string(gi->data);
converted_album_title = util_convert_to_UTF16_string(ai->name);
if (converted_group_name && converted_album_title) {
- result = i18n_ustring_case_compare_n(converted_group_name, converted_album_title, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
+ result = u_strncasecmp(converted_group_name, converted_album_title, 1, U_FOLD_CASE_DEFAULT);
}
if (converted_group_name) {
@@ -221,15 +163,15 @@ static void *_get_data_name(struct album_info *ai)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
+ UChar *converted_string = NULL;
- converted_string = _convert_to_UTF16_string(ai->name);
+ converted_string = util_convert_to_UTF16_string(ai->name);
if (converted_string == NULL) {
_ERR("_convert_to_UTF16_string failed");
goto OUT;
}
- result_str = _convert_to_UTF8_string(converted_string);
+ result_str = util_convert_to_UTF8_string(converted_string);
OUT:
if (converted_string)
@@ -244,8 +186,8 @@ static char *_get_name(struct album_info *ai)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
- i18n_uchar sub_string[10] = { 0, };
+ UChar *converted_string = NULL;
+ UChar sub_string[10] = { 0, };
converted_string = util_convert_to_UTF16_string(ai->name);
@@ -255,7 +197,7 @@ static char *_get_name(struct album_info *ai)
}
/* Get a character (not a byte) from left */
- i18n_ustring_copy_n(sub_string, converted_string, 1);
+ u_strncpy(sub_string, converted_string, 1);
result_str = util_convert_to_UTF8_string(sub_string);
OUT:
@@ -272,14 +214,14 @@ static int _compare_artist(struct group_info *gi, struct album_info *ai)
return -1;
int32_t result = -1;
- i18n_uchar *converted_group_name = NULL;
- i18n_uchar *converted_artist = NULL;
+ UChar *converted_group_name = NULL;
+ UChar *converted_artist = NULL;
converted_group_name = util_convert_to_UTF16_string(gi->data);
converted_artist = util_convert_to_UTF16_string(ai->artist);
if (converted_group_name && converted_artist) {
- result = i18n_ustring_case_compare_n(converted_group_name, converted_artist, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
+ result = u_strncasecmp(converted_group_name, converted_artist, 1, U_FOLD_CASE_DEFAULT);
}
if (converted_group_name) {
@@ -299,15 +241,15 @@ static void *_get_data_artist(struct album_info *ai)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
+ UChar *converted_string = NULL;
- converted_string = _convert_to_UTF16_string(ai->artist);
+ converted_string = util_convert_to_UTF16_string(ai->artist);
if (converted_string == NULL) {
_ERR("_convert_to_UTF16_string failed");
goto OUT;
}
- result_str = _convert_to_UTF8_string(converted_string);
+ result_str = util_convert_to_UTF8_string(converted_string);
OUT:
if (converted_string)
@@ -322,8 +264,8 @@ static char *_get_artist(struct album_info *ai)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
- i18n_uchar sub_string[10] = { 0, };
+ UChar *converted_string = NULL;
+ UChar sub_string[10] = { 0, };
converted_string = util_convert_to_UTF16_string(ai->artist);
@@ -333,7 +275,7 @@ static char *_get_artist(struct album_info *ai)
}
/* Get a character (not a byte) from left */
- i18n_ustring_copy_n(sub_string, converted_string, 1);
+ u_strncpy(sub_string, converted_string, 1);
result_str = util_convert_to_UTF8_string(sub_string);
OUT:
diff --git a/src/data/mediadata.c b/src/data/mediadata.c
index eac8507..66d3d1f 100644
--- a/src/data/mediadata.c
+++ b/src/data/mediadata.c
@@ -18,6 +18,8 @@
#include <media_content.h>
#include <app_debug.h>
#include <app_media.h>
+#include <unicode/ustring.h>
+#include <unicode/uchar.h>
#include "data/datamgr.h"
#include "util/util.h"
@@ -148,14 +150,14 @@ static int _compare_title(struct group_info *gi, app_media_info *info)
return -1;
int32_t result = -1;
- i18n_uchar *converted_group_name = NULL;
- i18n_uchar *converted_media_title = NULL;
+ UChar *converted_group_name = NULL;
+ UChar *converted_media_title = NULL;
converted_group_name = util_convert_to_UTF16_string(gi->data);
converted_media_title = util_convert_to_UTF16_string(info->title);
if (converted_group_name && converted_media_title) {
- result = i18n_ustring_case_compare_n(converted_group_name, converted_media_title, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
+ result = u_strncasecmp(converted_group_name, converted_media_title, 1, U_FOLD_CASE_DEFAULT);
}
if (converted_group_name) {
@@ -175,7 +177,7 @@ static void *_get_data_title(app_media_info *info)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
+ UChar *converted_string = NULL;
converted_string = util_convert_to_UTF16_string(info->title);
@@ -198,8 +200,8 @@ static char *_get_title(app_media_info *info)
return NULL;
char *result_str = NULL;
- i18n_uchar *converted_string = NULL;
- i18n_uchar sub_string[10] = { 0, };
+ UChar *converted_string = NULL;
+ UChar sub_string[10] = { 0, };
converted_string = util_convert_to_UTF16_string(info->title);
@@ -209,7 +211,7 @@ static char *_get_title(app_media_info *info)
}
/* Get a character (not a byte) from left */
- i18n_ustring_copy_n(sub_string, converted_string, 1);
+ u_strncpy(sub_string, converted_string, 1);
result_str = util_convert_to_UTF8_string(sub_string);
@@ -798,3 +800,53 @@ struct data_ops *mediadata_get_ops(void)
{
return &_ops;
};
+
+bool _media_item_cb(media_info_h item, void *user_data)
+{
+ app_media **am = (app_media**)user_data;
+
+ *am = app_media_create(item);
+
+ return false; //only 1 item
+}
+
+
+app_media* mediadata_get_app_media_by_file_path(char *file_path)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ filter_h media_filter = NULL;
+ app_media *am = NULL;
+ char condition[PATH_MAX + 256] = {0,};
+
+ if (file_path == NULL) {
+ _ERR("filepath is NULL");
+ goto out;
+ }
+
+ media_content_connect();
+
+ snprintf(condition, sizeof(condition), "%s = '%s'", MEDIA_PATH, file_path);
+
+
+ if ((ret = media_filter_create(&media_filter)) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("media_filter_create returns [%d]", ret);
+ goto out;
+ }
+
+ if ((ret = media_filter_set_condition(media_filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT)) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("media_filter_create returns [%d]", ret);
+ goto out;
+ }
+
+ ret = media_filter_set_order(media_filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_NOCASE);
+
+ if ((ret = media_info_foreach_media_from_db(media_filter, _media_item_cb, &am)) != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("media_info_foreach_media_from_db is failed [%d]", ret);
+ }
+
+out:
+ if (media_filter)
+ media_filter_destroy(media_filter);
+
+ return am;
+}
diff --git a/src/layout/gallery.c b/src/layout/gallery.c
index d1fba82..448ee44 100644
--- a/src/layout/gallery.c
+++ b/src/layout/gallery.c
@@ -62,8 +62,9 @@ struct _priv {
int source_type;
struct grid_data *gdata;
-
+#ifdef __FEATURE_LOCATION_SERVICE__
struct locmgr *locmgr;
+#endif
};
static void _recent_item_selected(struct _priv *priv, app_media *am)
@@ -177,7 +178,9 @@ static void _destroy_datamgr(struct _priv *priv)
static void _destroy_utils(struct _priv *priv)
{
+#ifdef __FEATURE_LOCATION_SERVICE__
locmgr_destroy(priv->locmgr);
+#endif
_destroy_datamgr(priv);
listmgr_destroy(priv->listmgr);
@@ -187,8 +190,10 @@ static void _destroy_utils(struct _priv *priv)
static Eina_Bool _create_location(void *data)
{
struct _priv *priv;
- struct locmgr *locmgr;
struct datamgr *dmgr;
+#ifdef __FEATURE_LOCATION_SERVICE__
+ struct locmgr *locmgr;
+#endif
if (!data) {
_ERR("invalid argument");
@@ -203,6 +208,7 @@ static Eina_Bool _create_location(void *data)
return ECORE_CALLBACK_CANCEL;
}
+#ifdef __FEATURE_LOCATION_SERVICE__
locmgr = locmgr_create();
if (!locmgr) {
_ERR("failed to create locmgr");
@@ -213,6 +219,7 @@ static Eina_Bool _create_location(void *data)
locmgr_set_locations(locmgr,
dmgr->ops->get_list(dmgr->handle, E_LIST_MEDIA, NULL));
+#endif
return ECORE_CALLBACK_CANCEL;
}
diff --git a/src/main.c b/src/main.c
index 8f08b9d..67b0ecb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -126,13 +126,28 @@ static void _terminate(void *data)
}
}
+static void _open_media_file(char *media_type, char *media_file_path)
+{
+ if (strcmp(media_type, "Image") == 0) {
+ viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT_WITH_MEDIA_ID, media_file_path);
+ viewmgr_push_view(VIEW_VIEWER);
+ } else if (strcmp(media_type, "Video") == 0) {
+ viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT_WITH_MEDIA_ID, media_file_path);
+ viewmgr_push_view(VIEW_VIEWER);
+ } else if (strcmp(media_type, "Audio") == 0) {
+ viewmgr_update_view(VIEW_MPLAYER, UPDATE_CONTENT_WITH_MEDIA_ID, media_file_path);
+ viewmgr_push_view(VIEW_MPLAYER);
+ }
+}
+
static void _app_control(app_control_h app_control, void *data)
{
struct _appdata *ad;
- char *media_id;
- char *caller_id;
+ char *media_id = NULL;
+ char *caller_id = NULL;
int r;
+
if (!data) {
_ERR("failed to get data");
return;
@@ -147,27 +162,52 @@ static void _app_control(app_control_h app_control, void *data)
if (r != APP_CONTROL_ERROR_NONE)
caller_id = NULL;
- r = app_control_get_extra_data(app_control, PARAM_MEDIA_ID, &media_id);
- if (r != APP_CONTROL_ERROR_NONE)
- media_id = NULL;
-
- if (media_id && caller_id) {
- if (!strcmp(caller_id, APP_ID_FAVORITE)) {
- while (viewmgr_active_view_count() > 0)
- viewmgr_pop_view();
- viewmgr_update_view(VIEW_BASE,
- UPDATE_FAVORITE, media_id);
- } else if (!strcmp(caller_id, APP_ID_RECENT)) {
+ if (caller_id == NULL) {
+ r = app_control_get_extra_data(app_control, PARAM_MEDIA_ID, &media_id);
+ if (r != APP_CONTROL_ERROR_NONE)
+ media_id = NULL;
+
+ if (media_id && caller_id) {
+ if (!strcmp(caller_id, APP_ID_FAVORITE)) {
+ while (viewmgr_active_view_count() > 0)
+ viewmgr_pop_view();
+
+ viewmgr_update_view(VIEW_BASE,
+ UPDATE_FAVORITE, media_id);
+ } else if (!strcmp(caller_id, APP_ID_RECENT)) {
+ viewmgr_push_view(VIEW_BASE);
+ viewmgr_update_view(VIEW_BASE,
+ UPDATE_RECENT, media_id);
+ }
+ } else {
viewmgr_push_view(VIEW_BASE);
- viewmgr_update_view(VIEW_BASE,
- UPDATE_RECENT, media_id);
+ viewmgr_update_view(VIEW_BASE, UPDATE_RECENT, media_id);
}
- } else
- viewmgr_push_view(VIEW_BASE);
- free(media_id);
- free(caller_id);
+ } else if (strcmp("org.tizen.myfiles", caller_id) == 0) {
+ char *file_path = NULL;
+ char *media_type = NULL;
+
+ app_control_get_extra_data(app_control, "Path", &file_path);
+ app_control_get_extra_data(app_control, "Media type", &media_type);
+
+ if (file_path == NULL) {
+ _DBG("file_path is NULL");
+ app_control_get_uri(app_control, &file_path);
+ }
+
+ if (file_path != NULL) {
+ if (media_type != NULL) {
+ _open_media_file(media_type, file_path);
+ }
+ }
+ }
+ if (media_id)
+ free(media_id);
+ if (caller_id)
+ free(caller_id);
+
}
static void _pause(void *data)
diff --git a/src/util/util.c b/src/util/util.c
index cb84c9e..5c0f282 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -19,6 +19,7 @@
#include <app_control.h>
#include <app_debug.h>
#include <app_contents.h>
+#include <unicode/ustring.h>
#include "define.h"
#include "util/util.h"
@@ -456,42 +457,64 @@ Elm_Image_Orient util_get_orient(media_content_orientation_e orient)
return o;
}
-i18n_uchar* util_convert_to_UTF16_string(const char *source_string)
+UChar* util_convert_to_UTF16_string(const char *source_string)
{
int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
- i18n_uchar *converted_string = NULL;
+ UErrorCode error_from_icu = 0;
+ UChar *converted_string = NULL;
/* Calc buffer size for converted UTF16 string */
- i18n_ustring_from_UTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_i18n);
-
- converted_string = malloc((buffer_length + 2) * sizeof(i18n_uchar));
+ u_strFromUTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_icu);
+ if (buffer_length == 0) {
+ _ERR("error form icu[%d][%s]", error_from_icu, u_errorName(error_from_icu));
+ goto OUT;
+ }
+ /* NOTE:
+ * Calling u_strFromUTF8 with 0 capacity always causes U_BUFFER_OVERFLOW_ERROR.
+ * When u_strFromUTF8 is succeeded, u_strFromUTF8 doesn't change error_from_icu.
+ * It means error_from_icu have U_BUFFER_OVERFLOW_ERROR even though there is no problem.
+ * So, error_from_icu should be reset as U_ZERO_ERROR here*/
+ error_from_icu = U_ZERO_ERROR;
+
+ converted_string = malloc((buffer_length + 2) * sizeof(UChar));
if (converted_string == NULL) {
_ERR("malloc failed");
goto OUT;
}
/* Convert to i18n(UTF16) string */
- i18n_ustring_from_UTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_from_UTF8 returns [%d]", error_from_i18n);
+ u_strFromUTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_icu);
+ if (U_FAILURE(error_from_icu)) {
+ _ERR("error form icu[%d][%s]", error_from_icu, u_errorName(error_from_icu));
free(converted_string);
+ converted_string = NULL;
goto OUT;
}
- converted_string[buffer_length] = (i18n_uchar)0;
+
+ converted_string[buffer_length] = (UChar)0;
OUT:
return converted_string;
}
-char* util_convert_to_UTF8_string(i18n_uchar *sourct_string)
+char* util_convert_to_UTF8_string(UChar *source_string)
{
int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
+ UErrorCode error_from_icu;
char *converted_string = NULL;
- i18n_ustring_to_UTF8(NULL, 0, &buffer_length, sourct_string, -1, &error_from_i18n);
+ u_strToUTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_icu);
+ if (buffer_length == 0) {
+ _ERR("error form icu[%d][%s]", error_from_icu, u_errorName(error_from_icu));
+ goto OUT;
+ }
+ /* NOTE:
+ * Calling u_strToUTF8 with 0 capacity always causes U_BUFFER_OVERFLOW_ERROR.
+ * When u_strFromUTF8 is succeeded, u_strFromUTF8 doesn't change error_from_icu.
+ * It means error_from_icu have U_BUFFER_OVERFLOW_ERROR even though there is no problem.
+ * So, error_from_icu should be reset as U_ZERO_ERROR here */
+ error_from_icu = U_ZERO_ERROR;
converted_string = malloc((buffer_length + 2) * sizeof(char));
if (converted_string == NULL) {
@@ -500,13 +523,14 @@ char* util_convert_to_UTF8_string(i18n_uchar *sourct_string)
}
/* Convert to UTF8 */
- i18n_ustring_to_UTF8(converted_string, buffer_length + 1, &buffer_length, sourct_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_to_UTF8 returns [%d]", error_from_i18n);
+ u_strToUTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_icu);
+ if (U_FAILURE(error_from_icu)) {
+ _ERR("error form icu[%d][%s]", error_from_icu, u_errorName(error_from_icu));
free(converted_string);
converted_string = NULL;
goto OUT;
}
+
converted_string[buffer_length] = '\0';
OUT:
diff --git a/src/view/action_menu.c b/src/view/action_menu.c
index 3d87e96..9e45319 100644
--- a/src/view/action_menu.c
+++ b/src/view/action_menu.c
@@ -904,6 +904,10 @@ static bool _update_items(struct _priv *priv, struct view_update_data *vdata)
}
priv->content_type = _get_content_type(mi);
+ if (priv->content_type >= E_CONTENT_MAX) {
+ _ERR("content_type[%d] exceeded E_CONTENT_MAX", priv->content_type);
+ return false;
+ }
_update_menu_area(priv);
_update_favorite_area(priv);
diff --git a/src/view/base.c b/src/view/base.c
index abb826a..b144c79 100644
--- a/src/view/base.c
+++ b/src/view/base.c
@@ -595,6 +595,11 @@ static void _update_recent_view(struct _priv *priv, const char *id)
type = _get_layout_type(info);
+ if (type >= E_LAYOUT_MAX) {
+ _ERR("type[%d] exceeded E_LAYOUT_MAX", type);
+ return;
+ }
+
_set_current_layout(priv, type);
layoutmgr_update_layout(priv->lmgr, g_menu_item[type].layout_id,
diff --git a/src/view/mplayer.c b/src/view/mplayer.c
index ab5ad4c..e085b72 100644
--- a/src/view/mplayer.c
+++ b/src/view/mplayer.c
@@ -31,6 +31,8 @@
#include "util/playermgr.h"
#include "util/progressbar.h"
#include "util/util.h"
+#include "data/mediadata.h"
+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -1130,6 +1132,7 @@ static void _update(void *view_data, int update_type, void *data)
{
struct _priv *priv;
struct view_update_data *vdata;
+ struct view_update_data temp_update_data;
if (!view_data || !data) {
_ERR("failed to get view data");
@@ -1137,7 +1140,19 @@ static void _update(void *view_data, int update_type, void *data)
}
priv = view_data;
- vdata = data;
+
+ if (update_type == UPDATE_CONTENT_WITH_MEDIA_ID) {
+ app_media *am = NULL;
+
+ am = mediadata_get_app_media_by_file_path(data);
+ temp_update_data.list = eina_list_append(NULL, am);
+ temp_update_data.index = 0;
+ temp_update_data.id = NULL;
+ vdata = &temp_update_data;
+ update_type = UPDATE_CONTENT;
+ } else {
+ vdata = data;
+ }
switch (update_type) {
case UPDATE_CONTENT:
diff --git a/src/view/viewer.c b/src/view/viewer.c
index c6e439e..c31e913 100644
--- a/src/view/viewer.c
+++ b/src/view/viewer.c
@@ -33,6 +33,7 @@
#include "util/playermgr.h"
#include "util/progressbar.h"
#include "util/util.h"
+#include "data/mediadata.h"
#define STYLE_VIEWER_BTN "viewer_btn"
#define PART_VIEWER_BTN "control_btn"
@@ -1462,6 +1463,7 @@ static void _update(void *view_data, int update_type, void *data)
{
struct _priv *priv;
struct view_update_data *vdata;
+ struct view_update_data temp_update_data;
if (!view_data) {
_ERR("failed to get view data");
@@ -1469,7 +1471,18 @@ static void _update(void *view_data, int update_type, void *data)
}
priv = view_data;
- vdata = data;
+
+ if (update_type == UPDATE_CONTENT_WITH_MEDIA_ID) {
+ app_media *am = NULL;
+ am = mediadata_get_app_media_by_file_path(data);
+ temp_update_data.list = eina_list_append(NULL, am);
+ temp_update_data.index = 0;
+ temp_update_data.id = NULL;
+ vdata = &temp_update_data;
+ update_type = UPDATE_CONTENT;
+ } else {
+ vdata = data;
+ }
switch (update_type) {
case UPDATE_CONTENT: