Ephoto: Fix opening of images from command.

This commit is contained in:
Stephen Houston 2016-09-20 15:24:49 -05:00
parent 4f10741f4f
commit 1dbee7b7b3
2 changed files with 31 additions and 18 deletions

View File

@ -1537,7 +1537,7 @@ _ephoto_single_populate_end(void *data, int type EINA_UNUSED,
if (!sb->entry && sb->ephoto->state == EPHOTO_STATE_SINGLE) if (!sb->entry && sb->ephoto->state == EPHOTO_STATE_SINGLE)
ephoto_single_browser_entry_set(sb->main, ephoto_single_browser_entry_set(sb->main,
eina_list_nth(sb->ephoto->entries, 0)); _first_entry_find(sb));
return ECORE_CALLBACK_PASS_ON; 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)) if (sb->pending_path && !strcmp(e->path, sb->pending_path))
{ {
eina_stringshare_del(sb->pending_path); eina_stringshare_del(sb->pending_path);
sb->pending_path = NULL; ephoto_single_browser_entry_set(sb->main, e);
ephoto_single_browser_entry_set(sb->ephoto->single_browser, e);
} }
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -2108,9 +2107,35 @@ void
ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries) ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries)
{ {
Ephoto_Single_Browser *sb = evas_object_data_get(obj, "single_browser"); 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) 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 void

View File

@ -1560,21 +1560,9 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED,
evas_object_smart_callback_call(tb->main, "changed,directory", NULL); evas_object_smart_callback_call(tb->main, "changed,directory", NULL);
ephoto_thumb_browser_update_info_label(tb->ephoto); 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; 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) if (eina_list_count(tb->entries) < 1 && tb->ephoto->config->folders)
{ {
ephoto_show_folders(tb->ephoto, EINA_FALSE); ephoto_show_folders(tb->ephoto, EINA_FALSE);