[evolution-data-server] Bug 791327 - Adapt to gweather_info_new() API change



commit d45a5b6261c8ec97b0fbde74d8c5212caff6ef2f
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 11 10:33:25 2017 +0100

    Bug 791327 - Adapt to gweather_info_new() API change

 CMakeLists.txt                                   |   13 +++++++++++++
 config.h.in                                      |    3 +++
 src/calendar/backends/weather/e-weather-source.c |   11 ++++++++---
 3 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6f396c..a9ec83f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -731,6 +731,19 @@ 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})
+
+       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 6d4e506..7ebf216 100644
--- a/config.h.in
+++ b/config.h.in
@@ -190,3 +190,6 @@
 
 /* Have libaccounts-glib */
 #cmakedefine HAVE_UOA 1
+
+/* gweather_info_new() has only one argument */
+#cmakedefine HAVE_ONE_ARG_GWEATHER_INFO_NEW 1
diff --git a/src/calendar/backends/weather/e-weather-source.c 
b/src/calendar/backends/weather/e-weather-source.c
index 340aa6e..8aada01 100644
--- a/src/calendar/backends/weather/e-weather-source.c
+++ b/src/calendar/backends/weather/e-weather-source.c
@@ -17,10 +17,12 @@
  * Authors: David Trowbridge <trowbrds cs colorado edu>
  */
 
-#include "e-weather-source.h"
+#include "evolution-data-server-config.h"
 
 #include <string.h>
 
+#include "e-weather-source.h"
+
 #define E_WEATHER_SOURCE_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_WEATHER_SOURCE, EWeatherSourcePrivate))
@@ -185,8 +187,11 @@ e_weather_source_parse (EWeatherSource *source,
 
        if (source->priv->info == NULL) {
                source->priv->info = gweather_info_new (
-                       source->priv->location,
-                       GWEATHER_FORECAST_LIST);
+                       source->priv->location
+               #ifndef HAVE_ONE_ARG_GWEATHER_INFO_NEW
+                       , GWEATHER_FORECAST_LIST
+               #endif
+               );
                gweather_info_set_enabled_providers (source->priv->info, GWEATHER_PROVIDER_ALL);
                g_signal_connect (
                        source->priv->info, "updated",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]