Ephoto: Support symlinked dirs.

This commit is contained in:
Stephen Houston 2016-08-05 21:26:21 -05:00
parent ccbc11373c
commit 49f792d962
3 changed files with 31 additions and 13 deletions

View File

@ -391,11 +391,13 @@ _check_for_subdirs(Ephoto_Entry *entry)
return EINA_FALSE; return EINA_FALSE;
EINA_ITERATOR_FOREACH(ls, info) EINA_ITERATOR_FOREACH(ls, info)
{ {
if (info->type == EINA_FILE_DIR) if (info->type != EINA_FILE_DIR && info->type != EINA_FILE_LNK)
{ continue;
eina_iterator_free(ls); if (info->type == EINA_FILE_LNK && !ecore_file_is_dir(
return EINA_TRUE; ecore_file_realpath(info->path)))
} continue;
eina_iterator_free(ls);
return EINA_TRUE;
} }
eina_iterator_free(ls); eina_iterator_free(ls);
return EINA_FALSE; return EINA_FALSE;
@ -729,7 +731,7 @@ _monitor_cb(void *data, int type,
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if (type == EIO_MONITOR_DIRECTORY_CREATED) if (type == EIO_MONITOR_DIRECTORY_CREATED)
{ {
if (!ecore_file_is_dir(ev->filename)) if (!ecore_file_is_dir(ecore_file_realpath(ev->filename)))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if (ephoto_entry_exists(entry->ephoto, ev->filename)) if (ephoto_entry_exists(entry->ephoto, ev->filename))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -833,7 +835,7 @@ _monitor_cb(void *data, int type,
} }
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED) else if (type == EIO_MONITOR_DIRECTORY_MODIFIED)
{ {
if (!ecore_file_is_dir(ev->filename)) if (!ecore_file_is_dir(ecore_file_realpath(ev->filename)))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE)) if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE))
{ {
@ -874,7 +876,7 @@ _top_monitor_cb(void *data, int type,
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if (type == EIO_MONITOR_DIRECTORY_CREATED) if (type == EIO_MONITOR_DIRECTORY_CREATED)
{ {
if (!ecore_file_is_dir(ev->filename)) if (!ecore_file_is_dir(ecore_file_realpath(ev->filename)))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
if (ephoto_entry_exists(db->ephoto, ev->filename)) if (ephoto_entry_exists(db->ephoto, ev->filename))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -924,7 +926,7 @@ _top_monitor_cb(void *data, int type,
} }
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED) else if (type == EIO_MONITOR_DIRECTORY_MODIFIED)
{ {
if (!ecore_file_is_dir(ev->filename)) if (!ecore_file_is_dir(ecore_file_realpath(ev->filename)))
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
item = elm_genlist_first_item_get(db->fsel); item = elm_genlist_first_item_get(db->fsel);
while (item) while (item)
@ -1068,6 +1070,11 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
db->todo_items = eina_list_append(db->todo_items, e); db->todo_items = eina_list_append(db->todo_items, e);
db->animator.count++; db->animator.count++;
} }
else if (ecore_file_is_dir(ecore_file_realpath(e->path)))
{
db->todo_items = eina_list_append(db->todo_items, e);
db->animator.count++;
}
if (!db->animator.todo_items) if (!db->animator.todo_items)
db->animator.todo_items = ecore_animator_add(_todo_items_process, db); db->animator.todo_items = ecore_animator_add(_todo_items_process, db);
@ -1185,8 +1192,12 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
cur = next; cur = next;
EINA_ITERATOR_FOREACH(it, finfo) EINA_ITERATOR_FOREACH(it, finfo)
{ {
if (finfo->type == EINA_FILE_DIR && if (finfo->type != EINA_FILE_DIR && finfo->type != EINA_FILE_LNK)
strncmp(finfo->path + finfo->name_start, ".", 1)) continue;
if (finfo->type == EINA_FILE_LNK && !ecore_file_is_dir(
ecore_file_realpath(finfo->path)))
continue;
if (strncmp(finfo->path + finfo->name_start, ".", 1))
{ {
Ephoto_Entry *entry = ephoto_entry_new(db->ephoto, finfo->path, Ephoto_Entry *entry = ephoto_entry_new(db->ephoto, finfo->path,
finfo->path+finfo->name_start, finfo->type); finfo->path+finfo->name_start, finfo->type);

View File

@ -741,6 +741,10 @@ _ephoto_populate_filter(void *data, Eio_File *handler EINA_UNUSED,
{ {
return EINA_TRUE; return EINA_TRUE;
} }
else if (info->type == EINA_FILE_LNK && !ed->thumbs_only)
{
return ecore_file_is_dir(ecore_file_realpath(info->path));
}
if (!ed->dirs_only) if (!ed->dirs_only)
return _ephoto_eina_file_direct_info_image_useful(info); return _ephoto_eina_file_direct_info_image_useful(info);
else else
@ -1065,7 +1069,10 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
entry->basename = ecore_file_file_get(entry->path); entry->basename = ecore_file_file_get(entry->path);
entry->label = eina_stringshare_add(label); entry->label = eina_stringshare_add(label);
if (type == EINA_FILE_DIR) if (type == EINA_FILE_DIR)
entry->is_dir = EINA_TRUE; entry->is_dir = EINA_TRUE;
else if (type == EINA_FILE_LNK && ecore_file_is_dir(
ecore_file_realpath(entry->path)))
entry->is_dir = EINA_TRUE;
else else
entry->is_dir = EINA_FALSE; entry->is_dir = EINA_FALSE;
return entry; return entry;

View File

@ -1417,7 +1417,7 @@ _ephoto_thumb_entry_create(void *data, int type EINA_UNUSED, void *event)
Ephoto_Entry *e; Ephoto_Entry *e;
e = ev->entry; e = ev->entry;
if (!e->is_dir) if (!e->is_dir && !ecore_file_is_dir(ecore_file_realpath(e->path)))
{ {
Eina_File *f; Eina_File *f;