[libgweather/ebassi/issue-161] docs: Add get_timezone_name() to the migration guide
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/ebassi/issue-161] docs: Add get_timezone_name() to the migration guide
- Date: Tue, 1 Mar 2022 18:17:04 +0000 (UTC)
commit 1e89ca9c89395e6e73c426b7e3dce014c7d310f7
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Mar 1 18:16:25 2022 +0000
docs: Add get_timezone_name() to the migration guide
Explain how to replace the old time zone name getter.
doc/migrating-3to4.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/doc/migrating-3to4.md b/doc/migrating-3to4.md
index 5c2f5fb5..fc63d586 100644
--- a/doc/migrating-3to4.md
+++ b/doc/migrating-3to4.md
@@ -83,6 +83,8 @@ The [struct@GLib.TimeZone] type provides all the functionality of the
`GWeatherTimezone` structure, and includes all the interval data from
the time zone database.
+#### Timezone offsets
+
If you are using `gweather_timezone_get_offset()` to compare two time
zones, you can replace that with [`method@GLib.TimeZone.find_interval`]
to find the interval relative to the current time; and then use
@@ -117,3 +119,22 @@ int interval_b = g_time_zone_find_interval (tz_b, G_TIME_TYPE_STANDARD, now);
int offset_a = g_time_zone_get_offset (tz_a, interval_a);
int offset_b = g_time_zone_get_offset (tz_b, interval_b);
```
+
+#### Timezone names
+
+If you are using `gweather_timezone_get_name()` to retrieve the localized
+name of a time zone, you can replace that function with
+[`method@GWeather.Location.get_timezone_name`], with the time zone identifier
+returned by [`method@GLib.TimeZone.get_identifier`]. If you were using
+`gweather_timezone_get_utc()` like this:
+
+```c
+GWeatherTimezone *utc = gweather_timezone_get_utc ();
+const char *name = gweather_timezone_get_name (utc);
+
+you can replace it with:
+
+```c
+GWeatherLocation *world = gweather_location_get_world ();
+const char *name = gweather_location_get_timezone_name (world, NULL);
+```
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]