]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-widget.c
Updated Oriya Translation
[empathy.git] / libempathy-gtk / empathy-contact-widget.c
index 22f274640dbd1f65bf5cb07d1d6ff10afccb4f76..d6f80636033ae7aefb23d0ba72d19c2680ea91ea 100644 (file)
@@ -32,7 +32,6 @@
 #include <champlain-gtk/champlain-gtk.h>
 #endif
 
-#include <libmissioncontrol/mc-account.h>
 #include <telepathy-glib/util.h>
 
 #include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-location.h>
 #include <libempathy/empathy-time.h>
 #include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-account.h>
 
 #include "empathy-contact-widget.h"
 #include "empathy-account-chooser.h"
 #include "empathy-avatar-chooser.h"
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
+#include "empathy-kludge-label.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
 #include <libempathy/empathy-debug.h>
@@ -105,7 +106,7 @@ typedef struct
 #if HAVE_LIBCHAMPLAIN
   GtkWidget *viewport_map;
   GtkWidget *map_view_embed;
-  ClutterActor *map_view;
+  ChamplainView *map_view;
 #endif
 
   /* Groups */
@@ -219,7 +220,6 @@ empathy_contact_widget_new (EmpathyContact *contact,
        "hbox_presence", &information->hbox_presence,
        "label_alias", &information->label_alias,
        "image_state", &information->image_state,
-       "label_status", &information->label_status,
        "table_contact", &information->table_contact,
        "vbox_avatar", &information->vbox_avatar,
        "vbox_location", &information->vbox_location,
@@ -400,6 +400,13 @@ contact_widget_set_contact (EmpathyContactWidget *information,
       information->factory = empathy_tp_contact_factory_dup_singleton (connection);
     }
 
+  /* set the selected account to be the account this contact came from */
+  if (contact && EMPATHY_IS_ACCOUNT_CHOOSER (information->widget_account)) {
+      empathy_account_chooser_set_account (
+                     EMPATHY_ACCOUNT_CHOOSER (information->widget_account),
+                     empathy_contact_get_account (contact));
+  }
+
   /* Update information for widgets */
   contact_widget_contact_update (information);
   contact_widget_groups_update (information);
@@ -587,6 +594,20 @@ update_avatar_chooser_account_cb (EmpathyAccountChooser *account_chooser,
 static void
 contact_widget_contact_setup (EmpathyContactWidget *information)
 {
+  /* Setup label_status as a KludgeLabel */
+  information->label_status = empathy_kludge_label_new ("");
+  gtk_label_set_line_wrap_mode (GTK_LABEL (information->label_status),
+                                PANGO_WRAP_WORD_CHAR);
+  gtk_label_set_line_wrap (GTK_LABEL (information->label_status),
+                           TRUE);
+
+  if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP))
+    gtk_label_set_selectable (GTK_LABEL (information->label_status), TRUE);
+
+  gtk_box_pack_start (GTK_BOX (information->hbox_presence),
+        information->label_status, TRUE, TRUE, 0);
+  gtk_widget_show (information->label_status);
+
   /* Setup account label/chooser */
   if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
     {
@@ -697,7 +718,7 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
 static void
 contact_widget_contact_update (EmpathyContactWidget *information)
 {
-  McAccount *account = NULL;
+  EmpathyAccount *account = NULL;
   const gchar *id = NULL;
 
   /* Connect and get info from new contact */
@@ -737,7 +758,7 @@ contact_widget_contact_update (EmpathyContactWidget *information)
         {
           const gchar *name;
 
-          name = mc_account_get_display_name (account);
+          name = empathy_account_get_display_name (account);
           gtk_label_set_label (GTK_LABEL (information->widget_account), name);
         }
     }
@@ -1276,7 +1297,7 @@ location_key_to_label (const gchar *key)
   else if (tp_strdiff (key, EMPATHY_LOCATION_CLIMB) == FALSE)
     return _("Climb Speed:");
   else if (tp_strdiff (key, EMPATHY_LOCATION_TIMESTAMP) == FALSE)
-    return _("Taken at:");
+    return _("Last Updated on:");
   else if (tp_strdiff (key, EMPATHY_LOCATION_LON) == FALSE)
     return _("Longitude:");
   else if (tp_strdiff (key, EMPATHY_LOCATION_LAT) == FALSE)
@@ -1295,7 +1316,7 @@ contact_widget_location_update (EmpathyContactWidget *information)
 {
   GHashTable *location;
   GValue *value;
-  gdouble lat, lon;
+  gdouble lat = 0.0, lon = 0.0;
   gboolean has_position = TRUE;
   GtkWidget *label;
   guint row = 0;
@@ -1340,9 +1361,9 @@ contact_widget_location_update (EmpathyContactWidget *information)
       stamp = g_value_get_int64 (value);
       time = stamp;
 
-      user_date = empathy_time_to_string_local (time, _("%B %e, %Y at %R"));
+      user_date = empathy_time_to_string_relative (time);
 
-      text = g_strconcat ( _("<b>Location</b> on "), user_date, NULL);
+      text = g_strconcat ( _("<b>Location</b>, "), user_date, NULL);
       gtk_label_set_markup (GTK_LABEL (information->label_location), text);
       g_free (text);
     }
@@ -1367,8 +1388,6 @@ contact_widget_location_update (EmpathyContactWidget *information)
       char *svalue = NULL;
 
       skey = (const gchar *) key;
-      if (tp_strdiff (skey, EMPATHY_LOCATION_TIMESTAMP) == FALSE)
-        continue;
 
       user_label = location_key_to_label (skey);
       gvalue = (GValue *) pvalue;
@@ -1389,6 +1408,13 @@ contact_widget_location_update (EmpathyContactWidget *information)
         {
           svalue = g_value_dup_string (gvalue);
         }
+      else if (G_VALUE_TYPE (gvalue) == G_TYPE_INT64)
+        {
+          time_t time;
+
+          time = g_value_get_int64 (value);
+          svalue = empathy_time_to_string_utc (time, _("%B %e, %Y at %R UTC"));
+        }
 
       if (svalue != NULL)
         {
@@ -1415,9 +1441,9 @@ contact_widget_location_update (EmpathyContactWidget *information)
       ClutterActor *marker;
       ChamplainLayer *layer;
 
-      information->map_view = champlain_view_new ();
-      information->map_view_embed = champlain_view_embed_new (
-          CHAMPLAIN_VIEW (information->map_view));
+      information->map_view_embed = gtk_champlain_embed_new ();
+      information->map_view = gtk_champlain_embed_get_view (
+          GTK_CHAMPLAIN_EMBED (information->map_view_embed));
 
       gtk_container_add (GTK_CONTAINER (information->viewport_map),
           information->map_view_embed);
@@ -1426,14 +1452,14 @@ contact_widget_location_update (EmpathyContactWidget *information)
           NULL);
 
       layer = champlain_layer_new ();
-      champlain_view_add_layer (CHAMPLAIN_VIEW (information->map_view), layer);
+      champlain_view_add_layer (information->map_view, layer);
 
       marker = champlain_marker_new_with_text (
           empathy_contact_get_name (information->contact), NULL, NULL, NULL);
       champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), lat, lon);
       clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
 
-      champlain_view_center_on (CHAMPLAIN_VIEW(information->map_view), lat, lon);
+      champlain_view_center_on (information->map_view, lat, lon);
       gtk_widget_show_all (information->viewport_map);
     }
 #endif