[geocode-glib] place: Add bounding-box property



commit f0079af1aa8ad1a676d726f59838aa82c7e4c55c
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Mon Jan 27 13:57:15 2014 +0100

    place: Add bounding-box property
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723095

 geocode-glib/geocode-glib.symbols |    2 +
 geocode-glib/geocode-place.c      |   63 ++++++++++++++++++++++
 geocode-glib/geocode-place.h      |  104 +++++++++++++++++++-----------------
 3 files changed, 120 insertions(+), 49 deletions(-)
---
diff --git a/geocode-glib/geocode-glib.symbols b/geocode-glib/geocode-glib.symbols
index 1031bec..b9265de 100644
--- a/geocode-glib/geocode-glib.symbols
+++ b/geocode-glib/geocode-glib.symbols
@@ -71,6 +71,8 @@ geocode_place_get_country
 geocode_place_set_continent
 geocode_place_get_continent
 geocode_place_get_icon
+geocode_place_get_bounding_box
+geocode_place_set_bounding_box
 geocode_bounding_box_get_type
 geocode_bounding_box_new
 geocode_bounding_box_get_top
diff --git a/geocode-glib/geocode-place.c b/geocode-glib/geocode-place.c
index 15f73b4..4a7f2de 100644
--- a/geocode-glib/geocode-place.c
+++ b/geocode-glib/geocode-place.c
@@ -23,6 +23,7 @@
 
 #include <gio/gio.h>
 #include <geocode-glib/geocode-place.h>
+#include <geocode-glib/geocode-bounding-box.h>
 #include <geocode-glib/geocode-enum-types.h>
 #include <geocode-glib/geocode-glib-private.h>
 
@@ -41,6 +42,7 @@ struct _GeocodePlacePrivate {
         char *name;
         GeocodePlaceType place_type;
         GeocodeLocation *location;
+        GeocodeBoundingBox *bbox;
 
         char *street_address;
         char *street;
@@ -75,6 +77,7 @@ enum {
         PROP_COUNTRY,
         PROP_CONTINENT,
         PROP_ICON,
+        PROP_BBOX
 };
 
 G_DEFINE_TYPE (GeocodePlace, geocode_place, G_TYPE_OBJECT)
@@ -168,6 +171,11 @@ geocode_place_get_property (GObject    *object,
                                     geocode_place_get_icon (place));
                 break;
 
+        case PROP_BBOX:
+                g_value_set_object (value,
+                                    geocode_place_get_bounding_box (place));
+                break;
+
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                 break;
@@ -248,6 +256,10 @@ geocode_place_set_property(GObject      *object,
                 geocode_place_set_continent (place, g_value_get_string (value));
                 break;
 
+        case PROP_BBOX:
+                place->priv->bbox = g_value_dup_object (value);
+                break;
+
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                 break;
@@ -260,6 +272,7 @@ geocode_place_dispose (GObject *gplace)
         GeocodePlace *place = (GeocodePlace *) gplace;
 
         g_clear_object (&place->priv->location);
+        g_clear_object (&place->priv->bbox);
 
         g_clear_pointer (&place->priv->name, g_free);
         g_clear_pointer (&place->priv->street_address, g_free);
@@ -499,6 +512,19 @@ geocode_place_class_init (GeocodePlaceClass *klass)
                                      G_PARAM_READABLE |
                                      G_PARAM_STATIC_STRINGS);
         g_object_class_install_property (gplace_class, PROP_ICON, pspec);
+
+        /**
+         * GeocodePlace:bounding-box:
+         *
+         * The bounding box for the place.
+         */
+        pspec = g_param_spec_object ("bounding-box",
+                                     "Bounding Box",
+                                     "The bounding box for the place",
+                                     GEOCODE_TYPE_BOUNDING_BOX,
+                                     G_PARAM_READWRITE |
+                                     G_PARAM_STATIC_STRINGS);
+        g_object_class_install_property (gplace_class, PROP_BBOX, pspec);
 }
 
 static void
@@ -507,6 +533,7 @@ geocode_place_init (GeocodePlace *place)
         place->priv = G_TYPE_INSTANCE_GET_PRIVATE ((place),
                                                       GEOCODE_TYPE_PLACE,
                                                       GeocodePlacePrivate);
+        place->priv->bbox = NULL;
 }
 
 /**
@@ -1101,3 +1128,39 @@ geocode_place_get_icon (GeocodePlace *place)
 
         return g_icon_new_for_string (icon_name, NULL);
 }
+
+/**
+ * geocode_place_get_bounding_box:
+ * @place: A place
+ *
+ * Gets the bounding box for the place @place.
+ *
+ * Returns: (transfer none): A #GeocodeBoundingBox, or NULL if boundaries are
+ * unknown.
+ **/
+GeocodeBoundingBox *
+geocode_place_get_bounding_box (GeocodePlace *place)
+{
+        g_return_val_if_fail (GEOCODE_IS_PLACE (place), NULL);
+
+        return place->priv->bbox;
+}
+
+/**
+ * geocode_place_set_bounding_box:
+ * @place: A place
+ * @bbox: A #GeocodeBoundingBox for the place
+ *
+ * Sets the #GeocodeBoundingBox for the place @place.
+ *
+ **/
+void
+geocode_place_set_bounding_box (GeocodePlace       *place,
+                                GeocodeBoundingBox *bbox)
+{
+        g_return_if_fail (GEOCODE_IS_PLACE (place));
+        g_return_if_fail (GEOCODE_IS_BOUNDING_BOX (bbox));
+
+        g_clear_object (&place->priv->bbox);
+        place->priv->bbox = g_object_ref (bbox);
+}
diff --git a/geocode-glib/geocode-place.h b/geocode-glib/geocode-place.h
index 1aba478..525f57c 100644
--- a/geocode-glib/geocode-place.h
+++ b/geocode-glib/geocode-place.h
@@ -27,6 +27,7 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 #include <geocode-glib/geocode-location.h>
+#include <geocode-glib/geocode-bounding-box.h>
 
 G_BEGIN_DECLS
 
@@ -134,71 +135,76 @@ typedef enum {
 
 #define GEOCODE_TYPE_PLACE (geocode_place_get_type ())
 
-GeocodePlace *geocode_place_new                   (const char      *name,
-                                                   GeocodePlaceType place_type);
-GeocodePlace *geocode_place_new_with_location     (const char      *name,
-                                                   GeocodePlaceType place_type,
-                                                   GeocodeLocation *location);
+GeocodePlace *geocode_place_new                    (const char      *name,
+                                                    GeocodePlaceType place_type);
+GeocodePlace *geocode_place_new_with_location      (const char      *name,
+                                                    GeocodePlaceType place_type,
+                                                    GeocodeLocation *location);
 
-void geocode_place_set_name                       (GeocodePlace *place,
-                                                   const char   *name);
-const char *geocode_place_get_name                (GeocodePlace *place);
+void geocode_place_set_name                        (GeocodePlace *place,
+                                                    const char   *name);
+const char *geocode_place_get_name                 (GeocodePlace *place);
 
-GeocodePlaceType geocode_place_get_place_type     (GeocodePlace *place);
+GeocodePlaceType geocode_place_get_place_type      (GeocodePlace *place);
 
-void geocode_place_set_location                   (GeocodePlace    *place,
-                                                   GeocodeLocation *location);
-GeocodeLocation *geocode_place_get_location       (GeocodePlace *place);
+GeocodeBoundingBox *geocode_place_get_bounding_box (GeocodePlace *place);
 
-void geocode_place_set_street_address             (GeocodePlace *place,
-                                                   const char   *street_address);
-const char *geocode_place_get_street_address      (GeocodePlace *place);
+void geocode_place_set_bounding_box                (GeocodePlace *place,
+                                                    GeocodeBoundingBox *bbox);
 
-void geocode_place_set_street                     (GeocodePlace *place,
-                                                   const char   *street);
-const char *geocode_place_get_street              (GeocodePlace *place);
+void geocode_place_set_location                    (GeocodePlace    *place,
+                                                    GeocodeLocation *location);
+GeocodeLocation *geocode_place_get_location        (GeocodePlace *place);
 
-void geocode_place_set_building                   (GeocodePlace *place,
-                                                   const char   *building);
-const char *geocode_place_get_building            (GeocodePlace *place);
+void geocode_place_set_street_address              (GeocodePlace *place,
+                                                    const char   *street_address);
+const char *geocode_place_get_street_address       (GeocodePlace *place);
 
-void geocode_place_set_postal_code                (GeocodePlace *place,
-                                                   const char   *postal_code);
-const char *geocode_place_get_postal_code         (GeocodePlace *place);
+void geocode_place_set_street                      (GeocodePlace *place,
+                                                    const char   *street);
+const char *geocode_place_get_street               (GeocodePlace *place);
 
-void geocode_place_set_area                       (GeocodePlace *place,
-                                                   const char   *area);
-const char *geocode_place_get_area                (GeocodePlace *place);
+void geocode_place_set_building                    (GeocodePlace *place,
+                                                    const char   *building);
+const char *geocode_place_get_building             (GeocodePlace *place);
 
-void geocode_place_set_town                       (GeocodePlace *place,
-                                                   const char   *town);
-const char *geocode_place_get_town                (GeocodePlace *place);
+void geocode_place_set_postal_code                 (GeocodePlace *place,
+                                                    const char   *postal_code);
+const char *geocode_place_get_postal_code          (GeocodePlace *place);
 
-void geocode_place_set_county                     (GeocodePlace *place,
-                                                   const char   *county);
-const char *geocode_place_get_county              (GeocodePlace *place);
+void geocode_place_set_area                        (GeocodePlace *place,
+                                                    const char   *area);
+const char *geocode_place_get_area                 (GeocodePlace *place);
 
-void geocode_place_set_state                      (GeocodePlace *place,
-                                                   const char   *state);
-const char *geocode_place_get_state               (GeocodePlace *place);
+void geocode_place_set_town                        (GeocodePlace *place,
+                                                    const char   *town);
+const char *geocode_place_get_town                 (GeocodePlace *place);
 
-void geocode_place_set_administrative_area        (GeocodePlace *place,
-                                                   const char   *admin_area);
-const char *geocode_place_get_administrative_area (GeocodePlace *place);
+void geocode_place_set_county                      (GeocodePlace *place,
+                                                    const char   *county);
+const char *geocode_place_get_county               (GeocodePlace *place);
 
-void geocode_place_set_country_code               (GeocodePlace *place,
-                                                   const char   *country_code);
-const char *geocode_place_get_country_code        (GeocodePlace *place);
+void geocode_place_set_state                       (GeocodePlace *place,
+                                                    const char   *state);
+const char *geocode_place_get_state                (GeocodePlace *place);
 
-void geocode_place_set_country                    (GeocodePlace *place,
-                                                   const char   *country);
-const char *geocode_place_get_country             (GeocodePlace *place);
+void geocode_place_set_administrative_area         (GeocodePlace *place,
+                                                    const char   *admin_area);
+const char *geocode_place_get_administrative_area  (GeocodePlace *place);
 
-void geocode_place_set_continent                  (GeocodePlace *place,
-                                                   const char   *continent);
-const char *geocode_place_get_continent           (GeocodePlace *place);
+void geocode_place_set_country_code                (GeocodePlace *place,
+                                                    const char   *country_code);
+const char *geocode_place_get_country_code         (GeocodePlace *place);
 
-GIcon *geocode_place_get_icon                     (GeocodePlace *place);
+void geocode_place_set_country                     (GeocodePlace *place,
+                                                    const char   *country);
+const char *geocode_place_get_country              (GeocodePlace *place);
+
+void geocode_place_set_continent                   (GeocodePlace *place,
+                                                    const char   *continent);
+const char *geocode_place_get_continent            (GeocodePlace *place);
+
+GIcon *geocode_place_get_icon                      (GeocodePlace *place);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]