diff options
author | Ondrej Holy <oholy@redhat.com> | 2020-09-25 16:12:18 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2020-12-08 12:56:05 +0100 |
commit | 906450614326b6d785b0ab5391b6c3b7d73571a3 (patch) | |
tree | 4f26a19ca0c8fceeb86c82e393a915366c43abbf /client/gdaemonfile.c | |
parent | 60ca0cea45fabf2b110f3ec2335f6d179ccf093c (diff) | |
download | gvfs-906450614326b6d785b0ab5391b6c3b7d73571a3.tar.gz |
client: Add fallback to session bus also for synchronous API
Asynchronous API fallbacks to session bus when peer-to-peer connection
fails, however, synchronous API fails in the same case. Let's add
fallback to session bus also for the synchronous case.
Diffstat (limited to 'client/gdaemonfile.c')
-rw-r--r-- | client/gdaemonfile.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index 6111b7bd..2ea6cd7c 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -441,12 +441,17 @@ create_proxy_for_file2 (GFile *file1, if (connection == NULL) { g_dbus_error_strip_remote_error (local_error); - g_warning ("The peer-to-peer connection failed: %s. Your application is " - "probably missing --filesystem=xdg-run/gvfsd privileges.", - local_error->message); - goto out; + g_warning ("The peer-to-peer connection failed: %s. Falling back to the " + "session bus. Your application is probably missing " + "--filesystem=xdg-run/gvfsd privileges.", local_error->message); + g_clear_error (&local_error); + + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &local_error); } + if (connection == NULL) + goto out; + proxy = gvfs_dbus_mount_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, mount_info1->dbus_id, |