Enlightenment CVS committal

Author  : kiwi
Project : e_modules
Module  : photo

Dir     : e_modules/photo/src/module


Modified Files:
        photo_picture.c photo_picture.h photo_picture_histo.c 
        photo_picture_local.c photo_picture_local.h 


Log Message:
fixes, and better status messages
* better support if the thumb fails to generate
* working on fixing the status messages for popups and main config pannel
* some more checks in histoic menu, to avoid segv

===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- photo_picture.c     12 Jul 2006 06:11:39 -0000      1.4
+++ photo_picture.c     12 Jul 2006 18:39:08 -0000      1.5
@@ -75,9 +75,20 @@
         if (!force) return 0;
         if (!force_now)
           {
-             p->delete_me = 1;
+           if (!p->delete_me)
+             {
+               if (p->from == PICTURE_LOCAL)
+                 photo_picture_local_picture_deleteme_nb_update(+1);
+               p->delete_me = 1;
+             }
              return 0;
           }
+     }
+
+   if (p->delete_me)
+     {
+       if (p->from == PICTURE_LOCAL)
+        photo_picture_local_picture_deleteme_nb_update(-1);
      }
 
    DD(("Picture Free : %s", p->path));
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- photo_picture.h     11 Jul 2006 05:52:13 -0000      1.3
+++ photo_picture.h     12 Jul 2006 18:39:08 -0000      1.4
@@ -42,7 +42,7 @@
       const char *comments;
    } infos;
    int original_w, original_h;
-   unsigned char from;
+  unsigned char from : 2;
 
    unsigned char delete_me : 1;
 
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture_histo.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- photo_picture_histo.c       12 Jul 2006 06:11:39 -0000      1.4
+++ photo_picture_histo.c       12 Jul 2006 18:39:08 -0000      1.5
@@ -175,12 +175,14 @@
   pi = data;

   mn = pi->menu_histo;

 

+  if (!mn) return;

+

   for (l=mn->items; l; l=evas_list_next(l))

     {

       E_Menu_Item *mi;

 

       mi = evas_list_data(l);

-      if (mi->separator) continue;

+      if (!mi || mi->separator) continue;

       evas_object_event_callback_add(mi->event_object, EVAS_CALLBACK_MOUSE_IN,

                                     _cb_menu_pre_select, mi);

       evas_object_event_callback_add(mi->event_object, EVAS_CALLBACK_MOUSE_OUT,

@@ -212,7 +214,9 @@
    int number;

 

    mi = data;

+   if (!mi) return;

    pi = mi->cb.data;

+   if (!pi) return;

 

    number = (evas_list_count(pi->histo.list) - (e_menu_item_num_get(mi)+1));

 

@@ -241,7 +245,9 @@
    Photo_Item *pi;

 

    mi = data;

+   if (!mi) return;

    pi = mi->cb.data;

+   if (!pi) return;

    

    DPIC(("Histo menu : Post select callback"));

 

===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture_local.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- photo_picture_local.c       12 Jul 2006 06:11:39 -0000      1.4
+++ photo_picture_local.c       12 Jul 2006 18:39:08 -0000      1.5
@@ -24,6 +24,7 @@
 struct _Picture_Local_List
 {
    Evas_List *pictures;
+  int pictures_waiting_delete;
 
    /* thumb */
   struct
@@ -159,7 +160,7 @@
 
    DPICL(("Trying to get a picture, position = %d", position));
 
-   if (!evas_list_count(pl->pictures))
+   if (!evas_list_count(pl->pictures) - pl->pictures_waiting_delete)
      return NULL;
 
    if (position != PICTURE_LOCAL_GET_RANDOM)
@@ -192,8 +193,9 @@
 
 int photo_picture_local_loaded_nb_get(void)
 {
-  return (evas_list_count(pictures_local->pictures) -
-         pictures_local->thumb.nb);
+  return ((evas_list_count(pictures_local->pictures) -
+         pictures_local->thumb.nb) -
+         pictures_local->pictures_waiting_delete);
 }
 
 int photo_picture_local_tothumb_nb_get(void)
@@ -228,6 +230,11 @@
    DPICL(("Loader event RAISED !"));
 }
 
+void photo_picture_local_picture_deleteme_nb_update(int how_much)
+{
+  pictures_local->pictures_waiting_delete += how_much;
+}
+
 Picture_Local_Dir *photo_picture_local_dir_new(char *path, int recursive, int 
read_hidden)
 {
    Picture_Local_Dir *dir;
@@ -281,7 +288,7 @@
         if (photo_picture_free(p, force, force_now))
           pictures_local->pictures = 
evas_list_remove(pictures_local->pictures, p);
         else
-          no++;
+         no++;
      }
 }
 
@@ -348,15 +355,8 @@
                 char buf[50];
 
                 snprintf(buf, sizeof(buf), "Scan finished : %d pictures found",
-                         evas_list_count(pl->pictures) + pl->thumb.nb);
+                         evas_list_count(pl->pictures) - 
pl->pictures_waiting_delete);
                 POPUP_LOADING(pl, buf, 3);
-                /* tell how much pictures to thumb */
-                if (pl->thumb.nb)
-                  {
-                    snprintf(buf, sizeof(buf), "Still %d pictures to 
thumbnail",
-                             pl->thumb.nb);
-                    POPUP_THUMBNAILING(pl, buf, 3);
-                  }
                }
              return 0;
           }
@@ -415,7 +415,7 @@
         int nb;
         
         /* loading popup message */        
-        nb = evas_list_count(pl->pictures) + pl->thumb.nb;
+        nb = evas_list_count(pl->pictures) - pl->pictures_waiting_delete;
         if (nb && ((nb == 1) || !(nb%PICTURE_LOCAL_POPUP_LOADER_MOD)))
           {
              char buf[50];
@@ -517,9 +517,12 @@
 
    DPICL(("back from thumb generation of %s", picture->infos.name));
 
+   pl->thumb.nb--;
+
    if (!obj)
      {
         DPICL(("generated object is NULL !!"));
+       pl->pictures = evas_list_remove(pl->pictures, picture);
         photo_picture_free(picture, 1, 1);
         return;
      }
@@ -530,18 +533,8 @@
 
    picture->thumb = PICTURE_THUMB_READY;
 
-   pl->thumb.nb--;
-
    /* popups about thumbnailing */
 
-   /* 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);
-     }
-   
    /* thumbnailing message, only one time */
    if (photo->config->local.thumb_msg)
      {
@@ -583,15 +576,21 @@
 
    /* refreshes */
 
-   if (!pl->thumb.nb && photo->config_dialog)
-     photo_config_dialog_refresh_local_load();
+   if (photo->config_dialog)
+     {
+       if (!pl->thumb.nb)
+        {
+          photo_config_dialog_refresh_local_load();
+          photo_config_dialog_refresh_local_infos();
+        }
+       if ( !(pl->thumb.nb%100) )
+        photo_config_dialog_refresh_local_infos();
+     }
+
+   /* new picture event */
 
    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 */
 
===================================================================
RCS file: /cvs/e/e_modules/photo/src/module/photo_picture_local.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- photo_picture_local.h       7 Jul 2006 17:15:25 -0000       1.1
+++ photo_picture_local.h       12 Jul 2006 18:39:08 -0000      1.2
@@ -61,5 +61,7 @@
 Picture_Local_Dir *photo_picture_local_dir_new(char *path, int recursive, int 
read_hidden);
 void               photo_picture_local_dir_free(Picture_Local_Dir *dir, int 
del_dialog);
 
+void               photo_picture_local_picture_deleteme_nb_update(int 
how_much);
+
 #endif
 #endif




-------------------------------------------------------------------------
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