]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-individual-store.c
Use double quotes for all internal headers
[empathy.git] / libempathy-gtk / empathy-individual-store.c
index b475b7c30cb7d0c69c2b499e3a62256ce24656cf..7223e2e9c0d8b88aab50bcfb3a538080e099dbb3 100644 (file)
 
 #include "config.h"
 
-#include <string.h>
-
-#include <glib.h>
 #include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-
-#include <folks/folks.h>
-#include <folks/folks-telepathy.h>
-#include <telepathy-glib/util.h>
 
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-enum-types.h>
+#include "libempathy/empathy-utils.h"
 
-#include "empathy-individual-store.h"
 #include "empathy-ui-utils.h"
 #include "empathy-gtk-enum-types.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
-#include <libempathy/empathy-debug.h>
+#include "libempathy/empathy-debug.h"
 
 /* Active users are those which have recently changed state
  * (e.g. online, offline or from normal to a busy state).
@@ -100,48 +90,6 @@ static void individual_store_contact_update (EmpathyIndividualStore *self,
 G_DEFINE_TYPE (EmpathyIndividualStore, empathy_individual_store,
     GTK_TYPE_TREE_STORE);
 
-static const gchar * const *
-individual_get_client_types (FolksIndividual *individual)
-{
-  GeeSet *personas;
-  GeeIterator *iter;
-  const gchar * const *types = NULL;
-  FolksPresenceType presence_type = FOLKS_PRESENCE_TYPE_UNSET;
-
-  personas = folks_individual_get_personas (individual);
-  iter = gee_iterable_iterator (GEE_ITERABLE (personas));
-  while (gee_iterator_next (iter))
-    {
-      FolksPresenceDetails *presence;
-      FolksPersona *persona = gee_iterator_get (iter);
-
-      /* We only want personas which have presence and a TpContact */
-      if (!empathy_folks_persona_is_interesting (persona))
-        goto while_finish;
-
-      presence = FOLKS_PRESENCE_DETAILS (persona);
-
-      if (folks_presence_details_typecmp (
-              folks_presence_details_get_presence_type (presence),
-              presence_type) > 0)
-        {
-          TpContact *tp_contact;
-
-          presence_type = folks_presence_details_get_presence_type (presence);
-
-          tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-          if (tp_contact != NULL)
-            types = tp_contact_get_client_types (tp_contact);
-        }
-
-while_finish:
-      g_clear_object (&persona);
-    }
-  g_clear_object (&iter);
-
-  return types;
-}
-
 static void
 add_individual_to_store (GtkTreeStore *store,
     GtkTreeIter *iter,
@@ -156,7 +104,7 @@ add_individual_to_store (GtkTreeStore *store,
   empathy_individual_can_audio_video_call (individual, &can_audio_call,
       &can_video_call, NULL);
 
-  types = individual_get_client_types (individual);
+  types = empathy_individual_get_client_types (individual);
 
   gtk_tree_store_insert_with_values (store, iter, parent, 0,
       EMPATHY_INDIVIDUAL_STORE_COL_NAME,
@@ -558,9 +506,15 @@ individual_avatar_pixbuf_received_cb (FolksIndividual *individual,
 
   if (error != NULL)
     {
-      DEBUG ("failed to retrieve pixbuf for individual %s: %s",
-          folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual)),
-          error->message);
+      /* No need to display an error if the individal just doesn't have an
+       * avatar */
+      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          DEBUG ("failed to retrieve pixbuf for individual %s: %s",
+              folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual)),
+              error->message);
+        }
+
       g_clear_error (&error);
     }
   else if (data->store != NULL)
@@ -697,7 +651,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
       empathy_individual_can_audio_video_call (individual, &can_audio_call,
           &can_video_call, NULL);
 
-      types = individual_get_client_types (individual);
+      types = empathy_individual_get_client_types (individual);
 
       gtk_tree_store_set (GTK_TREE_STORE (self), l->data,
           EMPATHY_INDIVIDUAL_STORE_COL_ICON_STATUS, pixbuf_status,
@@ -773,9 +727,6 @@ individual_personas_changed_cb (FolksIndividual *individual,
 {
   GeeIterator *iter;
 
-  DEBUG ("Individual '%s' personas-changed.",
-      folks_individual_get_id (individual));
-
   iter = gee_iterable_iterator (GEE_ITERABLE (removed));
   /* FIXME: libfolks hasn't grown capabilities support yet, so we have to go
    * through the EmpathyContacts for them. */
@@ -1171,8 +1122,8 @@ individual_store_contact_sort (FolksIndividual *individual_a,
       g_assert (account_b != NULL);
 
       /* protocol */
-      ret_val = g_strcmp0 (tp_account_get_protocol (account_a),
-          tp_account_get_protocol (account_b));
+      ret_val = g_strcmp0 (tp_account_get_protocol_name (account_a),
+          tp_account_get_protocol_name (account_b));
 
       if (ret_val != 0)
         goto out;