Merge commit 'sjoerd/master'
authorXavier Claessens <xclaesse@src.gnome.org>
Fri, 15 Feb 2008 21:29:18 +0000 (21:29 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 15 Feb 2008 21:29:18 +0000 (21:29 +0000)
svn path=/trunk/; revision=635

libempathy/empathy-tp-call.c
libempathy/empathy-utils.c

index c9da17491930bbb2b3c4ce6545aeecbf0daa3719..b72e3877e3cc9de5d46b862e5d47d2e016eef338 100644 (file)
@@ -542,6 +542,13 @@ tp_call_finalize (GObject *object)
   g_slice_free (EmpathyTpCallStream, priv->audio);
   g_slice_free (EmpathyTpCallStream, priv->video);
   g_object_unref (priv->group);
+
+  if (priv->connection != NULL)
+    g_object_unref (priv->connection);
+
+  if (priv->channel != NULL)
+    g_object_unref (priv->channel);
+
   if (priv->contact)
     {
       g_object_unref (priv->contact);
@@ -561,13 +568,15 @@ tp_call_set_property (GObject *object,
   switch (prop_id)
     {
     case PROP_CONNECTION:
-      priv->connection = g_value_get_object (value);
+      priv->connection = g_value_dup_object (value);
       break;
     case PROP_CHANNEL:
-      priv->channel = g_value_get_object (value);
+      priv->channel = g_value_dup_object (value);
       break;
     case PROP_CONTACT:
-      priv->contact = g_value_get_object (value);
+      /* FIXME should this one be writable in the first place ? */
+      g_assert (priv->contact == NULL);
+      priv->contact = g_value_dup_object (value);
       break;
     case PROP_IS_INCOMING:
       priv->is_incoming = g_value_get_boolean (value);
@@ -653,12 +662,12 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass)
   g_object_class_install_property (object_class, PROP_CONNECTION,
       g_param_spec_object ("connection", "connection", "connection",
       TELEPATHY_CONN_TYPE,
-      G_PARAM_CONSTRUCT | G_PARAM_READWRITE |
+      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
   g_object_class_install_property (object_class, PROP_CHANNEL,
       g_param_spec_object ("channel", "channel", "channel",
       TELEPATHY_CHAN_TYPE,
-      G_PARAM_CONSTRUCT | G_PARAM_READWRITE |
+      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
   g_object_class_install_property (object_class, PROP_CONTACT,
       g_param_spec_object ("contact", "Call contact", "Call contact",
index 070e45a0e057db052301856dc738d60f94e1f6c5..7548c58fbf4fe774a9e796221d91bdad53c1128c 100644 (file)
@@ -463,6 +463,28 @@ empathy_call_with_contact (EmpathyContact *contact)
 #endif
 }
 
+#ifdef HAVE_VOIP
+struct empathy_call_cb_user_data {
+       guint handler;
+       GObject *factory;
+};
+
+static void
+empathy_call_with_contact_id_got_handle_cb (EmpathyContact *contact, 
+  GParamSpec *property, gpointer user_data) {
+
+       struct empathy_call_cb_user_data *ud =
+               (struct empathy_call_cb_user_data *) user_data;
+
+       g_signal_handler_disconnect (contact, ud->handler);
+
+       empathy_call_with_contact (contact);
+       g_object_unref (ud->factory);
+       g_object_unref (contact);
+       g_free (ud);
+}
+#endif
+
 void
 empathy_call_with_contact_id (McAccount *account, const gchar *contact_id)
 {
@@ -472,9 +494,19 @@ empathy_call_with_contact_id (McAccount *account, const gchar *contact_id)
 
        factory = empathy_contact_factory_new ();
        contact = empathy_contact_factory_get_from_id (factory, account, contact_id);
-       empathy_call_with_contact (contact);
-       g_object_unref (contact);
-       g_object_unref (factory);
+
+       if (empathy_contact_get_handle (contact) != 0) {
+               empathy_call_with_contact (contact);
+               g_object_unref (contact);
+               g_object_unref (factory);
+       } else {
+               struct empathy_call_cb_user_data *ud;
+               ud = g_malloc0 (sizeof (struct empathy_call_cb_user_data));
+               ud->factory = G_OBJECT (factory);
+               ud->handler = g_signal_connect (G_OBJECT (contact), "notify::handle",
+                       G_CALLBACK (empathy_call_with_contact_id_got_handle_cb), ud);
+       }
+
 #endif
 }