[evolution-data-server/jjardon/libgweather4] Port to libgweather4
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/jjardon/libgweather4] Port to libgweather4
- Date: Sat, 8 Jan 2022 15:37:57 +0000 (UTC)
commit 7d2b7e54e4812d7408a0abb36964d6ead716e237
Author: Javier Jardón <jjardon gnome org>
Date: Sat Jan 8 15:30:52 2022 +0000
Port to libgweather4
CMakeLists.txt | 12 ++-------
config.h.in | 3 ---
.../backends/weather/e-cal-backend-weather.c | 4 +--
src/calendar/backends/weather/e-weather-source.c | 29 +++-------------------
4 files changed, 8 insertions(+), 40 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73f76f8c2..eb88473b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,7 +118,7 @@ set(sqlite_minimum_version 3.7.17)
# Optional Packages
set(goa_minimum_version 3.8)
-set(gweather_minimum_version 3.10)
+set(gweather_minimum_version 41)
set(libaccounts_glib_minimum_version 1.4)
set(libsignon_glib_minimum_version 1.8)
set(json_glib_minimum_version 1.0.4)
@@ -755,18 +755,10 @@ endif(NOT have_addrinfo)
add_printable_option(ENABLE_WEATHER "Build the weather calendar backend" ON)
if(ENABLE_WEATHER)
- pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER
gweather-3.0>=${gweather_minimum_version})
+ pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER
gweather4>=${gweather_minimum_version})
set(CMAKE_REQUIRED_INCLUDES ${LIBGWEATHER_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LIBGWEATHER_LDFLAGS})
- CHECK_C_SOURCE_COMPILES("#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
- #include <libgweather/gweather.h>
- #undef GWEATHER_I_KNOW_THIS_IS_UNSTABLE
-
- int main(void) {
- gweather_info_new (NULL);
- return 0;
- }" HAVE_ONE_ARG_GWEATHER_INFO_NEW)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
endif(ENABLE_WEATHER)
diff --git a/config.h.in b/config.h.in
index 4e79549ab..0060789ee 100644
--- a/config.h.in
+++ b/config.h.in
@@ -194,9 +194,6 @@
#define O_LARGEFILE 0
#endif /* HAVE_O_LARGEFILE */
-/* gweather_info_new() has only one argument */
-#cmakedefine HAVE_ONE_ARG_GWEATHER_INFO_NEW 1
-
/* evolution-alarm-notify - Define if using Canberra-GTK for sound */
#cmakedefine HAVE_CANBERRA 1
diff --git a/src/calendar/backends/weather/e-cal-backend-weather.c
b/src/calendar/backends/weather/e-cal-backend-weather.c
index 72faccd62..c757e36de 100644
--- a/src/calendar/backends/weather/e-cal-backend-weather.c
+++ b/src/calendar/backends/weather/e-cal-backend-weather.c
@@ -464,7 +464,7 @@ create_weather (ECalBackendWeather *cbw,
time_t update_time;
ICalTimezone *update_zone = NULL;
const GWeatherLocation *location;
- const GWeatherTimezone *w_timezone;
+ const GTimezone *w_timezone;
gdouble tmin = 0.0, tmax = 0.0, temp = 0.0;
g_return_val_if_fail (E_IS_CAL_BACKEND_WEATHER (cbw), NULL);
@@ -484,7 +484,7 @@ create_weather (ECalBackendWeather *cbw,
/* use timezone of the location to determine date for which this is set */
location = gweather_info_get_location (report);
if (location && (w_timezone = gweather_location_get_timezone ((GWeatherLocation *) location)))
- update_zone = i_cal_timezone_get_builtin_timezone (gweather_timezone_get_tzid
((GWeatherTimezone *) w_timezone));
+ update_zone = i_cal_timezone_get_builtin_timezone (g_time_zone_get_identifier ((GTimezone *)
w_timezone));
if (!update_zone)
update_zone = i_cal_timezone_get_utc_timezone ();
diff --git a/src/calendar/backends/weather/e-weather-source.c
b/src/calendar/backends/weather/e-weather-source.c
index 3052d034c..55579730f 100644
--- a/src/calendar/backends/weather/e-weather-source.c
+++ b/src/calendar/backends/weather/e-weather-source.c
@@ -39,7 +39,7 @@ weather_source_dispose (GObject *object)
EWeatherSourcePrivate *priv;
priv = E_WEATHER_SOURCE (object)->priv;
- g_clear_pointer (&priv->location, gweather_location_unref);
+ g_clear_pointer (&priv->location, g_object_unref);
g_clear_object (&priv->info);
@@ -85,31 +85,20 @@ weather_source_find_location_by_coords (GWeatherLocation *start,
gweather_location_get_coords (location, &lat, &lon);
if (lat == latitude && lon == longitude) {
- gweather_location_ref (location);
+ g_object_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);
+ g_object_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) {
- gweather_location_ref (location);
- return location;
- }
- }
- #endif
return NULL;
}
@@ -143,11 +132,6 @@ 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;
@@ -159,9 +143,7 @@ e_weather_source_new (const gchar *location)
}
}
-#if GWEATHER_CHECK_VERSION(3, 39, 0)
- gweather_location_unref (world);
-#endif
+ g_object_unref (world);
g_strfreev (tokens);
if (glocation == NULL)
@@ -204,9 +186,6 @@ e_weather_source_parse (EWeatherSource *source,
if (source->priv->info == NULL) {
source->priv->info = gweather_info_new (
source->priv->location
- #ifndef HAVE_ONE_ARG_GWEATHER_INFO_NEW
- , GWEATHER_FORECAST_LIST
- #endif
);
#if GWEATHER_CHECK_VERSION(3, 39, 0)
gweather_info_set_application_id (source->priv->info, "org.gnome.Evolution-data-server");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]