From 4b7cc046288933343e086a0afef3cb10cc451e23 Mon Sep 17 00:00:00 2001 From: Vladimir Chren Date: Mon, 1 May 2017 19:14:10 +0200 Subject: [PATCH] Allow GIO copy/delete fallback for file restore from Trash (bug #13535) If not allowed Thunar uses its own implementation which leads to operations not permitted on trash:// by gvfs. --- thunar/thunar-transfer-job.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/thunar/thunar-transfer-job.c b/thunar/thunar-transfer-job.c index 82482e0..5829f80 100644 --- a/thunar/thunar-transfer-job.c +++ b/thunar/thunar-transfer-job.c @@ -856,6 +856,7 @@ thunar_transfer_job_execute (ExoJob *job, ThunarJobResponse response; ThunarTransferJob *transfer_job = THUNAR_TRANSFER_JOB (job); GFileInfo *info; + GFileCopyFlags flags; gboolean parent_exists; GError *err = NULL; GList *new_files_list = NULL; @@ -900,10 +901,14 @@ thunar_transfer_job_execute (ExoJob *job, if (G_UNLIKELY (info == NULL)) break; + flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE; + /* check if we are moving a file out of the trash */ if (transfer_job->type == THUNAR_TRANSFER_JOB_MOVE && thunar_g_file_is_trashed (node->source_file)) { + flags &= ~G_FILE_COPY_NO_FALLBACK_FOR_MOVE; + /* update progress information */ exo_job_info_message (job, _("Trying to restore \"%s\""), g_file_info_get_display_name (info)); @@ -982,8 +987,7 @@ thunar_transfer_job_execute (ExoJob *job, g_file_info_get_display_name (info)); if (g_file_move (node->source_file, tp->data, - G_FILE_COPY_NOFOLLOW_SYMLINKS - | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, + flags, exo_job_get_cancellable (job), NULL, NULL, &err)) { -- 2.7.4