[libgweather/benzea/wip-variant-backend: 7/15] location: Add accessor function for english sort name
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/benzea/wip-variant-backend: 7/15] location: Add accessor function for english sort name
- Date: Sun, 26 Apr 2020 15:51:54 +0000 (UTC)
commit 38acdac4b5c8f8133919ac5cc8267f74e09bb6d5
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 160bb76..44f6e69 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -543,6 +543,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 30b794e..709a821 100644
--- a/libgweather/gweather-location.h
+++ b/libgweather/gweather-location.h
@@ -67,6 +67,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]