[evolution-data-server] I#288 - Adapt to libgweather 40.alpha API changes
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] I#288 - Adapt to libgweather 40.alpha API changes
- Date: Wed, 13 Jan 2021 13:51:08 +0000 (UTC)
commit bc5ef3b261710448ee0d05e7637adcf1f0b7cbc0
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 13 14:48:37 2021 +0100
I#288 - Adapt to libgweather 40.alpha API changes
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/288
src/calendar/backends/weather/e-weather-source.c | 44 ++++++++++++++++++++----
1 file changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/src/calendar/backends/weather/e-weather-source.c
b/src/calendar/backends/weather/e-weather-source.c
index dee8a4d77..3052d034c 100644
--- a/src/calendar/backends/weather/e-weather-source.c
+++ b/src/calendar/backends/weather/e-weather-source.c
@@ -67,8 +67,13 @@ weather_source_find_location_by_coords (GWeatherLocation *start,
gdouble latitude,
gdouble longitude)
{
- GWeatherLocation *location, **children;
+ GWeatherLocation *location;
+ #if GWEATHER_CHECK_VERSION(3, 39, 0)
+ GWeatherLocation *child = NULL;
+ #else
+ GWeatherLocation **children;
gint ii;
+ #endif
if (!start)
return NULL;
@@ -79,16 +84,32 @@ weather_source_find_location_by_coords (GWeatherLocation *start,
gweather_location_get_coords (location, &lat, &lon);
- if (lat == latitude && lon == longitude)
+ if (lat == latitude && lon == longitude) {
+ gweather_location_ref (location);
return location;
+ }
}
+ #if GWEATHER_CHECK_VERSION(3, 39, 0)
+ while (child = gweather_location_next_child (location, child), child) {
+ GWeatherLocation *result;
+
+ result = weather_source_find_location_by_coords (child, latitude, longitude);
+ if (result) {
+ gweather_location_unref (child);
+ return result;
+ }
+ }
+ #else
children = gweather_location_get_children (location);
for (ii = 0; children[ii]; ii++) {
location = weather_source_find_location_by_coords (children[ii], latitude, longitude);
- if (location)
+ if (location) {
+ gweather_location_ref (location);
return location;
+ }
}
+ #endif
return NULL;
}
@@ -122,6 +143,11 @@ e_weather_source_new (const gchar *location)
glocation = gweather_location_find_by_station_code (world, tokens[0]);
+#if !GWEATHER_CHECK_VERSION(3, 39, 0)
+ if (glocation)
+ gweather_location_ref (glocation);
+#endif
+
if (!glocation) {
gdouble latitude, longitude;
gchar *endptr = NULL;
@@ -133,9 +159,9 @@ e_weather_source_new (const gchar *location)
}
}
- if (glocation != NULL)
- gweather_location_ref (glocation);
-
+#if GWEATHER_CHECK_VERSION(3, 39, 0)
+ gweather_location_unref (world);
+#endif
g_strfreev (tokens);
if (glocation == NULL)
@@ -182,7 +208,11 @@ e_weather_source_parse (EWeatherSource *source,
, GWEATHER_FORECAST_LIST
#endif
);
- gweather_info_set_enabled_providers (source->priv->info, GWEATHER_PROVIDER_ALL);
+ #if GWEATHER_CHECK_VERSION(3, 39, 0)
+ gweather_info_set_application_id (source->priv->info, "org.gnome.Evolution-data-server");
+ gweather_info_set_contact_info (source->priv->info, "evolution-hackers gnome org");
+ #endif
+ gweather_info_set_enabled_providers (source->priv->info, GWEATHER_PROVIDER_METAR |
GWEATHER_PROVIDER_IWIN);
g_signal_connect_object (
source->priv->info, "updated",
G_CALLBACK (weather_source_updated_cb), source, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]