Ephoto: Fix an issue where overwrite was not working. On save as, add the new entry and change dirs.

This commit is contained in:
Stephen Houston 2015-03-05 16:18:17 -06:00
parent 57f2a4ea07
commit fb87d20f13
1 changed files with 29 additions and 11 deletions

View File

@ -899,14 +899,16 @@ _save_yes(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED
{ {
success = ecore_file_unlink(sb->entry->path); success = ecore_file_unlink(sb->entry->path);
if (!success) if (!success)
_failed_save(sb); {
} _failed_save(sb);
else ephoto_single_browser_entry_set(sb->main, sb->entry);
{ evas_object_del(win);
success = evas_object_image_save(elm_image_object_get(v->image), sb->entry->path, NULL, NULL); return;
if (!success) }
_failed_save(sb);
} }
success = evas_object_image_save(elm_image_object_get(v->image), sb->entry->path, NULL, NULL);
if (!success)
_failed_save(sb);
ephoto_single_browser_entry_set(sb->main, sb->entry); ephoto_single_browser_entry_set(sb->main, sb->entry);
evas_object_del(win); evas_object_del(win);
} }
@ -991,13 +993,22 @@ _save_image_as_overwrite(void *data, Evas_Object *obj EINA_UNUSED, void *event_i
{ {
success = ecore_file_unlink(file); success = ecore_file_unlink(file);
if (!success) if (!success)
_failed_save(sb); {
_failed_save(sb);
ephoto_single_browser_entry_set(sb->main, sb->entry);
evas_object_del(win);
return;
}
} }
success = evas_object_image_save(elm_image_object_get(v->image), file, NULL, NULL);
if (!success)
_failed_save(sb);
else else
{ {
success = evas_object_image_save(elm_image_object_get(v->image), file, NULL, NULL); char *dir = ecore_file_dir_get(file);
if (!success) ephoto_directory_set(sb->ephoto, dir);
_failed_save(sb); free(dir);
ephoto_single_browser_path_pending_set(sb->ephoto->single_browser, file);
} }
ephoto_single_browser_entry_set(sb->main, sb->entry); ephoto_single_browser_entry_set(sb->main, sb->entry);
evas_object_del(win); evas_object_del(win);
@ -1079,6 +1090,13 @@ _save_image_as_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
success = evas_object_image_save(elm_image_object_get(v->image), buf, NULL, NULL); success = evas_object_image_save(elm_image_object_get(v->image), buf, NULL, NULL);
if (!success) if (!success)
_failed_save(sb); _failed_save(sb);
else
{
char *dir = ecore_file_dir_get(buf);
ephoto_directory_set(sb->ephoto, dir);
free(dir);
ephoto_single_browser_path_pending_set(sb->ephoto->single_browser, buf);
}
} }
} }
evas_object_del(win); evas_object_del(win);