[libgweather/benzea/pre-variant-backend-cleanups: 6/8] location: Add accessor function for english sort name
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/benzea/pre-variant-backend-cleanups: 6/8] location: Add accessor function for english sort name
- Date: Thu, 25 Jun 2020 21:26:01 +0000 (UTC)
commit b7f0ca2813a21c49d4417f7057c991a6c57b6521
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 1477e51a..974c7c87 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 b33afb55..701862d8 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]