X-Git-Url: https://git.0d.be/?p=empathy.git;a=blobdiff_plain;f=libempathy%2Fempathy-individual-manager.c;h=55541b29955a7c9e997acd2bdaacf47346d0ef3f;hp=61f61f96d4d311624899ae51436e09ea54c65eae;hb=34e8fc1344c5433be1a9d8f8614cdb84933a84fb;hpb=f3e4307c1cfda8b363ac516e789a3b9668df23b3 diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 61f61f96..55541b29 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -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 * @@ -282,8 +283,12 @@ aggregator_add_persona_from_details_cb (GObject *source, g_clear_error (&error); } + /* Set the contact's persona */ + empathy_contact_set_persona (contact, persona); + /* We can unref the contact now */ g_object_unref (contact); + g_object_unref (persona); } void @@ -305,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)); @@ -321,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. @@ -341,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 @@ -349,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