diff options
author | Bastien Nocera <hadess@hadess.net> | 2012-11-26 05:30:50 +0800 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-11-28 13:47:10 +0800 |
commit | 0e83aaed266c7b438c9b8d80213f7660f78c755f (patch) | |
tree | f43d1cb2283e495309423f5ca70b1442656a7499 | |
parent | 4d7aaa9588b85033e7b4fe88fc3939ed0713daa5 (diff) | |
download | gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar.gz gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar.bz2 gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar.lz gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar.xz gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.tar.zst gsoc2013-empathy-0e83aaed266c7b438c9b8d80213f7660f78c755f.zip |
Port EmpathyContact to geocode-glib >= 0.99.1
https://bugzilla.gnome.org/show_bug.cgi?id=689056
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | libempathy/empathy-contact.c | 25 |
2 files changed, 16 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 0171d0379..b11107a87 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,7 @@ GOA_REQUIRED=3.5.1 # Optional deps ENCHANT_REQUIRED=1.2.0 GEOCLUE_REQUIRED=0.12 +GEOCODE_GLIB_REQUIRED=0.99.1 ISO_CODES_REQUIRED=0.35 NAUTILUS_SENDTO_REQUIRED=2.90.0 NETWORK_MANAGER_REQUIRED=0.7.0 @@ -434,7 +435,7 @@ AC_ARG_ENABLE(geocode, if test "x$enable_geocode" != "xno"; then PKG_CHECK_MODULES(GEOCODE, [ - geocode-glib + geocode-glib >= $GEOCODE_GLIB_REQUIRED ], have_geocode="yes", have_geocode="no") if test "x$have_geocode" = "xyes"; then diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 4fe428957..3963b52ed 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -1623,6 +1623,8 @@ geocode_cb (GObject *source, EmpathyContact *contact = user_data; EmpathyContactPriv *priv = GET_PRIV (contact); GError *error = NULL; + GList *res; + GeocodeLocation *loc; GHashTable *new_location; GHashTable *resolved = NULL; gdouble latitude, longitude; @@ -1630,26 +1632,27 @@ geocode_cb (GObject *source, if (priv->location == NULL) goto out; - resolved = geocode_object_resolve_finish (GEOCODE_OBJECT (source), result, + res = geocode_forward_search_finish (GEOCODE_OBJECT (source), result, &error); - if (resolved == NULL) + if (res == NULL) { DEBUG ("Failed to resolve geocode: %s", error->message); g_error_free (error); goto out; } - if (!geocode_object_get_coords (resolved, &longitude, &latitude)) - goto out; + loc = res->data; new_location = tp_asv_new ( - EMPATHY_LOCATION_LAT, G_TYPE_DOUBLE, latitude, - EMPATHY_LOCATION_LON, G_TYPE_DOUBLE, longitude, + EMPATHY_LOCATION_LAT, G_TYPE_DOUBLE, loc->latitude, + EMPATHY_LOCATION_LON, G_TYPE_DOUBLE, loc->longitude, NULL); - DEBUG ("\t - Latitude: %f", latitude); - DEBUG ("\t - Longitude: %f", longitude); + DEBUG ("\t - Latitude: %f", loc->latitude); + DEBUG ("\t - Longitude: %f", loc->longitude); + + g_list_free_full (res, geocode_location_free); /* Copy remaning fields. LAT and LON were not defined so we won't overwrite * the values we just set. */ @@ -1669,7 +1672,7 @@ out: static void update_geocode (EmpathyContact *contact) { - GeocodeObject *geocode; + GeocodeForward *geocode; GHashTable *location; location = empathy_contact_get_location (contact); @@ -1682,11 +1685,11 @@ update_geocode (EmpathyContact *contact) g_hash_table_lookup (location, EMPATHY_LOCATION_LON) != NULL) return; - geocode = geocode_object_new_for_params (location); + geocode = geocode_forward_new_for_params (location); if (geocode == NULL) return; - geocode_object_resolve_async (geocode, NULL, geocode_cb, + geocode_forward_search_async (geocode, NULL, geocode_cb, g_object_ref (contact)); g_object_unref (geocode); |