Commit 813ed186 authored by Zeeshan Ali's avatar Zeeshan Ali

service: Drop geocode-glib copy

The geocode-glib copy is out-of-date and updating it is not as trivial as
it used to be since geocode-location module is not so independent of the
rest of the code any more. Also geocode-glib doesn't see much changes
these days, especially to the geocode-location module so the effort to
port the code, isn't really worth it.

We already copied over the needed code in a previous commit and now we
ditch our geode-glib internal copy and dependency.

Fixes #88.
parent ca15136c
Pipeline #13988 passed with stage
in 1 minute and 58 seconds
......@@ -4,4 +4,3 @@ demo/where-am-i.c
demo/geoclue-demo-agent.desktop.in.in
demo/geoclue-where-am-i.desktop.in.in
src/gclue-main.c
src/geocode-glib/geocode-reverse.c
/*
Copyright 2013 Jonas Danielsson
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
Authors: Jonas Danielsson <jonas@threetimestwo.org>
*/
#include <geocode-glib/geocode-bounding-box.h>
/**
* SECTION:geocode-bounding-box
* @short_description: Geocode BoundingBox object
* @include: geocode-glib/geocode-bounding-box.h
*
* The #GeocodeBoundingBox represents a geographical area on earth, bounded
* by top, bottom, left and right coordinates.
**/
struct _GeocodeBoundingBoxPrivate {
gdouble top;
gdouble bottom;
gdouble left;
gdouble right;
};
enum {
PROP_0,
PROP_TOP,
PROP_BOTTOM,
PROP_LEFT,
PROP_RIGHT
};
G_DEFINE_TYPE (GeocodeBoundingBox, geocode_bounding_box, G_TYPE_OBJECT)
static void
geocode_bounding_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GeocodeBoundingBox *bbox = GEOCODE_BOUNDING_BOX (object);
switch (property_id) {
case PROP_TOP:
g_value_set_double (value,
geocode_bounding_box_get_top (bbox));
break;
case PROP_BOTTOM:
g_value_set_double (value,
geocode_bounding_box_get_bottom (bbox));
break;
case PROP_LEFT:
g_value_set_double (value,
geocode_bounding_box_get_left (bbox));
break;
case PROP_RIGHT:
g_value_set_double (value,
geocode_bounding_box_get_right (bbox));
break;
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
geocode_bounding_box_set_top (GeocodeBoundingBox *bbox,
gdouble top)
{
g_return_if_fail (top >= -90.0 && top <= 90.0);
bbox->priv->top = top;
}
static void
geocode_bounding_box_set_bottom (GeocodeBoundingBox *bbox,
gdouble bottom)
{
g_return_if_fail (bottom >= -90.0 && bottom <= 90.0);
bbox->priv->bottom = bottom;
}
static void
geocode_bounding_box_set_left (GeocodeBoundingBox *bbox,
gdouble left)
{
g_return_if_fail (left >= -180.0 && left <= 180.0);
bbox->priv->left = left;
}
static void
geocode_bounding_box_set_right (GeocodeBoundingBox *bbox,
gdouble right)
{
g_return_if_fail (right >= -180.0 && right <= 180.0);
bbox->priv->right = right;
}
static void
geocode_bounding_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GeocodeBoundingBox *bbox = GEOCODE_BOUNDING_BOX (object);
switch (property_id) {
case PROP_TOP:
geocode_bounding_box_set_top (bbox,
g_value_get_double (value));
break;
case PROP_BOTTOM:
geocode_bounding_box_set_bottom (bbox,
g_value_get_double (value));
break;
case PROP_LEFT:
geocode_bounding_box_set_left (bbox,
g_value_get_double (value));
break;
case PROP_RIGHT:
geocode_bounding_box_set_right (bbox,
g_value_get_double (value));
break;
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
geocode_bounding_box_finalize (GObject *gbbox)
{
G_OBJECT_CLASS (geocode_bounding_box_parent_class)->finalize (gbbox);
}
static void
geocode_bounding_box_class_init (GeocodeBoundingBoxClass *klass)
{
GObjectClass *gbbox_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
gbbox_class->finalize = geocode_bounding_box_finalize;
gbbox_class->get_property = geocode_bounding_box_get_property;
gbbox_class->set_property = geocode_bounding_box_set_property;
g_type_class_add_private (klass, sizeof (GeocodeBoundingBoxPrivate));
/**
* GeocodeBoundingBox:top:
*
* Top coordinate.
*/
pspec = g_param_spec_double ("top",
"Top",
"Top coordinate",
-90,
90,
0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gbbox_class, PROP_TOP, pspec);
/**
* GeocodeBoundingBox:bottom:
*
* Bottom coordinate.
*/
pspec = g_param_spec_double ("bottom",
"Bottom",
"Bottom coordinate",
-90,
90,
0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gbbox_class, PROP_BOTTOM, pspec);
/**
* GeocodeBoundingBox:left:
*
* Left coordinate.
*/
pspec = g_param_spec_double ("left",
"Left",
"Left coordinate",
-180,
180,
0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gbbox_class, PROP_LEFT, pspec);
/**
* GeocodeBoundingBox:right:
*
* Right coordinate.
*/
pspec = g_param_spec_double ("right",
"Right",
"Right coordinate",
-180,
180,
0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gbbox_class, PROP_RIGHT, pspec);
}
static void
geocode_bounding_box_init (GeocodeBoundingBox *bbox)
{
bbox->priv = G_TYPE_INSTANCE_GET_PRIVATE ((bbox),
GEOCODE_TYPE_BOUNDING_BOX,
GeocodeBoundingBoxPrivate);
}
/**
* geocode_bounding_box_new:
* @top: The left coordinate
* @bottom: The bottom coordinate
* @left: The left coordinate
* @right: The right coordinate
*
* Creates a new #GeocodeBoundingBox object.
*
* Returns: a new #GeocodeBoundingBox object. Use g_object_unref() when done.
**/
GeocodeBoundingBox *
geocode_bounding_box_new (gdouble top,
gdouble bottom,
gdouble left,
gdouble right)
{
return g_object_new (GEOCODE_TYPE_BOUNDING_BOX,
"top", top,
"bottom", bottom,
"left", left,
"right", right,
NULL);
}
/**
* geocode_bounding_box_get_top:
* @bbox: a #GeocodeBoundingBox
*
* Gets the top coordinate of @bbox.
*
* Returns: the top coordinate of @bbox.
**/
gdouble
geocode_bounding_box_get_top (GeocodeBoundingBox *bbox)
{
g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (bbox), 0.0);
return bbox->priv->top;
}
/**
* geocode_bounding_box_get_bottom:
* @bbox: a #GeocodeBoundingBox
*
* Gets the bottom coordinate of @bbox.
*
* Returns: the bottom coordinate of @bbox.
**/
gdouble
geocode_bounding_box_get_bottom (GeocodeBoundingBox *bbox)
{
g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (bbox), 0.0);
return bbox->priv->bottom;
}
/**
* geocode_bounding_box_get_left:
* @bbox: a #GeocodeBoundingBox
*
* Gets the left coordinate of @bbox.
*
* Returns: the left coordinate of @bbox.
**/
gdouble
geocode_bounding_box_get_left (GeocodeBoundingBox *bbox)
{
g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (bbox), 0.0);
return bbox->priv->left;
}
/**
* geocode_bounding_box_get_right:
* @bbox: a #GeocodeBoundingBox
*
* Gets the right coordinate of @bbox.
*
* Returns: the right coordinate of @bbox.
**/
gdouble
geocode_bounding_box_get_right (GeocodeBoundingBox *bbox)
{
g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (bbox), 0.0);
return bbox->priv->right;
}
/*
Copyright 2013 Jonas Danielsson
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
Authors: Jonas Danielsson <jonas@threetimestwo.org>
*/
#ifndef GEOCODE_BOUNDING_BOX_H
#define GEOCODE_BOUNDING_BOX_H
#include <glib-object.h>
G_BEGIN_DECLS
GType geocode_bounding_box_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_BOUNDING_BOX (geocode_bounding_box_get_type ())
#define GEOCODE_BOUNDING_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEOCODE_TYPE_BOUNDING_BOX, GeocodeBoundingBox))
#define GEOCODE_IS_BOUNDING_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEOCODE_TYPE_BOUNDING_BOX))
#define GEOCODE_BOUNDING_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEOCODE_TYPE_BOUNDING_BOX, GeocodeBoundingBoxClass))
#define GEOCODE_IS_BOUNDING_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEOCODE_TYPE_BOUNDING_BOX))
#define GEOCODE_BOUNDING_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEOCODE_TYPE_BOUNDING_BOX, GeocodeBoundingBoxClass))
typedef struct _GeocodeBoundingBox GeocodeBoundingBox;
typedef struct _GeocodeBoundingBoxClass GeocodeBoundingBoxClass;
typedef struct _GeocodeBoundingBoxPrivate GeocodeBoundingBoxPrivate;
/**
* GeocodeBoundingBox:
*
* All the fields in the #GeocodeLocation structure are private and should
* never be accessed directly.
**/
struct _GeocodeBoundingBox {
/* <private> */
GObject parent_instance;
GeocodeBoundingBoxPrivate *priv;
};
/**
* GeocodeBoundingBoxClass:
*
* All the fields in the #GeocodeBoundingBoxClass structure are private and
* should never be accessed directly.
**/
struct _GeocodeBoundingBoxClass {
/* <private> */
GObjectClass parent_class;
};
GeocodeBoundingBox *geocode_bounding_box_new (gdouble top,
gdouble bottom,
gdouble left,
gdouble right);
gdouble geocode_bounding_box_get_top (GeocodeBoundingBox *bbox);
gdouble geocode_bounding_box_get_bottom (GeocodeBoundingBox *bbox);
gdouble geocode_bounding_box_get_left (GeocodeBoundingBox *bbox);
gdouble geocode_bounding_box_get_right (GeocodeBoundingBox *bbox);
G_END_DECLS
#endif /* GEOCODE_BOUNDING_BOX_H */
#include <geocode-glib/geocode-glib.h>
#include <geocode-glib/geocode-enum-types.h>
/* enumerations from "geocode-location.h" */
GType
geocode_location_uri_scheme_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ GEOCODE_LOCATION_URI_SCHEME_GEO, "GEOCODE_LOCATION_URI_SCHEME_GEO", "geo" },
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GeocodeLocationURIScheme", values);
}
return etype;
}
GType
geocode_location_crs_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ GEOCODE_LOCATION_CRS_WGS84, "GEOCODE_LOCATION_CRS_WGS84", "wgs84" },
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GeocodeLocationCRS", values);
}
return etype;
}
/* enumerations from "geocode-error.h" */
GType
geocode_error_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ GEOCODE_ERROR_PARSE, "GEOCODE_ERROR_PARSE", "parse" },
{ GEOCODE_ERROR_NOT_SUPPORTED, "GEOCODE_ERROR_NOT_SUPPORTED", "not-supported" },
{ GEOCODE_ERROR_NO_MATCHES, "GEOCODE_ERROR_NO_MATCHES", "no-matches" },
{ GEOCODE_ERROR_INVALID_ARGUMENTS, "GEOCODE_ERROR_INVALID_ARGUMENTS", "invalid-arguments" },
{ GEOCODE_ERROR_INTERNAL_SERVER, "GEOCODE_ERROR_INTERNAL_SERVER", "internal-server" },
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GeocodeError", values);
}
return etype;
}
/* enumerations from "geocode-place.h" */
GType
geocode_place_type_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ GEOCODE_PLACE_TYPE_UNKNOWN, "GEOCODE_PLACE_TYPE_UNKNOWN", "unknown" },
{ GEOCODE_PLACE_TYPE_BUILDING, "GEOCODE_PLACE_TYPE_BUILDING", "building" },
{ GEOCODE_PLACE_TYPE_STREET, "GEOCODE_PLACE_TYPE_STREET", "street" },
{ GEOCODE_PLACE_TYPE_TOWN, "GEOCODE_PLACE_TYPE_TOWN", "town" },
{ GEOCODE_PLACE_TYPE_STATE, "GEOCODE_PLACE_TYPE_STATE", "state" },
{ GEOCODE_PLACE_TYPE_COUNTY, "GEOCODE_PLACE_TYPE_COUNTY", "county" },
{ GEOCODE_PLACE_TYPE_LOCAL_ADMINISTRATIVE_AREA, "GEOCODE_PLACE_TYPE_LOCAL_ADMINISTRATIVE_AREA", "local-administrative-area" },
{ GEOCODE_PLACE_TYPE_POSTAL_CODE, "GEOCODE_PLACE_TYPE_POSTAL_CODE", "postal-code" },
{ GEOCODE_PLACE_TYPE_COUNTRY, "GEOCODE_PLACE_TYPE_COUNTRY", "country" },
{ GEOCODE_PLACE_TYPE_ISLAND, "GEOCODE_PLACE_TYPE_ISLAND", "island" },
{ GEOCODE_PLACE_TYPE_AIRPORT, "GEOCODE_PLACE_TYPE_AIRPORT", "airport" },
{ GEOCODE_PLACE_TYPE_RAILWAY_STATION, "GEOCODE_PLACE_TYPE_RAILWAY_STATION", "railway-station" },
{ GEOCODE_PLACE_TYPE_BUS_STOP, "GEOCODE_PLACE_TYPE_BUS_STOP", "bus-stop" },
{ GEOCODE_PLACE_TYPE_MOTORWAY, "GEOCODE_PLACE_TYPE_MOTORWAY", "motorway" },
{ GEOCODE_PLACE_TYPE_DRAINAGE, "GEOCODE_PLACE_TYPE_DRAINAGE", "drainage" },
{ GEOCODE_PLACE_TYPE_LAND_FEATURE, "GEOCODE_PLACE_TYPE_LAND_FEATURE", "land-feature" },
{ GEOCODE_PLACE_TYPE_MISCELLANEOUS, "GEOCODE_PLACE_TYPE_MISCELLANEOUS", "miscellaneous" },
{ GEOCODE_PLACE_TYPE_SUPERNAME, "GEOCODE_PLACE_TYPE_SUPERNAME", "supername" },
{ GEOCODE_PLACE_TYPE_POINT_OF_INTEREST, "GEOCODE_PLACE_TYPE_POINT_OF_INTEREST", "point-of-interest" },
{ GEOCODE_PLACE_TYPE_SUBURB, "GEOCODE_PLACE_TYPE_SUBURB", "suburb" },
{ GEOCODE_PLACE_TYPE_COLLOQUIAL, "GEOCODE_PLACE_TYPE_COLLOQUIAL", "colloquial" },
{ GEOCODE_PLACE_TYPE_ZONE, "GEOCODE_PLACE_TYPE_ZONE", "zone" },
{ GEOCODE_PLACE_TYPE_HISTORICAL_STATE, "GEOCODE_PLACE_TYPE_HISTORICAL_STATE", "historical-state" },
{ GEOCODE_PLACE_TYPE_HISTORICAL_COUNTY, "GEOCODE_PLACE_TYPE_HISTORICAL_COUNTY", "historical-county" },
{ GEOCODE_PLACE_TYPE_CONTINENT, "GEOCODE_PLACE_TYPE_CONTINENT", "continent" },
{ GEOCODE_PLACE_TYPE_TIME_ZONE, "GEOCODE_PLACE_TYPE_TIME_ZONE", "time-zone" },
{ GEOCODE_PLACE_TYPE_ESTATE, "GEOCODE_PLACE_TYPE_ESTATE", "estate" },
{ GEOCODE_PLACE_TYPE_HISTORICAL_TOWN, "GEOCODE_PLACE_TYPE_HISTORICAL_TOWN", "historical-town" },
{ GEOCODE_PLACE_TYPE_OCEAN, "GEOCODE_PLACE_TYPE_OCEAN", "ocean" },
{ GEOCODE_PLACE_TYPE_SEA, "GEOCODE_PLACE_TYPE_SEA", "sea" },
{ GEOCODE_PLACE_TYPE_SCHOOL, "GEOCODE_PLACE_TYPE_SCHOOL", "school" },
{ 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);
}
return etype;
}
GType
geocode_place_osm_type_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ GEOCODE_PLACE_OSM_TYPE_UNKNOWN, "GEOCODE_PLACE_OSM_TYPE_UNKNOWN", "unknown" },
{ GEOCODE_PLACE_OSM_TYPE_NODE, "GEOCODE_PLACE_OSM_TYPE_NODE", "node" },
{ GEOCODE_PLACE_OSM_TYPE_RELATION, "GEOCODE_PLACE_OSM_TYPE_RELATION", "relation" },
{ GEOCODE_PLACE_OSM_TYPE_WAY, "GEOCODE_PLACE_OSM_TYPE_WAY", "way" },
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GeocodePlaceOsmType", values);
}
return etype;
}
#ifndef __GEOCODE_ENUM_TYPES_H__
#define __GEOCODE_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "geocode-location.h" */
GType geocode_location_uri_scheme_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_LOCATION_URI_SCHEME (geocode_location_uri_scheme_get_type())
/**
* SECTION:geocode-enum-types
* @short_description: Geocode enumerated types
* @include: geocode-glib/geocode-glib.h
*
* The enumerated types defined and used by geocode-glib.
**/
GType geocode_location_crs_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_LOCATION_CRS (geocode_location_crs_get_type())
/**
* SECTION:geocode-enum-types
* @short_description: Geocode enumerated types
* @include: geocode-glib/geocode-glib.h
*
* The enumerated types defined and used by geocode-glib.
**/
/* enumerations from "geocode-error.h" */
GType geocode_error_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_ERROR (geocode_error_get_type())
/**
* SECTION:geocode-enum-types
* @short_description: Geocode enumerated types
* @include: geocode-glib/geocode-glib.h
*
* The enumerated types defined and used by geocode-glib.
**/
/* enumerations from "geocode-place.h" */
GType geocode_place_type_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_PLACE_TYPE (geocode_place_type_get_type())
/**
* SECTION:geocode-enum-types
* @short_description: Geocode enumerated types
* @include: geocode-glib/geocode-glib.h
*
* The enumerated types defined and used by geocode-glib.
**/
GType geocode_place_osm_type_get_type (void) G_GNUC_CONST;
#define GEOCODE_TYPE_PLACE_OSM_TYPE (geocode_place_osm_type_get_type())
/**
* SECTION:geocode-enum-types
* @short_description: Geocode enumerated types
* @include: geocode-glib/geocode-glib.h
*
* The enumerated types defined and used by geocode-glib.
**/
G_END_DECLS
#endif /* __GEOCODE_ENUM_TYPES_H__ */
/*
Copyright 2011 Bastien Nocera
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
Authors: Bastien Nocera <hadess@hadess.net>
*/