Enlightenment CVS committal

Author  : kiwi
Project : e_modules
Module  : photo

Dir     : e_modules/photo/src/module


Modified Files:
        Photo.h photo_item.c photo_picture.c photo_picture.h 
        photo_picture_local.c 


Log Message:
update to current E, cleanings and add logo image
* use new e_thumb system, wich cause some problems (little delay before actualy 
getting the thumb, i'll see that later)
* don't use e_lib anymore to set the desktop background
* add the Photo module logo as default, when you have no pictures to display. 
Now you know where's the module when you add it in a shelf =)
* fix some typos and clean picture system. need indent session

===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/Photo.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Photo.h     7 Jul 2006 17:15:25 -0000       1.1
+++ Photo.h     11 Jul 2006 05:52:13 -0000      1.2
@@ -4,7 +4,6 @@
 /* Enlightenment includes */
 #include <config.h>
 #include <e.h>
-#include <E_Lib.h>
 
 /* Photo includes */
 #define E_MOD_PHOTO_TYPEDEFS 1
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_item.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- photo_item.c        7 Jul 2006 18:37:28 -0000       1.2
+++ photo_item.c        11 Jul 2006 05:52:13 -0000      1.3
@@ -352,7 +352,8 @@
 {
   Picture *p;
    E_Zone *zone;
-   const char *file = NULL;
+   Ecore_Exe *exe;
+   const char *file;
    const char *name;
    char buf[4096];
 
@@ -382,8 +383,6 @@
      {
         if (ecore_file_app_installed("e17setroot"))
           {
-             Ecore_Exe *exe;
-
              snprintf(buf, 4096, "e17setroot -s \"%s\"", file);
              DITEM(("Set background with %s", buf));
             exe = ecore_exe_pipe_run(buf, ECORE_EXE_USE_SH, NULL);
@@ -409,25 +408,20 @@
      {
         DITEM(("Set edje background %s", file));
 
-        if ((zone->container->num == 0) && (zone->num == 0) &&
-           (zone->desk_x_current == 0) && (zone->desk_y_current == 0))
-          {
-             e_lib_background_set(strdup(file));
-          }
-        else
-          {
-             e_lib_desktop_background_del(zone->container->num, zone->num,
-                                         zone->desk_x_current, 
zone->desk_y_current);
-             e_lib_desktop_background_add(zone->container->num, zone->num,
-                                         zone->desk_x_current, 
zone->desk_y_current,
-                                          strdup(file));
-          }
+       snprintf(buf, 4096, "enlightenment_remote -default-bg-set \"%s\"", 
file);
+       exe = ecore_exe_pipe_run(buf, ECORE_EXE_USE_SH, NULL);
+       if (exe > 0)
+         {
+           ecore_exe_free(exe);
+           if (photo->config->pictures_set_bg_purge)
+             photo_picture_setbg_add(name);
+         }
      }
 
    return 1;
 }
 
-int  photo_item_action_viewer(Photo_Item *pi)
+int photo_item_action_viewer(Photo_Item *pi)
 {
   Picture *p;
    const char *file = NULL;
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- photo_picture.c     7 Jul 2006 18:37:28 -0000       1.2
+++ photo_picture.c     11 Jul 2006 05:52:13 -0000      1.3
@@ -1,8 +1,5 @@
 #include "Photo.h"
 
-static char *_display_init(void);
-static void  _display_shutdown(void);
-
 /*
  * Public functions
  */
@@ -19,9 +16,6 @@
    //if (!photo_picture_net_init())
    // return 0;
 
-   if (!_display_init())
-     return 0;
-
    return 1;
 }
 
@@ -29,39 +23,50 @@
 {
    photo_picture_setbg_purge(1);
 
-   _display_shutdown();
-
    photo_picture_local_shutdown();
    //photo_picture_net_shutdown();
 }
 
-
-int photo_picture_load(Picture *pic, Evas *evas)
+Picture *photo_picture_new(char *path, char *name, int thumb_it, void 
(*func_done) (void *data, Evas_Object *obj, void *event_info))
 {
-   Evas_Object *im = NULL;
-
-   if (pic->picture)
-     return 1;
-
-   im = photo_picture_object_get(pic, evas);
-   if (!im)
-     return 0;
-   
-   pic->picture = im;
+   Picture *picture;
+   int th_w, th_h;
+   char *ext;
+
+   th_w = photo->config->pictures_thumb_size;
+   th_h = photo->config->pictures_thumb_size;
+      
+   ext = strrchr(name, '.');
+   if (!ext)
+     return NULL;
+   if (strcasecmp(ext, ".jpg") && strcasecmp(ext, ".JPG") &&
+       strcasecmp(ext, ".jpeg") && strcasecmp(ext, ".JPEG") &&
+       strcasecmp(ext, ".png") && strcasecmp(ext, ".PNG"))
+     return NULL;
+      
+   DPICL(("New picture :  file %s", name));
+      
+   picture = E_NEW(Picture, 1);
+   picture->path = evas_stringshare_add(path);
+   picture->infos.name = photo_picture_name_get(name);
+   picture->from = PICTURE_LOCAL;
 
-   return 1;
-}
+   if (thumb_it)
+     {
+        Evas_Object *im;
 
-void photo_picture_unload(Picture *pic)
-{
-   if (!pic->picture)
-     return;
+        picture->thumb = PICTURE_THUMB_WAITING;
+        im = e_thumb_icon_add(photo->e_evas);
+        DPICL(("THUMB of %s wanted at %dx%d", picture->path, th_w, th_h));
+        e_thumb_icon_file_set(im, (char *)picture->path, NULL);
+        evas_object_smart_callback_add(im, "e_thumb_gen", func_done, picture);
+        picture->picture = im;
+        e_thumb_icon_begin(im);
+     }
 
-   evas_object_del(pic->picture);
-   pic->picture = NULL;
+   return picture;
 }
 
-
 int photo_picture_free(Picture *p, int force, int force_now)
 {
    if (p->pi)
@@ -69,13 +74,12 @@
         if (!force) return 0;
         if (!force_now)
           {
-             p->delete = 1;
+             p->delete_me = 1;
              return 0;
           }
      }
 
    if (p->path) evas_stringshare_del(p->path);
-   if (p->thumb_path) evas_stringshare_del(p->thumb_path);
    if (p->picture) evas_object_del(p->picture);
 
    if (p->infos.name) evas_stringshare_del(p->infos.name);
@@ -90,53 +94,53 @@
    return 1;
 }
 
-Evas_Object *photo_picture_object_get(Picture *pic, Evas *evas)
+int photo_picture_load(Picture *pic, Evas *evas)
 {
    Evas_Object *im = NULL;
-   Eet_File *ef;
-   Evas_Coord sw, sh;
 
-   if (!pic) return NULL;
+   if (pic->picture)
+     return 1;
 
-   if (pic->thumb_path)
-     {
-        /* load picture thumb */
-        ef = eet_open(pic->thumb_path, EET_FILE_MODE_READ);
-        if (!ef)
-          {
-             eet_close(ef);
-             return 0;
-          }
+   im = photo_picture_object_get(pic, evas);
+   if (!im)
+     return 0;
+   
+   pic->picture = im;
 
-        im = e_icon_add(evas);
-        e_icon_file_key_set(im, pic->thumb_path, "/thumbnail/data");
+   return 1;
+}
 
-        e_icon_size_get(im, &sw, &sh);
-        evas_object_resize(im, sw, sh);
-        e_icon_fill_inside_set(im, 1);
+void photo_picture_unload(Picture *pic)
+{
+   if (!pic->picture)
+     return;
 
-        /* debug : modify e_icon */
-        /*
-        im = e_icon_add(evas);
-        e_icon_file_key_set(im, pic->thumb_path, "/thumbnail/data");
-        e_icon_size_get(im, &sw, &sh);
-        evas_object_resize(im, pic->original_w, pic->original_h);
-        e_icon_fill_inside_set(im, 1);
-        */
+   evas_object_del(pic->picture);
+   pic->picture = NULL;
+}
 
-        /* debug : try without e_icon */
-        /*
-        im = evas_object_image_add(evas);
-        evas_object_image_file_set(im, pic->thumb_path, "/thumbnail/data");
-       evas_object_image_fill_set(im, 0, 0, pic->original_w, pic->original_h);
-        evas_object_resize(im, pic->original_w, pic->original_h);
-        evas_object_move(im, 0, 0);
-        */
+Evas_Object *photo_picture_object_get(Picture *pic, Evas *evas)
+{
+   Evas_Object *im = NULL;
+   int th_w, th_h;
+
+   th_w = photo->config->pictures_thumb_size;
+   th_h = photo->config->pictures_thumb_size;
+
+   if (!pic) return NULL;
 
-        eet_close(ef);
+   if (pic->thumb)
+     {
+        /* load picture thumb */
+        im = e_thumb_icon_add(evas);
+        e_thumb_icon_file_set(im, (char *)pic->path, NULL);
+        e_thumb_icon_size_set(im, th_w, th_h);
+        e_thumb_icon_begin(im);
      }
    else
      {
+       int sw, sh;
+
         /* load picture */
         im = e_icon_add(evas);
         e_icon_file_set(im, pic->path);
@@ -254,64 +258,3 @@
  * Private functions
  *
  */
-
-static char *
-_display_init(void)
-{
-   char *display = NULL;
-   char *tmp;
-
-   tmp = getenv("DISPLAY");
-   if (tmp)
-     display = strdup(tmp);
-
-   /* make sure the display var is of the form name:0.0 or :0.0 */
-   if (display)
-     {
-        char *p;
-        char buf[1024];
-
-        p = strrchr(display, ':');
-        if (!p)
-          {
-             snprintf(buf, sizeof(buf), "%s:0.0", display);
-             free(display);
-             display = strdup(buf);
-          }
-        else
-          {
-             p = strrchr(p, '.');
-             if (!p)
-               {
-                  snprintf(buf, sizeof(buf), "%s.0", display);
-                  free(display);
-                  display = strdup(buf);
-               }
-          }
-     }
-   else
-     display = strdup(":0.0");
-
-   /* init e Lib */
-   if (display)
-     e_lib_init(display);
-   else
-     {
-        display = strdup(":0.0");
-        e_lib_init(display);
-     }
-
-   photo->display = display;
-
-   return display;
-}
-
-static void
-_display_shutdown(void)
-{
-   if (!photo->display)
-     return;
-
-   E_FREE(photo->display);
-   e_lib_shutdown();
-}
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- photo_picture.h     7 Jul 2006 18:37:28 -0000       1.2
+++ photo_picture.h     11 Jul 2006 05:52:13 -0000      1.3
@@ -17,6 +17,10 @@
 
 #define PICTURE_SET_BG_PURGE_DEFAULT 1
 
+#define PICTURE_THUMB_NO 0
+#define PICTURE_THUMB_READY 1
+#define PICTURE_THUMB_WAITING 2
+
 #define PICTURE_THUMB_SIZE_DEFAULT 300
 #define PICTURE_THUMB_SIZE_MIN 100
 #define PICTURE_THUMB_SIZE_MAX 600
@@ -26,7 +30,7 @@
    Photo_Item *pi;
 
    const char *path;
-   const char *thumb_path;
+   unsigned char thumb : 2;
    Evas_Object *picture;
 
    struct
@@ -37,9 +41,10 @@
       const char *date;
       const char *comments;
    } infos;
-   int delete;
-   int from;
    int original_w, original_h;
+   unsigned char from;
+
+   unsigned char delete_me : 1;
 
    /*
     * each photo item where the picture is in the histo
@@ -57,10 +62,12 @@
 int          photo_picture_init(void);
 void         photo_picture_shutdown(void);
 
+Picture     *photo_picture_new(char *path, char *name, int thumb_it, void 
(*func_done) (void *data, Evas_Object *obj, void *event_info));
+int          photo_picture_free(Picture *p, int force, int force_now);
+
 int          photo_picture_load(Picture *pic, Evas *evas);
 void         photo_picture_unload(Picture *pic);
 
-int          photo_picture_free(Picture *p, int force, int force_now);
 Evas_Object *photo_picture_object_get(Picture *pic, Evas *evas);
 const char  *photo_picture_name_get(char *name);
 char        *photo_picture_infos_get(Picture *p);
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture_local.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- photo_picture_local.c       7 Jul 2006 18:37:28 -0000       1.2
+++ photo_picture_local.c       11 Jul 2006 05:52:13 -0000      1.3
@@ -1,7 +1,5 @@
 #include "Photo.h"
 
-#define CACHE_SIZE() (2 + evas_list_count(DEVIANM->devians)*2)
-
 #define POPUP_LOADING(list, buf, dtime)                                \
 if (list->loader.popup)                                                \
   photo_popup_warn_del(list->loader.popup);                            \
@@ -30,7 +28,7 @@
    /* thumb */
   struct
   {
-    Evas_List  *pictures;
+     int nb;
     Popup_Warn *popup;
     int         popup_show;
   } thumb;
@@ -58,14 +56,13 @@
 static Picture_Local_List *pictures_local;
 
 
-static int  _picture_new(char *name);
 static void _pictures_old_del(int force, int force_now);
 
 static int  _load_idler(void *data);
 static void _load_idler_stop(void);
 static int  _load_cb_ev_fill(void *data, int type, void *event);
 
-static void _thumb_generate_cb(Evas_Object *obj, void *data);
+static void _thumb_generate_cb(void *data, Evas_Object *obj, void *event_info);
 static void _thumb_generate_stop(void);
 
 static int  _popup_loader_close(Popup_Warn *popw, void *data);
@@ -118,7 +115,12 @@
         d->state = PICTURE_LOCAL_DIR_NOT_LOADED;
      }
 
-   /* load pictures */
+   /* initialise thumbnailer */
+   pictures_local->thumb.nb = 0;
+   pictures_local->thumb.popup_show = 1;
+   pictures_local->thumb.popup = NULL;
+
+   /* initialise and launch loader */
    pictures_local->loader.idler = ecore_idler_add(_load_idler, NULL);
 
    if (photo->config_dialog)
@@ -140,7 +142,7 @@
 
 int photo_picture_local_load_state_get(void)
 {
-   if (pictures_local->thumb.pictures ||
+   if (pictures_local->thumb.nb ||
        pictures_local->loader.idler)
      return 1;
 
@@ -176,7 +178,8 @@
           {
              DD(("- Search -"));
              picture = evas_list_data(l);
-             if (!picture->pi && !picture->delete)
+             if (!picture->pi && !picture->delete_me &&
+                (picture->thumb != PICTURE_THUMB_WAITING))
                return picture;
              l = evas_list_next(l);
              if (!l) l = pl->pictures;
@@ -189,12 +192,13 @@
 
 int photo_picture_local_loaded_nb_get(void)
 {
-   return evas_list_count(pictures_local->pictures);
+  return (evas_list_count(pictures_local->pictures) -
+         pictures_local->thumb.nb);
 }
 
 int photo_picture_local_tothumb_nb_get(void)
 {
-   return evas_list_count(pictures_local->thumb.pictures);
+   return pictures_local->thumb.nb;
 }
 
 void photo_picture_local_ev_set(Photo_Item *pi)
@@ -266,111 +270,6 @@
  * Private functions
  */
 
-static int
-_picture_new(char *name)
-{
-   Picture_Local_List *pl;
-   Picture *picture;
-   char file[4096];
-   int th_w, th_h;
-   char *file_tmp, *ext;
-
-   pl = pictures_local;
-
-   file_tmp = evas_list_data(pl->loader.dirs);
-   snprintf(file, sizeof(file),
-            "%s/%s", file_tmp, name);
-
-   DD(("File %s", file));
-
-   if (!pl->loader.current_dir->read_hidden && (file[0] == '.'))
-     return 0;
-
-   th_w = photo->config->pictures_thumb_size;
-   th_h = photo->config->pictures_thumb_size;
-   
-   if ((file_tmp = ecore_file_readlink(file)))
-     {
-        name = strdup(ecore_file_get_file(file_tmp));
-        strncpy(file, file_tmp, sizeof(file));
-     }
-      
-   if (pl->loader.current_dir->recursive &&
-       ecore_file_is_dir(file))
-     {
-        pl->loader.dirs = evas_list_append(pl->loader.dirs, strdup(file));
-        DPICL(("added %s to loader dirs", file));
-        return 0;
-     }
-      
-   ext = strrchr(name, '.');
-   if (!ext)
-     return 0;
-   if (strcasecmp(ext, ".jpg") && strcasecmp(ext, ".JPG") &&
-       strcasecmp(ext, ".jpeg") && strcasecmp(ext, ".JPEG") &&
-       strcasecmp(ext, ".png") && strcasecmp(ext, ".PNG"))
-     return 0;
-      
-   DPICL(("File %s loading ...", file));
-      
-   picture = E_NEW(Picture, 1);
-   picture->path = evas_stringshare_add(file);
-   file_tmp = e_thumb_file_get((char *)picture->path);
-   picture->thumb_path = evas_stringshare_add(file_tmp);
-   free(file_tmp);
-   picture->infos.name = photo_picture_name_get(name);
-   picture->from = PICTURE_LOCAL;
-
-   DPICL(("Thumb %s of %s exists ?", picture->thumb_path, picture->path));
-   if (e_thumb_exists((char *)picture->path))
-     {
-        int w, h;
-
-        e_thumb_geometry_get((char *)picture->thumb_path, &w, &h, 1);
-        DPICL(("THUMB %dx%d (wanted %dx%d)", w, h, th_w, th_h));
-        if ((th_w > w) && (th_h > h))
-          {
-             /* thumb exists, but regen to new size */
-             int i;
-
-             i = ecore_file_unlink(picture->thumb_path);
-             DPICL(("File %s thumb exists (%dx%d),  but regen to %dx%d (del 
old %d)", file, w, h, th_w, th_h, i));
-             pl->thumb.pictures = evas_list_append(pl->thumb.pictures,
-                                                   picture);
-             e_thumb_generate_begin((char *)picture->path, th_w, th_h,
-                                    photo->e_evas,
-                                    &picture->picture, _thumb_generate_cb,
-                                    picture);
-          }
-        else
-          {
-             /* thumb exists and good size */
-             DPICL(("File %s thumb exists and good size, add (%de)", file, 
evas_list_count(pl->pictures)));
-             picture->original_w = w;
-             picture->original_h = h;
-             pl->pictures = evas_list_append(pl->pictures, picture);
-             if (pl->loader_ev.nb_clients)
-               photo_picture_local_ev_raise(1);
-             if (photo->config_dialog &&
-                 !(evas_list_count(pl->pictures)%100))
-               photo_config_dialog_refresh_local_infos();
-          }
-     }
-   else
-     {
-        /* thumb doesnt exists so generate it */
-        DPICL(("File %s thumb doesnt exist, gen %dx%d", file, th_w, th_h));
-        pl->thumb.pictures = evas_list_append(pl->thumb.pictures,
-                                              picture);
-        e_thumb_generate_begin((char *)picture->path, th_w, th_h,
-                               photo->e_evas,
-                               &picture->picture, _thumb_generate_cb,
-                               picture);
-     }
-
-   return 1;
-}
-
 static void
 _pictures_old_del(int force, int force_now)
 {
@@ -392,7 +291,9 @@
    Picture_Local_List *pl;
    Picture_Local_Dir *d;
    Evas_List *l;
-   char *name;
+   Picture *picture;
+   char *name, *file_tmp;
+   char file[200];
 
    pl = pictures_local;
 
@@ -445,15 +346,15 @@
              if (photo->config->local.popup >= PICTURE_LOCAL_POPUP_SUM)
                {
                 char buf[50];
-                int thumb_nb = evas_list_count(pl->thumb.pictures);
+
                 snprintf(buf, sizeof(buf), "Scan finished : %d pictures found",
-                         evas_list_count(pl->pictures) + thumb_nb);
+                         evas_list_count(pl->pictures) + pl->thumb.nb);
                 POPUP_LOADING(pl, buf, 3);
                 /* tell how much pictures to thumb */
-                if (thumb_nb)
+                if (pl->thumb.nb)
                   {
                     snprintf(buf, sizeof(buf), "Still %d pictures to 
thumbnail",
-                             thumb_nb);
+                             pl->thumb.nb);
                     POPUP_THUMBNAILING(pl, buf, 3);
                   }
                }
@@ -482,46 +383,48 @@
         return 1;
      }
 
+   snprintf(file, sizeof(file),
+            "%s/%s", (char *)evas_list_data(pl->loader.dirs), name);
+
+   if (!pl->loader.current_dir->read_hidden && (name[0] == '.'))
+     return 1;
+   if ((file_tmp = ecore_file_readlink(file)))
+     {
+        name = strdup(ecore_file_get_file(file_tmp));
+        strncpy(file, file_tmp, sizeof(file));
+     }
+   if (pl->loader.current_dir->recursive &&
+       ecore_file_is_dir(file))
+     {
+        pl->loader.dirs = evas_list_append(pl->loader.dirs, strdup(file));
+        DPICL(("added %s to loader dirs", file));
+        return 1;
+     }
+
    /* create the picture */
-   if (_picture_new(name))
+   picture = photo_picture_new(file, name, 1, _thumb_generate_cb);
+   if (!picture)
+     return 1;
+
+   pl->thumb.nb++;
+   pl->pictures = evas_list_append(pl->pictures, picture);
+
+   /* loader popups */
+   if (photo->config->local.popup == PICTURE_LOCAL_POPUP_ALWAYS)
      {
-        /* popups */
-        if (photo->config->local.popup == PICTURE_LOCAL_POPUP_ALWAYS)
-          {
-             int nb;
-             
-             /* loading popup message */        
-             nb = evas_list_count(pl->pictures) + 
evas_list_count(pl->thumb.pictures);
-             if (nb && ((nb == 1) || !(nb%PICTURE_LOCAL_POPUP_LOADER_MOD)))
-               {
-                  char buf[50];
-                  
-                  if (nb == 1)
-                    snprintf(buf, sizeof(buf), "Scanning for pictures");
-                  else
-                    snprintf(buf, sizeof(buf), "%d pictures found", nb);
-                  POPUP_LOADING(pl, buf, 0);
-               }
-             
-             /* thumbnailing popup message */
-             if (pl->thumb.popup_show && (evas_list_count(pl->thumb.pictures) 
== 1))
-               {
-                  POPUP_THUMBNAILING(pl, "Thumbnailing some pictures", 0);
-                  pl->thumb.popup_show = 0;
-               }
-          }
+        int nb;
         
-        /* thumbnailing message */
-        if (photo->config->local.thumb_msg &&
-            (evas_list_count(pl->thumb.pictures) > 2))
+        /* loading popup message */        
+        nb = evas_list_count(pl->pictures) + pl->thumb.nb;
+        if (nb && ((nb == 1) || !(nb%PICTURE_LOCAL_POPUP_LOADER_MOD)))
           {
-             photo->config->local.thumb_msg = 0;
-             e_module_dialog_show(photo->module, _("Photo Module Information"),
-                                  _("<hilight>Creating 
thumbs</hilight><br><br>"
-                                    "Some pictures are being thumbed in a 
<hilight>background task</hilight>.<br>"
-                                    "It can take a while, but after, loading 
will be faster :)<br><br>"
-                                    "Each time wou will load pictures that 
haven't been loaded in devian before,<br>"
-                                    "they will be thumbed"));
+             char buf[50];
+             
+             if (nb == 1)
+               snprintf(buf, sizeof(buf), "Scanning for pictures");
+             else
+               snprintf(buf, sizeof(buf), "%d pictures found", nb);
+             POPUP_LOADING(pl, buf, 0);
           }
      }
 
@@ -601,61 +504,63 @@
 }
 
 static void
-_thumb_generate_cb(Evas_Object *obj, void *data)
+_thumb_generate_cb(void *data, Evas_Object *obj, void *event_info)
 {
    Picture *picture;
    Picture_Local_List *pl;
 
-   if (!photo || !data)
-     return;
-   if (!e_module_enabled_get(photo->module))
+   if (!photo || !e_module_enabled_get(photo->module))
      return;
 
    pl = pictures_local;
-
-   if (!evas_list_count(pl->thumb.pictures))
-     return;
-
    picture = data;
 
-   pl->thumb.pictures = evas_list_remove(pl->thumb.pictures, picture);
-   if (!evas_list_count(pl->thumb.pictures))
+   DPICL(("back from thumb generation of %s", picture->infos.name));
+
+   if (!obj)
      {
-        pl->thumb.pictures = NULL;
-        if (photo->config_dialog)
-          photo_config_dialog_refresh_local_load();
+        DPICL(("generated object is NULL !!"));
+        photo_picture_free(picture, 1, 1);
+        return;
      }
 
-   DPICL(("back from thumb generation of %s", picture->infos.name));
+   evas_object_geometry_get(obj, NULL, NULL,
+                           &picture->original_w, &picture->original_h);
+   DPICL(("thumb generated %dx%d", picture->original_w, picture->original_h));
 
-   if (ecore_file_exists(picture->thumb_path))
-     {
-        e_thumb_geometry_get((char *)picture->thumb_path,
-                             &picture->original_w, &picture->original_h, 1);
-        DPICL(("thumb generated %dx%d", picture->original_w, 
picture->original_h));
+   picture->thumb = PICTURE_THUMB_READY;
 
-        pl->pictures = evas_list_append(pl->pictures, picture);
+   pl->thumb.nb--;
+   pl->pictures = evas_list_append(pl->pictures, picture);
 
-        /* if the pic is loaded, remove it, we dont want it !
-         * moreover it does memleak */
-        if (picture->picture)
-          {
-             evas_object_del(picture->picture);
-             picture->picture = NULL;
-          }
+   /* popups about thumbnailing */
 
-        if (photo->config_dialog)
-          photo_config_dialog_refresh_local_infos();
+   /* first thumbnailing popup message */
+   if (photo->config->local.popup &&
+       pl->thumb.popup_show && (pl->thumb.nb == 1))
+     {
+        pl->thumb.popup_show = 0;
+        POPUP_THUMBNAILING(pl, "Thumbnailing some pictures", 0);
      }
-   else
+   
+   /* thumbnailing message, only one time */
+   if (photo->config->local.thumb_msg)
      {
-        photo_picture_free(picture, 1, 1);
+        photo->config->local.thumb_msg = 0;
+       photo_config_save();
+        e_module_dialog_show(photo->module, _("Photo Module Information"),
+                             _("<hilight>Creating thumbs</hilight><br><br>"
+                               "Some pictures are being thumbed in a 
<hilight>background task</hilight>.<br>"
+                               "It can take a while, but after, loading will 
be faster :)<br><br>"
+                               "Each time wou will load pictures that haven't 
been loaded in Photo module before,<br>"
+                               "they will be thumbed"));
      }
 
+   /* when still thumbnailing after loading */
    if ((photo->config->local.popup >= PICTURE_LOCAL_POPUP_SUM) &&
        !pl->loader.idler)
      {
-        if (!evas_list_count(pl->thumb.pictures))
+        if (!pl->thumb.nb)
           {
              /* Last thumbnailing popup message */
              POPUP_THUMBNAILING(pl, "Thumbnailing finished :)", 2);
@@ -665,20 +570,37 @@
              if (photo->config->local.popup == PICTURE_LOCAL_POPUP_ALWAYS)
                {
                   /* thumbnailing popup message */
-                  if 
(!(evas_list_count(pl->thumb.pictures)%PICTURE_LOCAL_POPUP_THUMB_MOD))
+                  if (!(pl->thumb.nb%PICTURE_LOCAL_POPUP_THUMB_MOD))
                     {
                        char buf[50];
                        
                        snprintf(buf, sizeof(buf), "Still %d pictures to 
thumbnail",
-                                evas_list_count(pl->thumb.pictures));
+                                pl->thumb.nb);
                        POPUP_THUMBNAILING(pl, buf, 0);
                     }
                }
           }
      }
 
+   /* refreshes */
+
+   if (!pl->thumb.nb && photo->config_dialog)
+     photo_config_dialog_refresh_local_load();
+
    if (pl->loader_ev.nb_clients)
      photo_picture_local_ev_raise(1);
+
+   if (photo->config_dialog &&
+       !(evas_list_count(pl->pictures)%100))
+     photo_config_dialog_refresh_local_infos();
+
+   /* if the pic is loaded, remove it, we dont want it */
+
+   if (picture->picture)
+     {
+        evas_object_del(picture->picture);
+        picture->picture = NULL;
+     }
 }
 
 static void
@@ -690,26 +612,25 @@
 
    pl = pictures_local;
 
-   if (pl->thumb.pictures)
+   if (pl->thumb.nb)
      {
-        for (l=pl->thumb.pictures; l; l=evas_list_next(l))
+        for (l=pl->pictures; l; l=evas_list_next(l))
           {
              picture = evas_list_data(l);
-             e_thumb_generate_end((char *)picture->path);
+             if (picture->thumb != PICTURE_THUMB_WAITING)
+               continue;
+
+             e_thumb_icon_end(picture->picture);
              photo_picture_free(picture, 1, 1);
           }
-        evas_list_free(pl->thumb.pictures);
+        pl->thumb.nb = 0;
      }
 
-   pl->thumb.pictures = NULL;
-
    if (pl->thumb.popup)
      {
         photo_popup_warn_del(pl->thumb.popup);
         pl->thumb.popup = NULL;
      }
-
-   pl->thumb.popup_show = 1;
 }
 
 static int




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to