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);
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);
/* 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);
}
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;
}
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 {
/**
*
- * @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
(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);
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 {