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

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