summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2022-03-01 18:16:25 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2022-03-01 18:16:25 +0000
commit1e89ca9c89395e6e73c426b7e3dce014c7d310f7 (patch)
treeafddd4dec765d3c71bb33413d18bb8e0ccc3f2db
parentd84d9614b12fa628d5fafdeaaf9f723effcd8bd1 (diff)
downloadlibgweather-ebassi/issue-161.tar.gz
docs: Add get_timezone_name() to the migration guideebassi/issue-161
Explain how to replace the old time zone name getter.
-rw-r--r--doc/migrating-3to4.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/migrating-3to4.md b/doc/migrating-3to4.md
index 5c2f5fb..fc63d58 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);
+```