diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 17855b7..ce9c84f 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -203,7 +203,7 @@ struct _Ephoto_Event_Entry_Create Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, Eina_File_Type type); -void ephoto_entry_free(Ephoto_Entry *entry); +void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry); void ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); void ephoto_entry_free_listener_del(Ephoto_Entry *entry, diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index 0ec69e9..e601818 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -423,9 +423,11 @@ _ephoto_populate_entries(Ephoto_Dir_Data *ed) Ephoto_Entry *entry; if (ed->dirs_only) - EINA_LIST_FREE(ed->ephoto->direntries, entry) ephoto_entry_free(entry); + EINA_LIST_FREE(ed->ephoto->direntries, entry) + ephoto_entry_free(entry->ephoto, entry); else if (ed->thumbs_only) - EINA_LIST_FREE(ed->ephoto->entries, entry) ephoto_entry_free(entry); + EINA_LIST_FREE(ed->ephoto->entries, entry) + ephoto_entry_free(entry->ephoto, entry); else ephoto_entries_free(ed->ephoto); @@ -621,15 +623,26 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, } void -ephoto_entry_free(Ephoto_Entry *entry) +ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry) { Ephoto_Entry_Free_Listener *fl; + Eina_List *node; EINA_LIST_FREE(entry->free_listeners, fl) { fl->cb((void *) fl->data, entry); free(fl); } + if (entry->is_dir) + { + node = eina_list_data_find_list(ephoto->direntries, entry); + ephoto->direntries = eina_list_remove_list(ephoto->direntries, node); + } + else + { + node = eina_list_data_find_list(ephoto->entries, entry); + ephoto->entries = eina_list_remove_list(ephoto->entries, node); + } eina_stringshare_del(entry->path); eina_stringshare_del(entry->label); free(entry); @@ -670,6 +683,6 @@ 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); + EINA_LIST_FREE(ephoto->entries, entry) ephoto_entry_free(ephoto, entry); + EINA_LIST_FREE(ephoto->direntries, entry) ephoto_entry_free(ephoto, entry); } diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 4ec1174..5019721 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -837,8 +837,6 @@ _prev_entry(Ephoto_Single_Browser *sb) { Eina_List *node; Ephoto_Entry *entry = NULL; - printf("Hi\n"); - printf("%s\n", sb->entry->path); node = eina_list_data_find_list(sb->ephoto->entries, sb->entry); if (!node) return; @@ -1799,10 +1797,7 @@ _delete_apply(void *data, Evas_Object *obj EINA_UNUSED, elm_object_focus_set(sb->event, EINA_TRUE); evas_object_freeze_events_set(sb->event, EINA_FALSE); } - ephoto_directory_set(sb->ephoto, sb->ephoto->config->directory, - NULL, EINA_FALSE, EINA_TRUE); - ephoto_title_set(sb->ephoto, sb->ephoto->config->directory); - evas_object_smart_callback_call(sb->main, "back", NULL); + ephoto_entry_free(sb->ephoto, sb->entry); } static void @@ -2427,11 +2422,14 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } static void -_entry_free(void *data, const Ephoto_Entry *entry EINA_UNUSED) +_entry_free(void *data, const Ephoto_Entry *entry) { Ephoto_Single_Browser *sb = data; - sb->entry = NULL; + if (entry == sb->entry) + { + _next_entry(sb); + } } static void