[empathy] add empathy_individual_store_refresh_individual() as a protected method



commit f13e0c152b9de168c88f6ebde45c8e35e4df4934
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Nov 22 10:04:40 2011 +0100

    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

 libempathy-gtk/empathy-individual-store-manager.c |    7 +-----
 libempathy-gtk/empathy-individual-store.c         |   22 +++++++++++++++++---
 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 ca58649..72ddab6 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 07d97b9..d2ba629 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 3a102d7..3e077a9 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__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]