From ee5c4845b03dd47a3dd6827e9ba57a163cf9f679 Mon Sep 17 00:00:00 2001 From: shivamv Date: Tue, 7 Feb 2023 17:15:29 +0530 Subject: [PATCH] Modifying/Removing Depricated APIs Change-Id: Iedbbd2a65f7c34aede3d3237e352921ca7709ca6 Signed-off-by: shivamv --- include/ge-data-type.h | 1 - include/ge-data.h | 4 +--- src/data/ge-data-type.c | 4 ---- src/data/ge-data.c | 40 +++++++++++++++++++++++++++------------- src/data/ge-local-data.c | 1 - src/view/ge-albums.c | 36 +++--------------------------------- 6 files changed, 31 insertions(+), 55 deletions(-) mode change 100644 => 100755 include/ge-data-type.h mode change 100644 => 100755 include/ge-data.h mode change 100644 => 100755 src/data/ge-data-type.c mode change 100644 => 100755 src/data/ge-data.c mode change 100644 => 100755 src/data/ge-local-data.c diff --git a/include/ge-data-type.h b/include/ge-data-type.h old mode 100644 new mode 100755 index 108938b..0ae6045 --- a/include/ge-data-type.h +++ b/include/ge-data-type.h @@ -96,7 +96,6 @@ struct _ge_media_t { char *display_name; /*item name */ int mode; /* Show icon indicates different camera shot mode */ storage_type_e storage_type; /* Storage type got from DB */ - bool b_create_thumb; /* Request DB to create thumbnail */ }; int _ge_data_type_new_media(ge_media_s ** item); diff --git a/include/ge-data.h b/include/ge-data.h old mode 100644 new mode 100755 index 5b91877..fe39a37 --- a/include/ge-data.h +++ b/include/ge-data.h @@ -57,9 +57,7 @@ extern "C" { Eina_List * sel_id); int _ge_data_get_item_cnt(ge_ugdata * ugd, const char *cluster_id, int album_type, int *item_cnt); - int _ge_data_create_thumb(ge_media_s * item, - media_thumbnail_completed_cb callback, - void *data); + int _ge_data_create_thumb(ge_media_s * item); int _ge_data_init(ge_ugdata * ugd); int _ge_data_finalize(ge_ugdata * ugd); diff --git a/src/data/ge-data-type.c b/src/data/ge-data-type.c old mode 100644 new mode 100755 index b6765f9..8e62ed6 --- a/src/data/ge-data-type.c +++ b/src/data/ge-data-type.c @@ -48,10 +48,6 @@ static int __ge_data_type_free_media(ge_media_s ** item) /* For local medias */ if (tmp_item->media_h) { - if (tmp_item->b_create_thumb) { - media_info_cancel_thumbnail(tmp_item->media_h); - tmp_item->b_create_thumb = false; - } media_info_destroy(tmp_item->media_h); } diff --git a/src/data/ge-data.c b/src/data/ge-data.c old mode 100644 new mode 100755 index c6c0b29..9440946 --- a/src/data/ge-data.c +++ b/src/data/ge-data.c @@ -240,32 +240,46 @@ int _ge_data_get_item_cnt(ge_ugdata * ugd, const char *cluster_id, return 0; } -/* Creates a thumbnail image for given the media, asynchronously */ +/* Creates a thumbnail image for given the media, synchronously */ /** * * @param item - * @param callback - * @param data * @return */ -int _ge_data_create_thumb(ge_media_s * item, - media_thumbnail_completed_cb callback, - void *data) +int _ge_data_create_thumb(ge_media_s * item) { GE_CHECK_VAL(item, -1); GE_CHECK_VAL(item->media_h, -1); int ret = -1; ge_sdbg("File[%s]", item->file_url); - if (item->b_create_thumb) { - ge_dbgE("thumbnail generation request already sent, ignoring duplicate request"); - return 0; + ret = media_info_generate_thumbnail(item->media_h); + if (ret == MEDIA_CONTENT_ERROR_NONE) + { + char* path; + int error = media_info_get_thumbnail_path(item->media_h, &path); + if (GE_FILE_EXISTS(path) && error == MEDIA_CONTENT_ERROR_NONE) + { + ge_dbg("Update item with new thumb path[%s]", path); + GE_FREEIF(item->thumb_url); + item->thumb_url = strdup(path); /* Update thumb path */ + } + else if(error == MEDIA_CONTENT_ERROR_INVALID_PARAMETER) + { + GE_FREEIF(item->thumb_url); + item->thumb_url = strdup(GE_ICON_CONTENTS_BROKEN); + ge_dbg("File corrupted, change to broken thumbnail %s", path); + } + else + { + ge_dbgE("Invalid thumb path! Error number[%d]", error); + } + GE_FREEIF(path); } - ret = media_info_create_thumbnail(item->media_h, callback, data); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - ge_dbgE("Failed to create thumbnail[%d]!", ret); + else + { + ge_dbgE("Failed to generate thumbnail[%d]!", ret); return -1; } - item->b_create_thumb = true; return 0; } diff --git a/src/data/ge-local-data.c b/src/data/ge-local-data.c old mode 100644 new mode 100755 index 118f0f0..749eac6 --- a/src/data/ge-local-data.c +++ b/src/data/ge-local-data.c @@ -41,7 +41,6 @@ static bool __ge_local_data_get_media_list_cb(media_info_h media, Eina_List **elist = (Eina_List **) (td->userdata); if (_ge_data_util_clone_media(media, &item, td->with_meta)) { - item->b_create_thumb = false; *elist = eina_list_append(*elist, item); return true; } else { diff --git a/src/view/ge-albums.c b/src/view/ge-albums.c index 8791135..24263cf 100755 --- a/src/view/ge-albums.c +++ b/src/view/ge-albums.c @@ -1030,37 +1030,6 @@ int ge_update_gengrid(ge_ugdata * ugd) /** * - * @param error - * @param path - * @param user_data - */ -static void _ge_grid_thumb_created_cb(media_content_error_e error, - const char *path, void *user_data) -{ - GE_CHECK(user_data); - ge_item *gitem = (ge_item *) user_data; - GE_CHECK(gitem->item); - gitem->item->b_create_thumb = false; - if (GE_FILE_EXISTS(path) && error == MEDIA_CONTENT_ERROR_NONE) { - ge_dbg("Update item with new thumb path[%s]", path); - /* Update thumb path */ - GE_FREEIF(gitem->item->thumb_url); - gitem->item->thumb_url = strdup(path); - elm_gengrid_item_update(gitem->elm_item); - } else { - if (error == MEDIA_CONTENT_ERROR_INVALID_OPERATION || error == MEDIA_CONTENT_ERROR_NOT_SUPPORTED) { - GE_FREEIF(gitem->item->thumb_url); - gitem->item->thumb_url = strdup(GE_ICON_CONTENTS_BROKEN); - elm_gengrid_item_update(gitem->elm_item); - ge_dbg("File corrupted, change to broken thumbnail %s", path); - } else { - ge_dbgE("Invalid thumb path! Error number[%d]", error); - } - } -} - -/** - * * @param data * @param obj * @param ei @@ -1086,8 +1055,8 @@ static void __ge_grid_realized(void *data, Evas_Object * obj, void *ei) (gitem->store_type == GE_PHONE || gitem->store_type == GE_MMC || gitem->store_type == GE_ALL)) { ge_dbg("Generating Thumbs"); - _ge_data_create_thumb(gitem->item, - _ge_grid_thumb_created_cb, gitem); + _ge_data_create_thumb(gitem->item); + elm_gengrid_item_update(gitem->elm_item); } const Elm_Gengrid_Item_Class *it = elm_gengrid_item_item_class_get(ei); @@ -1096,6 +1065,7 @@ static void __ge_grid_realized(void *data, Evas_Object * obj, void *ei) ge_dbgE("item style is NULL"); return; } + if (!g_strcmp0(it->item_style, "gengrid_items")) { elm_object_item_signal_emit(item, "hide_default_image", "elm"); } else { -- 2.7.4