[Xfce4-commits] [xfce/xfdesktop] 01/01: Use async dbus proxy initialization (Bug #15418)

noreply at xfce.org noreply at xfce.org
Tue May 21 02:20:43 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfdesktop.

commit 0887d5248f81fda701a3370e35788704c98f7efc
Author: Andre Miranda <andreldm at xfce.org>
Date:   Mon May 20 21:20:22 2019 -0300

    Use async dbus proxy initialization (Bug #15418)
    
    This avoids xfdesktop hanging on startup waiting for a Thunar instance
    which may be started by dbus, or even worse, is not installed causing
    xfdesktop to hang until the synchronous calls timeout.
---
 src/xfdesktop-file-utils.c | 76 ++++++++++++++++++++++++++++++++++------------
 1 file changed, 57 insertions(+), 19 deletions(-)

diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index 7c66236..b6e4f40 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -67,6 +67,18 @@ static void xfdesktop_file_utils_add_emblems(GdkPixbuf *pix, GList *emblems);
 static XfdesktopTrash       *xfdesktop_file_utils_peek_trash_proxy(void);
 static XfdesktopFileManager *xfdesktop_file_utils_peek_filemanager_proxy(void);
 
+static void xfdesktop_file_utils_trash_proxy_new_cb (GObject *source_object,
+                                                     GAsyncResult *res,
+                                                     gpointer user_data);
+
+static void xfdesktop_file_utils_file_manager_proxy_new_cb (GObject *source_object,
+                                                            GAsyncResult *res,
+                                                            gpointer user_data);
+
+static void xfdesktop_file_utils_thunar_proxy_new_cb (GObject *source_object,
+                                                      GAsyncResult *res,
+                                                      gpointer user_data);
+
 #ifdef HAVE_THUNARX
 static XfdesktopThunar *xfdesktop_file_utils_peek_thunar_proxy(void);
 #else
@@ -1554,27 +1566,30 @@ xfdesktop_file_utils_dbus_init(void)
     }
 
     if(dbus_gconn) {
-        dbus_trash_proxy = xfdesktop_trash_proxy_new_sync(dbus_gconn,
-                                                          G_DBUS_PROXY_FLAGS_NONE,
-                                                          "org.xfce.FileManager",
-                                                          "/org/xfce/FileManager",
-                                                          NULL,
-                                                          NULL);
-
-        dbus_filemanager_proxy = xfdesktop_file_manager_proxy_new_sync(dbus_gconn,
-                                                                       G_DBUS_PROXY_FLAGS_NONE,
-                                                                       "org.xfce.FileManager",
-                                                                       "/org/xfce/FileManager",
-                                                                       NULL,
-                                                                       NULL);
+        xfdesktop_trash_proxy_new(dbus_gconn,
+                                  G_DBUS_PROXY_FLAGS_NONE,
+                                  "org.xfce.FileManager",
+                                  "/org/xfce/FileManager",
+                                  NULL,
+                                  xfdesktop_file_utils_trash_proxy_new_cb,
+                                  NULL);
+
+        xfdesktop_file_manager_proxy_new(dbus_gconn,
+                                         G_DBUS_PROXY_FLAGS_NONE,
+                                         "org.xfce.FileManager",
+                                         "/org/xfce/FileManager",
+                                         NULL,
+                                         xfdesktop_file_utils_file_manager_proxy_new_cb,
+                                         NULL);
 
 #ifdef HAVE_THUNARX
-        dbus_thunar_proxy = xfdesktop_thunar_proxy_new_sync(dbus_gconn,
-                                                            G_DBUS_PROXY_FLAGS_NONE,
-                                                            "org.xfce.FileManager",
-                                                            "/org/xfce/FileManager",
-                                                            NULL,
-                                                            NULL);
+        xfdesktop_thunar_proxy_new(dbus_gconn,
+                                   G_DBUS_PROXY_FLAGS_NONE,
+                                   "org.xfce.FileManager",
+                                   "/org/xfce/FileManager",
+                                   NULL,
+                                   xfdesktop_file_utils_thunar_proxy_new_cb,
+                                   NULL);
 #else
         dbus_thunar_proxy = NULL;
 #endif
@@ -1613,6 +1628,29 @@ xfdesktop_file_utils_peek_thunar_proxy(void)
 }
 #endif
 
+static void
+xfdesktop_file_utils_trash_proxy_new_cb (GObject *source_object,
+                                         GAsyncResult *res,
+                                         gpointer user_data) {
+    dbus_trash_proxy = xfdesktop_trash_proxy_new_finish (res, NULL);
+}
+
+static void
+xfdesktop_file_utils_file_manager_proxy_new_cb (GObject *source_object,
+                                                GAsyncResult *res,
+                                                gpointer user_data) {
+    dbus_filemanager_proxy = xfdesktop_file_manager_proxy_new_finish (res, NULL);
+}
+
+static void
+xfdesktop_file_utils_thunar_proxy_new_cb (GObject *source_object,
+                                          GAsyncResult *res,
+                                          gpointer user_data) {
+#ifdef HAVE_THUNARX
+    dbus_thunar_proxy = xfdesktop_thunar_proxy_new_finish (res, NULL);
+#endif
+}
+
 void
 xfdesktop_file_utils_dbus_cleanup(void)
 {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list