]> err.no Git - libchamplain/commitdiff
Switching to single selection mode clears the previous selections
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sat, 11 Jul 2009 09:47:42 +0000 (11:47 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 28 Jul 2009 21:23:17 +0000 (17:23 -0400)
champlain/champlain-selection-layer.c

index 0155997cf14dd728902ad736342564f8c495c433..c2e7cc1986e23f396ebf7dea922b229abeec75dc 100644 (file)
@@ -352,6 +352,8 @@ champlain_selection_layer_marker_is_selected (ChamplainSelectionLayer *layer,
  * @mode: a #ChamplainSelectionMode value
  *
  * Sets the selection mode of the layer.
+ * NOTE: changing selection mode to CHAMPLAIN_SELECTION_SINGLE will clear all
+ *       previously selected markers.
  *
  * Since: 0.4
  */
@@ -360,8 +362,15 @@ champlain_selection_layer_set_selection_mode (ChamplainSelectionLayer *layer,
     ChamplainSelectionMode mode)
 {
   g_return_if_fail (CHAMPLAIN_IS_SELECTION_LAYER (layer));
+
+  if (layer->priv->mode == mode)
+    return;
   layer->priv->mode = mode;
 
+  /* Switching to single mode shouldn't keep the selection */
+  if (mode == CHAMPLAIN_SELECTION_SINGLE)
+    champlain_selection_layer_unselect_all (layer);
+
   g_object_notify (G_OBJECT (layer), "selection-mode");
 }