Mercurial > geeqie
changeset 1623:2842a051c870
regroup sidecar files when an operation on partial group is finished
author | nadvornik |
---|---|
date | Wed, 03 Jun 2009 20:05:19 +0000 |
parents | 9e6cdef3bc3d |
children | dd361c680164 |
files | src/filedata.c src/filedata.h src/typedefs.h src/utilops.c |
diffstat | 4 files changed, 64 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filedata.c Tue Jun 02 22:33:53 2009 +0000 +++ b/src/filedata.c Wed Jun 03 20:05:19 2009 +0000 @@ -1429,6 +1429,8 @@ if (!fdci) return; file_data_planned_change_remove(fd); + + if (fdci->regroup_when_finished) file_data_disable_grouping(fd, FALSE); g_free(fdci->source); g_free(fdci->dest); @@ -1438,6 +1440,12 @@ fd->change = NULL; } +void file_data_set_regroup_when_finished(FileData *fd, gboolean enable) +{ + FileDataChangeInfo *fdci = fd->change; + if (!fdci) return; + fdci->regroup_when_finished = enable; +} static gboolean file_data_sc_add_ci(FileData *fd, FileDataChangeType type) { @@ -2373,7 +2381,7 @@ } #endif -GList *file_data_process_groups(GList *list) +GList *file_data_process_groups_in_selection(GList *list, GList **ungrouped_list) { GList *out = NULL; GList *work = list; @@ -2385,7 +2393,13 @@ work = work->next; if (!file_data_list_contains_whole_group(list, fd)) + { file_data_disable_grouping(fd, TRUE); + if (ungrouped_list) + { + *ungrouped_list = g_list_prepend(*ungrouped_list, file_data_ref(fd)); + } + } } /* remove sidecars from the list,
--- a/src/filedata.h Tue Jun 02 22:33:53 2009 +0000 +++ b/src/filedata.h Wed Jun 03 20:05:19 2009 +0000 @@ -118,6 +118,7 @@ void file_data_free_ci(FileData *fd); void file_data_free_ci_list(GList *fd_list); +void file_data_set_regroup_when_finished(FileData *fd, gboolean enable); gint file_data_sc_verify_ci(FileData *fd); @@ -126,7 +127,7 @@ void file_data_sc_free_ci(FileData *fd); void file_data_sc_free_ci_list(GList *fd_list); -GList *file_data_process_groups(GList *list); +GList *file_data_process_groups_in_selection(GList *list, GList **ungrouped); typedef void (*FileDataNotifyFunc)(FileData *fd, NotifyType type, gpointer data);
--- a/src/typedefs.h Tue Jun 02 22:33:53 2009 +0000 +++ b/src/typedefs.h Wed Jun 03 20:05:19 2009 +0000 @@ -450,6 +450,7 @@ gchar *source; gchar *dest; gint error; + gboolean regroup_when_finished; }; struct _FileData {
--- a/src/utilops.c Tue Jun 02 22:33:53 2009 +0000 +++ b/src/utilops.c Wed Jun 03 20:05:19 2009 +0000 @@ -1919,24 +1919,41 @@ g_free(message2); } + +static void file_util_mark_ungrouped_files(GList *work) +{ + while (work) + { + FileData *fd = work->data; + file_data_set_regroup_when_finished(fd, TRUE); + work = work->next; + } +} + static void file_util_delete_full(FileData *source_fd, GList *source_list, GtkWidget *parent, UtilityPhase phase) { UtilityData *ud; GList *flist = filelist_copy(source_list); + GList *ungrouped = NULL; if (source_fd) flist = g_list_append(flist, file_data_ref(source_fd)); if (!flist) return; - flist = file_data_process_groups(flist); + flist = file_data_process_groups_in_selection(flist, &ungrouped); if (!file_data_sc_add_ci_delete_list(flist)) { file_util_warn_op_in_progress(_("File deletion failed")); + file_data_disable_grouping_list(ungrouped, FALSE); filelist_free(flist); + filelist_free(ungrouped); return; } + + file_util_mark_ungrouped_files(ungrouped); + filelist_free(ungrouped); ud = file_util_data_new(UTILITY_TYPE_DELETE); @@ -2005,25 +2022,30 @@ file_util_dialog_run(ud); } - static void file_util_move_full(FileData *source_fd, GList *source_list, const gchar *dest_path, GtkWidget *parent, UtilityPhase phase) { UtilityData *ud; GList *flist = filelist_copy(source_list); + GList *ungrouped = NULL; if (source_fd) flist = g_list_append(flist, file_data_ref(source_fd)); if (!flist) return; - flist = file_data_process_groups(flist); + flist = file_data_process_groups_in_selection(flist, &ungrouped); if (!file_data_sc_add_ci_move_list(flist, dest_path)) { file_util_warn_op_in_progress(_("Move failed")); + file_data_disable_grouping_list(ungrouped, FALSE); filelist_free(flist); + filelist_free(ungrouped); return; } + + file_util_mark_ungrouped_files(ungrouped); + filelist_free(ungrouped); ud = file_util_data_new(UTILITY_TYPE_MOVE); @@ -2051,21 +2073,27 @@ { UtilityData *ud; GList *flist = filelist_copy(source_list); + GList *ungrouped = NULL; if (source_fd) flist = g_list_append(flist, file_data_ref(source_fd)); if (!flist) return; - flist = file_data_process_groups(flist); + flist = file_data_process_groups_in_selection(flist, &ungrouped); if (!file_data_sc_add_ci_copy_list(flist, dest_path)) { file_util_warn_op_in_progress(_("Copy failed")); + file_data_disable_grouping_list(ungrouped, FALSE); filelist_free(flist); + filelist_free(ungrouped); return; } + file_util_mark_ungrouped_files(ungrouped); + filelist_free(ungrouped); + ud = file_util_data_new(UTILITY_TYPE_COPY); ud->phase = phase; @@ -2092,21 +2120,27 @@ { UtilityData *ud; GList *flist = filelist_copy(source_list); + GList *ungrouped = NULL; if (source_fd) flist = g_list_append(flist, file_data_ref(source_fd)); if (!flist) return; - flist = file_data_process_groups(flist); + flist = file_data_process_groups_in_selection(flist, &ungrouped); if (!file_data_sc_add_ci_rename_list(flist, dest_path)) { file_util_warn_op_in_progress(_("Rename failed")); + file_data_disable_grouping_list(ungrouped, FALSE); filelist_free(flist); + filelist_free(ungrouped); return; } + file_util_mark_ungrouped_files(ungrouped); + filelist_free(ungrouped); + ud = file_util_data_new(UTILITY_TYPE_RENAME); ud->phase = phase; @@ -2133,6 +2167,7 @@ { UtilityData *ud; GList *flist; + GList *ungrouped = NULL; if (editor_no_param(key)) { @@ -2148,15 +2183,20 @@ if (!flist) return; - flist = file_data_process_groups(flist); + flist = file_data_process_groups_in_selection(flist, &ungrouped); if (!file_data_sc_add_ci_unspecified_list(flist, dest_path)) { file_util_warn_op_in_progress(_("Can't run external editor")); + file_data_disable_grouping_list(ungrouped, FALSE); filelist_free(flist); + filelist_free(ungrouped); return; } + file_util_mark_ungrouped_files(ungrouped); + filelist_free(ungrouped); + if (editor_is_filter(key)) ud = file_util_data_new(UTILITY_TYPE_FILTER); else