diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-04-24 15:40:02 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-04-25 18:11:14 +0200 |
commit | 7a02e2b63cbccb70a8667289fcff24c708a906ad (patch) | |
tree | c4f6d1c2cac6ab358f29bb034d72998fc6d1bebe | |
parent | 24a7ed8b81be027709bd3708d123a5a93f89d6a0 (diff) |
TpClientFactory: use tp_dbus_daemon_dup() if dbus is NULL
-rw-r--r-- | telepathy-glib/automatic-client-factory.c | 7 | ||||
-rw-r--r-- | 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 f776f1c8c..a41fc51b6 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 06fd7de47..cdea7f253 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); |