Modifying/Removing Depricated APIs 05/287905/2 accepted/tizen_8.0_unified accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_riscv tizen_8.0 tizen_9.0 accepted/tizen/8.0/unified/20231005.095904 accepted/tizen/9.0/unified/20241030.231135 accepted/tizen/unified/20230210.160935 accepted/tizen/unified/riscv/20231226.211331 tizen_8.0_m2_release tizen_9.0_m2_release
authorshivamv <shivam.v2@samsung.com>
Tue, 7 Feb 2023 11:45:29 +0000 (17:15 +0530)
committershivamv <shivam.v2@samsung.com>
Wed, 8 Feb 2023 07:55:19 +0000 (13:25 +0530)
Change-Id: Iedbbd2a65f7c34aede3d3237e352921ca7709ca6
Signed-off-by: shivamv <shivam.v2@samsung.com>
include/ge-data-type.h [changed mode: 0644->0755]
include/ge-data.h [changed mode: 0644->0755]
src/data/ge-data-type.c [changed mode: 0644->0755]
src/data/ge-data.c [changed mode: 0644->0755]
src/data/ge-local-data.c [changed mode: 0644->0755]
src/view/ge-albums.c

old mode 100644 (file)
new mode 100755 (executable)
index 108938b..0ae6045
@@ -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);
old mode 100644 (file)
new mode 100755 (executable)
index 5b91877..fe39a37
@@ -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);
 
old mode 100644 (file)
new mode 100755 (executable)
index b6765f9..8e62ed6
@@ -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);
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index c6c0b29..9440946
@@ -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;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 118f0f0..749eac6
@@ -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 {
index 8791135..24263cf 100755 (executable)
@@ -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 {