From 31305c8ab28c7340999e1030ba33f6a180b3ac3a Mon Sep 17 00:00:00 2001
From: Jean-Philippe Andre <jp.andre@samsung.com>
Date: Tue, 1 Oct 2013 18:05:21 +0900
Subject: [PATCH 2/2] elm_image: Fix preload for normal files

grmbl, elm_image must explicitely start preload or the
image will stay blank if evas_object_show() is called before
elm_image_file_set().
---
 src/lib/elm_image.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c
index d5fda46..13419a1 100644
--- a/src/lib/elm_image.c
+++ b/src/lib/elm_image.c
@@ -740,8 +740,12 @@ _elm_image_smart_memfile_set(Eo *obj, void *_pd, va_list *list)
    evas_object_image_memfile_set
      (sd->img, (void *)img, size, (char *)format, (char *)key);
 
-   sd->preloading = EINA_TRUE;
-   evas_object_image_preload(sd->img, EINA_FALSE);
+   if (evas_object_visible_get(obj))
+     {
+        sd->preloading = EINA_TRUE;
+        evas_object_image_preload(sd->img, EINA_FALSE);
+     }
+
    if (evas_object_image_load_error_get(sd->img) != EVAS_LOAD_ERROR_NONE)
      {
         ERR("Things are going bad for some random " FMT_SIZE_T
@@ -845,6 +849,12 @@ _elm_image_smart_internal_file_set(Eo *obj, Elm_Image_Smart_Data *sd,
 
    evas_object_hide(sd->img);
 
+   if (evas_object_visible_get(obj))
+     {
+        sd->preloading = EINA_TRUE;
+        evas_object_image_preload(sd->img, EINA_FALSE);
+     }
+
    if (evas_object_image_load_error_get(sd->img) != EVAS_LOAD_ERROR_NONE)
      {
         ERR("Things are going bad for '%s' (%p)", file, sd->img);
@@ -887,8 +897,8 @@ _elm_image_smart_download_done(void *data, Elm_Url *url EINA_UNUSED, Eina_Binbuf
      {
         if (evas_object_visible_get(obj))
           {
-             Evas_Object *eobj = elm_image_object_get(obj);
-             evas_object_image_preload(eobj, EINA_FALSE);
+             sd->preloading = EINA_TRUE;
+             evas_object_image_preload(sd->img, EINA_FALSE);
           }
 
         evas_object_smart_callback_call(obj, SIG_DOWNLOAD_DONE, NULL);
-- 
1.7.9.5

