Blame SOURCES/0001-dbus-manager-Implement-trashing-files.patch

1e3c33
From db2b7aea67c994ba8a6e5a9ffec245b1daebcdfb Mon Sep 17 00:00:00 2001
1e3c33
From: Carlos Soriano <csoriano@redhat.com>
1e3c33
Date: Mon, 6 Aug 2018 17:32:00 +0200
1e3c33
Subject: [PATCH 01/11] dbus-manager: Implement trashing files
1e3c33
1e3c33
So desktop icons extension can use it.
1e3c33
---
1e3c33
 data/dbus-interfaces.xml    |  3 +++
1e3c33
 src/nautilus-dbus-manager.c | 24 ++++++++++++++++++++++++
1e3c33
 2 files changed, 27 insertions(+)
1e3c33
1e3c33
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
1e3c33
index 35fb9945b..4588762a9 100644
1e3c33
--- a/data/dbus-interfaces.xml
1e3c33
+++ b/data/dbus-interfaces.xml
1e3c33
@@ -35,5 +35,8 @@
1e3c33
       <arg type='s' name='DestinationDirectoryURI' direction='in'/>
1e3c33
       <arg type='s' name='DestinationDisplayName' direction='in'/>
1e3c33
     </method>
1e3c33
+    <method name='TrashFiles'>
1e3c33
+      <arg type='as' name='URIs' direction='in'/>
1e3c33
+    </method>
1e3c33
   </interface>
1e3c33
 </node>
1e3c33
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
1e3c33
index 3611a2358..4da1c727b 100644
1e3c33
--- a/src/nautilus-dbus-manager.c
1e3c33
+++ b/src/nautilus-dbus-manager.c
1e3c33
@@ -131,6 +131,26 @@ handle_empty_trash (NautilusDBusFileOperations *object,
1e3c33
     return TRUE; /* invocation was handled */
1e3c33
 }
1e3c33
 
1e3c33
+static gboolean
1e3c33
+handle_trash_files (NautilusDBusFileOperations  *object,
1e3c33
+                    GDBusMethodInvocation       *invocation,
1e3c33
+                    const gchar                **sources)
1e3c33
+{
1e3c33
+    g_autolist (GFile) source_files = NULL;
1e3c33
+    gint idx;
1e3c33
+
1e3c33
+    for (idx = 0; sources[idx] != NULL; idx++)
1e3c33
+    {
1e3c33
+        source_files = g_list_prepend (source_files,
1e3c33
+                                       g_file_new_for_uri (sources[idx]));
1e3c33
+    }
1e3c33
+
1e3c33
+    nautilus_file_operations_trash_or_delete (source_files, NULL, NULL, NULL);
1e3c33
+
1e3c33
+    nautilus_dbus_file_operations_complete_trash_files (object, invocation);
1e3c33
+    return TRUE; /* invocation was handled */
1e3c33
+}
1e3c33
+
1e3c33
 static void
1e3c33
 nautilus_dbus_manager_init (NautilusDBusManager *self)
1e3c33
 {
1e3c33
@@ -148,6 +168,10 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
1e3c33
                       "handle-empty-trash",
1e3c33
                       G_CALLBACK (handle_empty_trash),
1e3c33
                       self);
1e3c33
+    g_signal_connect (self->file_operations,
1e3c33
+                      "handle-trash-files",
1e3c33
+                      G_CALLBACK (handle_trash_files),
1e3c33
+                      self);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-- 
1e3c33
2.17.1
1e3c33