You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.4 KiB
72 lines
2.4 KiB
2 years ago
|
From d2be99e4528759d28985246a55c9d4513e78f918 Mon Sep 17 00:00:00 2001
|
||
|
From: Carlos Soriano <csoriano@redhat.com>
|
||
|
Date: Mon, 6 Aug 2018 20:11:31 +0200
|
||
|
Subject: [PATCH 02/11] 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 4da1c727b..337a73262 100644
|
||
|
--- a/src/nautilus-dbus-manager.c
|
||
|
+++ b/src/nautilus-dbus-manager.c
|
||
|
@@ -94,6 +94,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,
|
||
|
@@ -172,6 +194,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
|
||
|
--
|
||
|
2.17.1
|
||
|
|