[Xfce4-commits] [xfce/xfconf] 16/31: Port the common code for tests to gdbus.

noreply at xfce.org noreply at xfce.org
Thu Jun 1 13:33:09 CEST 2017


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

a   l   i       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/xfconf.

commit 5a5afd687450c3fe6615fe0ca9cda75195342a21
Author: Ali Abdallah <aliovx at gmail.com>
Date:   Sun Apr 24 21:39:19 2016 +0200

    Port the common code for tests to gdbus.
---
 tests/tests-common.h | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/tests/tests-common.h b/tests/tests-common.h
index b6216c3..f895cfb 100644
--- a/tests/tests-common.h
+++ b/tests/tests-common.h
@@ -41,7 +41,7 @@
 #endif
 
 #include <glib.h>
-#include <dbus/dbus.h>
+#include <gio/gio.h>
 #include <xfconf/xfconf.h>
 
 #define TEST_CHANNEL_NAME  "test-channel"
@@ -76,41 +76,39 @@ static void xfconf_tests_end();
 static gboolean
 xfconf_tests_start(void)
 {
-    DBusConnection *dbus_conn;
-    DBusMessage *msg, *ret;
-    DBusError derror;
+    GDBusConnection *conn;
+    GDBusMessage *msg, *ret;
     GTimeVal start, now;
     GError *error = NULL;
 
     /* wait until xfconfd finishes starting */
-    dbus_error_init(&derror);
-    dbus_conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-    if(!dbus_conn) {
-        g_critical("Failed to connect to D-Bus: %s", derror.message);
-        dbus_error_free(&derror);
+    conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+    if(!conn) {
+        g_critical("Failed to connect to D-Bus: %s", error->message);
+        g_error_free (error);
         xfconf_tests_end();
         return FALSE;
     }
-    msg = dbus_message_new_method_call("org.xfce.Xfconf",
-                                      "/org/xfce/Xfconf",
-                                      "org.freedesktop.DBus.Peer",
-                                      "Ping");
+    msg = g_dbus_message_new_method_call("org.xfce.Xfconf",
+                                         "/org/xfce/Xfconf",
+                                         "org.freedesktop.DBus.Peer",
+                                         "Ping");
     g_get_current_time(&start);
-    while(!(ret = dbus_connection_send_with_reply_and_block(dbus_conn,
-                                                            msg, 0, NULL)))
+    while(!(ret = g_dbus_connection_send_message_with_reply_sync(conn,
+                                                                 msg, 
+                                                                 G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+                                                                 -1, NULL, NULL, NULL)))
     {
         g_get_current_time(&now);
         if(now.tv_sec - start.tv_sec > WAIT_TIMEOUT) {
             g_critical("xfconfd failed to start after %d seconds", WAIT_TIMEOUT);
-            dbus_message_unref(msg);
-            dbus_connection_unref(dbus_conn);
+            g_object_unref (msg);
             xfconf_tests_end();
             return FALSE;
         }
     }
-    dbus_message_unref(msg);
-    dbus_message_unref(ret);
-    dbus_connection_unref(dbus_conn);
+    g_object_unref (msg);
+    g_object_unref (ret);
 
     if(!xfconf_init(&error)) {
         g_critical("Failed to init libxfconf: %s", error->message);

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


More information about the Xfce4-commits mailing list