[libchamplain] Port Champlain to Clutter 0.9



commit 911e8256dc2fc6d4c526c81d9e75ed1c24c6941f
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Sat May 16 15:11:31 2009 -0400

    Port Champlain to Clutter 0.9

 champlain-gtk/gtk-champlain-embed.c      |    2 +-
 champlain/champlain-base-marker.c        |    1 -
 champlain/champlain-marker.c             |   33 ++++++++++++++---------------
 champlain/champlain-network-map-source.c |    5 +--
 champlain/champlain-tile.c               |   10 +++++---
 champlain/champlain-view.c               |    7 ++---
 demos/animated-marker.c                  |   11 ++++-----
 demos/launcher-gtk.c                     |    2 +-
 demos/launcher.c                         |    2 +-
 9 files changed, 35 insertions(+), 38 deletions(-)
---
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c
index a3d4839..b16c4c9 100644
--- a/champlain-gtk/gtk-champlain-embed.c
+++ b/champlain-gtk/gtk-champlain-embed.c
@@ -31,7 +31,7 @@
 
 #include <gtk/gtk.h>
 #include <clutter/clutter.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include "gtk-champlain-embed.h"
 
diff --git a/champlain/champlain-base-marker.c b/champlain/champlain-base-marker.c
index b97d840..a1dc670 100644
--- a/champlain/champlain-base-marker.c
+++ b/champlain/champlain-base-marker.c
@@ -46,7 +46,6 @@
 #include "champlain-zoom-level.h"
 
 #include <clutter/clutter.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <cairo.h>
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index 0f4f683..712b671 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -46,7 +46,6 @@
 #include "champlain-zoom-level.h"
 
 #include <clutter/clutter.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <cairo.h>
@@ -468,8 +467,8 @@ draw_shadow (ChamplainMarker *marker,
   else
     x = -58 * slope;
 
-  shadow = clutter_cairo_new (width + x, (height + point));
-  cr = clutter_cairo_create (CLUTTER_CAIRO (shadow));
+  shadow = clutter_cairo_texture_new (width + x, (height + point));
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (shadow));
 
   cairo_matrix_init (&matrix,
       1, 0,
@@ -512,8 +511,8 @@ draw_background (ChamplainMarker *marker,
   ClutterColor darker_color;
   cairo_t *cr;
 
-  bg = clutter_cairo_new (width, height + point);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (width, height + point);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* If selected, add the selection color to the marker's color */
   if (base_priv->highlighted)
@@ -572,22 +571,22 @@ draw_marker (ChamplainMarker *marker)
 
   if (priv->text != NULL && strlen (priv->text) > 0)
     {
-      ClutterLabel *label;
+      ClutterText *label;
       if (priv->text_actor == NULL)
       {
-        priv->text_actor = clutter_label_new_with_text (priv->font_name, priv->text);
+        priv->text_actor = clutter_text_new_with_text (priv->font_name, priv->text);
         g_object_ref (priv->text_actor);
       }
 
-      label = CLUTTER_LABEL (priv->text_actor);
-      clutter_label_set_use_markup (label, priv->use_markup);
-      clutter_label_set_font_name (label, priv->font_name);
-      clutter_label_set_text (label, priv->text);
-      clutter_label_set_alignment (label, priv->alignment);
-      clutter_label_set_line_wrap (label, priv->wrap);
-      clutter_label_set_line_wrap_mode (label, priv->wrap_mode);
-      clutter_label_set_ellipsize (label, priv->ellipsize);
-      clutter_label_set_attributes (label, priv->attributes);
+      label = CLUTTER_TEXT (priv->text_actor);
+      clutter_text_set_use_markup (label, priv->use_markup);
+      clutter_text_set_font_name (label, priv->font_name);
+      clutter_text_set_text (label, priv->text);
+      clutter_text_set_line_alignment (label, priv->alignment);
+      clutter_text_set_line_wrap (label, priv->wrap);
+      clutter_text_set_line_wrap_mode (label, priv->wrap_mode);
+      clutter_text_set_ellipsize (label, priv->ellipsize);
+      clutter_text_set_attributes (label, priv->attributes);
 
       height = clutter_actor_get_height (priv->text_actor);
       if (priv->image != NULL)
@@ -605,7 +604,7 @@ draw_marker (ChamplainMarker *marker)
       if (height > total_height)
         total_height = height;
 
-      clutter_label_set_color (CLUTTER_LABEL (priv->text_actor), priv->text_color);
+      clutter_text_set_color (CLUTTER_TEXT (priv->text_actor), priv->text_color);
       if (clutter_actor_get_parent (priv->text_actor) == NULL)
         clutter_container_add_actor (CLUTTER_CONTAINER (marker), priv->text_actor);
     }
diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c
index 99a90b2..596fcbf 100644
--- a/champlain/champlain-network-map-source.c
+++ b/champlain/champlain-network-map-source.c
@@ -60,7 +60,6 @@
 #include <math.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <clutter-cairo.h>
 
 enum
 {
@@ -387,8 +386,8 @@ create_error_tile (ChamplainTile* tile)
   guint size;
 
   size = champlain_tile_get_size (tile);
-  actor = clutter_cairo_new (size, size);
-  cr = clutter_cairo_create (CLUTTER_CAIRO(actor));
+  actor = clutter_cairo_texture_new (size, size);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE(actor));
 
   /* draw a linear gray to white pattern */
   pat = cairo_pattern_create_linear (size / 2.0, 0.0,  size, size / 2.0);
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index 318be9d..1497c10 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -826,11 +826,11 @@ champlain_tile_set_etag (ChamplainTile *self,
 
 typedef struct {
   ChamplainTile *tile;
-  ClutterEffectTemplate *etemplate;
+  //ClutterEffectTemplate *etemplate;
   ClutterTimeline *timeline;
   ClutterActor *old_actor;
 } AnimationContext;
-
+/*
 static void
 fade_in_completed (ClutterTimeline *timeline,
     gpointer data)
@@ -846,10 +846,11 @@ fade_in_completed (ClutterTimeline *timeline,
 
   g_object_unref (ctx->tile);
   g_object_unref (ctx->timeline);
-  g_object_unref (ctx->etemplate);
+  //g_object_unref (ctx->etemplate);
   g_free (ctx);
 
 }
+*/
 
 /**
  * champlain_tile_set_content:
@@ -883,7 +884,7 @@ champlain_tile_set_content (ChamplainTile *self,
 
   clutter_container_add (CLUTTER_CONTAINER (priv->actor), actor, NULL);
 
-  /* fixme: etemplate are leaked here */
+  /* fixme: etemplate are leaked here 
   if (fade_in == TRUE)
     {
       AnimationContext *ctx = g_new0 (AnimationContext, 1);
@@ -897,6 +898,7 @@ champlain_tile_set_content (ChamplainTile *self,
       clutter_actor_set_opacity (actor, 0);
       clutter_effect_fade (ctx->etemplate, actor, 255, NULL, NULL);
     }
+  */
 
   priv->content_actor = g_object_ref (actor);
   g_object_notify (G_OBJECT (self), "content");
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 75fcda3..82f9d6d 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1137,7 +1137,7 @@ update_license (ChamplainView *view)
 
   if (priv->show_license)
     {
-      priv->license_actor = g_object_ref (clutter_label_new_with_text ("sans 8",
+      priv->license_actor = g_object_ref (clutter_text_new_with_text ("sans 8",
           champlain_map_source_get_license (priv->map_source)));
       clutter_actor_set_opacity (priv->license_actor, 128);
       clutter_actor_show (priv->license_actor);
@@ -1283,7 +1283,7 @@ timeline_new_frame (ClutterTimeline *timeline,
   gdouble lat;
   gdouble lon;
 
-  alpha = (double) clutter_alpha_get_alpha (ctx->alpha) / CLUTTER_ALPHA_MAX_ALPHA;
+  alpha = clutter_alpha_get_alpha (ctx->alpha);
   lat = ctx->to_latitude - ctx->from_latitude;
   lon = ctx->to_longitude - ctx->from_longitude;
 
@@ -1374,8 +1374,7 @@ champlain_view_go_to (ChamplainView *view,
    */
   duration = 500 * priv->zoom_level / 2.0;
   ctx->timeline = clutter_timeline_new_for_duration (duration);
-  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_ALPHA_SINE_INC, NULL,
-      NULL);
+  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_EASE_OUT_SINE);
 
   g_signal_connect (ctx->timeline, "new-frame", G_CALLBACK (timeline_new_frame),
       ctx);
diff --git a/demos/animated-marker.c b/demos/animated-marker.c
index b6cb40b..abe5f4b 100644
--- a/demos/animated-marker.c
+++ b/demos/animated-marker.c
@@ -17,7 +17,6 @@
  */
 
 #include <champlain/champlain.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <math.h>
 
 #define MARKER_SIZE 10
@@ -39,8 +38,8 @@ create_marker ()
   marker = champlain_base_marker_new ();
 
   /* Static filled circle ----------------------------------------------- */
-  bg = clutter_cairo_new (MARKER_SIZE, MARKER_SIZE);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (MARKER_SIZE, MARKER_SIZE);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* Draw the circle */
   cairo_set_source_rgb (cr, 0, 0, 0);
@@ -59,8 +58,8 @@ create_marker ()
   clutter_actor_set_position (bg, 0, 0);
 
   /* Echo circle -------------------------------------------------------- */
-  bg = clutter_cairo_new (2 * MARKER_SIZE, 2 * MARKER_SIZE);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (2 * MARKER_SIZE, 2 * MARKER_SIZE);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* Draw the circle */
   cairo_set_source_rgb (cr, 0, 0, 0);
@@ -83,7 +82,7 @@ create_marker ()
   /* Animate the echo circle */
   timeline = clutter_timeline_new_for_duration (1000);
   clutter_timeline_set_loop (timeline, TRUE);
-  alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE_INC, NULL, g_object_unref);
+  alpha = clutter_alpha_new_full (timeline, CLUTTER_EASE_OUT_SINE);
 
   behaviour = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 2.0, 2.0);
   clutter_behaviour_apply (behaviour, bg);
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index d31816b..bcbbd07 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -20,7 +20,7 @@
 
 #include <champlain/champlain.h>
 #include <champlain-gtk/champlain-gtk.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include <markers.h>
 
diff --git a/demos/launcher.c b/demos/launcher.c
index 5e6d87c..a221eca 100644
--- a/demos/launcher.c
+++ b/demos/launcher.c
@@ -70,7 +70,7 @@ make_button (char *text)
   clutter_container_add_actor (CLUTTER_CONTAINER (button), button_bg);
   clutter_actor_set_opacity (button_bg, 0xcc);
 
-  button_text = clutter_label_new_full ("Sans 10", text, &black);
+  button_text = clutter_text_new_full ("Sans 10", text, &black);
   clutter_container_add_actor (CLUTTER_CONTAINER (button), button_text);
   clutter_actor_get_size (button_text, &width, &height);
 



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