+ Evas_Coord aw, ah;
+
+ evas_object_image_size_get(wd->view, &aw, &ah);
+ evas_object_size_hint_aspect_set(wd->view,
+ EVAS_ASPECT_CONTROL_BOTH,
+ aw, ah);
+ edje_object_part_swallow(wd->frame, "elm.swallow.content", wd->view);
+ edje_object_size_min_get(wd->frame, &mw, &mh);
+ edje_object_size_min_restricted_calc(wd->frame, &mw, &mh, mw, mh);
+ evas_object_size_hint_min_set(wd->self, mw, mh);
+ eina_stringshare_replace(&(wd->thumb.file), thumb_path);
+ eina_stringshare_replace(&(wd->thumb.key), thumb_key);
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_STOP, "elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm");
+ evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
+}
+
+static void
+_thumb_loaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = data;
+ const char *thumb_path;
+ const char *thumb_key;
+
+ evas_object_image_file_get(wd->view, &thumb_path, &thumb_key);
+
+ _thumb_ready(wd, thumb_path, thumb_key);
+}
+
+/* As we do use stat to check if a thumbnail is available, it's possible
+ that we end up accessing before the file is completly written on disk.
+ By retrying each time a thumbnail is finished we should be fine or not.
+*/
+static Eina_Bool
+_retry_thumb(Widget_Data *wd)
+{
+ int r;
+
+ if ((wd->is_video) && (wd->thumb.format == ETHUMB_THUMB_EET))
+ {
+ edje_object_file_set(wd->view, NULL, NULL);
+ if (!edje_object_file_set(wd->view,
+ wd->thumb.thumb_path,
+ "movie/thumb"))
+ {
+ if (pending_request == 0)
+ ERR("could not set file=%s key=%s for %s",
+ wd->thumb.thumb_path,
+ wd->thumb.thumb_key,
+ wd->file);
+ goto view_err;
+ }
+ }
+ else
+ {
+ evas_object_image_file_set(wd->view, NULL, NULL);
+ evas_object_image_file_set(wd->view,
+ wd->thumb.thumb_path,
+ wd->thumb.thumb_key);
+ r = evas_object_image_load_error_get(wd->view);
+ if (r != EVAS_LOAD_ERROR_NONE)
+ {
+ if (pending_request == 0)
+ ERR("%s: %s", wd->thumb.thumb_path, evas_load_error_str(r));
+ goto view_err;
+ }
+
+ evas_object_event_callback_add(wd->view,
+ EVAS_CALLBACK_IMAGE_PRELOADED,
+ _thumb_loaded, wd);
+ evas_object_image_preload(wd->view, EINA_TRUE);
+ return EINA_TRUE;
+ }
+
+ _thumb_ready(wd, wd->thumb.thumb_path, wd->thumb.thumb_key);
+
+ eina_stringshare_del(wd->thumb.thumb_path);
+ wd->thumb.thumb_path = NULL;
+
+ eina_stringshare_del(wd->thumb.thumb_key);
+ wd->thumb.thumb_key = NULL;
+
+ return EINA_TRUE;
+
+ view_err:
+ return EINA_FALSE;
+}
+
+static void
+_finished_thumb(Widget_Data *wd,
+ const char *thumb_path,
+ const char *thumb_key)
+{
+ Eina_List *l, *ll;