[Pkg-telepathy-commits] [telepathy-glib-1] 72/212: TpConnectionManager: Always create from a factory

Simon McVittie smcv at debian.org
Wed May 14 12:08:52 UTC 2014


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

smcv pushed a commit to branch debian
in repository telepathy-glib-1.

commit eaed94ea7bdfee64318f685f5a9a9d8789690ced
Author: Xavier Claessens <xavier.claessens at collabora.com>
Date:   Sat Mar 29 17:12:09 2014 -0400

    TpConnectionManager: Always create from a factory
    
    Also create CM's TpProtocol objects from the factory now
    that the CM always has one.
    
    In protocol-objects test_factory() it changes the cm_name because
    TpProtocol objects are now shared with TpConnectionManager that
    keeps a ref on them.
---
 .../telepathy-glib/telepathy-glib-sections.txt     |  3 +-
 examples/client/extended-client.c                  | 13 ++---
 examples/client/inspect-cm.c                       |  3 +-
 telepathy-glib/client-factory-internal.h           |  6 +++
 telepathy-glib/client-factory.c                    | 55 ++++++++++++++++++++++
 telepathy-glib/client-factory.h                    |  7 +++
 telepathy-glib/connection-manager.c                | 51 +++++++++-----------
 telepathy-glib/connection-manager.h                |  4 --
 telepathy-glib/versions/main-1.0.abi               |  1 -
 tests/dbus/call-channel.c                          |  9 ++--
 tests/dbus/cm.c                                    | 28 +++++------
 tests/dbus/example-no-protocols.c                  | 17 +++----
 tests/dbus/message-mixin.c                         | 13 +++--
 tests/dbus/protocol-objects.c                      | 14 +++---
 14 files changed, 145 insertions(+), 79 deletions(-)

diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index b7eb72d..2a5e9a5 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -3633,7 +3633,6 @@ tp_list_connection_managers_async
 tp_list_connection_managers_finish
 TpConnectionManager
 TpConnectionManagerClass
-tp_connection_manager_new
 tp_connection_manager_get_name
 TP_CONNECTION_MANAGER_FEATURE_CORE
 TpCMInfoSource
@@ -5767,6 +5766,8 @@ tp_client_factory_add_tls_certificate_features_varargs
 tp_client_factory_dup_tls_certificate_features
 <SUBSECTION>
 tp_client_factory_ensure_debug_client
+<SUBSECTION>
+tp_client_factory_ensure_connection_manager
 <SUBSECTION Standard>
 TP_IS_CLIENT_FACTORY
 TP_IS_CLIENT_FACTORY_CLASS
diff --git a/examples/client/extended-client.c b/examples/client/extended-client.c
index 21eb738..04f2ed5 100644
--- a/examples/client/extended-client.c
+++ b/examples/client/extended-client.c
@@ -283,13 +283,13 @@ main (int argc,
 {
   TpConnectionManager *cm = NULL;
   GError *error = NULL;
-  TpDBusDaemon *dbus = NULL;
+  TpClientFactory *factory = NULL;
 
   tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
 
-  dbus = tp_dbus_daemon_dup (&error);
+  factory = tp_client_factory_dup (&error);
 
-  if (dbus == NULL)
+  if (factory == NULL)
     {
       g_warning ("%s", error->message);
       g_error_free (error);
@@ -298,7 +298,8 @@ main (int argc,
 
   mainloop = g_main_loop_new (NULL, FALSE);
 
-  cm = tp_connection_manager_new (dbus, "example_extended", NULL, &error);
+  cm = tp_client_factory_ensure_connection_manager (factory, "example_extended",
+      NULL, &error);
 
   if (cm == NULL)
     {
@@ -317,8 +318,8 @@ out:
   if (cm != NULL)
     g_object_unref (cm);
 
-  if (dbus != NULL)
-    g_object_unref (dbus);
+  if (factory != NULL)
+    g_object_unref (factory);
 
   if (mainloop != NULL)
     g_main_loop_unref (mainloop);
diff --git a/examples/client/inspect-cm.c b/examples/client/inspect-cm.c
index 7c41d54..63b1a00 100644
--- a/examples/client/inspect-cm.c
+++ b/examples/client/inspect-cm.c
@@ -253,7 +253,8 @@ main (int argc,
       cm_name = argv[1];
       manager_file = argv[2];   /* possibly NULL */
 
-      cm = tp_connection_manager_new (dbus, cm_name, manager_file, &error);
+      cm = tp_client_factory_ensure_connection_manager (factory, cm_name,
+          manager_file, &error);
 
       if (cm == NULL)
         {
diff --git a/telepathy-glib/client-factory-internal.h b/telepathy-glib/client-factory-internal.h
index dd97147..0516a1e 100644
--- a/telepathy-glib/client-factory-internal.h
+++ b/telepathy-glib/client-factory-internal.h
@@ -84,6 +84,12 @@ TpDebugClient *_tp_debug_client_new (TpClientFactory *factory,
     const gchar *unique_name,
     GError **error);
 
+TpConnectionManager *_tp_connection_manager_new (TpClientFactory *factory,
+    const gchar *name,
+    const gchar *manager_filename,
+    GError **error);
+gchar *_tp_connection_manager_build_object_path (const gchar *name);
+
 G_END_DECLS
 
 #endif
diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c
index 3949ada..a628ff8 100644
--- a/telepathy-glib/client-factory.c
+++ b/telepathy-glib/client-factory.c
@@ -1808,3 +1808,58 @@ tp_client_factory_ensure_debug_client (TpClientFactory *self,
    * in this case. */
   return _tp_debug_client_new (self, unique_name, error);
 }
+
+/**
+ * tp_client_factory_ensure_connection_manager:
+ * @self: a #TpClientFactory
+ * @name: The connection manager name (such as "gabble")
+ * @manager_filename: (allow-none): The #TpConnectionManager:manager-file
+ *  property, which may (and generally should) be %NULL.
+ * @error: Used to raise an error
+ *
+ * The returned #TpConnectionManager is cached; the same #TpConnectionManager
+ * object will be returned by this function repeatedly, as long as at least one
+ * reference exists.
+ *
+ * Note that the returned #TpConnectionManager is not guaranteed to be ready;
+ * the caller is responsible for calling tp_proxy_prepare_async() with the
+ * desired features.
+ *
+ * Returns: (transfer full): a reference to a #TpConnectionManager,
+ *  or %NULL on invalid arguments.
+ *
+ * Since: UNRELEASED
+ */
+TpConnectionManager *
+tp_client_factory_ensure_connection_manager (TpClientFactory *self,
+    const gchar *name,
+    const gchar *manager_filename,
+    GError **error)
+{
+  TpConnectionManager *cm;
+  gchar *object_path;
+
+  g_return_val_if_fail (TP_IS_CLIENT_FACTORY (self), NULL);
+
+  object_path = _tp_connection_manager_build_object_path (name);
+  cm = lookup_proxy (self, object_path);
+  if (cm != NULL)
+    {
+      g_object_ref (cm);
+    }
+  else
+    {
+      cm = _tp_connection_manager_new (self, name, manager_filename, error);
+
+      if (cm != NULL)
+        {
+          g_assert (g_str_equal (tp_proxy_get_object_path (cm),
+              object_path));
+          insert_proxy (self, cm);
+        }
+    }
+
+  g_free (object_path);
+
+  return cm;
+}
diff --git a/telepathy-glib/client-factory.h b/telepathy-glib/client-factory.h
index 41bc78f..dc802a7 100644
--- a/telepathy-glib/client-factory.h
+++ b/telepathy-glib/client-factory.h
@@ -32,6 +32,7 @@
 #include <telepathy-glib/channel-dispatch-operation.h>
 #include <telepathy-glib/channel-request.h>
 #include <telepathy-glib/connection.h>
+#include <telepathy-glib/connection-manager.h>
 #include <telepathy-glib/contact.h>
 #include <telepathy-glib/dbus-daemon.h>
 #include <telepathy-glib/debug-client.h>
@@ -256,6 +257,12 @@ TpDebugClient *tp_client_factory_ensure_debug_client (TpClientFactory *self,
     const gchar *unique_name,
     GError **error);
 
+/* TpConnectionManager */
+TpConnectionManager *tp_client_factory_ensure_connection_manager (
+    TpClientFactory *self,
+    const gchar *name,
+    const gchar *manager_filename,
+    GError **error);
 G_END_DECLS
 
 #endif
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index a7087b9..5c4e931 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -389,8 +389,10 @@ tp_connection_manager_get_all_cb (TpProxy *proxy,
 
               if (tp_connection_manager_check_valid_protocol_name (name, NULL))
                 {
-                  TpProtocol *proto_object = _tp_protocol_new (
-                      tp_proxy_get_dbus_daemon (self), NULL, self->priv->name,
+                  TpProtocol *proto_object;
+
+                  proto_object = tp_client_factory_ensure_protocol (
+                      tp_proxy_get_factory (self), self->priv->name,
                       name, tp_asv_to_vardict (v), NULL);
 
                   /* _tp_protocol_new can currently only fail because of
@@ -594,7 +596,7 @@ name_vanished_cb (GDBusConnection *connection,
 }
 
 static gboolean
-tp_connection_manager_read_file (TpDBusDaemon *dbus_daemon,
+tp_connection_manager_read_file (TpClientFactory *factory,
     const gchar *cm_name,
     const gchar *filename,
     GHashTable **protocols_out,
@@ -636,7 +638,7 @@ tp_connection_manager_read_file (TpDBusDaemon *dbus_daemon,
       if (immutables == NULL)
         continue;
 
-      proto_object = _tp_protocol_new (dbus_daemon, NULL, cm_name, name,
+      proto_object = tp_client_factory_ensure_protocol (factory, cm_name, name,
           tp_asv_to_vardict (immutables), NULL);
       g_assert (proto_object != NULL);
 
@@ -682,7 +684,7 @@ tp_connection_manager_idle_read_manager_file (gpointer data)
           DEBUG ("%s: reading %s", self->priv->name, self->priv->manager_file);
 
           if (!tp_connection_manager_read_file (
-              tp_proxy_get_dbus_daemon (self),
+              tp_proxy_get_factory (self),
               self->priv->name, self->priv->manager_file, &protocols, &interfaces,
               &error))
             {
@@ -1109,23 +1111,14 @@ tp_connection_manager_class_init (TpConnectionManagerClass *klass)
       G_TYPE_NONE, 1, G_TYPE_UINT);
 }
 
-/**
- * tp_connection_manager_new:
- * @dbus: Proxy for the D-Bus daemon
- * @name: The connection manager name (such as "gabble")
- * @manager_filename: (allow-none): The #TpConnectionManager:manager-file
- *  property, which may (and generally should) be %NULL.
- * @error: used to return an error if %NULL is returned
- *
- * Convenience function to create a new connection manager proxy. If
- * its protocol and parameter information are required, you should call
- * tp_proxy_prepare_async() on the result.
- *
- * Returns: a new reference to a connection manager proxy, or %NULL if @error
- *          is set.
- */
+gchar *
+_tp_connection_manager_build_object_path (const gchar *name)
+{
+  return g_strdup_printf ("%s%s", TP_CM_OBJECT_PATH_BASE, name);
+}
+
 TpConnectionManager *
-tp_connection_manager_new (TpDBusDaemon *dbus,
+_tp_connection_manager_new (TpClientFactory *factory,
                            const gchar *name,
                            const gchar *manager_filename,
                            GError **error)
@@ -1133,21 +1126,21 @@ tp_connection_manager_new (TpDBusDaemon *dbus,
   TpConnectionManager *cm;
   gchar *object_path, *bus_name;
 
-  g_return_val_if_fail (dbus != NULL, NULL);
+  g_return_val_if_fail (TP_IS_CLIENT_FACTORY (factory), NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
   if (!tp_connection_manager_check_valid_name (name, error))
     return NULL;
 
-  object_path = g_strdup_printf ("%s%s", TP_CM_OBJECT_PATH_BASE, name);
+  object_path = _tp_connection_manager_build_object_path (name);
   bus_name = g_strdup_printf ("%s%s", TP_CM_BUS_NAME_BASE, name);
 
   cm = TP_CONNECTION_MANAGER (g_object_new (TP_TYPE_CONNECTION_MANAGER,
-        "dbus-daemon", dbus,
-        "dbus-connection", tp_proxy_get_dbus_connection (dbus),
+        "dbus-daemon", tp_client_factory_get_dbus_daemon (factory),
         "bus-name", bus_name,
         "object-path", object_path,
         "manager-file", manager_filename,
+        "factory", factory,
         NULL));
 
   g_free (object_path);
@@ -1302,9 +1295,8 @@ handle_list_names_reply (GTask *task,
 
       /* just ignore connection managers with bad names */
       cm_name = *iter + strlen (TP_CM_BUS_NAME_BASE);
-      cm = tp_connection_manager_new (
-          tp_client_factory_get_dbus_daemon (data->factory), cm_name, NULL,
-          NULL);
+      cm = tp_client_factory_ensure_connection_manager (data->factory, cm_name,
+          NULL, NULL);
       if (cm == NULL)
         continue;
 
@@ -1389,6 +1381,9 @@ out:
  * asynchronously, and wait for their %TP_CONNECTION_MANAGER_FEATURE_CORE
  * feature to be ready.
  *
+ * @factory will be used to create the #TpConnectionManager objects using
+ * tp_client_factory_ensure_connection_manager().
+ *
  * Since: 0.17.6
  */
 void
diff --git a/telepathy-glib/connection-manager.h b/telepathy-glib/connection-manager.h
index 056aefc..7c9c9c4 100644
--- a/telepathy-glib/connection-manager.h
+++ b/telepathy-glib/connection-manager.h
@@ -82,10 +82,6 @@ struct _TpConnectionManagerClass {
     gpointer *priv;
 };
 
-TpConnectionManager *tp_connection_manager_new (TpDBusDaemon *dbus,
-    const gchar *name, const gchar *manager_filename, GError **error)
-  G_GNUC_WARN_UNUSED_RESULT;
-
 gboolean tp_connection_manager_activate (TpConnectionManager *self);
 
 _TP_AVAILABLE_IN_0_18
diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi
index e667bfc..706ace9 100644
--- a/telepathy-glib/versions/main-1.0.abi
+++ b/telepathy-glib/versions/main-1.0.abi
@@ -665,7 +665,6 @@ tp_connection_manager_get_protocol
 tp_connection_manager_get_type
 tp_connection_manager_has_protocol
 tp_connection_manager_is_running
-tp_connection_manager_new
 tp_connection_manager_param_copy
 tp_connection_manager_param_dup_default_variant
 tp_connection_manager_param_dup_variant_type
diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c
index 3137510..94071df 100644
--- a/tests/dbus/call-channel.c
+++ b/tests/dbus/call-channel.c
@@ -78,11 +78,14 @@ setup (Test *test,
   guint video = TP_MEDIA_STREAM_TYPE_VIDEO;
   guint not_a_media_type = 31337;
   GQuark conn_features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };
+  GError *error = NULL;
 
   tp_debug_set_flags ("all");
 
   test->mainloop = g_main_loop_new (NULL, FALSE);
   test->dbus = tp_tests_dbus_daemon_dup_or_die ();
+  test->factory = tp_client_factory_dup (&error);
+  g_assert_no_error (error);
 
   test->service_cm = EXAMPLE_CALL_CONNECTION_MANAGER (
       tp_tests_object_new_static_class (
@@ -95,8 +98,8 @@ setup (Test *test,
   ok = tp_base_connection_manager_register (service_cm_as_base);
   g_assert (ok);
 
-  test->cm = tp_connection_manager_new (test->dbus, "example_call",
-      NULL, &test->error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "example_call", NULL, &test->error);
   g_assert (test->cm != NULL);
   tp_tests_proxy_run_until_prepared (test->cm, NULL);
 
@@ -111,8 +114,6 @@ setup (Test *test,
       "example", parameters, &bus_name, &object_path, &test->error, NULL);
   g_assert_no_error (test->error);
 
-  test->factory = tp_automatic_client_factory_new (test->dbus);
-
   test->conn = tp_client_factory_ensure_connection (test->factory,
       object_path, NULL, &test->error);
     g_assert_no_error (test->error);
diff --git a/tests/dbus/cm.c b/tests/dbus/cm.c
index 46a6425..778bb45 100644
--- a/tests/dbus/cm.c
+++ b/tests/dbus/cm.c
@@ -214,8 +214,8 @@ test_nothing_got_info (Test *test,
   GError *error = NULL;
   gulong id;
 
-  test->cm = tp_connection_manager_new (test->dbus, "not_actually_there",
-      NULL, &error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "not_actually_there", NULL, &error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (error);
 
@@ -263,8 +263,8 @@ test_file_got_info (Test *test,
   gboolean ok;
   GVariant *variant;
 
-  test->cm = tp_connection_manager_new (test->dbus, "spurious",
-      NULL, &error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "spurious", NULL, &error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (error);
 
@@ -390,8 +390,8 @@ test_complex_file_got_info (Test *test,
   GList *protocols;
   GValue value = {0, };
 
-  test->cm = tp_connection_manager_new (test->dbus, "test_manager_file",
-      NULL, &error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "test_manager_file", NULL, &error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (error);
 
@@ -793,7 +793,7 @@ test_dbus_got_info (Test *test,
   GError *error = NULL;
   gulong id;
 
-  test->cm = tp_connection_manager_new (test->dbus,
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
       TP_BASE_CONNECTION_MANAGER_GET_CLASS (test->service_cm)->cm_dbus_name,
       NULL, &error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
@@ -814,8 +814,8 @@ test_nothing_ready (Test *test,
   guint info_source;
 
   test->error = NULL;
-  test->cm = tp_connection_manager_new (test->dbus, "nonexistent_cm",
-      NULL, &test->error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "nonexistent_cm", NULL, &test->error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (test->error);
 
@@ -852,8 +852,8 @@ test_file_ready (Test *test,
   GList *l;
 
   test->error = NULL;
-  test->cm = tp_connection_manager_new (test->dbus, "spurious",
-      NULL, &test->error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "spurious", NULL, &test->error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (test->error);
 
@@ -893,8 +893,8 @@ test_complex_file_ready (Test *test,
   guint info_source;
 
   test->error = NULL;
-  test->cm = tp_connection_manager_new (test->dbus, "test_manager_file",
-      NULL, &test->error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "test_manager_file", NULL, &test->error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
   g_assert_no_error (test->error);
 
@@ -937,7 +937,7 @@ test_dbus_ready (Test *test,
   GList *l;
 
   test->error = NULL;
-  test->cm = tp_connection_manager_new (test->dbus,
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
       TP_BASE_CONNECTION_MANAGER_GET_CLASS (test->service_cm)->cm_dbus_name,
       NULL, &test->error);
   g_assert (TP_IS_CONNECTION_MANAGER (test->cm));
diff --git a/tests/dbus/example-no-protocols.c b/tests/dbus/example-no-protocols.c
index e7fce2e..1ca480d 100644
--- a/tests/dbus/example-no-protocols.c
+++ b/tests/dbus/example-no-protocols.c
@@ -105,7 +105,7 @@ test (Fixture *f,
 {
   GMainLoop *mainloop;
   TpConnectionManager *early_cm, *late_cm;
-  TpDBusDaemon *dbus_daemon;
+  TpClientFactory *factory;
   gulong handler;
   GError *error = NULL;
   gboolean saw_exited;
@@ -126,12 +126,13 @@ test (Fixture *f,
 
   mainloop = g_main_loop_new (NULL, FALSE);
 
-  dbus_daemon = tp_tests_dbus_daemon_dup_or_die ();
+  factory = tp_client_factory_dup (&error);
+  g_assert_no_error (error);
 
   /* First try making a TpConnectionManager before the CM is available. This
    * will fail. */
-  early_cm = tp_connection_manager_new (dbus_daemon, "example_no_protocols",
-      NULL, NULL);
+  early_cm = tp_client_factory_ensure_connection_manager (factory,
+      "example_no_protocols", NULL, NULL);
   g_assert (early_cm != NULL);
 
   /* Failure to introspect is signalled as 'exited' */
@@ -158,7 +159,7 @@ test (Fixture *f,
   /* Now start the connection manager and wait for it to start */
   prepare ();
   name_owner_watch = g_bus_watch_name_on_connection (
-      tp_proxy_get_dbus_connection (dbus_daemon),
+      tp_client_factory_get_dbus_connection (factory),
       TP_CM_BUS_NAME_BASE "example_no_protocols",
       G_BUS_NAME_WATCHER_FLAGS_NONE,
       wait_for_name_owner_cb, NULL,
@@ -167,8 +168,8 @@ test (Fixture *f,
   g_bus_unwatch_name (name_owner_watch);
 
   /* This TpConnectionManager works fine. */
-  late_cm = tp_connection_manager_new (dbus_daemon, "example_no_protocols",
-      NULL, NULL);
+  late_cm = tp_client_factory_ensure_connection_manager (factory,
+      "example_no_protocols", NULL, NULL);
   g_assert (late_cm != NULL);
 
   handler = g_signal_connect (late_cm, "got-info",
@@ -182,7 +183,7 @@ test (Fixture *f,
 
   g_object_unref (late_cm);
   g_object_unref (early_cm);
-  g_object_unref (dbus_daemon);
+  g_object_unref (factory);
   g_main_loop_unref (mainloop);
 
   g_test_dbus_down (test_dbus);
diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c
index 3f80012..6a651be 100644
--- a/tests/dbus/message-mixin.c
+++ b/tests/dbus/message-mixin.c
@@ -162,7 +162,7 @@ test (Fixture *f,
 {
   ExampleEcho2ConnectionManager *service_cm;
   TpBaseConnectionManager *service_cm_as_base;
-  TpDBusDaemon *dbus;
+  TpClientFactory *factory;
   TpConnectionManager *cm;
   TpConnection *conn;
   TpChannel *chan;
@@ -183,7 +183,8 @@ test (Fixture *f,
   test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
   g_test_dbus_up (test_dbus);
 
-  dbus = tp_tests_dbus_daemon_dup_or_die ();
+  factory = tp_client_factory_dup (&error);
+  g_assert_no_error (error);
 
   service_cm = EXAMPLE_ECHO_2_CONNECTION_MANAGER (
       tp_tests_object_new_static_class (
@@ -196,7 +197,8 @@ test (Fixture *f,
   ok = tp_base_connection_manager_register (service_cm_as_base);
   g_assert (ok);
 
-  cm = tp_connection_manager_new (dbus, "example_echo_2", NULL, &error);
+  cm = tp_client_factory_ensure_connection_manager (factory, "example_echo_2",
+      NULL, &error);
   g_assert (cm != NULL);
   tp_tests_proxy_run_until_prepared (cm, NULL);
 
@@ -210,7 +212,8 @@ test (Fixture *f,
 
   g_hash_table_unref (parameters);
 
-  conn = tp_tests_connection_new (dbus, name, conn_path, &error);
+  conn = tp_tests_connection_new (tp_client_factory_get_dbus_daemon (factory),
+      name, conn_path, &error);
   MYASSERT (conn != NULL, "");
   g_assert_no_error (error);
 
@@ -793,7 +796,7 @@ test (Fixture *f,
   g_object_unref (chan);
   g_object_unref (conn);
 
-  g_object_unref (dbus);
+  g_object_unref (factory);
   g_free (name);
   g_free (conn_path);
   g_free (chan_path);
diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c
index 68da80c..4e7f6a9 100644
--- a/tests/dbus/protocol-objects.c
+++ b/tests/dbus/protocol-objects.c
@@ -62,16 +62,16 @@ setup (Test *test,
   ok = tp_base_connection_manager_register (service_cm_as_base);
   g_assert (ok);
 
-  test->cm = tp_connection_manager_new (test->dbus, "example_echo_2",
-      NULL, &test->error);
+  test->cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "example_echo_2", NULL, &test->error);
   g_assert (test->cm != NULL);
   tp_tests_proxy_run_until_prepared (test->cm, NULL);
 
   ok = tp_base_connection_manager_register (service_cm_as_base);
   g_assert (ok);
 
-  test->file_cm = tp_connection_manager_new (test->dbus, "test_manager_file",
-      NULL, &test->error);
+  test->file_cm = tp_client_factory_ensure_connection_manager (test->factory,
+      "test_manager_file", NULL, &test->error);
   g_assert (test->file_cm != NULL);
   tp_tests_proxy_run_until_prepared (test->file_cm, NULL);
 }
@@ -623,18 +623,18 @@ test_factory (Test *test,
   GArray *arr;
 
   p1 = tp_client_factory_ensure_protocol (test->factory,
-      "example_echo_2", "example", NULL, NULL);
+      "example_echo_3", "example", NULL, NULL);
   g_assert (TP_IS_PROTOCOL (p1));
 
   p2 = tp_client_factory_ensure_protocol (test->factory,
-      "example_echo_2", "example", NULL, NULL);
+      "example_echo_3", "example", NULL, NULL);
   g_assert (p1 == p2);
 
   g_object_unref (p1);
   g_object_unref (p2);
 
   p3 = tp_client_factory_ensure_protocol (test->factory,
-      "example_echo_2", "example", NULL, NULL);
+      "example_echo_3", "example", NULL, NULL);
   g_assert (TP_IS_PROTOCOL (p3));
   /* the object has been removed from the cache */
   g_assert (p3 != p1);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib-1.git



More information about the Pkg-telepathy-commits mailing list