summaryrefslogtreecommitdiff
path: root/src/gclue-location.c
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>2022-10-05 23:50:46 +0200
committerMaciej S. Szmigiero <mail@maciej.szmigiero.name>2022-10-06 00:10:45 +0200
commit95ca094d08d63a15a6948706ed2959c3cd1a7c9a (patch)
tree68ed271781666adb47c06954cf4e3abe63c48d0a /src/gclue-location.c
parentbc4252ea5c2c4957f713d5136536379713c357ac (diff)
downloadgeoclue-95ca094d08d63a15a6948706ed2959c3cd1a7c9a.tar.gz
location: Add a generic gclue_location_duplicate_fresh() function
Instead of open-coding its equivalent in gclue-wifi.c (future location sources will also make use of this function).
Diffstat (limited to 'src/gclue-location.c')
-rw-r--r--src/gclue-location.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gclue-location.c b/src/gclue-location.c
index cf5ff97..0bc957c 100644
--- a/src/gclue-location.c
+++ b/src/gclue-location.c
@@ -770,7 +770,7 @@ gclue_location_create_from_nmeas (const char *nmeas[],
* gclue_location_duplicate:
* @location: the #GClueLocation instance to duplicate.
*
- * Creates a new copy of @location object.
+ * Creates a new copy of @location object (with the same timestamp).
*
* Returns: a new #GClueLocation object. Use g_object_unref() when done.
**/
@@ -792,6 +792,31 @@ gclue_location_duplicate (GClueLocation *location)
NULL);
}
+/**
+ * gclue_location_duplicate_fresh:
+ * @location: the #GClueLocation instance to duplicate.
+ *
+ * Creates a new copy of @location object with a refreshed timestamp.
+ *
+ * Returns: a new #GClueLocation object. Use g_object_unref() when done.
+ **/
+GClueLocation *
+gclue_location_duplicate_fresh (GClueLocation *location)
+{
+ g_return_val_if_fail (GCLUE_IS_LOCATION (location), NULL);
+
+ return g_object_new
+ (GCLUE_TYPE_LOCATION,
+ "latitude", location->priv->latitude,
+ "longitude", location->priv->longitude,
+ "accuracy", location->priv->accuracy,
+ "altitude", location->priv->altitude,
+ "speed", location->priv->speed,
+ "heading", location->priv->heading,
+ "description", location->priv->description,
+ NULL);
+}
+
const char *
gclue_location_get_description (GClueLocation *loc)
{