[next] telepathy-glib: TpClientFactory: use tp_dbus_daemon_dup() if dbus is NULL
Xavier Claessens
xclaesse at kemper.freedesktop.org
Wed Apr 25 09:12:06 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 7a02e2b63cbccb70a8667289fcff24c708a906ad
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=7a02e2b63cbccb70a8667289fcff24c708a906ad
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Tue Apr 24 15:40:02 2012 +0200
TpClientFactory: use tp_dbus_daemon_dup() if dbus is NULL
---
telepathy-glib/automatic-client-factory.c | 7 +++++--
telepathy-glib/client-factory.c | 10 +++++++---
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c
index f776f1c..a41fc51 100644
--- a/telepathy-glib/automatic-client-factory.c
+++ b/telepathy-glib/automatic-client-factory.c
@@ -269,9 +269,10 @@ tp_automatic_client_factory_class_init (TpAutomaticClientFactoryClass *klass)
/**
* tp_automatic_client_factory_new:
- * @dbus: a #TpDBusDaemon
+ * @dbus: a #TpDBusDaemon, or %NULL
*
- * Returns a new #TpAutomaticClientFactory instance.
+ * Returns a new #TpAutomaticClientFactory instance. If @dbus is %NULL then
+ * tp_dbus_daemon_dup() will be used.
*
* Returns: a new #TpAutomaticClientFactory
*
@@ -280,6 +281,8 @@ tp_automatic_client_factory_class_init (TpAutomaticClientFactoryClass *klass)
TpClientFactory *
tp_automatic_client_factory_new (TpDBusDaemon *dbus)
{
+ g_return_val_if_fail (dbus == NULL || TP_IS_DBUS_DAEMON (dbus), NULL);
+
return g_object_new (TP_TYPE_AUTOMATIC_CLIENT_FACTORY,
"dbus-daemon", dbus,
NULL);
diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c
index 06fd7de..cdea7f2 100644
--- a/telepathy-glib/client-factory.c
+++ b/telepathy-glib/client-factory.c
@@ -306,7 +306,8 @@ tp_client_factory_constructed (GObject *object)
{
TpClientFactory *self = (TpClientFactory *) 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_client_factory_parent_class)->constructed (object);
}
@@ -392,9 +393,10 @@ tp_client_factory_class_init (TpClientFactoryClass *klass)
/**
* tp_client_factory_new:
- * @dbus: a #TpDBusDaemon
+ * @dbus: a #TpDBusDaemon, or %NULL
*
- * Creates a new #TpClientFactory instance.
+ * Creates a new #TpClientFactory instance. If @dbus is %NULL then
+ * tp_dbus_daemon_dup() will be used.
*
* Returns: a new #TpClientFactory
*
@@ -403,6 +405,8 @@ tp_client_factory_class_init (TpClientFactoryClass *klass)
TpClientFactory *
tp_client_factory_new (TpDBusDaemon *dbus)
{
+ g_return_val_if_fail (dbus == NULL || TP_IS_DBUS_DAEMON (dbus), NULL);
+
return g_object_new (TP_TYPE_CLIENT_FACTORY,
"dbus-daemon", dbus,
NULL);
More information about the telepathy-commits
mailing list