[empathy] individual-store: use Folks directly to watch is-favourite changes
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] individual-store: use Folks directly to watch is-favourite changes
- Date: Tue, 6 Sep 2011 16:37:45 +0000 (UTC)
commit 905dec95625ac420b3fc2914b5d365a89e5b70f8
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Sep 6 18:18:05 2011 +0200
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.
libempathy-gtk/empathy-individual-store.c | 38 +++++++++++++---------------
1 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index d21a9d5..d80d292 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]