okra pushed a commit to branch master.

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

commit a59450718f779bb0b71b203b8f996ef7be1b7a8f
Author: Stephen Houston <[email protected]>
Date:   Sat Jan 24 18:37:43 2015 -0600

    Ephoto: fix an issue where directories were considered images in single 
browser.
---
 src/bin/ephoto.h      |  1 +
 src/bin/ephoto_main.c | 41 +++++++++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index a472682..0b645db 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -118,6 +118,7 @@ struct _Ephoto
    Evas_Object *slideshow;
 
    Eina_List *entries;
+   Eina_List *direntries;
    Eina_List *thumbs; /* live thumbs that need to be regenerated on changes */
 
    int thumb_gen_size; /* pending value for thumb_regen */
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 882c249..4eb1a9f 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -298,19 +298,39 @@ _ephoto_populate_main(void *data, Eio_File *handler 
EINA_UNUSED, const Eina_File
 
    e = ephoto_entry_new(ephoto, info->path, info->path + info->name_start, 
info->type);
 
-   if (!ephoto->entries)
-     ephoto->entries = eina_list_append(ephoto->entries, e);
+   if (e->is_dir)
+     {
+        if (!ephoto->direntries)
+          ephoto->direntries = eina_list_append(ephoto->direntries, e);
+        else
+          {
+             int near_cmp;
+             Eina_List *near_node = eina_list_search_sorted_near_list
+               (ephoto->direntries, ephoto_entries_cmp, e, &near_cmp);
+             if (near_cmp < 0)
+               ephoto->direntries = eina_list_append_relative_list
+                 (ephoto->direntries, e, near_node);
+             else
+               ephoto->direntries = eina_list_prepend_relative_list
+                 (ephoto->direntries, e, near_node);
+          }
+     }
    else
      {
-        int near_cmp;
-        Eina_List *near_node = eina_list_search_sorted_near_list
-          (ephoto->entries, ephoto_entries_cmp, e, &near_cmp);
-        if (near_cmp < 0)
-          ephoto->entries = eina_list_append_relative_list
-            (ephoto->entries, e, near_node);
+        if (!ephoto->entries)
+          ephoto->entries = eina_list_append(ephoto->entries, e);
         else
-          ephoto->entries = eina_list_prepend_relative_list
-            (ephoto->entries, e, near_node);
+          {
+             int near_cmp;
+             Eina_List *near_node = eina_list_search_sorted_near_list
+               (ephoto->entries, ephoto_entries_cmp, e, &near_cmp);
+             if (near_cmp < 0)
+               ephoto->entries = eina_list_append_relative_list
+                 (ephoto->entries, e, near_node);
+             else
+               ephoto->entries = eina_list_prepend_relative_list
+                 (ephoto->entries, e, near_node);
+          }
      }
    ev = calloc(1, sizeof(Ephoto_Event_Entry_Create));
    ev->entry = e;
@@ -593,4 +613,5 @@ ephoto_entries_free(Ephoto *ephoto)
 {
    Ephoto_Entry *entry;
    EINA_LIST_FREE(ephoto->entries, entry) ephoto_entry_free(entry);
+   EINA_LIST_FREE(ephoto->direntries, entry) ephoto_entry_free(entry);
 }

-- 


Reply via email to