From 98ded3a289eac17d0a53724789226ed11bdf7321 Mon Sep 17 00:00:00 2001 From: Cyrille Pontvieux Date: Sun, 5 Apr 2020 17:21:19 +0200 Subject: [PATCH] Option to rename a file when existing copy conflicts. --- thunar/thunar-dialogs.c | 20 +++- thunar/thunar-enum-types.h | 33 ++++--- thunar/thunar-io-jobs-util.c | 90 ++++++++++++++++- thunar/thunar-io-jobs-util.h | 6 ++ thunar/thunar-job.c | 8 ++ thunar/thunar-transfer-job.c | 184 ++++++++++++++++++++++------------- 6 files changed, 258 insertions(+), 83 deletions(-) diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c index 78850ed4..77469bee 100644 --- a/thunar/thunar-dialogs.c +++ b/thunar/thunar-dialogs.c @@ -441,7 +441,7 @@ thunar_dialogs_show_job_ask (GtkWindow *parent, gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", secondary->str); /* add the buttons based on the possible choices */ - for (n = 6; n >= 0; --n) + for (n = THUNAR_JOB_RESPONSE_MAX_INT; n >= 0; --n) { /* check if the response is set */ response = choices & (1 << n); @@ -458,6 +458,14 @@ thunar_dialogs_show_job_ask (GtkWindow *parent, mnemonic = _("Yes to _all"); break; + case THUNAR_JOB_RESPONSE_RENAME: + mnemonic = _("Re_name"); + break; + + case THUNAR_JOB_RESPONSE_RENAME_ALL: + mnemonic = _("Rena_me all"); + break; + case THUNAR_JOB_RESPONSE_NO: mnemonic = _("_No"); break; @@ -563,6 +571,8 @@ thunar_dialogs_show_job_ask_replace (GtkWindow *parent, GtkWidget *skip_button; GtkWidget *replaceall_button; GtkWidget *replace_button; + GtkWidget *renameall_button; + GtkWidget *rename_button; GdkPixbuf *icon; gchar *date_custom_style; gchar *date_string; @@ -610,24 +620,32 @@ thunar_dialogs_show_job_ask_replace (GtkWindow *parent, skip_button = gtk_button_new_with_mnemonic (_("_Skip")); replaceall_button = gtk_button_new_with_mnemonic (_("Replace _All")); replace_button = gtk_button_new_with_mnemonic (_("_Replace")); + renameall_button = gtk_button_new_with_mnemonic (_("Rena_me All")); + rename_button = gtk_button_new_with_mnemonic (_("Re_name")); g_signal_connect (cancel_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); g_signal_connect (skipall_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); g_signal_connect (skip_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); g_signal_connect (replaceall_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); g_signal_connect (replace_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); + g_signal_connect (renameall_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); + g_signal_connect (rename_button, "clicked", G_CALLBACK (thunar_dialogs_show_job_ask_replace_callback), dialog); g_object_set_data (G_OBJECT (cancel_button), "response-id", GINT_TO_POINTER (GTK_RESPONSE_CANCEL)); g_object_set_data (G_OBJECT (skipall_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_NO_ALL)); g_object_set_data (G_OBJECT (skip_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_NO)); g_object_set_data (G_OBJECT (replaceall_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_YES_ALL)); g_object_set_data (G_OBJECT (replace_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_YES)); + g_object_set_data (G_OBJECT (renameall_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_RENAME_ALL)); + g_object_set_data (G_OBJECT (rename_button), "response-id", GINT_TO_POINTER (THUNAR_JOB_RESPONSE_RENAME)); gtk_container_add (GTK_CONTAINER (button_box), cancel_button); gtk_container_add (GTK_CONTAINER (button_box), skipall_button); gtk_container_add (GTK_CONTAINER (button_box), skip_button); gtk_container_add (GTK_CONTAINER (button_box), replaceall_button); gtk_container_add (GTK_CONTAINER (button_box), replace_button); + gtk_container_add (GTK_CONTAINER (button_box), renameall_button); + gtk_container_add (GTK_CONTAINER (button_box), rename_button); gtk_container_add (GTK_CONTAINER (content_area), button_box); gtk_widget_set_halign (button_box, GTK_ALIGN_CENTER); gtk_box_set_spacing (GTK_BOX (button_box), 5); diff --git a/thunar/thunar-enum-types.h b/thunar/thunar-enum-types.h index 17a792d4..1a00887d 100644 --- a/thunar/thunar-enum-types.h +++ b/thunar/thunar-enum-types.h @@ -229,26 +229,31 @@ ThunarThumbnailSize thunar_zoom_level_to_thumbnail_size (ThunarZoomLevel zoom_ /** * ThunarJobResponse: - * @THUNAR_JOB_RESPONSE_YES : - * @THUNAR_JOB_RESPONSE_YES_ALL : - * @THUNAR_JOB_RESPONSE_NO : - * @THUNAR_JOB_RESPONSE_NO_ALL : - * @THUNAR_JOB_RESPONSE_CANCEL : - * @THUNAR_JOB_RESPONSE_RETRY : - * @THUNAR_JOB_RESPONSE_FORCE : + * @THUNAR_JOB_RESPONSE_YES : + * @THUNAR_JOB_RESPONSE_YES_ALL : + * @THUNAR_JOB_RESPONSE_NO : + * @THUNAR_JOB_RESPONSE_NO_ALL : + * @THUNAR_JOB_RESPONSE_CANCEL : + * @THUNAR_JOB_RESPONSE_RETRY : + * @THUNAR_JOB_RESPONSE_FORCE : + * @THUNAR_JOB_RESPONSE_RENAME : + * @THUNAR_JOB_RESPONSE_RENAME_ALL : * * Possible responses for the ThunarJob::ask signal. **/ typedef enum /*< flags >*/ { - THUNAR_JOB_RESPONSE_YES = 1 << 0, - THUNAR_JOB_RESPONSE_YES_ALL = 1 << 1, - THUNAR_JOB_RESPONSE_NO = 1 << 2, - THUNAR_JOB_RESPONSE_CANCEL = 1 << 3, - THUNAR_JOB_RESPONSE_NO_ALL = 1 << 4, - THUNAR_JOB_RESPONSE_RETRY = 1 << 5, - THUNAR_JOB_RESPONSE_FORCE = 1 << 6, + THUNAR_JOB_RESPONSE_YES = 1 << 0, + THUNAR_JOB_RESPONSE_YES_ALL = 1 << 1, + THUNAR_JOB_RESPONSE_NO = 1 << 2, + THUNAR_JOB_RESPONSE_CANCEL = 1 << 3, + THUNAR_JOB_RESPONSE_NO_ALL = 1 << 4, + THUNAR_JOB_RESPONSE_RETRY = 1 << 5, + THUNAR_JOB_RESPONSE_FORCE = 1 << 6, + THUNAR_JOB_RESPONSE_RENAME = 1 << 7, + THUNAR_JOB_RESPONSE_RENAME_ALL = 1 << 8, } ThunarJobResponse; +#define THUNAR_JOB_RESPONSE_MAX_INT 8 GType thunar_job_response_get_type (void) G_GNUC_CONST; diff --git a/thunar/thunar-io-jobs-util.c b/thunar/thunar-io-jobs-util.c index 2a3a47b6..e875f60d 100644 --- a/thunar/thunar-io-jobs-util.c +++ b/thunar/thunar-io-jobs-util.c @@ -102,7 +102,7 @@ thunar_io_jobs_util_next_duplicate_file (ThunarJob *job, if (dot != NULL) { file_basename = g_strndup (old_display_name, dot - old_display_name); - /* I18N: put " (copy #) between basename and extension */ + /* I18N: put " (copy #)" between basename and extension */ display_name = g_strdup_printf (_("%s (copy %u)%s"), file_basename, n, dot); g_free(file_basename); } @@ -141,3 +141,91 @@ thunar_io_jobs_util_next_duplicate_file (ThunarJob *job, +/** + * thunar_io_jobs_util_next_renamed_file: + * @job : a #ThunarJob. + * @src_file : the source #GFile. + * @tgt_file : the target #GFile. + * @n : the @nth copy/move to create the #GFile for. + * @error : return location for errors or %NULL. + * + * Determines the #GFile for the next copy/move to @tgt_file. + * + * File named X will be renamed to "X (copy 1)". + * + * If there are errors or the job was cancelled, the return value + * will be %NULL and @error will be set. + * + * Return value: the #GFile referencing the @nth copy/move + * of @tgt_file or %NULL on error/cancellation. + **/ +GFile * +thunar_io_jobs_util_next_renamed_file (ThunarJob *job, + GFile *src_file, + GFile *tgt_file, + guint n, + GError **error) +{ + GFileInfo *info; + GError *err = NULL; + GFile *renamed_file = NULL; + GFile *parent_file = NULL; + const gchar *old_display_name; + gchar *display_name; + gchar *file_basename; + gchar *dot = NULL; + + _thunar_return_val_if_fail (THUNAR_IS_JOB (job), NULL); + _thunar_return_val_if_fail (G_IS_FILE (src_file), NULL); + _thunar_return_val_if_fail (G_IS_FILE (tgt_file), NULL); + _thunar_return_val_if_fail (0 < n, NULL); + _thunar_return_val_if_fail (error == NULL || *error == NULL, NULL); + _thunar_return_val_if_fail (!thunar_g_file_is_root (src_file), NULL); + _thunar_return_val_if_fail (!thunar_g_file_is_root (tgt_file), NULL); + + /* abort on cancellation */ + if (exo_job_set_error_if_cancelled (EXO_JOB (job), error)) + return NULL; + + /* query the source file info / display name */ + info = g_file_query_info (src_file, G_FILE_ATTRIBUTE_STANDARD_TYPE "," + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + exo_job_get_cancellable (EXO_JOB (job)), &err); + + /* abort on error */ + if (info == NULL) + { + g_propagate_error (error, err); + return NULL; + } + + old_display_name = g_file_info_get_display_name (info); + /* get file extension if file is not a directory */ + if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) + dot = thunar_util_str_get_extension (old_display_name); + + if (dot != NULL) + { + file_basename = g_strndup (old_display_name, dot - old_display_name); + /* I18N: put " (copy #)" between basename and extension */ + display_name = g_strdup_printf (_("%s (copy %u)%s"), file_basename, n, dot); + g_free(file_basename); + } + else + { + /* I18N: put " (copy #)" after filename (for files without extension) */ + display_name = g_strdup_printf (_("%s (copy %u)"), old_display_name, n); + } + + /* create the GFile for the copy/move */ + parent_file = g_file_get_parent (tgt_file); + renamed_file = g_file_get_child (parent_file, display_name); + g_object_unref (parent_file); + + /* free resources */ + g_object_unref (info); + g_free (display_name); + + return renamed_file; +} diff --git a/thunar/thunar-io-jobs-util.h b/thunar/thunar-io-jobs-util.h index 2ff28960..b79687e9 100644 --- a/thunar/thunar-io-jobs-util.h +++ b/thunar/thunar-io-jobs-util.h @@ -31,6 +31,12 @@ GFile *thunar_io_jobs_util_next_duplicate_file (ThunarJob *job, guint n, GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +GFile *thunar_io_jobs_util_next_renamed_file (ThunarJob *job, + GFile *src_file, + GFile *tgt_file, + guint n, + GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + G_END_DECLS #endif /* !__THUNAR_IO_JOBS_UITL_H__ */ diff --git a/thunar/thunar-job.c b/thunar/thunar-job.c index 79456934..c52c1706 100644 --- a/thunar/thunar-job.c +++ b/thunar/thunar-job.c @@ -259,6 +259,8 @@ thunar_job_real_ask_replace (ThunarJob *job, g_signal_emit (job, job_signals[ASK], 0, message, THUNAR_JOB_RESPONSE_YES | THUNAR_JOB_RESPONSE_YES_ALL + | THUNAR_JOB_RESPONSE_RENAME + | THUNAR_JOB_RESPONSE_RENAME_ALL | THUNAR_JOB_RESPONSE_NO | THUNAR_JOB_RESPONSE_NO_ALL | THUNAR_JOB_RESPONSE_CANCEL, @@ -484,6 +486,10 @@ thunar_job_ask_replace (ThunarJob *job, if (G_UNLIKELY (job->priv->earlier_ask_overwrite_response == THUNAR_JOB_RESPONSE_YES_ALL)) return THUNAR_JOB_RESPONSE_YES; + /* check if the user said "Rename All" earlier */ + if (G_UNLIKELY (job->priv->earlier_ask_overwrite_response == THUNAR_JOB_RESPONSE_RENAME_ALL)) + return THUNAR_JOB_RESPONSE_RENAME; + /* check if the user said "Overwrite None" earlier */ if (G_UNLIKELY (job->priv->earlier_ask_overwrite_response == THUNAR_JOB_RESPONSE_NO_ALL)) return THUNAR_JOB_RESPONSE_NO; @@ -513,6 +519,8 @@ thunar_job_ask_replace (ThunarJob *job, /* translate the response */ if (response == THUNAR_JOB_RESPONSE_YES_ALL) response = THUNAR_JOB_RESPONSE_YES; + else if (response == THUNAR_JOB_RESPONSE_RENAME_ALL) + response = THUNAR_JOB_RESPONSE_RENAME; else if (response == THUNAR_JOB_RESPONSE_NO_ALL) response = THUNAR_JOB_RESPONSE_NO; else if (response == THUNAR_JOB_RESPONSE_CANCEL) diff --git a/thunar/thunar-transfer-job.c b/thunar/thunar-transfer-job.c index 3ec41546..6ced0739 100644 --- a/thunar/thunar-transfer-job.c +++ b/thunar/thunar-transfer-job.c @@ -104,6 +104,7 @@ struct _ThunarTransferNode ThunarTransferNode *children; GFile *source_file; gboolean replace_confirmed; + gboolean rename_confirmed; }; @@ -336,6 +337,7 @@ thunar_transfer_job_collect_node (ThunarTransferJob *job, child_node = g_slice_new0 (ThunarTransferNode); child_node->source_file = g_object_ref (lp->data); child_node->replace_confirmed = node->replace_confirmed; + child_node->rename_confirmed = node->rename_confirmed; /* hook the child node into the child list */ child_node->next = node->children; @@ -493,14 +495,15 @@ ttj_copy_file (ThunarTransferJob *job, * @source_file : the source #GFile to copy. * @target_file : the destination #GFile to copy to. * @replace_confirmed : whether the user has already confirmed that this file should replace an existing one + * @rename_confirmed : whether the user has already confirmed that this file should be renamed to a new unique file name * @error : return location for errors or %NULL. * * Tries to copy @source_file to @target_file. The real destination is the * return value and may differ from @target_file (e.g. if you try to copy * the file "/foo/bar" into the same directory you'll end up with something * like "/foo/copy of bar" instead of "/foo/bar"). If an existing file would - * be replaced, the user is asked to confirm this unless @replace_confirmed - * is TRUE. + * be replaced, the user is asked to confirm replace or rename it unless + * @replace_confirmed or @rename_confirmed is TRUE. * * The return value is guaranteed to be %NULL on errors and @error will * always be set in those cases. If the file is skipped, the return value @@ -517,12 +520,15 @@ thunar_transfer_job_copy_file (ThunarTransferJob *job, GFile *source_file, GFile *target_file, gboolean replace_confirmed, + gboolean rename_confirmed, GError **error) { ThunarJobResponse response; GFileCopyFlags copy_flags = G_FILE_COPY_NOFOLLOW_SYMLINKS; GError *err = NULL; gint n; + gint n_rename; + GFile *renamed_file; _thunar_return_val_if_fail (THUNAR_IS_TRANSFER_JOB (job), NULL); _thunar_return_val_if_fail (G_IS_FILE (source_file), NULL); @@ -534,6 +540,7 @@ thunar_transfer_job_copy_file (ThunarTransferJob *job, return NULL; /* various attempts to copy the file */ + n_rename = 0; while (err == NULL) { thunar_transfer_job_check_pause (job); @@ -581,9 +588,11 @@ thunar_transfer_job_copy_file (ThunarTransferJob *job, /* reset the error */ g_clear_error (&err); - /* if necessary, ask the user whether to replace the target file */ + /* if necessary, ask the user whether to replace or rename the target file */ if(replace_confirmed) response = THUNAR_JOB_RESPONSE_YES; + else if(rename_confirmed) + response = THUNAR_JOB_RESPONSE_RENAME; else response = thunar_job_ask_replace (THUNAR_JOB (job), source_file, target_file, &err); @@ -597,6 +606,16 @@ thunar_transfer_job_copy_file (ThunarTransferJob *job, copy_flags |= G_FILE_COPY_OVERWRITE; continue; } + else if (response == THUNAR_JOB_RESPONSE_RENAME) + { + rename_confirmed = TRUE; + renamed_file = thunar_io_jobs_util_next_renamed_file (THUNAR_JOB (job), + source_file, + target_file, + ++n_rename, &err); + if (err == NULL) + target_file = renamed_file; + } /* tell the caller we skipped the file if the user * doesn't want to retry/overwrite */ @@ -679,7 +698,10 @@ retry_copy: /* copy the item specified by this node (not recursively) */ real_target_file = thunar_transfer_job_copy_file (job, node->source_file, - target_file, node->replace_confirmed, &err); + target_file, + node->replace_confirmed, + node->rename_confirmed, + &err); if (G_LIKELY (real_target_file != NULL)) { /* node->source_file == real_target_file means to skip the file */ @@ -893,6 +915,9 @@ thunar_transfer_job_execute (ExoJob *job, GFile *target_parent; gchar *base_name; gchar *parent_display_name; + gint n_rename; + gboolean try_again; + GFile *renamed_file; _thunar_return_val_if_fail (THUNAR_IS_TRANSFER_JOB (job), FALSE); _thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -1019,82 +1044,106 @@ thunar_transfer_job_execute (ExoJob *job, g_file_info_get_display_name (info)); /* try moving without overwriting */ - move_successful = g_file_move (node->source_file, tp->data, - flags, - exo_job_get_cancellable (job), - NULL, NULL, &err); - - /* if the file already exists, ask the user if they want to overwrite it */ - if (!move_successful && err->code == G_IO_ERROR_EXISTS) + n_rename = 0; + try_again = TRUE; + while (try_again) { - g_clear_error (&err); - response = thunar_job_ask_replace (THUNAR_JOB (job), node->source_file, tp->data, NULL); + move_successful = g_file_move (node->source_file, tp->data, + flags, + exo_job_get_cancellable (job), + NULL, NULL, &err); - /* if the user chose to overwrite then try to do so */ - if (response == THUNAR_JOB_RESPONSE_YES) + /* if the file already exists, ask the user if they want to overwrite it */ + if (!move_successful && err->code == G_IO_ERROR_EXISTS) { - node->replace_confirmed = TRUE; - move_successful = g_file_move (node->source_file, tp->data, - flags | G_FILE_COPY_OVERWRITE, - exo_job_get_cancellable (job), - NULL, NULL, &err); - } + g_clear_error (&err); + response = thunar_job_ask_replace (THUNAR_JOB (job), node->source_file, tp->data, NULL); - /* if the user chose to cancel then abort all remaining file moves */ - if (response == THUNAR_JOB_RESPONSE_CANCEL) - { - /* release all the remaining source and target files, and free the lists */ - g_list_free_full (transfer_job->source_node_list, thunar_transfer_node_free); - transfer_job->source_node_list = NULL; - g_list_free_full (transfer_job->target_file_list, g_object_unref); - transfer_job->target_file_list= NULL; - g_object_unref (info); - break; - } + /* if the user chose to overwrite then try to do so */ + if (response == THUNAR_JOB_RESPONSE_YES) + { + try_again = FALSE; + node->replace_confirmed = TRUE; + move_successful = g_file_move (node->source_file, tp->data, + flags | G_FILE_COPY_OVERWRITE, + exo_job_get_cancellable (job), + NULL, NULL, &err); + } + /* if the user chose to rename then try to do so */ + else if (response == THUNAR_JOB_RESPONSE_RENAME) + { + node->rename_confirmed = TRUE; + renamed_file = thunar_io_jobs_util_next_renamed_file (THUNAR_JOB (job), + node->source_file, + tp->data, + ++n_rename, &err); + if (err == NULL) + { + tp->data = renamed_file; + /* try to move it again to the new renamed file */ + g_clear_error (&err); + continue; + } + } - /* if the user chose not to replace the file, so that response == THUNAR_JOB_RESPONSE_NO, - * then err will be NULL but move_successfull will be FALSE, so that the source and target - * files will be released and the matching list items will be dropped below - */ - } + /* if the user chose to cancel then abort all remaining file moves */ + else if (response == THUNAR_JOB_RESPONSE_CANCEL) + { + try_again = FALSE; + /* release all the remaining source and target files, and free the lists */ + g_list_free_full (transfer_job->source_node_list, thunar_transfer_node_free); + transfer_job->source_node_list = NULL; + g_list_free_full (transfer_job->target_file_list, g_object_unref); + transfer_job->target_file_list= NULL; + g_object_unref (info); + break; + } - if (err == NULL) - { - if (move_successful) + /* if the user chose not to replace the file, so that response == THUNAR_JOB_RESPONSE_NO, + * then err will be NULL but move_successfull will be FALSE, so that the source and target + * files will be released and the matching list items will be dropped below + */ + } + + if (err == NULL) { - /* notify the thumbnail cache of the move operation */ - thunar_thumbnail_cache_move_file (thumbnail_cache, - node->source_file, - tp->data); + if (move_successful) + { + /* notify the thumbnail cache of the move operation */ + thunar_thumbnail_cache_move_file (thumbnail_cache, + node->source_file, + tp->data); - /* add the target file to the new files list */ - new_files_list = thunar_g_file_list_prepend (new_files_list, tp->data); - } + /* add the target file to the new files list */ + new_files_list = thunar_g_file_list_prepend (new_files_list, tp->data); + } - /* release source and target files */ - thunar_transfer_node_free (node); - g_object_unref (tp->data); + try_again = FALSE; + /* release source and target files */ + thunar_transfer_node_free (node); + g_object_unref (tp->data); - /* drop the matching list items */ - transfer_job->source_node_list = g_list_delete_link (transfer_job->source_node_list, sp); - transfer_job->target_file_list = g_list_delete_link (transfer_job->target_file_list, tp); - } - /* prepare for the fallback copy and delete if appropriate */ - else if (!exo_job_is_cancelled (job) && - ((err->code == G_IO_ERROR_NOT_SUPPORTED) || - (err->code == G_IO_ERROR_WOULD_MERGE) || (err->code == G_IO_ERROR_WOULD_RECURSE)) ) - { - g_clear_error (&err); + /* drop the matching list items */ + transfer_job->source_node_list = g_list_delete_link (transfer_job->source_node_list, sp); + transfer_job->target_file_list = g_list_delete_link (transfer_job->target_file_list, tp); + } + /* prepare for the fallback copy and delete if appropriate */ + else if (!exo_job_is_cancelled (job) && + ((err->code == G_IO_ERROR_NOT_SUPPORTED) || + (err->code == G_IO_ERROR_WOULD_MERGE) || (err->code == G_IO_ERROR_WOULD_RECURSE)) ) + { + try_again = FALSE; + g_clear_error (&err); - /* update progress information */ - exo_job_info_message (job, _("Could not move \"%s\" directly. " - "Collecting files for copying..."), - g_file_info_get_display_name (info)); + /* update progress information */ + exo_job_info_message (job, _("Could not move \"%s\" directly. " + "Collecting files for copying..."), + g_file_info_get_display_name (info)); - /* if this call fails to collect the node, err will be non-NULL and the loop will exit */ - thunar_transfer_job_collect_node (transfer_job, node, &err); + /* if this call fails to collect the node, err will be non-NULL and the loop will exit */ + thunar_transfer_job_collect_node (transfer_job, node, &err); + } } - } else if (transfer_job->type == THUNAR_TRANSFER_JOB_COPY) @@ -1217,6 +1266,7 @@ thunar_transfer_job_new (GList *source_node_list, node = g_slice_new0 (ThunarTransferNode); node->source_file = g_object_ref (sp->data); node->replace_confirmed = FALSE; + node->rename_confirmed = FALSE; job->source_node_list = g_list_append (job->source_node_list, node); /* append target file */ -- 2.26.1