aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-01 23:10:23 +0800
committerPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-01 23:35:34 +0800
commiteb8b217e20baaa817371266abf43f32de24bd906 (patch)
tree7521b3a0b70ca136202be51842ba95faf73a65f8 /libempathy-gtk
parent1dec1e60d647ba5380824b6887341f07e0c0ae1b (diff)
downloadgsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar.gz
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar.bz2
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar.lz
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar.xz
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.tar.zst
gsoc2013-empathy-eb8b217e20baaa817371266abf43f32de24bd906.zip
Only remove the address fields and position fields instead of all
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-location-manager.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 27cfb4ee6..1acdb3b99 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -293,7 +293,12 @@ address_changed_cb (GeoclueAddress *address,
DEBUG ("New address (accuracy level %d):", level);
geoclue_accuracy_get_details (accuracy, &level, NULL, NULL);
- g_hash_table_remove_all (priv->location);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_STREET);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_AREA);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_REGION);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_COUNTRY);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_COUNTRY_CODE);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_POSTAL_CODE);
if (g_hash_table_size (details) == 0)
return;
@@ -351,6 +356,7 @@ position_changed_cb (GeocluePosition *position,
gdouble mean, horizontal, vertical;
GValue *new_value;
+
geoclue_accuracy_get_details (accuracy, &level, &horizontal, &vertical);
DEBUG ("New position (accuracy level %d)", level);
if (level == GEOCLUE_ACCURACY_LEVEL_NONE)
@@ -364,30 +370,48 @@ position_changed_cb (GeocluePosition *position,
new_value);
DEBUG ("\t - Longitude: %f", longitude);
}
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_LON);
+ }
+
if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE)
{
latitude += priv->reduce_value;
new_value = tp_g_value_slice_new_double (latitude);
- g_hash_table_insert (priv->location, g_strdup (EMPATHY_LOCATION_LAT),
+ g_hash_table_replace (priv->location, g_strdup (EMPATHY_LOCATION_LAT),
new_value);
DEBUG ("\t - Latitude: %f", latitude);
}
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_LAT);
+ }
+
if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
{
new_value = tp_g_value_slice_new_double (altitude);
- g_hash_table_insert (priv->location, g_strdup (EMPATHY_LOCATION_ALT),
+ g_hash_table_replace (priv->location, g_strdup (EMPATHY_LOCATION_ALT),
new_value);
DEBUG ("\t - Altitude: %f", altitude);
}
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_ALT);
+ }
if (level == GEOCLUE_ACCURACY_LEVEL_DETAILED)
{
mean = (horizontal + vertical) / 2.0;
new_value = tp_g_value_slice_new_double (mean);
- g_hash_table_insert (priv->location,
+ g_hash_table_replace (priv->location,
g_strdup (EMPATHY_LOCATION_ACCURACY), new_value);
DEBUG ("\t - Accuracy: %f", mean);
}
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_ACCURACY);
+ }
update_timestamp (location_manager);
if (priv->timeout_id == 0)