[totem/wip/hadess/save-file-fixes: 8/11] save-file: Add support for nautilus >= 3.30
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/save-file-fixes: 8/11] save-file: Add support for nautilus >= 3.30
- Date: Wed, 6 Feb 2019 21:19:31 +0000 (UTC)
commit 1ee672071e86c7490493fe75c223dd06067aea45
Author: Bastien Nocera <hadess hadess net>
Date: Tue Feb 5 18:08:38 2019 +0100
save-file: Add support for nautilus >= 3.30
The CopyFile API was removed without warning, update our code to use
CopyURIs instead.
See https://gitlab.gnome.org/GNOME/nautilus/commit/60c3f2ea839deaf3040872d1ee43d4fea22d543b
Closes: #285
src/plugins/save-file/totem-save-file.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/save-file/totem-save-file.c b/src/plugins/save-file/totem-save-file.c
index 85f6a38f5..6d20c1868 100644
--- a/src/plugins/save-file/totem-save-file.c
+++ b/src/plugins/save-file/totem-save-file.c
@@ -64,6 +64,7 @@ copy_uris_with_nautilus (TotemSaveFilePlugin *pi,
GError *error = NULL;
GDBusProxyFlags flags;
GDBusProxy *proxy;
+ GVariant *ret;
g_return_if_fail (source != NULL);
g_return_if_fail (dest_dir != NULL);
@@ -92,12 +93,29 @@ copy_uris_with_nautilus (TotemSaveFilePlugin *pi,
return;
}
- if (g_dbus_proxy_call_sync (proxy,
- "CopyFile", g_variant_new ("(&s&s&s&s)", source, "", dest_dir, dest_name),
- G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, &error) == FALSE) {
+ ret = g_dbus_proxy_call_sync (proxy,
+ "CopyFile", g_variant_new ("(&s&s&s&s)", source, "", dest_dir,
dest_name),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ if (ret == NULL) {
+ /* nautilus >= 3.30.0? */
+ if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
+ const char *sources[2] = { source, NULL };
+
+ g_clear_error (&error);
+ ret = g_dbus_proxy_call_sync (proxy,
+ "CopyURIs", g_variant_new ("(^ass)", sources, dest_dir),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+ }
+ }
+
+ if (ret == NULL) {
g_warning ("Could not get nautilus to copy file: %s", error->message);
g_error_free (error);
+ } else {
+ g_variant_unref (ret);
}
g_object_unref (proxy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]