From 2f6f710031481440adca3f2adbe728fa0cd8d205 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 10 Sep 2013 00:14:04 +0200 Subject: [PATCH 5/7] locator: Fix units in distance threshold comparison Make sure we don't compare kilometers to meters. https://bugs.freedesktop.org/show_bug.cgi?id=69105 --- src/gclue-locator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gclue-locator.c b/src/gclue-locator.c index de209a0..edc0f96 100644 --- a/src/gclue-locator.c +++ b/src/gclue-locator.c @@ -161,15 +161,17 @@ gclue_locator_update_location (GClueLocator *locator, GClueLocationInfo *location) { GClueLocatorPrivate *priv = locator->priv; - gdouble distance; + gdouble distance_km; + gdouble threshold_km; if (priv->location == NULL) goto update; - distance = gclue_location_info_get_distance_from (priv->location, - location); + threshold_km = priv->threshold / 1000.0; + distance_km = gclue_location_info_get_distance_from (priv->location, + location); if (gclue_location_info_equal (priv->location, location) && - distance < priv->threshold) { + distance_km < threshold_km) { g_debug ("Location remains unchanged"); return; } -- 1.8.3.1