From 51f07091719dd0e1a9f9669a2dcca0691b7df5ce Mon Sep 17 00:00:00 2001 From: Emmanuel Rodriguez Date: Sat, 11 Jul 2009 11:47:42 +0200 Subject: [PATCH] Switching to single selection mode clears the previous selections --- champlain/champlain-selection-layer.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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"); } -- 2.39.5