okra pushed a commit to branch master.

http://git.enlightenment.org/apps/ephoto.git/commit/?id=75131514ccf2b82e7864537bad4eaa1442c07c00

commit 75131514ccf2b82e7864537bad4eaa1442c07c00
Author: Stephen okra Houston <smhousto...@gmail.com>
Date:   Tue Mar 15 16:45:20 2016 -0500

    Ephoto: Eliminate duplicate thumbing.
---
 src/bin/ephoto.h               |  1 +
 src/bin/ephoto_config.c        |  4 ++--
 src/bin/ephoto_main.c          | 30 +++++++++++++++++++++++-------
 src/bin/ephoto_thumb_browser.c | 10 +++++++---
 4 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index f0ed31a..71ab446 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -218,6 +218,7 @@ struct _Ephoto_Event_Entry_Create
 
 Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path,
     const char *label, Eina_File_Type type);
+Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path);
 void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry);
 void ephoto_entry_free_listener_add(Ephoto_Entry *entry,
     void (*cb) (void *data, const Ephoto_Entry *entry), const void *data);
diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c
index 92ff0ab..dd72d91 100644
--- a/src/bin/ephoto_config.c
+++ b/src/bin/ephoto_config.c
@@ -442,8 +442,8 @@ _ephoto_config_about(Evas_Object *parent)
    evas_object_size_hint_weight_set(entry, 0.0, 0.0);
    evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
    eina_strbuf_append_printf(sbuf,
-       _("Ephoto is a comprehensive image viewer based on the EFL.<br/>"
-          "For more information, please visit the Ephoto project page:<br/>"
+       _("Ephoto is a comprehensive image viewer based on the EFL. For 
more<br/>"
+          "information, please visit the Ephoto project page:<br/>"
            "<a href=http://www.smhouston.us/ephoto/>"
            "http://www.smhouston.us/ephoto/</a><br/><br/>"
            "Ephoto also has a page on the Enlightenment wiki:<br/>"
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 62c3c83..b4dfade 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -353,6 +353,8 @@ _ephoto_populate_main(void *data, Eio_File *handler 
EINA_UNUSED,
    Ephoto_Entry *e;
    Ephoto_Event_Entry_Create *ev;
 
+   if (ephoto_entry_exists(ed->ephoto, info->path))
+     return;
    e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start,
        info->type);
 
@@ -451,6 +453,7 @@ _ephoto_change_dir(void *data)
 {
    Ephoto_Dir_Data *ed = data;
 
+   ed->ephoto->thumb_entry = NULL;
    ed->ephoto->job.change_dir = NULL;
    _ephoto_populate_entries(ed);
 }
@@ -471,16 +474,12 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
    if (evas_object_image_extension_can_load_get(path))
      {
         if (event == ECORE_FILE_EVENT_CREATED_FILE)
-          { 
-             Eina_List *l;
+          {
              Ephoto_Entry *entry;
              char buf[PATH_MAX];
 
-             EINA_LIST_FOREACH(ephoto->entries, l, entry)
-               {
-                  if (!strcmp(entry->path, path))
-                    return;
-               }
+             if (ephoto_entry_exists(ephoto, path))
+               return;
              snprintf(buf, PATH_MAX, "%s", path);
              entry = ephoto_entry_new(ephoto, path, basename(buf),
                  EINA_FILE_REG);
@@ -553,6 +552,9 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
              if (!found)
                {
                   char buf[PATH_MAX];
+
+                  if (ephoto_entry_exists(ephoto, path))
+                    return;
                   snprintf(buf, PATH_MAX, "%s", path);
                   entry = ephoto_entry_new(ephoto, path, basename(buf),
                       EINA_FILE_REG);
@@ -763,6 +765,20 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const 
char *label,
    return entry;
 }
 
+Eina_Bool 
+ephoto_entry_exists(Ephoto *ephoto, const char *path)
+{
+   Ephoto_Entry *entry;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(ephoto->entries, l, entry)
+     {
+        if (!strcmp(entry->path, path))
+          return EINA_TRUE;
+     }
+   return EINA_FALSE;
+}
+
 void
 ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
 {
diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c
index 296cb3a..e35e4fb 100644
--- a/src/bin/ephoto_thumb_browser.c
+++ b/src/bin/ephoto_thumb_browser.c
@@ -551,6 +551,8 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
           {
              ic = &_ephoto_dir_class;
              snprintf(buf, PATH_MAX, "%s", path);
+             if (ephoto_entry_exists(entry->ephoto, path))
+               return;
              e = ephoto_entry_new(entry->ephoto, path, basename(buf),
                  EINA_FILE_DIR);
              e->genlist = entry->genlist;
@@ -662,7 +664,7 @@ _todo_items_process(void *data)
       i++;
       if (i > TODO_ITEM_MIN_BATCH)
         return EINA_TRUE;
-      if (entry->is_dir)
+      if (entry->is_dir && !entry->item)
         {
           const Elm_Genlist_Item_Class *ic;
 
@@ -685,7 +687,7 @@ _todo_items_process(void *data)
                entry->genlist = tb->fsel;
              }
         }
-      else
+      else if (!entry->is_dir && !entry->item)
         {
           const Elm_Gengrid_Item_Class *ic;
 
@@ -3624,6 +3626,8 @@ _top_monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
              item = elm_genlist_item_next_get(item);
           }
         snprintf(buf, PATH_MAX, "%s", path);
+        if (ephoto_entry_exists(tb->ephoto, path))
+          return;
         e = ephoto_entry_new(tb->ephoto, path, basename(buf),
             EINA_FILE_DIR);
         e->genlist = tb->fsel;
@@ -3706,7 +3710,7 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry 
*entry)
    Ephoto_Thumb_Browser *tb =
        evas_object_data_get(ephoto->thumb_browser, "thumb_browser");
 
-   if (!entry->is_dir)
+   if (!entry->is_dir && !entry->item)
      {
         Eina_File *f;
         const Elm_Gengrid_Item_Class *ic;

-- 


Reply via email to