[empathy] Calculate contact capabilities ourselves.



commit 9d7bdfa085b50a7c96082ffeebd5489c7192f4e2
Author: Travis Reitter <treitter gmail com>
Date:   Mon Jul 12 10:08:05 2010 -0700

    Calculate contact capabilities ourselves.
    
    The libfolks Capabilities interface will be removed temporarily, so we can't
    rely upon it for now.

 libempathy-gtk/empathy-individual-store.c |   45 +++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 12 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 8f969c0..84fcbe2 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -121,20 +121,32 @@ add_individual_to_store (GtkTreeStore *self,
     FolksIndividual *individual,
     EmpathyIndividualManagerFlags flags)
 {
+  EmpathyContact *contact;
+
+  contact = empathy_contact_dup_from_folks_individual (individual);
+
   gtk_tree_store_insert_with_values (self, iter, parent, 0,
       EMPATHY_INDIVIDUAL_STORE_COL_NAME,
       folks_individual_get_alias (individual),
       EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, individual,
       EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, FALSE,
       EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR, FALSE,
-      EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL,
-      folks_individual_get_capabilities (individual) &
-      FOLKS_CAPABILITIES_FLAGS_AUDIO,
-      EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL,
-      folks_individual_get_capabilities (individual) &
-      FOLKS_CAPABILITIES_FLAGS_VIDEO,
       EMPATHY_INDIVIDUAL_STORE_COL_FLAGS, flags,
       -1);
+
+  if (contact != NULL)
+    {
+      gtk_tree_store_set (GTK_TREE_STORE (self), iter,
+          EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL,
+            empathy_contact_get_capabilities (contact) &
+              EMPATHY_CAPABILITIES_AUDIO,
+          EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL,
+            empathy_contact_get_capabilities (contact) &
+              EMPATHY_CAPABILITIES_VIDEO,
+          -1);
+    }
+
+  tp_clear_object (&contact);
 }
 
 static gboolean
@@ -544,6 +556,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
   EmpathyIndividualStorePriv *priv;
   ShowActiveData *data;
   GtkTreeModel *model;
+  EmpathyContact *contact;
   GList *iters, *l;
   gboolean in_list;
   gboolean should_be_in_list;
@@ -559,6 +572,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
   priv = GET_PRIV (self);
 
   model = GTK_TREE_MODEL (self);
+  contact = empathy_contact_dup_from_folks_individual (individual);
 
   iters = individual_store_find_contact (self, individual);
   if (!iters)
@@ -684,17 +698,23 @@ individual_store_contact_update (EmpathyIndividualStore *self,
             folks_individual_get_presence_type (individual),
           EMPATHY_INDIVIDUAL_STORE_COL_STATUS,
             folks_individual_get_presence_message (individual),
-          EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL,
-            folks_individual_get_capabilities (individual) &
-              FOLKS_CAPABILITIES_FLAGS_AUDIO,
-          EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL,
-            folks_individual_get_capabilities (individual) &
-              FOLKS_CAPABILITIES_FLAGS_VIDEO,
           EMPATHY_INDIVIDUAL_STORE_COL_COMPACT, priv->is_compact,
           EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, FALSE,
           EMPATHY_INDIVIDUAL_STORE_COL_IS_ONLINE, now_online,
           EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR, FALSE,
           -1);
+
+      if (contact != NULL)
+        {
+          gtk_tree_store_set (GTK_TREE_STORE (self), l->data,
+              EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL,
+                empathy_contact_get_capabilities (contact) &
+                  EMPATHY_CAPABILITIES_AUDIO,
+              EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL,
+                empathy_contact_get_capabilities (contact) &
+                  EMPATHY_CAPABILITIES_VIDEO,
+              -1);
+        }
     }
 
   if (priv->show_active && do_set_active)
@@ -719,6 +739,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
    */
   g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
   g_list_free (iters);
+  tp_clear_object (&contact);
 }
 
 static void



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