]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-widget.c
Merge commit 'jtellier/video-call-button-sensitivity'
[empathy.git] / libempathy-gtk / empathy-contact-widget.c
index 6c10153649cb31e1e2547471243388c6dc24207b..a9a673c43c44333151d04693a96fa9456a9fcd84 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,12 @@ 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_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 +710,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 +750,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);
         }
     }
@@ -1420,9 +1433,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);
@@ -1431,14 +1444,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