Make the file transfer portal setup sync again
authorMatthias Clasen <mclasen@redhat.com>
Wed, 7 Sep 2022 03:38:08 +0000 (23:38 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 7 Sep 2022 10:45:03 +0000 (06:45 -0400)
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

index a658d086a89dc26ff1a71e6f2d8e02884da6fc87..fac2ab213c810382268bc3bc78e09dd3d055198e 100644 (file)
@@ -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 ();
     }
 }