]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-roster-contact.c
GNOME Goal: Update icon names
[empathy.git] / libempathy-gtk / empathy-roster-contact.c
index e72ae4494fdacddd7d701449b9aa8de8510c1a94..2db024a3d8a9a5283483a4794dc60c3e89a264aa 100644 (file)
@@ -1,13 +1,11 @@
 #include "config.h"
-
 #include "empathy-roster-contact.h"
 
-#include <telepathy-glib/telepathy-glib.h>
-
-#include <libempathy/empathy-utils.h>
+#include <glib/gi18n-lib.h>
 
-#include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include "empathy-images.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 G_DEFINE_TYPE (EmpathyRosterContact, empathy_roster_contact, GTK_TYPE_ALIGNMENT)
 
@@ -171,25 +169,11 @@ alias_changed_cb (FolksIndividual *individual,
   update_alias (self);
 }
 
-static gboolean
-is_phone (FolksIndividual *individual)
-{
-  const gchar * const *types;
-
-  types = empathy_individual_get_client_types (individual);
-  if (types == NULL)
-    return FALSE;
-
-  if (g_strv_length ((GStrv) types) <= 0)
-    return FALSE;
-
-  return !tp_strdiff (types[0], "phone");
-}
-
 static void
 update_presence_msg (EmpathyRosterContact *self)
 {
   const gchar *msg;
+  GStrv types;
 
   msg = folks_presence_details_get_presence_message (
       FOLKS_PRESENCE_DETAILS (self->priv->individual));
@@ -204,7 +188,25 @@ update_presence_msg (EmpathyRosterContact *self)
     }
   else
     {
-      gtk_label_set_text (GTK_LABEL (self->priv->presence_msg), msg);
+      FolksPresenceType type;
+
+      type = folks_presence_details_get_presence_type (
+          FOLKS_PRESENCE_DETAILS (self->priv->individual));
+      if (type == FOLKS_PRESENCE_TYPE_ERROR)
+        {
+          gchar *tmp;
+
+          /* Add a prefix explaining that something goes wrong when trying to
+           * fetch contact's presence. */
+          tmp = g_strdup_printf (_("Server cannot find contact: %s"), msg);
+          gtk_label_set_text (GTK_LABEL (self->priv->presence_msg), tmp);
+
+          g_free (tmp);
+        }
+      else
+        {
+          gtk_label_set_text (GTK_LABEL (self->priv->presence_msg), msg);
+        }
 
       gtk_alignment_set (GTK_ALIGNMENT (self->priv->first_line_alig),
           0, 0.75, 1, 1);
@@ -213,8 +215,10 @@ update_presence_msg (EmpathyRosterContact *self)
       gtk_widget_show (self->priv->presence_msg);
     }
 
+  types = (GStrv) empathy_individual_get_client_types (self->priv->individual);
+
   gtk_widget_set_visible (self->priv->phone_icon,
-      is_phone (self->priv->individual));
+      empathy_client_types_contains_mobile_device (types));
 }
 
 static void