diff options
author | Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk> | 2009-05-28 09:42:47 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk> | 2009-06-01 23:35:31 +0800 |
commit | d64c42ef982318c23562986a4b82a0f4f77f7122 (patch) | |
tree | 66f781fa49ce829cdbef63db4d84c9886bff103b /libempathy-gtk/empathy-location-manager.c | |
parent | f4029062299a0f1c5f68c213bf65569e35ff44a0 (diff) | |
download | gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar.gz gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar.bz2 gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar.lz gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar.xz gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.tar.zst gsoc2013-empathy-d64c42ef982318c23562986a4b82a0f4f77f7122.zip |
Don't use geoclue's timestamp
It turns out that the timestamp are not reliable (they
are often set to 0).
Diffstat (limited to 'libempathy-gtk/empathy-location-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-location-manager.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c index 040bc619d..899850bf8 100644 --- a/libempathy-gtk/empathy-location-manager.c +++ b/libempathy-gtk/empathy-location-manager.c @@ -283,14 +283,16 @@ empathy_location_manager_get_default (void) } static void -update_timestamp (EmpathyLocationManager *location_manager, - int timestamp) +update_timestamp (EmpathyLocationManager *location_manager) { EmpathyLocationManagerPriv *priv; priv = GET_PRIV (location_manager); GValue *new_value; - gint64 stamp64 = (gint64) timestamp; + gint64 stamp64; + time_t timestamp; + timestamp = time (NULL); + stamp64 = (gint64) timestamp; new_value = tp_g_value_slice_new (G_TYPE_INT64); g_value_set_int64 (new_value, stamp64); g_hash_table_insert (priv->location, g_strdup (EMPATHY_LOCATION_TIMESTAMP), @@ -377,7 +379,7 @@ position_changed_cb (GeocluePosition *position, DEBUG ("\t - Accuracy: %f", mean); } - update_timestamp (location_manager, timestamp); + update_timestamp (location_manager); publish_location_to_all_accounts (EMPATHY_LOCATION_MANAGER (location_manager), FALSE); } @@ -438,9 +440,12 @@ address_changed_cb (GeoclueAddress *address, priv = GET_PRIV (location_manager); g_hash_table_remove_all (priv->location); + if (g_hash_table_size (details) == 0) + return; + g_hash_table_foreach (details, address_foreach_cb, (gpointer)location_manager); - update_timestamp (location_manager, timestamp); + update_timestamp (location_manager); publish_location_to_all_accounts (EMPATHY_LOCATION_MANAGER (location_manager), FALSE); } |