[nautilus/wip/corey/dnd_features: 4/13] file-operations: Allow starring files for COPY operations
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/dnd_features: 4/13] file-operations: Allow starring files for COPY operations
- Date: Thu, 1 Sep 2022 20:32:46 +0000 (UTC)
commit 87c2b0b0060351b8e96f0982439312192985706e
Author: Corey Berla <corey berla me>
Date: Thu Sep 1 13:30:41 2022 -0700
file-operations: Allow starring files for COPY operations
If the operation is COPY and it's to the starred directory
simply star the files. This allows us to DnD to starred.
src/nautilus-file-operations.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index c3d488f79..0892a4e92 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -55,6 +55,7 @@
#include "nautilus-operations-ui-manager.h"
#include "nautilus-file-changes-queue.h"
#include "nautilus-file-private.h"
+#include "nautilus-tag-manager.h"
#include "nautilus-trash-monitor.h"
#include "nautilus-file-utilities.h"
#include "nautilus-file-undo-operations.h"
@@ -7491,9 +7492,23 @@ nautilus_file_operations_copy_move (const GList *item_uris,
if (copy_action == GDK_ACTION_COPY)
{
src_dir = g_file_get_parent (locations->data);
- if (target_dir == NULL ||
- (src_dir != NULL &&
- g_file_equal (src_dir, dest)))
+
+ if (g_file_has_uri_scheme (dest, "starred"))
+ {
+ g_autolist (NautilusFile) source_file_list = NULL;
+
+ for (GList *l = locations; l != NULL; l = l->next)
+ {
+ source_file_list = g_list_prepend (source_file_list, nautilus_file_get (l->data));
+ }
+
+ source_file_list = g_list_reverse (source_file_list);
+ nautilus_tag_manager_star_files (nautilus_tag_manager_get (),
+ G_OBJECT (parent_view),
+ source_file_list, NULL, NULL);
+ }
+ else if (target_dir == NULL ||
+ (src_dir != NULL && g_file_equal (src_dir, dest)))
{
nautilus_file_operations_duplicate (locations,
parent_window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]