summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2016-04-05 13:48:48 +0100
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2016-04-05 13:55:51 +0100
commit9d90e62214ca4cee4bfe845e37f3b1f50f882107 (patch)
treefb80d3f1fed3bccc90ee82442f71fae66660b397
parent4cefb6bf6d1835776e687f7302967e4ba9c22335 (diff)
downloadgeoclue-9d90e62214ca4cee4bfe845e37f3b1f50f882107.tar.gz
location: Update from geocode-glib
https://bugs.freedesktop.org/show_bug.cgi?id=94521
-rw-r--r--src/geocode-glib/Makefile.am1
-rw-r--r--src/geocode-glib/geocode-enum-types.c1
-rw-r--r--src/geocode-glib/geocode-forward.c10
-rw-r--r--src/geocode-glib/geocode-glib-private.h1
-rw-r--r--src/geocode-glib/geocode-glib.c23
-rw-r--r--src/geocode-glib/geocode-location.c8
-rw-r--r--src/geocode-glib/geocode-place.c4
-rw-r--r--src/geocode-glib/geocode-place.h4
-rw-r--r--src/geocode-glib/geocode-reverse.c3
9 files changed, 47 insertions, 8 deletions
diff --git a/src/geocode-glib/Makefile.am b/src/geocode-glib/Makefile.am
index f63b767..d47c681 100644
--- a/src/geocode-glib/Makefile.am
+++ b/src/geocode-glib/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = $(GEOCLUE_CFLAGS) \
-DG_LOG_DOMAIN=\""Geoclue"\" \
-DABS_TOP_SRCDIR=\""$(abs_top_srcdir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DPACKAGE_VERSION=\"@PACKAGE_VERSION@\" \
-I$(top_srcdir)/src \
-I$(top_builddir)/src
diff --git a/src/geocode-glib/geocode-enum-types.c b/src/geocode-glib/geocode-enum-types.c
index 8638b14..9422774 100644
--- a/src/geocode-glib/geocode-enum-types.c
+++ b/src/geocode-glib/geocode-enum-types.c
@@ -92,6 +92,7 @@ geocode_place_type_get_type (void)
{ GEOCODE_PLACE_TYPE_PLACE_OF_WORSHIP, "GEOCODE_PLACE_TYPE_PLACE_OF_WORSHIP", "place-of-worship" },
{ GEOCODE_PLACE_TYPE_RESTAURANT, "GEOCODE_PLACE_TYPE_RESTAURANT", "restaurant" },
{ GEOCODE_PLACE_TYPE_BAR, "GEOCODE_PLACE_TYPE_BAR", "bar" },
+ { GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION, "GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION", "light-rail-station" },
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GeocodePlaceType", values);
diff --git a/src/geocode-glib/geocode-forward.c b/src/geocode-glib/geocode-forward.c
index 446d6b5..5939afe 100644
--- a/src/geocode-glib/geocode-forward.c
+++ b/src/geocode-glib/geocode-forward.c
@@ -202,7 +202,7 @@ geocode_forward_init (GeocodeForward *forward)
forward->priv = G_TYPE_INSTANCE_GET_PRIVATE ((forward), GEOCODE_TYPE_FORWARD, GeocodeForwardPrivate);
forward->priv->ht = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
- forward->priv->soup_session = soup_session_new ();
+ forward->priv->soup_session = _geocode_glib_build_soup_session ();
forward->priv->answer_count = DEFAULT_ANSWER_COUNT;
forward->priv->search_area = NULL;
forward->priv->bounded = FALSE;
@@ -566,6 +566,7 @@ geocode_forward_search_async (GeocodeForward *forward,
on_cache_data_loaded,
simple);
g_object_unref (cache);
+ g_free (cache_path);
}
}
@@ -735,8 +736,11 @@ get_place_type_from_attributes (GHashTable *ht)
else
place_type = GEOCODE_PLACE_TYPE_STREET;
} else if (g_strcmp0 (category, "railway") == 0) {
- if (g_strcmp0 (type, "station") == 0)
- place_type = GEOCODE_PLACE_TYPE_RAILWAY_STATION;
+ if (g_strcmp0 (type, "station") == 0 ||
+ g_strcmp0 (type, "halt") == 0)
+ place_type = GEOCODE_PLACE_TYPE_RAILWAY_STATION;
+ else if (g_strcmp0 (type, "tram_stop") == 0)
+ place_type = GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION;
} else if (g_strcmp0 (category, "waterway") == 0) {
place_type = GEOCODE_PLACE_TYPE_DRAINAGE;
} else if (g_strcmp0 (category, "boundary") == 0) {
diff --git a/src/geocode-glib/geocode-glib-private.h b/src/geocode-glib/geocode-glib-private.h
index 7dde8e7..1be5d2d 100644
--- a/src/geocode-glib/geocode-glib-private.h
+++ b/src/geocode-glib/geocode-glib-private.h
@@ -55,6 +55,7 @@ gboolean _geocode_glib_cache_load (SoupMessage *query,
char **contents);
GHashTable *_geocode_glib_dup_hash_table (GHashTable *ht);
gboolean _geocode_object_is_number_after_street (void);
+SoupSession *_geocode_glib_build_soup_session (void);
G_END_DECLS
diff --git a/src/geocode-glib/geocode-glib.c b/src/geocode-glib/geocode-glib.c
index 0ac4eb5..4e3b3fd 100644
--- a/src/geocode-glib/geocode-glib.c
+++ b/src/geocode-glib/geocode-glib.c
@@ -37,6 +37,29 @@
* <ulink url="http://wiki.openstreetmap.org/wiki/Nominatim">OSM Nominatim APIs</ulink>
**/
+SoupSession *
+_geocode_glib_build_soup_session (void)
+{
+ GApplication *application;
+ SoupSession *session;
+ char *user_agent;
+
+ application = g_application_get_default ();
+ if (application) {
+ const char *id = g_application_get_application_id (application);
+ user_agent = g_strdup_printf ("geocode-glib/%s (%s)",
+ PACKAGE_VERSION, id);
+ } else {
+ user_agent = g_strdup_printf ("geocode-glib/%s",
+ PACKAGE_VERSION);
+ }
+
+ session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ user_agent, NULL);
+ g_free (user_agent);
+ return session;
+}
+
char *
_geocode_glib_cache_path_for_query (SoupMessage *query)
{
diff --git a/src/geocode-glib/geocode-location.c b/src/geocode-glib/geocode-location.c
index 14223dc..f770042 100644
--- a/src/geocode-glib/geocode-location.c
+++ b/src/geocode-glib/geocode-location.c
@@ -606,7 +606,8 @@ geocode_location_class_init (GeocodeLocationClass *klass)
* GeocodeLocation:timestamp:
*
* A timestamp in seconds since
- * <ulink url="http://en.wikipedia.org/wiki/Unix_epoch">Epoch</ulink>.
+ * <ulink url="http://en.wikipedia.org/wiki/Unix_epoch">Epoch</ulink>,
+ * giving when the location was resolved from an address.
*
* A value of 0 (zero) will be interpreted as the current time.
*/
@@ -831,14 +832,15 @@ geocode_location_get_crs (GeocodeLocation *loc)
* geocode_location_get_timestamp:
* @loc: a #GeocodeLocation
*
- * Gets the timestamp (in seconds since Epoc) of location @loc.
+ * Gets the timestamp (in seconds since the Epoch) of location @loc. See
+ * #GeocodeLocation:timestamp.
*
* Returns: The timestamp of location @loc.
**/
guint64
geocode_location_get_timestamp (GeocodeLocation *loc)
{
- g_return_val_if_fail (GEOCODE_IS_LOCATION (loc), -1);
+ g_return_val_if_fail (GEOCODE_IS_LOCATION (loc), 0);
return loc->priv->timestamp;
}
diff --git a/src/geocode-glib/geocode-place.c b/src/geocode-glib/geocode-place.c
index 7166e81..70a40df 100644
--- a/src/geocode-glib/geocode-place.c
+++ b/src/geocode-glib/geocode-place.c
@@ -1169,6 +1169,10 @@ get_icon_name (GeocodePlace *place)
icon_name = "poi-bar";
break;
+ case GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION:
+ icon_name = "poi-light-rail-station";
+ break;
+
default:
icon_name = "poi-marker"; /* generic marker */
break;
diff --git a/src/geocode-glib/geocode-place.h b/src/geocode-glib/geocode-place.h
index f25c03d..b71a82c 100644
--- a/src/geocode-glib/geocode-place.h
+++ b/src/geocode-glib/geocode-place.h
@@ -101,6 +101,7 @@ struct _GeocodePlaceClass {
* @GEOCODE_PLACE_TYPE_PLACE_OF_WORSHIP: All places of worship independently of the religion or denomination.
* @GEOCODE_PLACE_TYPE_RESTAURANT: Generally formal place with sit-down facilities selling full meals served by waiters.
* @GEOCODE_PLACE_TYPE_BAR: A bar or pub.
+ * @GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION: A light rail station or tram stop.
*
* Type of the place.
*/
@@ -138,7 +139,8 @@ typedef enum {
GEOCODE_PLACE_TYPE_SCHOOL,
GEOCODE_PLACE_TYPE_PLACE_OF_WORSHIP,
GEOCODE_PLACE_TYPE_RESTAURANT,
- GEOCODE_PLACE_TYPE_BAR
+ GEOCODE_PLACE_TYPE_BAR,
+ GEOCODE_PLACE_TYPE_LIGHT_RAIL_STATION
} GeocodePlaceType;
diff --git a/src/geocode-glib/geocode-reverse.c b/src/geocode-glib/geocode-reverse.c
index 7d251f4..7e70acc 100644
--- a/src/geocode-glib/geocode-reverse.c
+++ b/src/geocode-glib/geocode-reverse.c
@@ -79,7 +79,7 @@ geocode_reverse_init (GeocodeReverse *object)
object->priv = G_TYPE_INSTANCE_GET_PRIVATE ((object), GEOCODE_TYPE_REVERSE, GeocodeReversePrivate);
object->priv->ht = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
- object->priv->soup_session = soup_session_new ();
+ object->priv->soup_session = _geocode_glib_build_soup_session ();
}
/**
@@ -467,6 +467,7 @@ geocode_reverse_resolve_async (GeocodeReverse *object,
on_cache_data_loaded,
simple);
g_object_unref (cache);
+ g_free (cache_path);
}
}