aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-04-19 23:33:14 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-04-20 21:13:36 +0800
commit83f3f9dc6adf394915c7da8a1da16c127ea6a10d (patch)
treed407150315246b0824d71920a72da780e0ae18a6 /libempathy-gtk
parent2f5f9eb6d3d4185f9a20c158567ccdd969df52d9 (diff)
downloadgsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar.gz
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar.bz2
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar.lz
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar.xz
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.tar.zst
gsoc2013-empathy-83f3f9dc6adf394915c7da8a1da16c127ea6a10d.zip
location-manager: use tp_asv_*
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-location-manager.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 93dda08f9..8184bc043 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -296,14 +296,12 @@ address_changed_cb (GeoclueAddress *address,
g_hash_table_iter_init (&iter, details);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- GValue *new_value;
/* Discard street information if reduced accuracy is on */
if (self->priv->reduce_accuracy &&
!tp_strdiff (key, EMPATHY_LOCATION_STREET))
continue;
- new_value = tp_g_value_slice_new_string (value);
- g_hash_table_insert (self->priv->location, g_strdup (key), new_value);
+ tp_asv_set_string (self->priv->location, key, value);
DEBUG ("\t - %s: %s", (gchar *) key, (gchar *) value);
}
@@ -346,8 +344,6 @@ position_changed_cb (GeocluePosition *position,
EmpathyLocationManager *self = user_data;
GeoclueAccuracyLevel level;
gdouble mean, horizontal, vertical;
- GValue *new_value;
-
geoclue_accuracy_get_details (accuracy, &level, &horizontal, &vertical);
DEBUG ("New position (accuracy level %d)", level);
@@ -361,9 +357,8 @@ position_changed_cb (GeocluePosition *position,
/* Truncate at 1 decimal place */
longitude = ((int) (longitude * 10)) / 10.0;
- new_value = tp_g_value_slice_new_double (longitude);
- g_hash_table_insert (self->priv->location,
- g_strdup (EMPATHY_LOCATION_LON), new_value);
+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LON, longitude);
+
DEBUG ("\t - Longitude: %f", longitude);
}
else
@@ -377,9 +372,8 @@ position_changed_cb (GeocluePosition *position,
/* Truncate at 1 decimal place */
latitude = ((int) (latitude * 10)) / 10.0;
- new_value = tp_g_value_slice_new_double (latitude);
- g_hash_table_replace (self->priv->location,
- g_strdup (EMPATHY_LOCATION_LAT), new_value);
+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LAT, latitude);
+
DEBUG ("\t - Latitude: %f", latitude);
}
else
@@ -389,9 +383,8 @@ position_changed_cb (GeocluePosition *position,
if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
{
- new_value = tp_g_value_slice_new_double (altitude);
- g_hash_table_replace (self->priv->location,
- g_strdup (EMPATHY_LOCATION_ALT), new_value);
+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_ALT, altitude);
+
DEBUG ("\t - Altitude: %f", altitude);
}
else
@@ -402,9 +395,8 @@ position_changed_cb (GeocluePosition *position,
if (level == GEOCLUE_ACCURACY_LEVEL_DETAILED)
{
mean = (horizontal + vertical) / 2.0;
- new_value = tp_g_value_slice_new_double (mean);
- g_hash_table_replace (self->priv->location,
- g_strdup (EMPATHY_LOCATION_ACCURACY), new_value);
+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_ACCURACY, mean);
+
DEBUG ("\t - Accuracy: %f", mean);
}
else
@@ -643,8 +635,7 @@ empathy_location_manager_init (EmpathyLocationManager *self)
self->priv = priv;
priv->geoclue_is_setup = FALSE;
- priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- g_free, (GDestroyNotify) tp_g_value_slice_free);
+ priv->location = tp_asv_new (NULL, NULL);
priv->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA);
/* Setup account status callbacks */