]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-file.c
tp-file: implement getter/setter for the ready property
[empathy.git] / libempathy / empathy-tp-file.c
index bcd35a257e1e786346edf3b4c1d8d9fa8ca99466..41f319b314270acd2a23aa40f5c682789fe98d78 100644 (file)
@@ -508,13 +508,21 @@ tp_file_check_if_ready (EmpathyTpFile *tp_file)
 
 static void
 tp_file_got_contact_cb (EmpathyTpContactFactory *factory,
-                        GList *contacts,
+                        EmpathyContact *contact,
+                        const GError *error,
                         gpointer user_data,
                         GObject *weak_object)
 {
   EmpathyTpFile *tp_file = EMPATHY_TP_FILE (weak_object);
 
-  tp_file->priv->contact = g_object_ref (contacts->data);
+  if (error)
+    {
+      DEBUG ("Error: %s", error->message);
+      empathy_tp_file_close (tp_file);
+      return;
+    }
+
+  tp_file->priv->contact = g_object_ref (contact);
   tp_file_check_if_ready (tp_file);
 }
 
@@ -633,8 +641,8 @@ tp_file_constructor (GType type,
       tp_file_get_all_cb, NULL, NULL, file_obj);
 
   handle = tp_channel_get_handle (tp_file->priv->channel, NULL);
-  empathy_tp_contact_factory_get_from_handles (tp_file->priv->factory,
-      1, &handle, tp_file_got_contact_cb, NULL, NULL, file_obj);
+  empathy_tp_contact_factory_get_from_handle (tp_file->priv->factory,
+      handle, tp_file_got_contact_cb, NULL, NULL, file_obj);
 
   return file_obj;
 }
@@ -678,6 +686,9 @@ tp_file_get_property (GObject *object,
       case PROP_TRANSFERRED_BYTES:
         g_value_set_uint64 (value, tp_file->priv->transferred_bytes);
         break;
+      case PROP_READY:
+        g_value_set_boolean (value, tp_file->priv->ready);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
         break;
@@ -736,6 +747,9 @@ tp_file_set_property (GObject *object,
         g_free (tp_file->priv->content_hash);
         tp_file->priv->content_hash = g_value_dup_string (value);
         break;
+      case PROP_READY:
+        tp_file->priv->ready = g_value_get_boolean (value);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
         break;