From: Emmanuel Rodriguez Date: Sat, 11 Jul 2009 09:47:42 +0000 (+0200) Subject: Switching to single selection mode clears the previous selections X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51f07091719dd0e1a9f9669a2dcca0691b7df5ce;p=libchamplain Switching to single selection mode clears the previous selections --- 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"); }