diff options
author | Benjamin Berg <bberg@redhat.com> | 2021-01-08 22:22:48 +0100 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2021-01-08 22:53:49 +0100 |
commit | 1b70ccc58bcdfb0a9f9c9325c81287af37167f0e (patch) | |
tree | b76b022e17c1f2e0f6e2e65f4c8e9212cb666ec6 | |
parent | d4da13ac58bab1b5bef69c6d2600d03d63c81d93 (diff) | |
download | gnome-settings-daemon-benzea/no-tz-cache.tar.gz |
datetime: Make use of new gweather APIbenzea/no-tz-cache
This mainly means free'ing the world when done and stopping to use the
now deprecated API (even though it would be acceptable in our case).
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | plugins/datetime/weather-tz.c | 21 |
2 files changed, 10 insertions, 13 deletions
diff --git a/meson.build b/meson.build index 7dbee64b..53962a7e 100644 --- a/meson.build +++ b/meson.build @@ -97,7 +97,7 @@ gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.34.2') gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.35.91') gtk_dep = dependency('gtk+-3.0', version: '>= 3.15.3') gtk_x11_dep = dependency('gtk+-x11-3.0') -gweather_dep = dependency('gweather-3.0', version: '>= 3.9.5') +gweather_dep = dependency('gweather-3.0', version: '>= 40.alpha') lcms_dep = dependency('lcms2', version: '>= 2.2') libcanberra_gtk_dep = dependency('libcanberra-gtk3') libgeoclue_dep = dependency('libgeoclue-2.0', version: '>= 2.3.1') diff --git a/plugins/datetime/weather-tz.c b/plugins/datetime/weather-tz.c index f1de2b94..63b9d217 100644 --- a/plugins/datetime/weather-tz.c +++ b/plugins/datetime/weather-tz.c @@ -29,17 +29,14 @@ static GList * location_get_cities (GWeatherLocation *parent_location) { GList *cities = NULL; - GWeatherLocation **children; - gint i; - - children = gweather_location_get_children (parent_location); - for (i = 0; children[i]; i++) { - if (gweather_location_get_level (children[i]) == GWEATHER_LOCATION_CITY) { - cities = g_list_prepend (cities, - children[i]); + GWeatherLocation *child = NULL; + + while ((child = gweather_location_next_child (parent_location, child))) { + if (gweather_location_get_level (child) == GWEATHER_LOCATION_CITY) { + cities = g_list_prepend (cities, gweather_location_ref (child)); } else { cities = g_list_concat (cities, - location_get_cities (children[i])); + location_get_cities (child)); } } @@ -101,10 +98,10 @@ load_timezones (GList *cities) GList * weather_tz_db_get_locations (const gchar *country_code) { - GList *cities; + g_autoptr(GWeatherLocation) world = NULL; + g_autoptr(GWeatherLocation) country = NULL; + g_autolist(GWeatherLocation) cities = NULL; GList *tz_locations; - GWeatherLocation *world; - GWeatherLocation *country; world = gweather_location_get_world (); |