[empathy] Update to use libchamplain 0.3's API



commit 28107b1f3fc85df86d1325791804b27e9059d1d7
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Tue May 12 00:10:34 2009 -0400

    Update to use libchamplain 0.3's API
---
 configure.ac                            |    8 ++++----
 libempathy-gtk/empathy-contact-widget.c |    7 ++++---
 src/empathy-map-view.c                  |   19 ++++++++++++-------
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index b766093..ffaa14f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,8 +36,8 @@ ISO_CODES_REQUIRED=0.35
 LIBNOTIFY_REQUIRED=0.4.4
 LIBCANBERRA_GTK_REQUIRED=0.4
 GEOCLUE_REQUIRED=0.11
-LIBCHAMPLAIN_REQUIRED=0.2.6
-LIBCHAMPLAIN_GTK_REQUIRED=0.2.6
+LIBCHAMPLAIN_REQUIRED=0.3.0
+LIBCHAMPLAIN_GTK_REQUIRED=0.3.0
 CLUTTER_GTK_REQUIRED=0.8.2
 
 # Use --enable-maintainer-mode to disabled deprecated symbols
@@ -204,8 +204,8 @@ AC_ARG_ENABLE(map,
 if test "x$enable_map" != "xno"; then
    PKG_CHECK_MODULES(LIBCHAMPLAIN,
    [
-      champlain-0.2 >= $LIBCHAMPLAIN_REQUIRED,
-      champlain-gtk-0.2 >= $LIBCHAMPLAIN_GTK_REQUIRED
+      champlain-0.3 >= $LIBCHAMPLAIN_REQUIRED,
+      champlain-gtk-0.3 >= $LIBCHAMPLAIN_GTK_REQUIRED
       clutter-gtk-0.8 >= $CLUTTER_GTK_REQUIRED
    ], have_libchamplain="yes", have_libchamplain="no")
 
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 6555854..0828455 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -1353,21 +1353,22 @@ contact_widget_location_update (EmpathyContactWidget *information)
       ClutterActor *marker;
       ChamplainLayer *layer;
 
-      information->map_view = champlain_view_new (CHAMPLAIN_VIEW_MODE_KINETIC);
+      information->map_view = champlain_view_new ();
       information->map_view_embed = champlain_view_embed_new (
           CHAMPLAIN_VIEW (information->map_view));
 
       gtk_container_add (GTK_CONTAINER (information->viewport_map),
           information->map_view_embed);
       g_object_set (G_OBJECT (information->map_view), "show-license", FALSE,
+          "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
           NULL);
 
       layer = champlain_layer_new ();
       champlain_view_add_layer (CHAMPLAIN_VIEW (information->map_view), layer);
 
-      marker = champlain_marker_new_with_label (
+      marker = champlain_marker_new_with_text (
           empathy_contact_get_name (information->contact), NULL, NULL, NULL);
-      champlain_marker_set_position (CHAMPLAIN_MARKER (marker), lat, lon);
+      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);
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index df2681c..6f89d74 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -114,9 +114,9 @@ empathy_map_view_show ()
   window->list_store = list_store;
 
   /* Set up map view */
-  window->map_view = CHAMPLAIN_VIEW (champlain_view_new (
-      CHAMPLAIN_VIEW_MODE_KINETIC));
-  g_object_set (G_OBJECT (window->map_view), "zoom-level", 1, NULL);
+  window->map_view = CHAMPLAIN_VIEW (champlain_view_new ());
+  g_object_set (G_OBJECT (window->map_view), "zoom-level", 1,
+     "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC, NULL);
   champlain_view_center_on (window->map_view, 36, 0);
 
   embed = champlain_view_embed_new (window->map_view);
@@ -125,7 +125,7 @@ empathy_map_view_show ()
   gtk_widget_show_all (embed);
 
   window->layer = champlain_layer_new ();
-  champlain_view_add_layer (CHAMPLAIN_VIEW (window->map_view), window->layer);
+  champlain_view_add_layer (window->map_view, window->layer);
 
   /* Set up contact list. */
   model = GTK_TREE_MODEL (window->list_store);
@@ -268,7 +268,7 @@ map_view_marker_update (ChamplainMarker *marker,
   lon = g_value_get_double (value);
 
   clutter_actor_show (CLUTTER_ACTOR (marker));
-  champlain_marker_set_position (marker, lat, lon);
+  champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), lat, lon);
 }
 
 
@@ -297,6 +297,7 @@ map_view_contacts_foreach (GtkTreeModel *model,
   GValue *value;
   GdkPixbuf *avatar;
   guint handle_id;
+  const gchar *name;
 
   gtk_tree_model_get (model, iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT,
      &contact, -1);
@@ -317,9 +318,13 @@ map_view_contacts_foreach (GtkTreeModel *model,
     {
       texture = clutter_texture_new ();
       gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (texture), avatar);
-      clutter_actor_set_position (CLUTTER_ACTOR (texture), 5, 5);
-      clutter_container_add (CLUTTER_CONTAINER (marker), texture, NULL);
+      champlain_marker_set_image (CHAMPLAIN_MARKER (marker), texture);
     }
+  else
+    champlain_marker_set_image (CHAMPLAIN_MARKER (marker), NULL);
+
+  name = empathy_contact_get_name (contact);
+  champlain_marker_set_text (CHAMPLAIN_MARKER (marker), name);
 
   map_view_marker_update (CHAMPLAIN_MARKER (marker), contact);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]