diff options
author | Corey Berla <corey@berla.me> | 2022-09-01 13:30:41 -0700 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-09-01 21:42:41 +0000 |
commit | f8270f7313af82f3f58bad3a5d5d0641ee912c56 (patch) | |
tree | 27dc84ce90a911f06f627e843b9cf66fffa27935 | |
parent | 4d422bfdf94135600a6a0c6967d0bc2abb8e14aa (diff) | |
download | nautilus-f8270f7313af82f3f58bad3a5d5d0641ee912c56.tar.gz |
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.
-rw-r--r-- | src/nautilus-file-operations.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index c3d488f79..aa8bd29f3 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" @@ -7488,7 +7489,21 @@ nautilus_file_operations_copy_move (const GList *item_uris, parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW); } - if (copy_action == GDK_ACTION_COPY) + 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 (copy_action == GDK_ACTION_COPY) { src_dir = g_file_get_parent (locations->data); if (target_dir == NULL || |