[geocode-glib] lib: Add geocode_location_set_description() helper



commit 2c5bd3fee3b2a4c4ab533ff6fa1c27b31ed404ce
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 3 07:59:19 2012 +0100

    lib: Add geocode_location_set_description() helper

 geocode-glib/geocode-glib.symbols |    1 +
 geocode-glib/geocode-location.c   |   17 +++++++++++++++++
 geocode-glib/geocode-location.h   |    3 +++
 3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/geocode-glib/geocode-glib.symbols b/geocode-glib/geocode-glib.symbols
index 0436a5a..513ca69 100644
--- a/geocode-glib/geocode-glib.symbols
+++ b/geocode-glib/geocode-glib.symbols
@@ -3,6 +3,7 @@ geocode_location_new
 geocode_location_new_with_description
 geocode_location_free
 geocode_location_get_distance_from
+geocode_location_set_description
 geocode_forward_get_type
 geocode_forward_new_for_string
 geocode_forward_new_for_params
diff --git a/geocode-glib/geocode-location.c b/geocode-glib/geocode-location.c
index 7fe4642..9855f39 100644
--- a/geocode-glib/geocode-location.c
+++ b/geocode-glib/geocode-location.c
@@ -120,6 +120,23 @@ geocode_location_new_with_description (gdouble     latitude,
 }
 
 /**
+ * geocode_location_set_description:
+ * @description: a description for the location
+ *
+ * Sets the #GeocodeLocation object's @description to
+ * the passed value.
+ **/
+void
+geocode_location_set_description (GeocodeLocation *loc,
+				  const char      *description)
+{
+	g_return_if_fail (loc != NULL);
+
+	g_free (loc->description);
+	loc->description = g_strdup (description);
+}
+
+/**
  * geocode_location_get_distance_from:
  * @loca: a #GeocodeLocation
  * @locb: a #GeocodeLocation
diff --git a/geocode-glib/geocode-location.h b/geocode-glib/geocode-location.h
index a16525d..351bf59 100644
--- a/geocode-glib/geocode-location.h
+++ b/geocode-glib/geocode-location.h
@@ -60,6 +60,9 @@ GeocodeLocation *geocode_location_new_with_description (gdouble     latitude,
 double geocode_location_get_distance_from (GeocodeLocation *loca,
 					   GeocodeLocation *locb);
 
+void geocode_location_set_description (GeocodeLocation *loc,
+				       const char      *description);
+
 void geocode_location_free (GeocodeLocation *loc);
 
 G_END_DECLS



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