okra pushed a commit to branch master.

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

commit 1dbee7b7b3cdbfc3a83e6dfbb4494a89b72602bb
Author: Stephen Houston <stephen@localhost.localdomain>
Date:   Tue Sep 20 15:24:49 2016 -0500

    Ephoto: Fix opening of images from command.
---
 src/bin/ephoto_single_browser.c | 33 +++++++++++++++++++++++++++++----
 src/bin/ephoto_thumb_browser.c  | 16 ++--------------
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c
index 96ba403..bf1fe07 100644
--- a/src/bin/ephoto_single_browser.c
+++ b/src/bin/ephoto_single_browser.c
@@ -1537,7 +1537,7 @@ _ephoto_single_populate_end(void *data, int type 
EINA_UNUSED,
 
    if (!sb->entry && sb->ephoto->state == EPHOTO_STATE_SINGLE)
      ephoto_single_browser_entry_set(sb->main,
-                 eina_list_nth(sb->ephoto->entries, 0));
+                 _first_entry_find(sb));
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1554,8 +1554,7 @@ _ephoto_single_entry_create(void *data, int type 
EINA_UNUSED,
    if (sb->pending_path && !strcmp(e->path, sb->pending_path))
      {
        eina_stringshare_del(sb->pending_path);
-       sb->pending_path = NULL;
-       ephoto_single_browser_entry_set(sb->ephoto->single_browser, e);
+       ephoto_single_browser_entry_set(sb->main, e);
      }
 
    return ECORE_CALLBACK_PASS_ON;
@@ -2108,9 +2107,35 @@ void
 ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries)
 {
    Ephoto_Single_Browser *sb = evas_object_data_get(obj, "single_browser");
+   Ephoto_Viewer *v = NULL;
 
+   if (sb->viewer)
+     v = evas_object_data_get(sb->viewer, "viewer");
    if (entries)
-     sb->entries = entries;
+     {
+        sb->entries = entries;
+        if (sb->ephoto->state == EPHOTO_STATE_SINGLE)
+          {
+             if (v)
+               {
+                  const char *image;
+                  char *dir;
+
+                  elm_image_file_get(v->image, &image, NULL);
+                  printf("%s\n", image);
+                  dir = ecore_file_dir_get(image);
+                  if (strcmp(sb->ephoto->config->directory, dir))
+                    ephoto_single_browser_entry_set(sb->main,
+                        _first_entry_find(sb));
+                  free(dir);
+               }
+             else
+               ephoto_single_browser_entry_set(sb->main,
+                        _first_entry_find(sb));
+          }
+     }
+   else
+     ephoto_single_browser_entry_set(sb->main, NULL);
 }
 
 void
diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c
index 3f0198d..cb2acf6 100644
--- a/src/bin/ephoto_thumb_browser.c
+++ b/src/bin/ephoto_thumb_browser.c
@@ -1560,21 +1560,9 @@ _ephoto_thumb_populate_end(void *data, int type 
EINA_UNUSED,
         evas_object_smart_callback_call(tb->main, "changed,directory", NULL);  
      
         ephoto_thumb_browser_update_info_label(tb->ephoto);
      }
-   else if (tb->ephoto->state == EPHOTO_STATE_SINGLE)
-     {
-        if (tb->ephoto->entries)
-          {
-             ephoto_single_browser_entry_set(tb->ephoto->single_browser, NULL);
-             ephoto_single_browser_entries_set(tb->ephoto->single_browser,
-                 tb->ephoto->entries);
-          }
-        else
-          {
-             ephoto_single_browser_entry_set(tb->ephoto->single_browser, NULL);
-             ephoto_title_set(tb->ephoto, tb->ephoto->config->directory);
-          }
-     }
    tb->entries = tb->ephoto->entries;
+   ephoto_single_browser_entries_set(tb->ephoto->single_browser,
+                 tb->ephoto->entries);
    if (eina_list_count(tb->entries) < 1 && tb->ephoto->config->folders)
      {
         ephoto_show_folders(tb->ephoto, EINA_FALSE);

-- 


Reply via email to