diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-22 17:04:40 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-24 19:29:03 +0800 |
commit | f13e0c152b9de168c88f6ebde45c8e35e4df4934 (patch) | |
tree | 4961e686a71d2a7b8f722972d8195f1695bb79a1 | |
parent | 2a03f6ffb41e22d712ed790cdb9aed4a823c1e81 (diff) | |
download | gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar.gz gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar.bz2 gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar.lz gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar.xz gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.tar.zst gsoc2013-empathy-f13e0c152b9de168c88f6ebde45c8e35e4df4934.zip |
add empathy_individual_store_refresh_individual() as a protected method
This allows us to remove show_active as a protected variable.
https://bugzilla.gnome.org/show_bug.cgi?id=663387
-rw-r--r-- | libempathy-gtk/empathy-individual-store-manager.c | 7 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 22 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.h | 4 |
3 files changed, 22 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-individual-store-manager.c b/libempathy-gtk/empathy-individual-store-manager.c index ca586493f..72ddab61b 100644 --- a/libempathy-gtk/empathy-individual-store-manager.c +++ b/libempathy-gtk/empathy-individual-store-manager.c @@ -96,7 +96,6 @@ individual_store_manager_groups_changed_cb (EmpathyIndividualManager *manager, gboolean is_member, EmpathyIndividualStoreManager *self) { - gboolean show_active; EmpathyIndividualStore *store = EMPATHY_INDIVIDUAL_STORE (self); DEBUG ("Updating groups for individual %s", @@ -106,11 +105,7 @@ individual_store_manager_groups_changed_cb (EmpathyIndividualManager *manager, * would have to check the groups already set up for each * contact and then see what has been updated. */ - show_active = store->show_active; - store->show_active = FALSE; - empathy_individual_store_remove_individual (store, individual); - empathy_individual_store_add_individual (store, individual); - store->show_active = show_active; + empathy_individual_store_refresh_individual (store, individual); } static gboolean diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 07d97b95b..d2ba6297a 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -72,6 +72,7 @@ struct _EmpathyIndividualStorePriv GHashTable *folks_individual_cache; /* Hash: char *groupname -> GtkTreeIter * */ GHashTable *empathy_group_cache; + gboolean show_active; }; typedef struct @@ -635,7 +636,7 @@ individual_store_contact_update (EmpathyIndividualStore *self, empathy_individual_store_add_individual (self, individual); - if (self->show_active) + if (self->priv->show_active) { do_set_active = TRUE; @@ -655,7 +656,7 @@ individual_store_contact_update (EmpathyIndividualStore *self, } /* Is this really an update or an online/offline. */ - if (self->show_active) + if (self->priv->show_active) { if (was_online != now_online) { @@ -732,7 +733,7 @@ individual_store_contact_update (EmpathyIndividualStore *self, -1); } - if (self->show_active && do_set_active) + if (self->priv->show_active && do_set_active) { individual_store_contact_set_active (self, individual, do_set_active, do_set_refresh); @@ -1362,7 +1363,7 @@ individual_store_setup (EmpathyIndividualStore *self) static gboolean individual_store_inhibit_active_cb (EmpathyIndividualStore *self) { - self->show_active = TRUE; + self->priv->show_active = TRUE; self->priv->inhibit_active = 0; return FALSE; @@ -1762,3 +1763,16 @@ empathy_individual_store_get_individual_status_icon ( return pixbuf_status; } + +void +empathy_individual_store_refresh_individual (EmpathyIndividualStore *self, + FolksIndividual *individual) +{ + gboolean show_active; + + show_active = self->priv->show_active; + self->priv->show_active = FALSE; + empathy_individual_store_remove_individual (self, individual); + empathy_individual_store_add_individual (self, individual); + self->priv->show_active = show_active; +} diff --git a/libempathy-gtk/empathy-individual-store.h b/libempathy-gtk/empathy-individual-store.h index 3a102d7f8..3e077a95d 100644 --- a/libempathy-gtk/empathy-individual-store.h +++ b/libempathy-gtk/empathy-individual-store.h @@ -79,7 +79,6 @@ struct _EmpathyIndividualStore EmpathyIndividualStorePriv *priv; /* protected */ - gboolean show_active; guint setup_idle_id; }; @@ -157,5 +156,8 @@ void empathy_individual_store_remove_individual (EmpathyIndividualStore *self, void empathy_individual_store_add_individual (EmpathyIndividualStore *self, FolksIndividual *individual); +void empathy_individual_store_refresh_individual (EmpathyIndividualStore *self, + FolksIndividual *individual); + G_END_DECLS #endif /* __EMPATHY_INDIVIDUAL_STORE_H__ */ |