[gvfs/wip/oholy/runtime-dir-socket: 21/23] gvfsiconloadable: Fallback to session bus when peer-to-peer fails
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/runtime-dir-socket: 21/23] gvfsiconloadable: Fallback to session bus when peer-to-peer fails
- Date: Tue, 8 Dec 2020 11:32:25 +0000 (UTC)
commit 9aa40b72379ecb3a57104e4a5403d7d6f87851e2
Author: Ondrej Holy <oholy redhat com>
Date: Fri Sep 25 15:55:15 2020 +0200
gvfsiconloadable: Fallback to session bus when peer-to-peer fails
g_vfs_icon_load_async fails if peer-to-peer connection can't be
establised. Let's add fallback to session bus as it is implemented
already on other places.
client/gvfsiconloadable.c | 58 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 45 insertions(+), 13 deletions(-)
---
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index e6a0a8f4..5050cfbe 100644
--- a/client/gvfsiconloadable.c
+++ b/client/gvfsiconloadable.c
@@ -196,20 +196,9 @@ async_proxy_new_cb (GObject *source_object,
}
static void
-async_got_connection_cb (GDBusConnection *connection,
- GError *io_error,
- gpointer callback_data)
+async_construct_proxy (GDBusConnection *connection,
+ AsyncPathCall *data)
{
- AsyncPathCall *data = callback_data;
-
- if (connection == NULL)
- {
- g_dbus_error_strip_remote_error (io_error);
- g_task_return_error (data->task, io_error);
- async_path_call_free (data);
- return;
- }
-
data->connection = g_object_ref (connection);
gvfs_dbus_mount_proxy_new (connection,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
@@ -220,6 +209,49 @@ async_got_connection_cb (GDBusConnection *connection,
data);
}
+
+static void
+bus_get_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ AsyncPathCall *data = user_data;
+ GDBusConnection *connection;
+ GError *error = NULL;
+
+ connection = g_bus_get_finish (res, &error);
+
+ if (connection == NULL)
+ {
+ g_dbus_error_strip_remote_error (error);
+ g_task_return_error (data->task, error);
+ async_path_call_free (data);
+ return;
+ }
+
+ async_construct_proxy (connection, data);
+ g_object_unref (connection);
+}
+
+static void
+async_got_connection_cb (GDBusConnection *connection,
+ GError *io_error,
+ gpointer callback_data)
+{
+ AsyncPathCall *data = callback_data;
+
+ if (connection == NULL)
+ {
+ g_bus_get (G_BUS_TYPE_SESSION,
+ g_task_get_cancellable (data->task),
+ bus_get_cb,
+ data);
+ return;
+ }
+
+ async_construct_proxy (connection, data);
+}
+
static void
async_got_mount_info (GMountInfo *mount_info,
gpointer _data,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]