[libchamplain] Switching to single selection mode clears the previous selections



commit 51f07091719dd0e1a9f9669a2dcca0691b7df5ce
Author: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
Date:   Sat Jul 11 11:47:42 2009 +0200

    Switching to single selection mode clears the previous selections

 champlain/champlain-selection-layer.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-selection-layer.c b/champlain/champlain-selection-layer.c
index 0155997..c2e7cc1 100644
--- a/champlain/champlain-selection-layer.c
+++ b/champlain/champlain-selection-layer.c
@@ -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");
 }
 



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