diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-04-06 16:49:01 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-04-06 21:19:15 +0300 |
commit | 1b063137ce415d1a49e10c21612199c81fafbad5 (patch) | |
tree | 69fc8e3a9d346f45390d6a74a83c42c983878f01 | |
parent | 7425abd7c00b98b7dfe1e7c44f1effbe9db96f69 (diff) | |
download | nautilus-1b063137ce415d1a49e10c21612199c81fafbad5.tar.gz |
dbus-manager: clarify CreateFolder method
https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/504
-rw-r--r-- | data/dbus-interfaces2.xml | 3 | ||||
-rw-r--r-- | src/nautilus-dbus-manager.c | 32 |
2 files changed, 19 insertions, 16 deletions
diff --git a/data/dbus-interfaces2.xml b/data/dbus-interfaces2.xml index 8bd24bbdd..8216be006 100644 --- a/data/dbus-interfaces2.xml +++ b/data/dbus-interfaces2.xml @@ -62,7 +62,8 @@ <arg type='a{sv}' name='platform_data' direction='in'/> </method> <method name='CreateFolder'> - <arg type='s' name='uri' direction='in'/> + <arg type='s' name='parent_uri' direction='in'/> + <arg type='s' name='new_folder_name' direction='in'/> <arg type='a{sv}' name='platform_data' direction='in'/> </method> <method name='RenameURI'> diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c index 56213268b..6736205d1 100644 --- a/src/nautilus-dbus-manager.c +++ b/src/nautilus-dbus-manager.c @@ -164,22 +164,13 @@ create_folder_on_finished (GFile *new_file, } static void -handle_create_folder_internal (const char *uri, +handle_create_folder_internal (const gchar *parent_uri, + const gchar *new_folder_name, NautilusFileOperationsDBusData *dbus_data) { - 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); - g_application_hold (g_application_get_default ()); nautilus_file_operations_new_folder (NULL, dbus_data, - parent_file_uri, basename, + parent_uri, new_folder_name, create_folder_on_finished, NULL); } @@ -188,7 +179,17 @@ handle_create_folder (NautilusDBusFileOperations *object, GDBusMethodInvocation *invocation, const gchar *uri) { - handle_create_folder_internal (uri, NULL); + 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); + + handle_create_folder_internal (parent_file_uri, basename, NULL); nautilus_dbus_file_operations_complete_create_folder (object, invocation); return TRUE; /* invocation was handled */ @@ -197,14 +198,15 @@ handle_create_folder (NautilusDBusFileOperations *object, static gboolean handle_create_folder2 (NautilusDBusFileOperations2 *object, GDBusMethodInvocation *invocation, - const gchar *uri, + const gchar *parent_uri, + const gchar *new_folder_name, GVariant *platform_data) { g_autoptr (NautilusFileOperationsDBusData) dbus_data = NULL; dbus_data = nautilus_file_operations_dbus_data_new (platform_data); - handle_create_folder_internal (uri, dbus_data); + handle_create_folder_internal (parent_uri, new_folder_name, dbus_data); nautilus_dbus_file_operations2_complete_create_folder (object, invocation); return TRUE; /* invocation was handled */ |