[next] telepathy-glib: allow parent to be NULL

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed May 9 13:10:50 PDT 2012


Module: telepathy-glib
Branch: next
Commit: adddf79bf94450f3b9a6bd797093df7d620d0feb
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=adddf79bf94450f3b9a6bd797093df7d620d0feb

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Apr 20 15:08:50 2012 +0200

allow parent to be NULL

Needed to be able to port the empathy-tls-test without adding mock objects.
tp_tls_certificate_new() still checks that a parent is passed so that
shouldn't affect 'normal' users of this API.

---

 telepathy-glib/tls-certificate.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/telepathy-glib/tls-certificate.c b/telepathy-glib/tls-certificate.c
index 2669250..eeb635c 100644
--- a/telepathy-glib/tls-certificate.c
+++ b/telepathy-glib/tls-certificate.c
@@ -277,20 +277,24 @@ tp_tls_certificate_constructed (GObject *object)
   if (constructed != NULL)
     constructed (object);
 
-  g_return_if_fail (TP_IS_CHANNEL (self->priv->parent) ||
+  g_return_if_fail (self->priv->parent == NULL ||
+      TP_IS_CHANNEL (self->priv->parent) ||
       TP_IS_CONNECTION (self->priv->parent));
 
-  if (self->priv->parent->invalidated != NULL)
+  if (self->priv->parent != NULL)
     {
-      GError *invalidated = self->priv->parent->invalidated;
+      if (self->priv->parent->invalidated != NULL)
+        {
+          GError *invalidated = self->priv->parent->invalidated;
 
-      parent_invalidated_cb (self->priv->parent, invalidated->domain,
-          invalidated->code, invalidated->message, self);
-    }
-  else
-    {
-      tp_g_signal_connect_object (self->priv->parent,
-          "invalidated", G_CALLBACK (parent_invalidated_cb), self, 0);
+          parent_invalidated_cb (self->priv->parent, invalidated->domain,
+              invalidated->code, invalidated->message, self);
+        }
+      else
+        {
+          tp_g_signal_connect_object (self->priv->parent,
+              "invalidated", G_CALLBACK (parent_invalidated_cb), self, 0);
+        }
     }
 
   tp_cli_authentication_tls_certificate_connect_to_accepted (self,



More information about the telepathy-commits mailing list