summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-09-25 16:00:49 +0200
committerOndrej Holy <oholy@redhat.com>2020-12-08 12:56:05 +0100
commit60ca0cea45fabf2b110f3ec2335f6d179ccf093c (patch)
treed8801b0cd5699a8fe856ced76f1530903a8cee8d /client
parentdc0c335636f24db541944623c597c9c1af73ae0b (diff)
downloadgvfs-60ca0cea45fabf2b110f3ec2335f6d179ccf093c.tar.gz
client: Show warning when peer-to-peer connection failed
When peer-to-peer connection fails, the session bus is silently used instead by the asynchronous API. Let's add warnings to make it more obvious and mention that --filesystem=xdg-run/gvfsd is probably missing.
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonfile.c15
-rw-r--r--client/gdaemonfilemonitor.c6
-rw-r--r--client/gdaemonmount.c7
-rw-r--r--client/gvfsiconloadable.c13
4 files changed, 33 insertions, 8 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index f11cf91c..6111b7bd 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -439,7 +439,13 @@ create_proxy_for_file2 (GFile *file1,
connection = _g_dbus_connection_get_sync (mount_info1->dbus_id, cancellable, &local_error);
if (connection == NULL)
- goto out;
+ {
+ 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;
+ }
proxy = gvfs_dbus_mount_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
@@ -613,8 +619,11 @@ async_got_connection_cb (GDBusConnection *connection,
if (connection == NULL)
{
- /* TODO: we should probably test if we really want a session bus;
- * for now, this code is on par with the old dbus code */
+ g_dbus_error_strip_remote_error (io_error);
+ 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.", io_error->message);
+
g_bus_get (G_BUS_TYPE_SESSION,
g_task_get_cancellable (data->task),
bus_get_cb,
diff --git a/client/gdaemonfilemonitor.c b/client/gdaemonfilemonitor.c
index 2d9f958f..6c80c6ab 100644
--- a/client/gdaemonfilemonitor.c
+++ b/client/gdaemonfilemonitor.c
@@ -180,8 +180,10 @@ g_daemon_file_monitor_new (const char *remote_id,
connection = _g_dbus_connection_get_sync (daemon_monitor->remote_id, NULL, &error);
if (connection == NULL)
{
- g_printerr ("Error getting connection for monitoring: %s (%s, %d)\n",
- error->message, g_quark_to_string (error->domain), error->code);
+ g_dbus_error_strip_remote_error (error);
+ g_warning ("The peer-to-peer connection failed: %s. Your application is "
+ "probably missing --filesystem=xdg-run/gvfsd privileges.",
+ error->message);
g_error_free (error);
}
else
diff --git a/client/gdaemonmount.c b/client/gdaemonmount.c
index d49fad89..a3cb2578 100644
--- a/client/gdaemonmount.c
+++ b/client/gdaemonmount.c
@@ -315,8 +315,11 @@ async_got_connection_cb (GDBusConnection *connection,
if (connection == NULL)
{
- /* TODO: we should probably test if we really want a session bus;
- * for now, this code is on par with the old dbus code */
+ g_dbus_error_strip_remote_error (io_error);
+ 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.", io_error->message);
+
g_bus_get (G_BUS_TYPE_SESSION,
g_task_get_cancellable (task),
bus_get_cb,
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index 5050cfbe..45fb6c2c 100644
--- a/client/gvfsiconloadable.c
+++ b/client/gvfsiconloadable.c
@@ -59,7 +59,13 @@ create_proxy_for_icon (GVfsIcon *vfs_icon,
connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, &local_error);
if (connection == NULL)
- goto out;
+ {
+ 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;
+ }
proxy = gvfs_dbus_mount_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
@@ -242,6 +248,11 @@ async_got_connection_cb (GDBusConnection *connection,
if (connection == NULL)
{
+ g_dbus_error_strip_remote_error (io_error);
+ 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.", io_error->message);
+
g_bus_get (G_BUS_TYPE_SESSION,
g_task_get_cancellable (data->task),
bus_get_cb,