]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-individual-manager.c
Merge branch 'folks-async-and-prepare'
[empathy.git] / libempathy / empathy-individual-manager.c
index 9eeb5d3c801e357c2974fb983d4175aaa26ad08c..55541b29955a7c9e997acd2bdaacf47346d0ef3f 100644 (file)
@@ -228,6 +228,7 @@ empathy_individual_manager_init (EmpathyIndividualManager *self)
   priv->aggregator = folks_individual_aggregator_new ();
   g_signal_connect (priv->aggregator, "individuals-changed",
       G_CALLBACK (aggregator_individuals_changed_cb), self);
+  folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
 }
 
 EmpathyIndividualManager *
@@ -309,7 +310,7 @@ empathy_individual_manager_add_from_contact (EmpathyIndividualManager *self,
   g_object_ref (contact);
 
   DEBUG ("adding individual from contact %s (%s)",
-      empathy_contact_get_id (contact), empathy_contact_get_name (contact));
+      empathy_contact_get_id (contact), empathy_contact_get_alias (contact));
 
   account = empathy_contact_get_account (contact);
   store_id = tp_proxy_get_object_path (TP_PROXY (account));
@@ -325,6 +326,23 @@ empathy_individual_manager_add_from_contact (EmpathyIndividualManager *self,
   g_hash_table_destroy (details);
 }
 
+static void
+aggregator_remove_individual_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  FolksIndividualAggregator *aggregator = FOLKS_INDIVIDUAL_AGGREGATOR (source);
+  GError *error = NULL;
+
+  folks_individual_aggregator_remove_individual_finish (
+      aggregator, result, &error);
+  if (error != NULL)
+    {
+      g_warning ("failed to remove individual: %s", error->message);
+      g_clear_error (&error);
+    }
+}
+
 /**
  * Removes the inner contact from the server (and thus the Individual). Not
  * meant for de-shelling inner personas from an Individual.
@@ -345,7 +363,24 @@ empathy_individual_manager_remove (EmpathyIndividualManager *self,
       folks_individual_get_id (individual),
       folks_individual_get_alias (individual));
 
-  folks_individual_aggregator_remove_individual (priv->aggregator, individual);
+  folks_individual_aggregator_remove_individual (priv->aggregator, individual,
+      aggregator_remove_individual_cb, self);
+}
+
+static void
+groups_change_group_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  FolksGroups *groups = FOLKS_GROUPS (source);
+  GError *error = NULL;
+
+  folks_groups_change_group_finish (groups, result, &error);
+  if (error != NULL)
+    {
+      g_warning ("failed to change group: %s", error->message);
+      g_clear_error (&error);
+    }
 }
 
 static void
@@ -353,7 +388,8 @@ remove_group_cb (const gchar *id,
     FolksIndividual *individual,
     const gchar *group)
 {
-  folks_groups_change_group (FOLKS_GROUPS (individual), group, FALSE);
+  folks_groups_change_group (FOLKS_GROUPS (individual), group, FALSE,
+      groups_change_group_cb, NULL);
 }
 
 void