diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-10-02 16:44:17 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-10-02 19:58:38 +0800 |
commit | 33b5753dab14d6f387fdb0346aac5c0998489477 (patch) | |
tree | f89ebe7b8b7fcb5069f1a20d3a67b8c7cd02b807 /libempathy-gtk/empathy-roster-model-manager.c | |
parent | 06dd24d2acae7b49fd72869fd265eb1144a32dc0 (diff) | |
download | gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar.gz gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar.bz2 gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar.lz gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar.xz gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.tar.zst gsoc2013-empathy-33b5753dab14d6f387fdb0346aac5c0998489477.zip |
roster-model-manager: factor out {add_to,remove_from}_top_group_members()
https://bugzilla.gnome.org/show_bug.cgi?id=685203
Diffstat (limited to 'libempathy-gtk/empathy-roster-model-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-roster-model-manager.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-roster-model-manager.c b/libempathy-gtk/empathy-roster-model-manager.c index 896923fbb..bd3eeeb00 100644 --- a/libempathy-gtk/empathy-roster-model-manager.c +++ b/libempathy-gtk/empathy-roster-model-manager.c @@ -102,6 +102,22 @@ individual_should_be_in_top_group_members (EmpathyRosterModelManager *self, } static void +add_to_top_group_members (EmpathyRosterModelManager *self, + FolksIndividual *individual) +{ + self->priv->top_group_members = g_list_prepend (self->priv->top_group_members, + individual); +} + +static void +remove_from_top_group_members (EmpathyRosterModelManager *self, + FolksIndividual *individual) +{ + self->priv->top_group_members = g_list_remove (self->priv->top_group_members, + individual); +} + +static void populate_model (EmpathyRosterModelManager *self) { GList *individuals, *l; @@ -111,8 +127,7 @@ populate_model (EmpathyRosterModelManager *self) for (l = individuals; l != NULL; l = g_list_next (l)) { if (individual_should_be_in_top_group_members (self, l->data)) - self->priv->top_group_members = g_list_prepend ( - self->priv->top_group_members, l->data); + add_to_top_group_members (self, l->data); empathy_roster_model_fire_individual_added (EMPATHY_ROSTER_MODEL (self), l->data); @@ -133,8 +148,7 @@ members_changed_cb (EmpathyIndividualManager *manager, { if (individual_should_be_in_top_group_members (self, l->data) && !individual_in_top_group_members (self, l->data)) - self->priv->top_group_members = g_list_prepend ( - self->priv->top_group_members, l->data); + add_to_top_group_members (self, l->data); empathy_roster_model_fire_individual_added (EMPATHY_ROSTER_MODEL (self), l->data); @@ -143,8 +157,7 @@ members_changed_cb (EmpathyIndividualManager *manager, for (l = removed; l != NULL; l = g_list_next (l)) { if (individual_in_top_group_members (self, l->data)) - self->priv->top_group_members = g_list_remove ( - self->priv->top_group_members, l->data); + remove_from_top_group_members (self, l->data); empathy_roster_model_fire_individual_removed (EMPATHY_ROSTER_MODEL (self), l->data); @@ -175,8 +188,7 @@ top_individuals_changed_cb (EmpathyIndividualManager *manager, { if (!individual_in_top_group_members (self, l->data)) { - self->priv->top_group_members = g_list_prepend ( - self->priv->top_group_members, l->data); + add_to_top_group_members (self, l->data); empathy_roster_model_fire_groups_changed ( EMPATHY_ROSTER_MODEL (self), l->data, @@ -187,8 +199,7 @@ top_individuals_changed_cb (EmpathyIndividualManager *manager, { if (!individual_should_be_in_top_group_members (self, l->data)) { - self->priv->top_group_members = g_list_remove ( - self->priv->top_group_members, l->data); + remove_from_top_group_members (self, l->data); empathy_roster_model_fire_groups_changed ( EMPATHY_ROSTER_MODEL (self), l->data, @@ -205,8 +216,7 @@ favourites_changed_cb (EmpathyIndividualManager *manager, { if (favourite && !individual_in_top_group_members (self, individual)) { - self->priv->top_group_members = g_list_prepend ( - self->priv->top_group_members, individual); + add_to_top_group_members (self, individual); empathy_roster_model_fire_groups_changed ( EMPATHY_ROSTER_MODEL (self), individual, @@ -215,8 +225,7 @@ favourites_changed_cb (EmpathyIndividualManager *manager, else if (!favourite && !individual_should_be_in_top_group_members (self, individual)) { - self->priv->top_group_members = g_list_remove ( - self->priv->top_group_members, individual); + remove_from_top_group_members (self, individual); empathy_roster_model_fire_groups_changed ( EMPATHY_ROSTER_MODEL (self), individual, |