[libchamplain] Fix Vala demos and rename them to avoid clash with C demos



commit a825e169f6d1c6af789c25962a8bf3412097079f
Author: JiÅ?í Techet <techet gmail com>
Date:   Fri Apr 1 00:11:56 2011 +0200

    Fix Vala demos and rename them to avoid clash with C demos

 demos/Makefile.am                           |    2 +-
 demos/{launcher.vala => launcher-vala.vala} |   10 ++++++----
 demos/{markers.vala => markers-vala.vala}   |   20 ++++++++++----------
 3 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/demos/Makefile.am b/demos/Makefile.am
index aa5705d..f790839 100644
--- a/demos/Makefile.am
+++ b/demos/Makefile.am
@@ -48,7 +48,7 @@ endif
 
 if ENABLE_VALA_DEMOS
 noinst_PROGRAMS += launcher-vala
-launcher_vala_SOURCES = launcher.vala markers.vala
+launcher_vala_SOURCES = launcher-vala.vala markers-vala.vala
 VALAFLAGS = \
   --vapidir=../champlain \
   --pkg atk --pkg clutter-1.0 --pkg champlain- CHAMPLAIN_API_VERSION@
diff --git a/demos/launcher.vala b/demos/launcher-vala.vala
similarity index 93%
rename from demos/launcher.vala
rename to demos/launcher-vala.vala
index 0391c95..eeeb682 100644
--- a/demos/launcher.vala
+++ b/demos/launcher-vala.vala
@@ -67,7 +67,7 @@ public class Launcher : GLib.Object
     stage.add_actor (buttons);
 
     /* Create the markers and marker layer */
-    var layer = new  MarkerLayer ();
+    var layer = new  DemoLayer ();
     view.add_layer (layer);
 
     /* Connect to the click event */
@@ -76,7 +76,7 @@ public class Launcher : GLib.Object
 
     /* Finish initialising the map view */
     view.zoom_level = 7;
-    view.scroll_mode = Champlain.ScrollMode.KINETIC;
+    view.kinetic_mode = true;
     view.center_on (45.466, -73.75);
   }
 
@@ -91,9 +91,11 @@ public class Launcher : GLib.Object
 
     if (event.button != 1 || event.click_count > 1)
       return false;
+      
+    lat = view.y_to_latitude (event.y);
+    lon = view.x_to_longitude (event.x);
 
-    if (view.get_coords_at ((uint) event.x, (uint) event.y, out lat, out lon))
-      GLib.print ("Map clicked at %f, %f \n", lat, lon);
+    GLib.print ("Map clicked at %f, %f \n", lat, lon);
 
     return true;
   }
diff --git a/demos/markers.vala b/demos/markers-vala.vala
similarity index 79%
rename from demos/markers.vala
rename to demos/markers-vala.vala
index dea5606..2c8a9c8 100644
--- a/demos/markers.vala
+++ b/demos/markers-vala.vala
@@ -19,47 +19,47 @@
 using GLib;
 using Clutter;
 
-class MarkerLayer : Champlain.SelectionLayer
+class DemoLayer : Champlain.MarkerLayer
 {
-  public MarkerLayer ()
+  public DemoLayer ()
   {
     Clutter.Color orange = { 0xf3, 0x94, 0x07, 0xbb };
-    var marker = new Champlain.Marker.with_text (
+    var marker = new Champlain.Label.with_text (
         "Montréal\n<span size=\"xx-small\">Québec</span>",
         "Serif 14", null, null);
     marker.set_use_markup (true);
     marker.set_alignment (Pango.Alignment.RIGHT);
     marker.set_color (orange);
-    marker.set_position (45.528178, -73.563788);
+    marker.set_location (45.528178, -73.563788);
     add_marker (marker);
 
     try {
-      marker = new Champlain.Marker.from_file (
+      marker = new Champlain.Label.from_file (
           "/usr/share/icons/gnome/24x24/emblems/emblem-generic.png");
     } catch (GLib.Error e) {
       GLib.warning ("%s", e.message);
     }
     marker.set_text ("New York");
-    marker.set_position (40.77, -73.98);
+    marker.set_location (40.77, -73.98);
     add_marker (marker);
 
     try {
-      marker = new Champlain.Marker.from_file (
+      marker = new Champlain.Label.from_file (
           "/usr/share/icons/gnome/24x24/emblems/emblem-important.png");
     } catch (GLib.Error e) {
       GLib.warning ("%s", e.message);
     }
-    marker.set_position (47.130885, -70.764141);
+    marker.set_location (47.130885, -70.764141);
     add_marker (marker);
 
     try {
-      marker = new Champlain.Marker.from_file (
+      marker = new Champlain.Label.from_file (
           "/usr/share/icons/gnome/24x24/emblems/emblem-favorite.png");
     } catch (GLib.Error e) {
       GLib.warning ("%s", e.message);
     }
     marker.set_draw_background (false);
-    marker.set_position (45.41484, -71.918907);
+    marker.set_location (45.41484, -71.918907);
     add_marker (marker);
   }
 }



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