[empathy] Only retrieve server-stored groups for Individuals with TpContacts.



commit 018ba00ead80bed3238273a772ec1fd1c55cf58e
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue May 10 16:41:04 2011 -0700

    Only retrieve server-stored groups for Individuals with TpContacts.
    
    Helps: bgo#648822 - Port Empathy to Folks 0.5.1

 libempathy-gtk/empathy-individual-store.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 01ec894..ac1a96c 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -419,9 +419,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
   EmpathyIndividualStorePriv *priv;
   GtkTreeIter iter;
   GeeIterator *group_iter = NULL;
-  EmpathyContact *contact;
-  TpConnection *connection;
-  gchar *protocol_name;
 
   priv = GET_PRIV (self);
 
@@ -440,18 +437,23 @@ individual_store_add_individual (EmpathyIndividualStore *self,
         group_iter = gee_iterable_iterator (GEE_ITERABLE (group_set));
     }
 
-  contact = empathy_contact_dup_from_folks_individual (individual);
-  connection = empathy_contact_get_connection (contact);
-
-  tp_connection_parse_object_path (connection, &protocol_name, NULL);
-
   /* fall-back groups, in case there are no named groups */
   if (group_iter == NULL)
     {
       GtkTreeIter iter_group, *parent;
+      EmpathyContact *contact;
+      TpConnection *connection;
+      gchar *protocol_name = NULL;
 
       parent = &iter_group;
 
+      contact = empathy_contact_dup_from_folks_individual (individual);
+      if (contact != NULL)
+        {
+          connection = empathy_contact_get_connection (contact);
+          tp_connection_parse_object_path (connection, &protocol_name, NULL);
+        }
+
       if (!priv->show_groups)
         parent = NULL;
       else if (!tp_strdiff (protocol_name, "local-xmpp"))
@@ -470,9 +472,10 @@ individual_store_add_individual (EmpathyIndividualStore *self,
 
       add_individual_to_store (GTK_TREE_STORE (self), &iter, parent,
           individual);
-    }
 
-  g_free (protocol_name);
+      g_free (protocol_name);
+      g_clear_object (&contact);
+    }
 
   /* Else add to each group. */
   while (group_iter != NULL && gee_iterator_next (group_iter))
@@ -505,8 +508,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
     }
 
   individual_store_contact_update (self, individual);
-
-  tp_clear_object (&contact);
 }
 
 static void



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