diff options
author | Laurent Contzen <lcontzen@gmail.com> | 2012-08-04 18:30:08 +0800 |
---|---|---|
committer | Laurent Contzen <lcontzen@gmail.com> | 2012-08-06 17:02:18 +0800 |
commit | 93da7465f929f0cb950adb76e7b645f5ff23f1ad (patch) | |
tree | e7cfded0d5e989ff40d1e29d84b31c259b2fe81c /libempathy-gtk | |
parent | e0542a641adc30e04255b1eb561bbcd6e0b17da2 (diff) | |
download | gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar.gz gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar.bz2 gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar.lz gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar.xz gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.tar.zst gsoc2013-empathy-93da7465f929f0cb950adb76e7b645f5ff23f1ad.zip |
Added new function _get_top_individuals in the model
empathy-roster-model: new function _get_top_individuals
empathy-roster-model-manager: implemented _get_top_individuals
empathy-roster-view: uses the roster-model's _get_top_individuals instead of the individual-manager's
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-roster-model-manager.c | 9 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-model.c | 21 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-model.h | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-view.c | 7 |
4 files changed, 36 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-roster-model-manager.c b/libempathy-gtk/empathy-roster-model-manager.c index c0549d80a..be41aceca 100644 --- a/libempathy-gtk/empathy-roster-model-manager.c +++ b/libempathy-gtk/empathy-roster-model-manager.c @@ -271,10 +271,19 @@ empathy_roster_model_manager_get_groups_for_individual (EmpathyRosterModel *mode return groups_list; } +static GList * +empathy_roster_model_manager_get_top_individuals (EmpathyRosterModel *model) +{ + EmpathyRosterModelManager *self = EMPATHY_ROSTER_MODEL_MANAGER (model); + + return empathy_individual_manager_get_top_individuals (self->priv->manager); +} + static void roster_model_iface_init (EmpathyRosterModelInterface *iface) { iface->get_individuals = empathy_roster_model_manager_get_individuals; iface->get_groups_for_individual = empathy_roster_model_manager_get_groups_for_individual; + iface->get_top_individuals = empathy_roster_model_manager_get_top_individuals; } diff --git a/libempathy-gtk/empathy-roster-model.c b/libempathy-gtk/empathy-roster-model.c index 80a82bf1d..37ca594fe 100644 --- a/libempathy-gtk/empathy-roster-model.c +++ b/libempathy-gtk/empathy-roster-model.c @@ -134,3 +134,24 @@ empathy_roster_model_get_groups_for_individual (EmpathyRosterModel *self, return (* iface->get_groups_for_individual) (self, individual); } + +/** + * empathy_roster_model_get_top_individuals: + * @self: a #EmpathyRosterModel + * + * Returns a list of the top_individuals. + * + * Return value: (transfer none): a #GList of #FolksIndividual + */ +GList * +empathy_roster_model_get_top_individuals (EmpathyRosterModel *self) +{ + EmpathyRosterModelInterface *iface; + + g_return_val_if_fail (EMPATHY_IS_ROSTER_MODEL (self), NULL); + + iface = EMPATHY_ROSTER_MODEL_GET_IFACE (self); + g_return_val_if_fail (iface->get_top_individuals != NULL, NULL); + + return (* iface->get_top_individuals) (self); +} diff --git a/libempathy-gtk/empathy-roster-model.h b/libempathy-gtk/empathy-roster-model.h index 9d6000893..860efd77f 100644 --- a/libempathy-gtk/empathy-roster-model.h +++ b/libempathy-gtk/empathy-roster-model.h @@ -38,6 +38,7 @@ struct _EmpathyRosterModelInterface GList * (* get_individuals) (EmpathyRosterModel *self); GList * (*get_groups_for_individual) (EmpathyRosterModel *self, FolksIndividual *individual); + GList * (*get_top_individuals) (EmpathyRosterModel *self); }; GType empathy_roster_model_get_type (void); @@ -76,6 +77,8 @@ GList * empathy_roster_model_get_individuals (EmpathyRosterModel *self); GList * empathy_roster_model_get_groups_for_individual (EmpathyRosterModel *self, FolksIndividual *individual); +GList * empathy_roster_model_get_top_individuals (EmpathyRosterModel *self); + G_END_DECLS #endif /* #ifndef __EMPATHY_ROSTER_MODEL_H__*/ diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index 3fc664c5f..0b50b0d39 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -316,8 +316,7 @@ individual_added (EmpathyRosterView *self, GList *groups, *l; GList *tops; - tops = empathy_individual_manager_get_top_individuals ( - self->priv->manager); + tops = empathy_roster_model_get_top_individuals (self->priv->model); if (folks_favourite_details_get_is_favourite ( FOLKS_FAVOURITE_DETAILS (individual)) || @@ -544,7 +543,7 @@ contact_in_top (EmpathyRosterView *self, individual = empathy_roster_contact_get_individual (contact); - tops = empathy_individual_manager_get_top_individuals (self->priv->manager); + tops = empathy_roster_model_get_top_individuals (self->priv->model); if (g_list_index (tops, individual) != -1) return TRUE; @@ -959,7 +958,7 @@ update_top_contacts (EmpathyRosterView *self) return; } - tops = empathy_individual_manager_get_top_individuals (self->priv->manager); + tops = empathy_roster_model_get_top_individuals (self->priv->model); group = g_hash_table_lookup (self->priv->roster_groups, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); |