[nautilus/wip/antoniof/try-admin-backend-for-file-ops: 9/11] file-operations: Store op kind at job creation
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/try-admin-backend-for-file-ops: 9/11] file-operations: Store op kind at job creation
- Date: Sat, 16 Oct 2021 14:02:31 +0000 (UTC)
commit 2ecf54e6a899cc264de9fd31e9890af12c8d11f1
Author: António Fernandes <antoniof gnome org>
Date: Thu Oct 14 16:51:38 2021 +0100
file-operations: Store op kind at job creation
This is going to be useful for admin operations.
Existing uses of OpKind are left unchanged because they may represent
a sub-operation (e.g.: delete fallback path of a trashing operation),
not the main operation.
src/nautilus-file-operations-private.h | 20 +++++++++++---------
src/nautilus-file-operations.c | 4 ++++
2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-file-operations-private.h b/src/nautilus-file-operations-private.h
index 4aff5aebd..7b34fd041 100644
--- a/src/nautilus-file-operations-private.h
+++ b/src/nautilus-file-operations-private.h
@@ -9,8 +9,19 @@
#include "nautilus-progress-info.h"
#include "nautilus-file-undo-operations.h"
+typedef enum
+{
+ OP_KIND_NOT_SET = 0,
+ OP_KIND_COPY,
+ OP_KIND_MOVE,
+ OP_KIND_DELETE,
+ OP_KIND_TRASH,
+ OP_KIND_COMPRESS
+} OpKind;
+
typedef struct
{
+ OpKind kind;
GTimer *time;
GtkWindow *parent_window;
NautilusFileOperationsDBusData *dbus_data;
@@ -86,15 +97,6 @@ typedef struct
guint32 dir_mask;
} SetPermissionsJob;
-typedef enum
-{
- OP_KIND_COPY,
- OP_KIND_MOVE,
- OP_KIND_DELETE,
- OP_KIND_TRASH,
- OP_KIND_COMPRESS
-} OpKind;
-
typedef struct
{
CommonJob common;
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 60b012224..ff1fa1d05 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -2514,6 +2514,7 @@ setup_delete_job (GList *files,
/* TODO: special case desktop icon link files ... */
job = op_job_new (DeleteJob, parent_window, dbus_data);
+ job->common.kind = try_trash ? OP_KIND_TRASH : OP_KIND_DELETE;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
job->try_trash = try_trash;
job->user_cancel = FALSE;
@@ -5855,6 +5856,7 @@ copy_job_setup (GList *files,
g_autoptr (GFile) src_dir = NULL;
job = op_job_new (CopyMoveJob, parent_window, dbus_data);
+ job->common.kind = OP_KIND_COPY;
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
@@ -6484,6 +6486,7 @@ move_job_setup (GList *files,
CopyMoveJob *job;
job = op_job_new (CopyMoveJob, parent_window, dbus_data);
+ job->common.kind = OP_KIND_MOVE;
job->is_move = TRUE;
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
@@ -8909,6 +8912,7 @@ nautilus_file_operations_compress (GList *files,
CompressJob *compress_job;
compress_job = op_job_new (CompressJob, parent_window, dbus_data);
+ compress_job->common.kind = OP_KIND_COMPRESS;
compress_job->source_files = g_list_copy_deep (files,
(GCopyFunc) g_object_ref,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]