[nautilus/dbus-trash: 10/15] dbus-manager: Implement creation of new folders
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/dbus-trash: 10/15] dbus-manager: Implement creation of new folders
- Date: Tue, 7 Aug 2018 19:16:03 +0000 (UTC)
commit 2543432aa1a51017f7fa0cd06b0659d5505821b3
Author: Carlos Soriano <csoriano redhat com>
Date: Mon Aug 6 20:11:31 2018 +0200
dbus-manager: Implement creation of new folders
For the integration with the desktop icons extension.
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 4588762a9..4e67f1393 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -38,5 +38,8 @@
<method name='TrashFiles'>
<arg type='as' name='URIs' direction='in'/>
</method>
+ <method name='CreateFolder'>
+ <arg type='s' name='URI' direction='in'/>
+ </method>
</interface>
</node>
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
index 7852b1f27..5ba39e73f 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -87,6 +87,28 @@ handle_copy_file (NautilusDBusFileOperations *object,
return TRUE; /* invocation was handled */
}
+static gboolean
+handle_create_folder (NautilusDBusFileOperations *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *uri)
+{
+ g_autoptr (GFile) file = NULL;
+ g_autoptr (GFile) parent_file = NULL;
+ g_autofree gchar *basename = NULL;
+ g_autofree gchar *parent_file_uri = NULL;
+
+ file = g_file_new_for_uri (uri);
+ basename = g_file_get_basename (file);
+ parent_file = g_file_get_parent (file);
+ parent_file_uri = g_file_get_uri (parent_file);
+
+ nautilus_file_operations_new_folder (NULL, parent_file_uri, basename,
+ NULL, NULL);
+
+ nautilus_dbus_file_operations_complete_create_folder (object, invocation);
+ return TRUE; /* invocation was handled */
+}
+
static gboolean
handle_copy_uris (NautilusDBusFileOperations *object,
GDBusMethodInvocation *invocation,
@@ -165,6 +187,10 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
"handle-trash-files",
G_CALLBACK (handle_trash_files),
self);
+ g_signal_connect (self->file_operations,
+ "handle-create-folder",
+ G_CALLBACK (handle_create_folder),
+ self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]