[nautilus/dbus-trash: 9/9] dbus-manager: Implement trashing files
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/dbus-trash: 9/9] dbus-manager: Implement trashing files
- Date: Mon, 6 Aug 2018 16:01:54 +0000 (UTC)
commit 35827490989cea495bb260f700c69146aad46e90
Author: Carlos Soriano <csoriano redhat com>
Date: Mon Aug 6 17:32:00 2018 +0200
dbus-manager: Implement trashing files
So desktop icons extension can use it.
data/dbus-interfaces.xml | 3 +++
src/nautilus-dbus-manager.c | 26 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
---
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
index 35fb9945b..4588762a9 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -35,5 +35,8 @@
<arg type='s' name='DestinationDirectoryURI' direction='in'/>
<arg type='s' name='DestinationDisplayName' direction='in'/>
</method>
+ <method name='TrashFiles'>
+ <arg type='as' name='URIs' direction='in'/>
+ </method>
</interface>
</node>
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
index 14240e18f..d2e92c316 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -124,6 +124,28 @@ handle_empty_trash (NautilusDBusFileOperations *object,
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_trash_files (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources)
+{
+ GList *source_files = NULL;
+ gint idx;
+
+ for (idx = 0; sources[idx] != NULL; idx++)
+ {
+ source_files = g_list_prepend (source_files,
+ g_file_new_for_uri (sources[idx]));
+ }
+
+ nautilus_file_operations_trash_or_delete_async (source_files, NULL, NULL, NULL);
+
+ g_list_free_full (source_files, g_object_unref);
+
+ nautilus_dbus_file_operations_complete_trash_files (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
nautilus_dbus_manager_init (NautilusDBusManager *self)
{
@@ -141,6 +163,10 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
"handle-empty-trash",
G_CALLBACK (handle_empty_trash),
self);
+ g_signal_connect (self->file_operations,
+ "handle-trash-files",
+ G_CALLBACK (handle_trash_files),
+ self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]