int mode; /* Show icon indicates different camera shot mode */
char *ext;
gl_store_type_e storage_type; /* Storage type got from DB */
- bool b_create_thumb; /* Request DB to create thumbnail */
bool check_state; /* store check state */
Elm_Object_Item *elm_item; /*store item handle */
bool _gl_data_is_screenshot_album(const char *match_folder,
gl_album_s * album);
bool _gl_data_is_camera_album(gl_album_s * album);
- int _gl_data_create_thumb(gl_media_s * item,
- media_thumbnail_completed_cb callback,
- void *user_data);
- int _gl_data_cancel_thumb(gl_media_s * item);
+ int _gl_data_create_thumb(gl_media_s * item);
int _gl_data_save_selected_str_ids(void *data, Eina_List ** elist);
int _gl_data_restore_selected(Eina_List * sel_ids, gl_item * gitem);
bool _gl_data_check_selected_id(Eina_List * sel_id_list,
album->cluster->type == GL_STORE_T_MMC ||
album->cluster->type == GL_STORE_T_ALL)) {
__gl_albums_create_thumb(album->cover, album);
+ elm_gengrid_item_update(album->item);
}
}
GL_CHECK(album->cover);
GL_CHECK(album->cover->item);
- /* Checking for local files only */
- if (album->cluster->type == GL_STORE_T_PHONE ||
- album->cluster->type == GL_STORE_T_MMC ||
- album->cluster->type == GL_STORE_T_ALL) {
- if (album->cover->item->b_create_thumb) {
- _gl_data_cancel_thumb(album->cover->item);
- }
- }
}
/**
return strdup(buf);
}
-/**
- * CB function is called when thumbnail is created for media
- * @param error
- * @param path
- * @param user_data
- */
-static void __gl_albums_create_thumb_cb(media_content_error_e error,
- const char *path, void *user_data)
-{
- GL_CHECK(user_data);
- gl_album_data_s *album_data = (gl_album_data_s *) user_data;
- GL_CHECK(album_data->album);
- gl_appdata *ad = (gl_appdata *)_gl_get_app_data();
- GL_CHECK(ad);
- gl_cluster *album = album_data->album;
- GL_FREE(album_data);
- album->album_data = NULL;
-
- if (gl_get_view_mode(ad) != GL_VIEW_ALBUMS &&
- gl_get_view_mode(ad) != GL_VIEW_ALBUMS_EDIT &&
- gl_get_view_mode(ad) != GL_VIEW_ALBUMS_SELECT) {
- return;
- }
-
- if (error == MEDIA_CONTENT_ERROR_NONE && GL_FILE_EXISTS(path) &&
- g_strcmp0(path, GL_ICON_DB_DEFAULT_THUMB)) {
- GL_CHECK(album);
- GL_CHECK(album->item);
- elm_gengrid_item_update(album->item);
- } else {
- gl_sdbgE("[%d]Invalid path[%s]!", error, path);
- }
-}
-
/**
* Sends request to create thumbnail for media
* @param gitem : media item data
GL_CHECK_VAL(album_data, -1);
album_data->album = album;
album->album_data = album_data;
- _gl_data_create_thumb(gitem->item, __gl_albums_create_thumb_cb,
- album_data);
+ _gl_data_create_thumb(gitem->item);
return 0;
}
return -1;
/* Use default image */
if (!GL_FILE_EXISTS(gitem->item->thumb_url)) {
_gl_thumbs_create_thumb(gitem);
+ elm_gengrid_item_update(gitem->elm_item);
}
}
}
gl_item *gitem = elm_object_item_data_get(it);
GL_CHECK(gitem);
GL_CHECK(gitem->item);
- /* Checking for local files only */
- if (gitem->store_type == GL_STORE_T_MMC ||
- gitem->store_type == GL_STORE_T_ALL ||
- gitem->store_type == GL_STORE_T_PHONE) {
- if (gitem->item->b_create_thumb) {
- _gl_data_cancel_thumb(gitem->item);
- }
- }
}
/**
}
-/**
- * CB function is called when thumbnail is created for media
- * @param error : thumbnail server error type
- * @param path : thumbnail path
- * @param user_data : Thumb data
- */
-static void __gl_thumbs_create_thumb_cb(media_content_error_e error,
- const char *path, void *user_data)
-{
- GL_CHECK(user_data);
- gl_thumb_data_s *thumb_data = (gl_thumb_data_s *) user_data;
- gl_appdata *ad = (gl_appdata *)_gl_get_app_data();
- GL_CHECK(ad);
- gl_item *gitem = thumb_data->item;
- GL_FREE(thumb_data);
- GL_CHECK(gitem);
- gitem->thumb_data = NULL;
-
- if (gl_get_view_mode(ad) != GL_VIEW_THUMBS &&
- gl_get_view_mode(ad) != GL_VIEW_THUMBS_EDIT &&
- gl_get_view_mode(ad) != GL_VIEW_THUMBS_SELECT) {
- return;
- }
-
- if (error == MEDIA_CONTENT_ERROR_NONE && GL_FILE_EXISTS(path) &&
- g_strcmp0(path, GL_ICON_DB_DEFAULT_THUMB)) {
- GL_CHECK(gitem);
- GL_CHECK(gitem->item);
- gl_dbg("Update item with new thumb path[%s]", path);
- /* Update thumb path */
- GL_FREEIF(gitem->item->thumb_url);
- gitem->item->thumb_url = strdup(path);
- elm_gengrid_item_update(gitem->elm_item);
- } else {
- gl_dbgE("[%d]Invalid path[%s]!", error, path);
- }
-}
-
/**
* ends request to create thumbnail for media
* @param gitem : item data
GL_CHECK_VAL(thumb_data, -1);
thumb_data->item = gitem;
gitem->thumb_data = thumb_data;
- _gl_data_create_thumb(gitem->item, __gl_thumbs_create_thumb_cb,
- thumb_data);
+ _gl_data_create_thumb(gitem->item);
return 0;
}
return -1;
return layout;
}
-/**
- * thumbnail generation request CB
- * @param error : thumbnail server error code
- * @param path : thumbnail path
- * @param user_data : media data
- */
-static void __gl_timeline_thumbs_create_thumb_cb(media_content_error_e
- error, const char *path,
- void *user_data)
-{
- GL_CHECK(user_data);
- gl_media_s *thumb_data = (gl_media_s *) user_data;
-
- thumb_data->b_create_thumb = false;
- if (error == MEDIA_CONTENT_ERROR_NONE && GL_FILE_EXISTS(path) &&
- g_strcmp0(path, GL_ICON_DB_DEFAULT_THUMB)) {
- /* Update thumb path */
- GL_FREEIF(thumb_data->thumb_url);
- thumb_data->thumb_url = strdup(path);
- elm_gengrid_item_update(thumb_data->elm_item);
- } else {
- gl_dbgE("[%d]Invalid path[%s]!", error, path);
- }
-}
-
/* Use file to create new thumb if possible */
/**
* send thumbnail creation request for media
GL_CHECK_VAL(gitem->file_url, -1);
if (GL_FILE_EXISTS(gitem->file_url)) {
- _gl_data_create_thumb(gitem, __gl_timeline_thumbs_create_thumb_cb,
- gitem);
+ _gl_data_create_thumb(gitem);
return 0;
}
return -1;
/* Use default image */
if (!GL_FILE_EXISTS(gitem->thumb_url)) {
_gl_timeline_thumbs_create_thumb(gitem);
+ elm_gengrid_item_update(gitem->elm_item);
}
}
}
gl_media_s *gitem = elm_object_item_data_get(it);
GL_CHECK(gitem);
- /* Checking for local files only */
- if (gitem->storage_type == GL_STORE_T_MMC ||
- gitem->storage_type == GL_STORE_T_ALL ||
- gitem->storage_type == GL_STORE_T_PHONE) {
- if (gitem->b_create_thumb) {
- _gl_data_cancel_thumb(gitem);
- }
- }
}
/**
/* 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);
tmp_item->media_h = NULL;
}
#include "gl-strings.h"
#include "gl-db-update.h"
#include "gl-file-util.h"
+#include "gl-icons.h"
/**
* Append the album cluster to the list
* @param user_data : user data to be passed to callback
* @return
*/
-int _gl_data_create_thumb(gl_media_s * item,
- media_thumbnail_completed_cb callback,
- void *user_data)
+int _gl_data_create_thumb(gl_media_s * item)
{
GL_CHECK_VAL(item, -1);
GL_CHECK_VAL(item->media_h, -1);
int ret = -1;
gl_sdbg("File[%s]", item->file_url);
- ret = media_info_create_thumbnail(item->media_h, callback, user_data);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ 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 (GL_FILE_EXISTS(path) && error == MEDIA_CONTENT_ERROR_NONE)
+ {
+ gl_dbg("Update item with new thumb path[%s]", path);
+ GL_FREEIF(item->thumb_url);
+ item->thumb_url = strdup(path); /* Update thumb path */
+ }
+ else if(error == MEDIA_CONTENT_ERROR_INVALID_PARAMETER)
+ {
+ GL_FREEIF(item->thumb_url);
+ item->thumb_url = strdup(GL_ICON_DB_DEFAULT_THUMB);
+ gl_dbg("File corrupted, change to broken thumbnail %s", path);
+ }
+ else
+ {
+ gl_dbgE("Invalid thumb path! Error number[%d]", error);
+ }
+ GL_FREEIF(path);
+ }
+ else
+ {
gl_dbgE("Failed to create thumbnail[%d]!", ret);
return -1;
}
- item->b_create_thumb = true;
- return 0;
-}
-
-/**
- * Cancel the thumbnail generation request
- * @param item : media item data
- * @return
- */
-int _gl_data_cancel_thumb(gl_media_s * item)
-{
- GL_CHECK_VAL(item, -1);
- GL_CHECK_VAL(item->media_h, -1);
-
- media_info_cancel_thumbnail(item->media_h);
- item->b_create_thumb = false;
return 0;
}