telepathy-glib: tp_simple/automatic_client_factory_new: allow NULL TpDBusDaemon

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed May 23 01:31:08 PDT 2012


Module: telepathy-glib
Branch: master
Commit: 947b96fd587d13f657077f7e3479fb135bf38858
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=947b96fd587d13f657077f7e3479fb135bf38858

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed May 16 13:15:12 2012 +0200

tp_simple/automatic_client_factory_new: allow NULL TpDBusDaemon

https://bugs.freedesktop.org/show_bug.cgi?id=49372

---

 telepathy-glib/automatic-client-factory.c |    5 +++--
 telepathy-glib/simple-client-factory.c    |    8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c
index b2cc10a..6620138 100644
--- a/telepathy-glib/automatic-client-factory.c
+++ b/telepathy-glib/automatic-client-factory.c
@@ -288,9 +288,10 @@ tp_automatic_client_factory_class_init (TpAutomaticClientFactoryClass *cls)
 
 /**
  * tp_automatic_client_factory_new:
- * @dbus: a #TpDBusDaemon
+ * @dbus: (allow-none): a #TpDBusDaemon, or %NULL
  *
- * Returns a new #TpAutomaticClientFactory instance.
+ * Returns a new #TpAutomaticClientFactory instance. If @dbus is %NULL,
+ * tp_dbus_daemon_dup() will be used.
  *
  * Returns: a new #TpAutomaticClientFactory
  *
diff --git a/telepathy-glib/simple-client-factory.c b/telepathy-glib/simple-client-factory.c
index 51b9221..7d00b75 100644
--- a/telepathy-glib/simple-client-factory.c
+++ b/telepathy-glib/simple-client-factory.c
@@ -312,7 +312,8 @@ tp_simple_client_factory_constructed (GObject *object)
 {
   TpSimpleClientFactory *self = (TpSimpleClientFactory *) object;
 
-  g_assert (TP_IS_DBUS_DAEMON (self->priv->dbus));
+  if (self->priv->dbus == NULL)
+    self->priv->dbus = tp_dbus_daemon_dup (NULL);
 
   G_OBJECT_CLASS (tp_simple_client_factory_parent_class)->constructed (object);
 }
@@ -398,9 +399,10 @@ tp_simple_client_factory_class_init (TpSimpleClientFactoryClass *klass)
 
 /**
  * tp_simple_client_factory_new:
- * @dbus: a #TpDBusDaemon
+ * @dbus: (allow-none): a #TpDBusDaemon, or %NULL
  *
- * Creates a new #TpSimpleClientFactory instance.
+ * Creates a new #TpSimpleClientFactory instance. If @dbus is %NULL,
+ * tp_dbus_daemon_dup() will be used.
  *
  * Returns: a new #TpSimpleClientFactory
  *



More information about the telepathy-commits mailing list