[glib/portal: 15/17] portal support: Don't wait for the reply



commit 5af31fbdbc45acd15a831148d257dac67cf54fb8
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jun 30 12:33:16 2016 -0400

    portal support: Don't wait for the reply
    
    It does not really make sense for g_app_info_launch_default_for_uri
    to block on an interactive dialog. If we want that, we can should
    introduce a proper async variant of this API with a cancellable
    and a finish().

 gio/gappinfo.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 51de5d6..14ea3db 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -694,23 +694,23 @@ launch_default_with_portal (const char         *uri,
 
   g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
 
-  message = g_dbus_message_new_method_call ("org.freedesktop.portal.Desktop",
-                                            "/org/freedesktop/portal/desktop",
-                                            "org.freedesktop.portal.OpenURI",
-                                            "OpenURI");
+  g_dbus_connection_call (bus,
+                          "org.freedesktop.portal.Desktop",
+                          "/org/freedesktop/portal/desktop",
+                          "org.freedesktop.portal.OpenURI",
+                          "OpenURI",
+                          g_variant_new ("(ss a{sv})",
+                                         parent_window ? parent_window : "",
+                                         uri,
+                                         g_variant_builder_end (&opt_builder)),
+                          NULL,
+                          G_DBUS_CALL_FLAGS_NONE,
+                          G_MAXINT,
+                          NULL,
+                          NULL,
+                          NULL);
+  g_object_unref (bus);
 
-  g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
-
-  g_dbus_message_set_body (message, g_variant_new ("(ss a{sv})",
-                                                   parent_window ? parent_window : "",
-                                                   uri,
-                                                   g_variant_builder_end (&opt_builder)));
-
-  g_dbus_connection_send_message (bus,
-                                  message,
-                                  G_DBUS_SEND_MESSAGE_FLAGS_NONE,
-                                  NULL,
-                                  NULL);
   return TRUE;
 }
 


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