From 5caacc9a2cc6b8208381fee69ca9fea56cf4437f Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 10 Sep 2013 00:14:04 +0200 Subject: [PATCH 2/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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gclue-locator.c b/src/gclue-locator.c index a343260..4a05682 100644 --- a/src/gclue-locator.c +++ b/src/gclue-locator.c @@ -162,6 +162,7 @@ gclue_locator_update_location (GClueLocator *locator, { GClueLocatorPrivate *priv = locator->priv; gdouble accuracy, new_accuracy, distance; + gdouble threshold_km; const char *desc, *new_desc; if (priv->location == NULL) @@ -171,11 +172,13 @@ gclue_locator_update_location (GClueLocator *locator, new_accuracy = gclue_location_info_get_accuracy (location); desc = gclue_location_info_get_description (priv->location); new_desc = gclue_location_info_get_description (location); + + threshold_km = priv->threshold / 1000.0; distance = gclue_location_info_get_distance_from (priv->location, location); if (accuracy == new_accuracy && g_strcmp0 (desc, new_desc) == 0 && - distance < priv->threshold) { + distance < threshold_km) { g_debug ("Location remain unchanged"); return; } -- 1.8.3.1