-update_top_contacts (EmpathyRosterView *self)
-{
- GList *tops, *l;
- GList *to_add = NULL, *to_remove = NULL;
- EmpathyRosterGroup *group;
-
- if (!self->priv->show_groups)
- {
- egg_list_box_resort (EGG_LIST_BOX (self));
- return;
- }
-
- tops = empathy_individual_manager_get_top_individuals (self->priv->manager);
-
- group = g_hash_table_lookup (self->priv->roster_groups,
- EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP);
- if (group == NULL)
- {
- to_add = g_list_copy (tops);
- }
- else
- {
- GList *contacts;
-
- contacts = empathy_roster_group_get_widgets (group);
-
- /* Check which EmpathyRosterContact have to be removed */
- for (l = contacts; l != NULL; l = g_list_next (l))
- {
- EmpathyRosterContact *contact = l->data;
- FolksIndividual *individual;
-
- if (contact_is_favourite (contact))
- continue;
-
- individual = empathy_roster_contact_get_individual (contact);
-
- if (g_list_find (tops, individual) == NULL)
- to_remove = g_list_prepend (to_remove, individual);
- }
-
- /* Check which EmpathyRosterContact have to be added */
- for (l = tops; l != NULL; l = g_list_next (l))
- {
- FolksIndividual *individual = l->data;
-
- if (!individual_in_list (individual, contacts))
- to_add = g_list_prepend (to_add, individual);
- }
- }
-
- for (l = to_add; l != NULL; l = g_list_next (l))
- add_to_group (self, l->data, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP);
-
- for (l = to_remove; l != NULL; l = g_list_next (l))
- remove_from_group (self, l->data, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP);
-
- g_list_free (to_add);
- g_list_free (to_remove);
-}
-
-static void
-groups_changed_cb (EmpathyIndividualManager *manager,