summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2021-10-09 22:35:28 +0100
committerAntónio Fernandes <antoniof@gnome.org>2021-11-27 20:32:19 +0000
commit1582ab697eee39c135db5e985effaa34447c6ee5 (patch)
tree847bd3edaef421b036f9a798f261cfa8025104cd
parent3c6f66ae72f74a6ec323bbcfe639ee6474322f9a (diff)
downloadnautilus-1582ab697eee39c135db5e985effaa34447c6ee5.tar.gz
file-operations: Simplify abort_job
Make finalize_common() call nautilus_file_undo_manager_set_action() only if the job hasn't been cancelled. This way, abort_job() becomes a simple wrapper for g_cancellable_cancel(), and we can just call g_cancellable_cancel() as well if needed (such as from another file).
-rw-r--r--src/nautilus-file-operations.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 7fd681822..a532c2524 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -269,6 +269,8 @@ is_all_button_text (const char *button_text)
!strcmp (button_text, MERGE_ALL);
}
+static gboolean job_aborted (CommonJob *job);
+
static void scan_sources (GList *files,
SourceInfo *source_info,
CommonJob *job,
@@ -1119,7 +1121,10 @@ finalize_common (CommonJob *common)
if (common->undo_info != NULL)
{
- nautilus_file_undo_manager_set_action (common->undo_info);
+ if (!job_aborted (common))
+ {
+ nautilus_file_undo_manager_set_action (common->undo_info);
+ }
g_object_unref (common->undo_info);
}
@@ -1619,9 +1624,6 @@ inhibit_power_manager (CommonJob *job,
static void
abort_job (CommonJob *job)
{
- /* destroy the undo action data too */
- g_clear_object (&job->undo_info);
-
g_cancellable_cancel (job->cancellable);
}