[libchamplain] Prepend elements of the list instead of appending them in markers and paths



commit fd4f7b865ea22d9916ffbda7854cf88e31108447
Author: JiÅ?í Techet <techet gmail com>
Date:   Fri Apr 1 23:09:09 2011 +0200

    Prepend elements of the list instead of appending them in markers and paths

 champlain/champlain-marker-layer.c |    8 +++++---
 champlain/champlain-path-layer.c   |   13 +++++++------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/champlain/champlain-marker-layer.c b/champlain/champlain-marker-layer.c
index c75bfa2..bb6f42f 100644
--- a/champlain/champlain-marker-layer.c
+++ b/champlain/champlain-marker-layer.c
@@ -512,8 +512,10 @@ GList *
 champlain_marker_layer_get_markers (ChamplainMarkerLayer *layer)
 {
   ChamplainMarkerLayerPrivate *priv = layer->priv;
-
-  return clutter_container_get_children (CLUTTER_CONTAINER (priv->content_group));
+  GList *lst;
+  
+  lst = clutter_container_get_children (CLUTTER_CONTAINER (priv->content_group));
+  return g_list_reverse (lst);
 }
 
 
@@ -544,7 +546,7 @@ champlain_marker_layer_get_selected (ChamplainMarkerLayer *layer)
       ChamplainMarker *marker = CHAMPLAIN_MARKER (elem->data);
 
       if (champlain_marker_get_selected (marker))
-        selected = g_list_append (selected, marker);
+        selected = g_list_prepend (selected, marker);
     }
 
   g_list_free (markers);
diff --git a/champlain/champlain-path-layer.c b/champlain/champlain-path-layer.c
index d58870a..145ca46 100644
--- a/champlain/champlain-path-layer.c
+++ b/champlain/champlain-path-layer.c
@@ -511,7 +511,7 @@ position_notify (ChamplainLocation *location,
 static void
 add_node (ChamplainPathLayer *layer,
     ChamplainLocation *location,
-    gboolean append,
+    gboolean prepend,
     guint position)
 {
   ChamplainPathLayerPrivate *priv = layer->priv;
@@ -521,8 +521,8 @@ add_node (ChamplainPathLayer *layer,
 
   g_object_ref_sink (location);
 
-  if (append)
-    priv->nodes = g_list_append (priv->nodes, location);
+  if (prepend)
+    priv->nodes = g_list_prepend (priv->nodes, location);
   else
     priv->nodes = g_list_insert (priv->nodes, location, position);
   schedule_redraw (layer);
@@ -595,9 +595,10 @@ champlain_path_layer_remove_all (ChamplainPathLayer *layer)
 GList *
 champlain_path_layer_get_nodes (ChamplainPathLayer *layer)
 {
-  ChamplainPathLayerPrivate *priv = layer->priv;
-
-  return g_list_copy (priv->nodes);
+  GList *lst;
+  
+  lst = g_list_copy (layer->priv->nodes);
+  return g_list_reverse (lst);
 }
 
 



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