Blame SOURCES/0002-dbus-manager-Implement-creation-of-new-folders.patch

af40a0
From d2be99e4528759d28985246a55c9d4513e78f918 Mon Sep 17 00:00:00 2001
af40a0
From: Carlos Soriano <csoriano@redhat.com>
af40a0
Date: Mon, 6 Aug 2018 20:11:31 +0200
af40a0
Subject: [PATCH 02/11] dbus-manager: Implement creation of new folders
af40a0
af40a0
For the integration with the desktop icons extension.
af40a0
---
af40a0
 data/dbus-interfaces.xml    |  3 +++
af40a0
 src/nautilus-dbus-manager.c | 26 ++++++++++++++++++++++++++
af40a0
 2 files changed, 29 insertions(+)
af40a0
af40a0
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
af40a0
index 4588762a9..4e67f1393 100644
af40a0
--- a/data/dbus-interfaces.xml
af40a0
+++ b/data/dbus-interfaces.xml
af40a0
@@ -38,5 +38,8 @@
af40a0
     <method name='TrashFiles'>
af40a0
       <arg type='as' name='URIs' direction='in'/>
af40a0
     </method>
af40a0
+    <method name='CreateFolder'>
af40a0
+      <arg type='s' name='URI' direction='in'/>
af40a0
+    </method>
af40a0
   </interface>
af40a0
 </node>
af40a0
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
af40a0
index 4da1c727b..337a73262 100644
af40a0
--- a/src/nautilus-dbus-manager.c
af40a0
+++ b/src/nautilus-dbus-manager.c
af40a0
@@ -94,6 +94,28 @@ handle_copy_file (NautilusDBusFileOperations *object,
af40a0
     return TRUE; /* invocation was handled */
af40a0
 }
af40a0
 
af40a0
+static gboolean
af40a0
+handle_create_folder (NautilusDBusFileOperations *object,
af40a0
+                      GDBusMethodInvocation      *invocation,
af40a0
+                      const gchar                *uri)
af40a0
+{
af40a0
+    g_autoptr (GFile) file = NULL;
af40a0
+    g_autoptr (GFile) parent_file = NULL;
af40a0
+    g_autofree gchar *basename = NULL;
af40a0
+    g_autofree gchar *parent_file_uri = NULL;
af40a0
+
af40a0
+    file = g_file_new_for_uri (uri);
af40a0
+    basename = g_file_get_basename (file);
af40a0
+    parent_file = g_file_get_parent (file);
af40a0
+    parent_file_uri = g_file_get_uri (parent_file);
af40a0
+
af40a0
+    nautilus_file_operations_new_folder (NULL, parent_file_uri, basename,
af40a0
+                                         NULL, NULL);
af40a0
+
af40a0
+    nautilus_dbus_file_operations_complete_create_folder (object, invocation);
af40a0
+    return TRUE; /* invocation was handled */
af40a0
+}
af40a0
+
af40a0
 static gboolean
af40a0
 handle_copy_uris (NautilusDBusFileOperations  *object,
af40a0
                   GDBusMethodInvocation       *invocation,
af40a0
@@ -172,6 +194,10 @@ nautilus_dbus_manager_init (NautilusDBusManager *self)
af40a0
                       "handle-trash-files",
af40a0
                       G_CALLBACK (handle_trash_files),
af40a0
                       self);
af40a0
+    g_signal_connect (self->file_operations,
af40a0
+                      "handle-create-folder",
af40a0
+                      G_CALLBACK (handle_create_folder),
af40a0
+                      self);
af40a0
 }
af40a0
 
af40a0
 static void
af40a0
-- 
af40a0
2.17.1
af40a0