]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-individual-widget.c
Merge branch 'gnome-3-6'
[empathy.git] / libempathy-gtk / empathy-individual-widget.c
index aa7a7f05315cb0de14dcd1b83143680903629192..4dab7390cdbd7ba946956ba581cec2299819b082 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n-lib.h>
 
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib.h>
 
 #include <folks/folks.h>
 #include <folks/folks-telepathy.h>
@@ -239,7 +239,7 @@ details_update_show (EmpathyIndividualWidget *self,
   TpConnection *conn;
   TpAccount *account;
 
-  info = tp_contact_get_contact_info (contact);
+  info = tp_contact_dup_contact_info (contact);
   info = g_list_sort (info, (GCompareFunc) empathy_contact_info_field_cmp);
   for (l = info; l != NULL; l = l->next)
     {
@@ -267,7 +267,7 @@ details_update_show (EmpathyIndividualWidget *self,
 
       /* Add Title */
       title = empathy_contact_info_field_label (field->field_name,
-          field->parameters);
+          field->parameters, TRUE);
       title_widget = gtk_label_new (title);
 
       /* Add Value */
@@ -309,7 +309,7 @@ details_update_show (EmpathyIndividualWidget *self,
       n_rows++;
     }
 
-  g_list_free (info);
+  tp_contact_info_list_free (info);
 
   return n_rows;
 }
@@ -680,8 +680,7 @@ location_update (EmpathyIndividualWidget *self)
 
 #ifdef HAVE_LIBCHAMPLAIN
   if ((g_hash_table_lookup (location, EMPATHY_LOCATION_LAT) != NULL) &&
-      (g_hash_table_lookup (location, EMPATHY_LOCATION_LON) != NULL) &&
-      !(priv->flags & EMPATHY_INDIVIDUAL_WIDGET_FOR_TOOLTIP))
+      (g_hash_table_lookup (location, EMPATHY_LOCATION_LON) != NULL))
     {
       /* Cannot be displayed in tooltips until Clutter-Gtk can deal with such
        * windows */
@@ -809,9 +808,7 @@ client_types_update (EmpathyIndividualWidget *self)
 
   types = tp_contact_get_client_types (priv->contact);
 
-  if (types != NULL
-      && g_strv_length ((gchar **) types) > 0
-      && !tp_strdiff (types[0], "phone"))
+  if (empathy_client_types_contains_mobile_device ((GStrv) types))
     {
       gtk_widget_show (priv->hbox_client_types);
     }
@@ -1215,6 +1212,8 @@ notify_presence_cb (gpointer folks_object,
   GtkWidget *status_label, *state_image;
   const gchar *message;
   gchar *markup_text = NULL;
+  FolksPresenceType presence;
+  gboolean visible = TRUE;
 
   if (FOLKS_IS_INDIVIDUAL (folks_object))
     grid = G_OBJECT (priv->individual_grid);
@@ -1229,14 +1228,22 @@ notify_presence_cb (gpointer folks_object,
   status_label = g_object_get_data (grid, "status-label");
   state_image = g_object_get_data (grid, "state-image");
 
+  presence = folks_presence_details_get_presence_type (
+      FOLKS_PRESENCE_DETAILS (folks_object));
+  if (presence == FOLKS_PRESENCE_TYPE_UNKNOWN ||
+      presence == FOLKS_PRESENCE_TYPE_ERROR)
+    {
+      /* Don't display anything if we don't know the presence */
+      visible = FALSE;
+      goto out;
+    }
+
   /* FIXME: Default messages should be moved into libfolks (bgo#627403) */
   message = folks_presence_details_get_presence_message (
       FOLKS_PRESENCE_DETAILS (folks_object));
   if (EMP_STR_EMPTY (message))
     {
-      message = empathy_presence_get_default_message (
-          folks_presence_details_get_presence_type (
-              FOLKS_PRESENCE_DETAILS (folks_object)));
+      message = empathy_presence_get_default_message (presence);
     }
 
   if (message != NULL)
@@ -1245,11 +1252,12 @@ notify_presence_cb (gpointer folks_object,
   g_free (markup_text);
 
   gtk_image_set_from_icon_name (GTK_IMAGE (state_image),
-      empathy_icon_name_for_presence (
-          folks_presence_details_get_presence_type (
-              FOLKS_PRESENCE_DETAILS (folks_object))),
+      empathy_icon_name_for_presence (presence),
       GTK_ICON_SIZE_BUTTON);
-  gtk_widget_show (state_image);
+
+out:
+  gtk_widget_set_visible (status_label, visible);
+  gtk_widget_set_visible (state_image, visible);
 }
 
 static void
@@ -1323,7 +1331,7 @@ alias_presence_avatar_favourite_set_up (EmpathyIndividualWidget *self,
   current_row++;
 
   /* Presence */
-  priv->hbox_presence = gtk_hbox_new (FALSE, 6);
+  priv->hbox_presence = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
 
   /* Presence image */
   image = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE,
@@ -1478,7 +1486,7 @@ add_persona (EmpathyIndividualWidget *self,
   gtk_widget_show (label);
 
   /* Pack the protocol icon with the account name in an hbox */
-  hbox = GTK_BOX (gtk_hbox_new (FALSE, 6));
+  hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6));
 
   account_label = gtk_label_new (NULL);
   gtk_label_set_selectable (GTK_LABEL (account_label),
@@ -1675,6 +1683,17 @@ individual_grid_destroy (EmpathyIndividualWidget *self)
 
   gtk_container_remove (GTK_CONTAINER (priv->vbox_individual),
       GTK_WIDGET (priv->individual_grid));
+
+#ifdef HAVE_LIBCHAMPLAIN
+  if (priv->map_view_embed != NULL)
+    {
+      gtk_container_remove (GTK_CONTAINER (priv->viewport_map),
+          priv->map_view_embed);
+
+      priv->map_view_embed = NULL;
+    }
+#endif
+
   priv->individual_grid = NULL;
 }