|
|
|
@ -388,12 +388,19 @@ _check_for_subdirs(Ephoto_Entry *entry) |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
EINA_ITERATOR_FOREACH(ls, info) |
|
|
|
|
{ |
|
|
|
|
char *realpath = ecore_file_realpath(info->path); |
|
|
|
|
if (info->type != EINA_FILE_DIR && info->type != EINA_FILE_LNK) |
|
|
|
|
continue; |
|
|
|
|
if (info->type == EINA_FILE_LNK && !ecore_file_is_dir( |
|
|
|
|
ecore_file_realpath(info->path))) |
|
|
|
|
continue; |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (info->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
eina_iterator_free(ls); |
|
|
|
|
free(realpath); |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
} |
|
|
|
|
eina_iterator_free(ls); |
|
|
|
@ -700,7 +707,9 @@ _todo_items_free(Ephoto_Directory_Browser *db) |
|
|
|
|
static void |
|
|
|
|
_monitor_add(Ephoto_Entry *e) |
|
|
|
|
{ |
|
|
|
|
e->monitor = eio_monitor_add(ecore_file_realpath(e->path)); |
|
|
|
|
char *realpath = ecore_file_realpath(e->path); |
|
|
|
|
|
|
|
|
|
e->monitor = eio_monitor_add(realpath); |
|
|
|
|
e->monitor_handlers = |
|
|
|
|
eina_list_append(e->monitor_handlers, |
|
|
|
|
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, |
|
|
|
@ -725,6 +734,8 @@ _monitor_add(Ephoto_Entry *e) |
|
|
|
|
eina_list_append(e->monitor_handlers, |
|
|
|
|
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, |
|
|
|
|
_monitor_cb, e)); |
|
|
|
|
|
|
|
|
|
free(realpath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
@ -749,11 +760,17 @@ _monitor_cb(void *data, int type, |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED) |
|
|
|
|
{ |
|
|
|
|
if (!ecore_file_is_dir(ecore_file_realpath(ev->filename))) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
char *realpath = ecore_file_realpath(ev->filename); |
|
|
|
|
if (!ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
if (ephoto_entry_exists(entry->ephoto, ev->filename)) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE && |
|
|
|
|
elm_genlist_item_expanded_get(entry->item) == EINA_TRUE) |
|
|
|
|
{ |
|
|
|
@ -787,6 +804,7 @@ _monitor_cb(void *data, int type, |
|
|
|
|
entry->item = parent; |
|
|
|
|
entry->no_delete = EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
else if (type == EIO_MONITOR_DIRECTORY_DELETED || type == EIO_MONITOR_FILE_DELETED) |
|
|
|
@ -835,8 +853,12 @@ _monitor_cb(void *data, int type, |
|
|
|
|
} |
|
|
|
|
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED || type == EIO_MONITOR_FILE_MODIFIED) |
|
|
|
|
{ |
|
|
|
|
if (!ecore_file_is_dir(ecore_file_realpath(ev->filename))) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
char *realpath = ecore_file_realpath(ev->filename); |
|
|
|
|
if (!ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE)) |
|
|
|
|
{ |
|
|
|
|
item = elm_genlist_first_item_get(entry->genlist); |
|
|
|
@ -851,6 +873,7 @@ _monitor_cb(void *data, int type, |
|
|
|
|
item = elm_genlist_item_next_get(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
@ -876,10 +899,17 @@ _top_monitor_cb(void *data, int type, |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED) |
|
|
|
|
{ |
|
|
|
|
if (!ecore_file_is_dir(ecore_file_realpath(ev->filename))) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
char *realpath = ecore_file_realpath(ev->filename); |
|
|
|
|
if (!ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
if (ephoto_entry_exists(db->ephoto, ev->filename)) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
snprintf(buf, PATH_MAX, "%s", ev->filename); |
|
|
|
|
e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf), |
|
|
|
|
EINA_FILE_DIR); |
|
|
|
@ -890,6 +920,7 @@ _top_monitor_cb(void *data, int type, |
|
|
|
|
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
if (e->item) |
|
|
|
|
_monitor_add(e); |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
else if (type == EIO_MONITOR_DIRECTORY_DELETED || type == EIO_MONITOR_FILE_DELETED) |
|
|
|
@ -912,8 +943,12 @@ _top_monitor_cb(void *data, int type, |
|
|
|
|
} |
|
|
|
|
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED || type == EIO_MONITOR_FILE_MODIFIED) |
|
|
|
|
{ |
|
|
|
|
if (!ecore_file_is_dir(ecore_file_realpath(ev->filename))) |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
char *realpath = ecore_file_realpath(ev->filename); |
|
|
|
|
if (!ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
item = elm_genlist_first_item_get(db->fsel); |
|
|
|
|
while (item) |
|
|
|
|
{ |
|
|
|
@ -925,6 +960,7 @@ _top_monitor_cb(void *data, int type, |
|
|
|
|
} |
|
|
|
|
item = elm_genlist_item_next_get(item); |
|
|
|
|
} |
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
@ -1039,14 +1075,16 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event) |
|
|
|
|
Ephoto_Directory_Browser *db = data; |
|
|
|
|
Ephoto_Event_Entry_Create *ev = event; |
|
|
|
|
Ephoto_Entry *e; |
|
|
|
|
char *realpath; |
|
|
|
|
|
|
|
|
|
e = ev->entry; |
|
|
|
|
realpath = ecore_file_realpath(e->path); |
|
|
|
|
if (e->is_dir) |
|
|
|
|
{ |
|
|
|
|
db->todo_items = eina_list_append(db->todo_items, e); |
|
|
|
|
db->animator.count++; |
|
|
|
|
} |
|
|
|
|
else if (ecore_file_is_dir(ecore_file_realpath(e->path))) |
|
|
|
|
else if (ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
db->todo_items = eina_list_append(db->todo_items, e); |
|
|
|
|
db->animator.count++; |
|
|
|
@ -1054,6 +1092,7 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event) |
|
|
|
|
if (!db->animator.todo_items) |
|
|
|
|
db->animator.todo_items = ecore_animator_add(_todo_items_process, db); |
|
|
|
|
|
|
|
|
|
free(realpath); |
|
|
|
|
return ECORE_CALLBACK_PASS_ON; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1102,6 +1141,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) |
|
|
|
|
Ephoto_Directory_Browser *db = |
|
|
|
|
evas_object_data_get(ephoto->dir_browser, "directory_browser"); |
|
|
|
|
Ecore_Event_Handler *handler; |
|
|
|
|
char *realpath = ecore_file_realpath(dir); |
|
|
|
|
|
|
|
|
|
if (db->monitor) |
|
|
|
|
{ |
|
|
|
@ -1113,7 +1153,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) |
|
|
|
|
eina_stringshare_replace(&ephoto->top_directory, dir); |
|
|
|
|
else |
|
|
|
|
ephoto->top_directory = eina_stringshare_add(dir); |
|
|
|
|
db->monitor = eio_monitor_add(ecore_file_realpath(dir)); |
|
|
|
|
db->monitor = eio_monitor_add(realpath); |
|
|
|
|
db->monitor_handlers = |
|
|
|
|
eina_list_append(db->monitor_handlers, |
|
|
|
|
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, |
|
|
|
@ -1138,6 +1178,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) |
|
|
|
|
eina_list_append(db->monitor_handlers, |
|
|
|
|
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, |
|
|
|
|
_top_monitor_cb, db)); |
|
|
|
|
free(realpath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
@ -1181,11 +1222,17 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) |
|
|
|
|
cur = next; |
|
|
|
|
EINA_ITERATOR_FOREACH(it, finfo) |
|
|
|
|
{ |
|
|
|
|
char *realpath = ecore_file_realpath(finfo->path); |
|
|
|
|
if (finfo->type != EINA_FILE_DIR && finfo->type != EINA_FILE_LNK) |
|
|
|
|
continue; |
|
|
|
|
if (finfo->type == EINA_FILE_LNK && !ecore_file_is_dir( |
|
|
|
|
ecore_file_realpath(finfo->path))) |
|
|
|
|
continue; |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (finfo->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)realpath)) |
|
|
|
|
{ |
|
|
|
|
free(realpath); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (strncmp(finfo->path + finfo->name_start, ".", 1)) |
|
|
|
|
{ |
|
|
|
|
Ephoto_Entry *entry = ephoto_entry_new(ephoto, finfo->path, |
|
|
|
@ -1229,6 +1276,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
free(realpath); |
|
|
|
|
} |
|
|
|
|
count++; |
|
|
|
|
free(dir); |
|
|
|
|