gc-iface-geocode.c 3.16 KB
Newer Older
1 2 3 4 5
/*
 * Geoclue
 * gc-iface-geocode.c - GInterface for org.freedesktop.Geocode
 * 
 * Author: Iain Holmes <iain@openedhand.com>
6
 * Copyright 2007 by Garmin Ltd. or its subsidiaries
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * This 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.
 *
 * This 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 this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
23 24
 */

Jussi Kukkonen's avatar
Jussi Kukkonen committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
/**
 * SECTION:geoclue-geocode
 * @short_description: Geoclue Geocoding client API
 *
 * #GeoclueGeocode contains Geocoding-related methods. 
 * It is part of the Geoclue public C client API which uses D-Bus 
 * to communicate with the actual provider.
 * 
 * After a #GeoclueGeocode is created with geoclue_geocode_new(), the 
 * geoclue_geocode_address_to_position() and geoclue_geocode_address_to_position_async() 
 * methods can be used to obtain the position (coordinates) of a given address. 
 * 
 * Address #GHashTable keys are defined in 
 * <ulink url="geoclue-types.html">geoclue-types.h</ulink>. See also 
 * convenience functions in 
 * <ulink url="geoclue-address-details.html">geoclue-address-details.h</ulink>.
 */

43 44 45 46
#include <glib.h>

#include <dbus/dbus-glib.h>

47
#include <geoclue/geoclue-accuracy.h>
48 49 50
#include <geoclue/gc-iface-geocode.h>

static gboolean 
51 52 53 54 55 56 57 58
gc_iface_geocode_address_to_position (GcIfaceGeocode   *gc,
				      GHashTable       *address,
				      int              *fields,
				      double           *latitude,
				      double           *longitude,
				      double           *altitude,
				      GeoclueAccuracy **accuracy,
				      GError          **error);
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
#include "gc-iface-geocode-glue.h"

static void
gc_iface_geocode_base_init (gpointer klass)
{
	static gboolean initialized = FALSE;

	if (initialized) {
		return;
	}
	initialized = TRUE;
	
	dbus_g_object_type_install_info (gc_iface_geocode_get_type (),
					 &dbus_glib_gc_iface_geocode_object_info);
}

GType
gc_iface_geocode_get_type (void)
{
	static GType type = 0;
	
	if (!type) {
		const GTypeInfo info = {
			sizeof (GcIfaceGeocodeClass),
			gc_iface_geocode_base_init,
			NULL,
		};

		type = g_type_register_static (G_TYPE_INTERFACE,
					       "GcIfaceGeocode", &info, 0);
	}

	return type;
}

static gboolean 
95 96 97 98 99 100 101 102
gc_iface_geocode_address_to_position (GcIfaceGeocode   *gc,
				      GHashTable       *address,
				      int              *fields,
				      double           *latitude,
				      double           *longitude,
				      double           *altitude,
				      GeoclueAccuracy **accuracy,
				      GError          **error)
103
{
Iain Holmes's avatar
Iain Holmes committed
104
	return GC_IFACE_GEOCODE_GET_CLASS (gc)->address_to_position 
105
		(gc, address, (GeocluePositionFields *) fields,
106
		 latitude, longitude, altitude, accuracy, error);
107
}