[empathy] Finish adding favourites support
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Finish adding favourites support
- Date: Tue, 20 Jul 2010 23:21:36 +0000 (UTC)
commit 0dea2287893dc5cf657bb48c2707e30139118cb4
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Jun 25 13:48:43 2010 +0100
Finish adding favourites support
libempathy-gtk/empathy-individual-store.c | 41 +++++++++++++++--------------
libempathy-gtk/empathy-individual-view.c | 7 -----
libempathy/empathy-individual-manager.c | 22 +++++++++++++++
3 files changed, 43 insertions(+), 27 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index a1a07a3..95f236a 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -794,6 +794,24 @@ individual_store_members_changed_cb (EmpathyIndividualManager *manager,
}
static void
+individual_store_favourites_changed_cb (EmpathyIndividualManager *manager,
+ FolksIndividual *individual,
+ gboolean is_favourite,
+ EmpathyIndividualStore *self)
+{
+ EmpathyIndividualStorePriv *priv;
+
+ priv = GET_PRIV (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,
@@ -835,8 +853,9 @@ individual_store_manager_setup (gpointer user_data)
"members-changed",
G_CALLBACK (individual_store_members_changed_cb), self);
- /* TODO: implement */
- DEBUG ("handling individual favourite status changes unimplemented");
+ g_signal_connect (priv->manager,
+ "favourites-changed",
+ G_CALLBACK (individual_store_favourites_changed_cb), self);
g_signal_connect (priv->manager,
"groups-changed",
@@ -891,24 +910,6 @@ individual_store_member_renamed_cb (EmpathyIndividualManager *manager,
}
static void
-individual_store_favourites_changed_cb (EmpathyIndividualManager *manager,
- FolksIndividual *individual,
- gboolean is_favourite,
- EmpathyIndividualStore *self)
-{
- EmpathyIndividualStorePriv *priv;
-
- priv = GET_PRIV (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_dispose (GObject *object)
{
EmpathyIndividualStorePriv *priv = GET_PRIV (object);
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 067fb60..2185909 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -346,10 +346,6 @@ individual_view_handle_drag (EmpathyIndividualView *self,
{
/* Mark contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
-
- /* TODO: implement this */
- DEBUG ("adding individual to favourites not fully implemented");
-
return;
}
@@ -358,9 +354,6 @@ individual_view_handle_drag (EmpathyIndividualView *self,
/* Remove contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), FALSE);
- /* TODO: implement this */
- DEBUG ("removing individual from favourites not fully " "implemented");
-
/* Don't try to remove it */
old_group = NULL;
}
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index 53843ce..f162ba3 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -66,6 +66,16 @@ individual_group_changed_cb (FolksIndividual *individual,
}
static void
+individual_notify_is_favourite_cb (FolksIndividual *individual,
+ GParamSpec *pspec,
+ EmpathyIndividualManager *self)
+{
+ gboolean is_favourite = folks_favourite_get_is_favourite (
+ FOLKS_FAVOURITE (individual));
+ g_signal_emit_by_name (self, "favourites-changed", individual, is_favourite);
+}
+
+static void
aggregator_individuals_added_cb (FolksIndividualAggregator *aggregator,
GList *individuals,
EmpathyIndividualManager *self)
@@ -76,6 +86,8 @@ aggregator_individuals_added_cb (FolksIndividualAggregator *aggregator,
{
g_signal_connect (l->data, "group-changed",
G_CALLBACK (individual_group_changed_cb), self);
+ g_signal_connect (l->data, "notify::is-favourite",
+ G_CALLBACK (individual_notify_is_favourite_cb), self);
}
/* TODO: don't hard-code the reason or message */
@@ -95,6 +107,8 @@ aggregator_individuals_removed_cb (FolksIndividualAggregator *aggregator,
{
g_signal_handlers_disconnect_by_func (l->data,
individual_group_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (l->data,
+ individual_notify_is_favourite_cb, self);
}
/* TODO: don't hard-code the reason or message */
@@ -175,6 +189,14 @@ empathy_individual_manager_class_init (EmpathyIndividualManagerClass *klass)
_empathy_marshal_VOID__OBJECT_STRING_BOOLEAN,
G_TYPE_NONE, 3, FOLKS_TYPE_INDIVIDUAL, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ g_signal_new ("favourites-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_BOOLEAN,
+ G_TYPE_NONE, 2, FOLKS_TYPE_INDIVIDUAL, G_TYPE_BOOLEAN);
+
g_signal_new ("members-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]