aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-07 00:18:05 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-07 00:37:35 +0800
commit905dec95625ac420b3fc2914b5d365a89e5b70f8 (patch)
tree297fa254ea3a74f3d8b007932adc79ec66812d55 /libempathy-gtk
parentbb6e00b22a1c7ee318e701d3780338d13be7e9e5 (diff)
downloadgsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar.gz
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar.bz2
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar.lz
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar.xz
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.tar.zst
gsoc2013-empathy-905dec95625ac420b3fc2914b5d365a89e5b70f8.zip
individual-store: use Folks directly to watch is-favourite changes
We already use it to check if a contact is in favourite or not. The contact manager should probably be killed at some point any way.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-store.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index d21a9d50b..d80d292d0 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -954,6 +954,20 @@ individual_personas_changed_cb (FolksIndividual *individual,
g_clear_object (&iter);
}
+static void
+individual_store_favourites_changed_cb (FolksIndividual *individual,
+ GParamSpec *param,
+ EmpathyIndividualStore *self)
+{
+ DEBUG ("Individual %s is %s a favourite",
+ folks_individual_get_id (individual),
+ folks_favourite_details_get_is_favourite (
+ FOLKS_FAVOURITE_DETAILS (individual)) ? "now" : "no longer");
+
+ individual_store_remove_individual (self, individual);
+ individual_store_add_individual (self, individual);
+}
+
void
individual_store_add_individual_and_connect (EmpathyIndividualStore *self,
FolksIndividual *individual)
@@ -972,6 +986,8 @@ individual_store_add_individual_and_connect (EmpathyIndividualStore *self,
(GCallback) individual_store_individual_updated_cb, self);
g_signal_connect (individual, "personas-changed",
(GCallback) individual_personas_changed_cb, self);
+ g_signal_connect (individual, "notify::is-favourite",
+ (GCallback) individual_store_favourites_changed_cb, self);
/* provide an empty set so the callback can assume non-NULL sets */
individual_personas_changed_cb (individual,
@@ -994,6 +1010,8 @@ individual_store_disconnect_individual (EmpathyIndividualStore *self,
(GCallback) individual_store_individual_updated_cb, self);
g_signal_handlers_disconnect_by_func (individual,
(GCallback) individual_personas_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (individual,
+ (GCallback) individual_store_favourites_changed_cb, self);
}
void
@@ -1031,20 +1049,6 @@ individual_store_members_changed_cb (EmpathyIndividualManager *manager,
}
static void
-individual_store_favourites_changed_cb (EmpathyIndividualManager *manager,
- FolksIndividual *individual,
- gboolean is_favourite,
- EmpathyIndividualStore *self)
-{
- DEBUG ("Individual %s is %s a favourite",
- folks_individual_get_id (individual),
- is_favourite ? "now" : "no longer");
-
- individual_store_remove_individual (self, individual);
- individual_store_add_individual (self, individual);
-}
-
-static void
individual_store_groups_changed_cb (EmpathyIndividualManager *manager,
FolksIndividual *individual,
gchar *group,
@@ -1087,10 +1091,6 @@ individual_store_manager_setup (gpointer user_data)
G_CALLBACK (individual_store_members_changed_cb), self);
g_signal_connect (priv->manager,
- "favourites-changed",
- G_CALLBACK (individual_store_favourites_changed_cb), self);
-
- g_signal_connect (priv->manager,
"groups-changed",
G_CALLBACK (individual_store_groups_changed_cb), self);
@@ -1169,8 +1169,6 @@ individual_store_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (priv->manager,
G_CALLBACK (individual_store_members_changed_cb), object);
g_signal_handlers_disconnect_by_func (priv->manager,
- G_CALLBACK (individual_store_favourites_changed_cb), object);
- g_signal_handlers_disconnect_by_func (priv->manager,
G_CALLBACK (individual_store_groups_changed_cb), object);
g_object_unref (priv->manager);