[libchamplain] Adjust demos to show "dynamic" path



commit 032e2757b57e25010ce24c64cb4725056d3517e8
Author: JiÅ?í Techet <techet gmail com>
Date:   Tue Feb 15 00:20:39 2011 +0100

    Adjust demos to show "dynamic" path

 champlain/champlain-path-layer.c |    4 ++--
 demos/launcher-gtk.c             |    4 +++-
 demos/launcher.c                 |    3 ++-
 demos/markers.c                  |    8 +++++++-
 demos/markers.h                  |    2 +-
 5 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/champlain/champlain-path-layer.c b/champlain/champlain-path-layer.c
index 67c1e02..7d1254e 100644
--- a/champlain/champlain-path-layer.c
+++ b/champlain/champlain-path-layer.c
@@ -444,7 +444,7 @@ champlain_path_layer_class_init (ChamplainPathLayerClass *klass)
       g_param_spec_boolean ("visible",
           "Visible",
           "The path's visibility",
-          FALSE,
+          TRUE,
           CHAMPLAIN_PARAM_READWRITE));
 
 }
@@ -459,7 +459,7 @@ champlain_path_layer_init (ChamplainPathLayer *self)
   priv = self->priv;
   priv->view = NULL;
 
-  priv->visible = FALSE;
+  priv->visible = TRUE;
   priv->fill = FALSE;
   priv->stroke = TRUE;
   priv->stroke_width = 2.0;
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index aca4e74..642132f 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -220,6 +220,7 @@ main (int argc,
   ClutterActor *scale;
   ClutterBinLayout *layout_manager;
   ChamplainLicense *license_actor;
+  ChamplainPathLayer *path;
 
   g_thread_init (NULL);
   gtk_clutter_init (&argc, &argv);
@@ -267,7 +268,8 @@ main (int argc,
   
   champlain_view_center_on (CHAMPLAIN_VIEW (view), 45.466, -73.75);
 
-  layer = create_marker_layer (view);
+  layer = create_marker_layer (view, &path);
+  champlain_view_add_layer (view, CHAMPLAIN_LAYER (path));
   champlain_view_add_layer (view, CHAMPLAIN_LAYER (layer));
 
   path_layer = champlain_path_layer_new ();
diff --git a/demos/launcher.c b/demos/launcher.c
index ef52b2f..470c257 100644
--- a/demos/launcher.c
+++ b/demos/launcher.c
@@ -92,6 +92,7 @@ main (int argc,
 {
   ClutterActor *actor, *stage, *buttons, *button;
   ChamplainMarkerLayer *layer;
+  ChamplainPathLayer *path;
   gfloat width, total_width = 0;
 
   g_thread_init (NULL);
@@ -130,7 +131,7 @@ main (int argc,
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), buttons);
 
   /* Create the markers and marker layer */
-  layer = create_marker_layer (CHAMPLAIN_VIEW (actor));
+  layer = create_marker_layer (CHAMPLAIN_VIEW (actor), &path);
   champlain_view_add_layer (CHAMPLAIN_VIEW (actor), CHAMPLAIN_LAYER (layer));
 
   /* Connect to the click event */
diff --git a/demos/markers.c b/demos/markers.c
index 7494325..c36534b 100644
--- a/demos/markers.c
+++ b/demos/markers.c
@@ -21,13 +21,14 @@
 
 
 ChamplainMarkerLayer *
-create_marker_layer (G_GNUC_UNUSED ChamplainView *view)
+create_marker_layer (G_GNUC_UNUSED ChamplainView *view, ChamplainPathLayer **path)
 {
   ClutterActor *marker;
   ChamplainMarkerLayer *layer;
   ClutterActor *layer_actor;
   ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb };
 
+  *path = champlain_path_layer_new ();
   layer = champlain_marker_layer_new_full (CHAMPLAIN_SELECTION_SINGLE);
   layer_actor = CLUTTER_ACTOR (layer);
 
@@ -40,27 +41,32 @@ create_marker_layer (G_GNUC_UNUSED ChamplainView *view)
   champlain_location_set_position (CHAMPLAIN_LOCATION (marker),
       45.528178, -73.563788);
   champlain_marker_layer_add_marker (layer, CHAMPLAIN_MARKER (marker));
+  champlain_path_layer_add_node (*path, CHAMPLAIN_LOCATION (marker));
 
   marker = champlain_label_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-generic.png", NULL);
   champlain_label_set_text (CHAMPLAIN_LABEL (marker), "New York");
   champlain_location_set_position (CHAMPLAIN_LOCATION (marker), 40.77, -73.98);
   champlain_marker_layer_add_marker (layer, CHAMPLAIN_MARKER (marker));
+  champlain_path_layer_add_node (*path, CHAMPLAIN_LOCATION (marker));
 
   marker = champlain_label_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-important.png", NULL);
   champlain_location_set_position (CHAMPLAIN_LOCATION (marker), 47.130885,
       -70.764141);
   champlain_marker_layer_add_marker (layer, CHAMPLAIN_MARKER (marker));
+  champlain_path_layer_add_node (*path, CHAMPLAIN_LOCATION (marker));
 
   marker = champlain_point_new ();
   champlain_location_set_position (CHAMPLAIN_LOCATION (marker), 45.130885,
       -65.764141);
   champlain_marker_layer_add_marker (layer, CHAMPLAIN_MARKER (marker));
+  champlain_path_layer_add_node (*path, CHAMPLAIN_LOCATION (marker));
 
   marker = champlain_label_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-favorite.png", NULL);
   champlain_label_set_draw_background (CHAMPLAIN_LABEL (marker), FALSE);
   champlain_location_set_position (CHAMPLAIN_LOCATION (marker), 45.41484,
       -71.918907);
   champlain_marker_layer_add_marker (layer, CHAMPLAIN_MARKER (marker));
+  champlain_path_layer_add_node (*path, CHAMPLAIN_LOCATION (marker));
   
   champlain_marker_layer_set_all_markers_draggable (layer);
 
diff --git a/demos/markers.h b/demos/markers.h
index b7d3f5d..9b7aa80 100644
--- a/demos/markers.h
+++ b/demos/markers.h
@@ -21,6 +21,6 @@
 #ifndef MARKERS_H
 #define MARKERS_H
 
-ChamplainMarkerLayer *create_marker_layer (ChamplainView *view);
+ChamplainMarkerLayer *create_marker_layer (ChamplainView *view, ChamplainPathLayer **path);
 
 #endif



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