diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-06 17:40:38 +0800 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-09 17:54:09 +0800 |
commit | 878faf8c3357c3b96a5dc49d53754382079bd470 (patch) | |
tree | cd9761f39db0bcf94e852cab876dbcefd06078aa | |
parent | da3e8203013b3cf8329fceedaf07c0827cb27114 (diff) | |
download | gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar.gz gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar.bz2 gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar.lz gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar.xz gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.tar.zst gsoc2013-empathy-878faf8c3357c3b96a5dc49d53754382079bd470.zip |
Fix capability change notification in the EmpathyIndividualStore
Closes: bgo#626162
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 2f530069c..64411f10b 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -740,7 +740,7 @@ individual_store_contact_update (EmpathyIndividualStore *self, } static void -individual_store_contact_updated_cb (FolksIndividual *individual, +individual_store_individual_updated_cb (FolksIndividual *individual, GParamSpec *param, EmpathyIndividualStore *self) { @@ -751,19 +751,44 @@ individual_store_contact_updated_cb (FolksIndividual *individual, } static void +individual_store_contact_updated_cb (EmpathyContact *contact, + GParamSpec *pspec, + EmpathyIndividualStore *self) +{ + FolksIndividual *individual; + + DEBUG ("Contact '%s' updated, checking roster is in sync...", + empathy_contact_get_alias (contact)); + + individual = g_object_get_data (G_OBJECT (contact), "individual"); + if (individual == NULL) + return; + + individual_store_contact_update (self, individual); +} + +static void individual_store_add_individual_and_connect (EmpathyIndividualStore *self, FolksIndividual *individual) { + EmpathyContact *contact; + g_signal_connect (individual, "notify::avatar", - G_CALLBACK (individual_store_contact_updated_cb), self); + G_CALLBACK (individual_store_individual_updated_cb), self); g_signal_connect (individual, "notify::presence-type", - G_CALLBACK (individual_store_contact_updated_cb), self); + G_CALLBACK (individual_store_individual_updated_cb), self); g_signal_connect (individual, "notify::presence-message", - G_CALLBACK (individual_store_contact_updated_cb), self); + G_CALLBACK (individual_store_individual_updated_cb), self); g_signal_connect (individual, "notify::alias", + G_CALLBACK (individual_store_individual_updated_cb), self); + + /* FIXME: libfolks hasn't grown capabilities support yet, so we have to go + * through the EmpathyContact for them. */ + contact = empathy_contact_dup_from_folks_individual (individual); + g_object_set_data (G_OBJECT (contact), "individual", individual); + g_signal_connect (contact, "notify::capabilities", G_CALLBACK (individual_store_contact_updated_cb), self); - g_signal_connect (individual, "notify::capabilities", - G_CALLBACK (individual_store_contact_updated_cb), self); + g_object_unref (contact); individual_store_add_individual (self, individual); } @@ -774,6 +799,8 @@ individual_store_remove_individual_and_disconnect ( FolksIndividual *individual) { g_signal_handlers_disconnect_by_func (individual, + G_CALLBACK (individual_store_individual_updated_cb), self); + g_signal_handlers_disconnect_by_func (individual, G_CALLBACK (individual_store_contact_updated_cb), self); individual_store_remove_individual (self, individual); @@ -934,6 +961,8 @@ individual_store_dispose (GObject *object) for (l = contacts; l; l = l->next) { g_signal_handlers_disconnect_by_func (l->data, + G_CALLBACK (individual_store_individual_updated_cb), object); + g_signal_handlers_disconnect_by_func (l->data, G_CALLBACK (individual_store_contact_updated_cb), object); } g_list_free (contacts); |