[nautilus/dbus-trash: 9/15] dbus-manager: Implement trashing files
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/dbus-trash: 9/15] dbus-manager: Implement trashing files
- Date: Tue, 7 Aug 2018 19:15:58 +0000 (UTC)
commit 6b5be51c0497f9ad1633e9db19047d163c34f18a
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 | 24 ++++++++++++++++++++++++
2 files changed, 27 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..7852b1f27 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -124,6 +124,26 @@ handle_empty_trash (NautilusDBusFileOperations *object,
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_trash_files (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar **sources)
+{
+ g_autolist (GFile) 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);
+
+ nautilus_dbus_file_operations_complete_trash_files (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static void
nautilus_dbus_manager_init (NautilusDBusManager *self)
{
@@ -141,6 +161,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]