[nautilus/wip/antoniof/try-admin-backend-for-file-ops: 7/11] file-operations: Simplify abort_job
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/try-admin-backend-for-file-ops: 7/11] file-operations: Simplify abort_job
- Date: Sat, 16 Oct 2021 14:02:31 +0000 (UTC)
commit d586eeecee5a16d60dc8b4d4a7efdfbae07143c8
Author: António Fernandes <antoniof gnome org>
Date: Sat Oct 9 22:35:28 2021 +0100
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).
src/nautilus-file-operations.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index c9312d4a7..78fb006b2 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -268,6 +268,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,
@@ -1118,7 +1120,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);
}
@@ -1618,9 +1623,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]