[next] telepathy-glib: Tests: Use GDBusConnection directly to watch name
Simon McVittie
smcv at kemper.freedesktop.org
Thu Mar 27 08:42:06 PDT 2014
Module: telepathy-glib
Branch: next
Commit: 98e7b7af4f9e2edccb5ef66203fd2726015c3b5c
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=98e7b7af4f9e2edccb5ef66203fd2726015c3b5c
Author: Xavier Claessens <xavier.claessens at collabora.com>
Date: Wed Mar 26 13:45:30 2014 -0400
Tests: Use GDBusConnection directly to watch name
[explicitly cancel the watch -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
---
tests/dbus/example-no-protocols.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/dbus/example-no-protocols.c b/tests/dbus/example-no-protocols.c
index 9adac2a..e7fce2e 100644
--- a/tests/dbus/example-no-protocols.c
+++ b/tests/dbus/example-no-protocols.c
@@ -84,13 +84,12 @@ connection_manager_got_info (TpConnectionManager *cm,
}
static void
-wait_for_name_owner_cb (TpDBusDaemon *dbus_daemon,
+wait_for_name_owner_cb (GDBusConnection *connection,
const gchar *name,
const gchar *new_owner,
gpointer main_loop)
{
- if (new_owner[0] != '\0')
- g_main_loop_quit (main_loop);
+ g_main_loop_quit (main_loop);
}
static void
@@ -111,6 +110,7 @@ test (Fixture *f,
GError *error = NULL;
gboolean saw_exited;
GTestDBus *test_dbus;
+ guint name_owner_watch;
/* If we're running slowly (for instance in a parallel build)
* we don't want the CM process in the background to time out and exit. */
@@ -157,10 +157,14 @@ test (Fixture *f,
/* Now start the connection manager and wait for it to start */
prepare ();
- tp_dbus_daemon_watch_name_owner (dbus_daemon,
- TP_CM_BUS_NAME_BASE "example_no_protocols", wait_for_name_owner_cb,
+ name_owner_watch = g_bus_watch_name_on_connection (
+ tp_proxy_get_dbus_connection (dbus_daemon),
+ TP_CM_BUS_NAME_BASE "example_no_protocols",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ wait_for_name_owner_cb, NULL,
g_main_loop_ref (mainloop), (GDestroyNotify) g_main_loop_unref);
g_main_loop_run (mainloop);
+ g_bus_unwatch_name (name_owner_watch);
/* This TpConnectionManager works fine. */
late_cm = tp_connection_manager_new (dbus_daemon, "example_no_protocols",
More information about the telepathy-commits
mailing list