Commit 315a7132 authored by Philip Withnall's avatar Philip Withnall Committed by Travis Reitter

Use the new FolksFavourite interface for favourites support

parent e53b7431
......@@ -516,10 +516,8 @@ favourite_menu_item_toggled_cb (GtkCheckMenuItem *item,
manager = empathy_individual_manager_dup_singleton ();
list = EMPATHY_INDIVIDUAL_MANAGER (manager);
if (gtk_check_menu_item_get_active (item))
empathy_individual_manager_add_to_favourites (list, individual);
else
empathy_individual_manager_remove_from_favourites (list, individual);
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual),
gtk_check_menu_item_get_active (item));
g_object_unref (manager);
}
......@@ -534,8 +532,7 @@ empathy_individual_favourite_menu_item_new (FolksIndividual *individual)
manager = empathy_individual_manager_dup_singleton ();
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
empathy_individual_manager_is_favourite (
EMPATHY_INDIVIDUAL_MANAGER (manager), individual));
folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)));
g_signal_connect (item, "toggled",
G_CALLBACK (favourite_menu_item_toggled_cb), individual);
......
......@@ -412,9 +412,8 @@ individual_store_add_individual (EmpathyIndividualStore *self,
if (group_set != NULL)
g_hash_table_unref (group_set);
#ifdef HAVE_FAVOURITE_CONTACTS
if (priv->show_groups &&
empathy_individual_manager_is_favourite (priv->manager, individual))
folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)))
{
/* Add contact to the fake 'Favorites' group */
GtkTreeIter iter_group;
......@@ -425,7 +424,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
add_individual_to_store (GTK_TREE_STORE (self), &iter, &iter_group,
individual, flags);
}
#endif
individual_store_contact_update (self, individual);
}
......
......@@ -345,6 +345,7 @@ individual_view_handle_drag (EmpathyIndividualView *self,
if (!tp_strdiff (new_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Mark contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
/* TODO: implement this */
DEBUG ("adding individual to favourites not fully implemented");
......@@ -355,6 +356,7 @@ individual_view_handle_drag (EmpathyIndividualView *self,
if (!tp_strdiff (old_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Remove contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), FALSE);
/* TODO: implement this */
DEBUG ("removing individual from favourites not fully " "implemented");
......
......@@ -48,10 +48,6 @@ typedef struct
FolksIndividualAggregator *aggregator;
EmpathyContactManager *contact_manager;
TpProxy *logger;
/* account object path (gchar *) => GHashTable containing favorite contacts
* (contact ID (gchar *) => TRUE) */
GHashTable *favourites;
TpProxySignalConnection *favourite_contacts_changed_signal;
} EmpathyIndividualManagerPriv;
G_DEFINE_TYPE (EmpathyIndividualManager, empathy_individual_manager,
......@@ -112,9 +108,6 @@ individual_manager_finalize (GObject *object)
{
EmpathyIndividualManagerPriv *priv = GET_PRIV (object);
tp_proxy_signal_connection_disconnect (
priv->favourite_contacts_changed_signal);
if (priv->logger != NULL)
g_object_unref (priv->logger);
......@@ -123,8 +116,6 @@ individual_manager_finalize (GObject *object)
if (priv->aggregator != NULL)
g_object_unref (priv->aggregator);
g_hash_table_destroy (priv->favourites);
}
static GObject *
......@@ -208,22 +199,11 @@ empathy_individual_manager_init (EmpathyIndividualManager *self)
self->priv = priv;
priv->contact_manager = empathy_contact_manager_dup_singleton ();
priv->favourites = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) g_hash_table_unref);
priv->aggregator = folks_individual_aggregator_new ();
if (error == NULL)
{
g_signal_connect (priv->aggregator, "individuals-added",
G_CALLBACK (aggregator_individuals_added_cb), self);
g_signal_connect (priv->aggregator, "individuals-removed",
G_CALLBACK (aggregator_individuals_removed_cb), self);
}
else
{
DEBUG ("Failed to get individual aggregator: %s", error->message);
g_clear_error (&error);
}
g_signal_connect (priv->aggregator, "individuals-added",
G_CALLBACK (aggregator_individuals_added_cb), self);
g_signal_connect (priv->aggregator, "individuals-removed",
G_CALLBACK (aggregator_individuals_removed_cb), self);
bus = tp_dbus_daemon_dup (&error);
......
......@@ -75,10 +75,6 @@ void empathy_individual_manager_remove (EmpathyIndividualManager *manager,
FolksIndividual *individual,
const gchar *message);
gboolean empathy_individual_manager_is_favourite (
EmpathyIndividualManager *manager,
FolksIndividual *individual);
EmpathyIndividualManagerFlags
empathy_individual_manager_get_flags_for_connection (
EmpathyIndividualManager *manager,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment