]> err.no Git - libchamplain/commitdiff
Implement champlain_selection_layer_select_all
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sat, 11 Jul 2009 08:11:28 +0000 (10:11 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 28 Jul 2009 21:23:17 +0000 (17:23 -0400)
This implementation will only work when the layer selection mode is set to
multiple. This is because it seems strange to select more than one marker if
the selection mode is set to single.

champlain/champlain-selection-layer.c

index 18850bef9fdb7e34c2c783b24d67618f82b4d191..0155997cf14dd728902ad736342564f8c495c433 100644 (file)
@@ -290,6 +290,36 @@ champlain_selection_layer_unselect_all (ChamplainSelectionLayer *layer)
   layer->priv->selection = selection;
 }
 
+/**
+ * champlain_selection_layer_select_all:
+ *
+ * Selects all markers in the layer. This call will only work if the selection
+ * mode is set CHAMPLAIN_SELETION_MULTIPLE.
+ *
+ * Since: 0.4
+ */
+void
+champlain_selection_layer_select_all (ChamplainSelectionLayer *layer)
+{
+  gint n_children = 0;
+  gint i = 0;
+
+  if (layer->priv->mode == CHAMPLAIN_SELECTION_SINGLE)
+    return;
+
+  n_children = clutter_group_get_n_children (CLUTTER_GROUP (layer) );
+  for (; i < n_children; ++i)
+    {
+      ClutterActor *actor = clutter_group_get_nth_child (
+          CLUTTER_GROUP (layer), i);
+      if (CHAMPLAIN_IS_BASE_MARKER (actor) )
+        {
+          ChamplainBaseMarker *marker = CHAMPLAIN_BASE_MARKER (actor);
+          real_select (layer, marker, TRUE);
+        }
+    }
+}
+
 void
 champlain_selection_layer_unselect (ChamplainSelectionLayer *layer,
     ChamplainBaseMarker *marker)