Ephoto: Don't resort back to thumb browser on delete.

This commit is contained in:
Stephen Houston 2015-12-02 19:11:29 -06:00
parent 271d43b9b0
commit e5695a6aee
3 changed files with 25 additions and 14 deletions

View File

@ -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,

View File

@ -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);
}

View File

@ -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