Mercurial > geeqie
changeset 913:2f9edd196dca
clean up fd->change on error
author | nadvornik |
---|---|
date | Tue, 22 Jul 2008 18:27:12 +0000 |
parents | 9108a7158c02 |
children | 9427c91951e8 |
files | src/filedata.c |
diffstat | 1 files changed, 40 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filedata.c Tue Jul 22 18:13:41 2008 +0000 +++ b/src/filedata.c Tue Jul 22 18:27:12 2008 +0000 @@ -1331,72 +1331,99 @@ return ret; } -gboolean file_data_sc_add_ci_copy_list(GList *fd_list, const gchar *dest) +static void file_data_sc_revert_ci_list(GList *fd_list) { GList *work; - gboolean ret = TRUE; work = fd_list; while (work) { FileData *fd = work->data; - if (!file_data_sc_add_ci_copy(fd, dest)) ret = FALSE; + file_data_sc_free_ci(fd); + work = work->prev; + } +} + + +gboolean file_data_sc_add_ci_copy_list(GList *fd_list, const gchar *dest) +{ + GList *work; + + work = fd_list; + while (work) + { + FileData *fd = work->data; + + if (!file_data_sc_add_ci_copy(fd, dest)) + { + file_data_sc_revert_ci_list(work->prev); + return FALSE; + } work = work->next; } - return ret; + return TRUE; } gboolean file_data_sc_add_ci_move_list(GList *fd_list, const gchar *dest) { GList *work; - gboolean ret = TRUE; work = fd_list; while (work) { FileData *fd = work->data; - if (!file_data_sc_add_ci_move(fd, dest)) ret = FALSE; + if (!file_data_sc_add_ci_move(fd, dest)) + { + file_data_sc_revert_ci_list(work->prev); + return FALSE; + } work = work->next; } - return ret; + return TRUE; } gboolean file_data_sc_add_ci_rename_list(GList *fd_list, const gchar *dest) { GList *work; - gboolean ret = TRUE; work = fd_list; while (work) { FileData *fd = work->data; - if (!file_data_sc_add_ci_rename(fd, dest)) ret = FALSE; + if (!file_data_sc_add_ci_rename(fd, dest)) + { + file_data_sc_revert_ci_list(work->prev); + return FALSE; + } work = work->next; } - return ret; + return TRUE; } gboolean file_data_sc_add_ci_unspecified_list(GList *fd_list, const gchar *dest) { GList *work; - gboolean ret = TRUE; work = fd_list; while (work) { FileData *fd = work->data; - if (!file_data_sc_add_ci_unspecified(fd, dest)) ret = FALSE; + if (!file_data_sc_add_ci_unspecified(fd, dest)) + { + file_data_sc_revert_ci_list(work->prev); + return FALSE; + } work = work->next; } - return ret; + return TRUE; } void file_data_sc_free_ci_list(GList *fd_list)