[gtk/gtk-4-6: 2/11] Make the file transfer portal setup sync again




commit 11e90e4fa0b767a8ca5f9c3d9b77dcd9cb6ce4eb
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 6 23:38:08 2022 -0400

    Make the file transfer portal setup sync again
    
    We need to register the portal mime types before
    the others to prefer them, doing this call async
    messes up that ordering.
    
    This is effectively reverting 69fb3648b2e20935b7839f874

 gdk/filetransferportal.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/gdk/filetransferportal.c b/gdk/filetransferportal.c
index a658d086a8..fac2ab213c 100644
--- a/gdk/filetransferportal.c
+++ b/gdk/filetransferportal.c
@@ -480,20 +480,8 @@ connection_closed (GDBusConnection *connection,
 }
 
 static void
-got_proxy (GObject *source,
-           GAsyncResult *result,
-           gpointer data)
+finish_registration (void)
 {
-  GError *error = NULL;
-
-  file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
-  if (!file_transfer_proxy)
-    {
-      g_message ("Failed to get file transfer portal: %s", error->message);
-      g_clear_error (&error);
-      return;
-    }
-
   gdk_content_register_serializer (G_TYPE_FILE,
                                    "application/vnd.portal.files",
                                    portal_file_serializer,
@@ -531,7 +519,8 @@ file_transfer_portal_register (void)
   if (!called)
     {
       called = TRUE;
-      g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+
+      file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
                                 | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
                                 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@@ -540,8 +529,9 @@ file_transfer_portal_register (void)
                                 "/org/freedesktop/portal/documents",
                                 "org.freedesktop.portal.FileTransfer",
                                 NULL,
-                                got_proxy,
                                 NULL);
+      if (file_transfer_proxy)
+        finish_registration ();
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]