[libgweather/benzea/wip-variant-backend: 4/12] location: Add accessor function for english sort name



commit 50bf80015f18ee2b0c979dd81b6a160a2a56d631
Author: Benjamin Berg <bberg redhat com>
Date:   Sun Apr 26 15:14:07 2020 +0200

    location: Add accessor function for english sort name

 libgweather/gweather-location.c | 20 ++++++++++++++++++++
 libgweather/gweather-location.h |  2 ++
 2 files changed, 22 insertions(+)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 1477e51..974c7c8 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -616,6 +616,26 @@ gweather_location_get_english_name (GWeatherLocation *loc)
     return loc->english_name;
 }
 
+/**
+ * gweather_location_get_english_sort_name:
+ * @loc: a #GWeatherLocation
+ *
+ * Gets @loc's english "sort name", which is the english name after having
+ * g_utf8_normalize() (with %G_NORMALIZE_ALL) and g_utf8_casefold()
+ * called on it. You can use this to sort locations, or to comparing
+ * user input against a location name.
+ *
+ * Return value: @loc's English name for sorting
+ * Since: XXX
+ **/
+const char *
+gweather_location_get_english_sort_name (GWeatherLocation *loc)
+{
+    g_return_val_if_fail (loc != NULL, NULL);
+
+    return loc->english_sort_name;
+}
+
 /**
  * gweather_location_get_level:
  * @loc: a #GWeatherLocation
diff --git a/libgweather/gweather-location.h b/libgweather/gweather-location.h
index b33afb5..701862d 100644
--- a/libgweather/gweather-location.h
+++ b/libgweather/gweather-location.h
@@ -65,6 +65,8 @@ const char            *gweather_location_get_sort_name  (GWeatherLocation  *loc)
 GWEATHER_EXTERN
 const char            *gweather_location_get_english_name (GWeatherLocation  *loc);
 GWEATHER_EXTERN
+const char            *gweather_location_get_english_sort_name (GWeatherLocation  *loc);
+GWEATHER_EXTERN
 GWeatherLocationLevel  gweather_location_get_level      (GWeatherLocation  *loc);
 GWEATHER_EXTERN
 GWeatherLocation      *gweather_location_get_parent     (GWeatherLocation  *loc);


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