[evolution-data-server] Bug 723928 - Weather backend: Replace two deprecated gweather_* functions
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 723928 - Weather backend: Replace two deprecated gweather_* functions
- Date: Tue, 7 Apr 2015 14:04:36 +0000 (UTC)
commit 149d5880979512459259f5b2cd09c901242ed3fe
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 7 16:04:34 2015 +0200
Bug 723928 - Weather backend: Replace two deprecated gweather_* functions
calendar/backends/weather/e-cal-backend-weather.c | 38 +++++++++++++++++++-
calendar/backends/weather/e-weather-source.c | 3 +-
configure.ac | 2 +-
3 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/calendar/backends/weather/e-cal-backend-weather.c
b/calendar/backends/weather/e-cal-backend-weather.c
index de3096b..1183dc1 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -342,6 +342,40 @@ cal_backend_weather_get_temp (gdouble value,
return g_strdup_printf (_("%.1f"), value);
}
+static gchar *
+cal_weather_get_info_forecast_text (GWeatherInfo *info)
+{
+ GString *buffer;
+ GSList *forecasts, *link;
+
+ if (!info)
+ return NULL;
+
+ buffer = g_string_new ("");
+
+ forecasts = gweather_info_get_forecast_list (info);
+ for (link = forecasts; link; link = g_slist_next (link)) {
+ GWeatherInfo *nfo = link->data;
+ gchar *date, *summary, *temp;
+
+ date = gweather_info_get_update (nfo);
+ summary = gweather_info_get_conditions (nfo);
+ if (g_str_equal (summary, "-")) {
+ g_free (summary);
+ summary = gweather_info_get_sky (nfo);
+ }
+ temp = gweather_info_get_temp_summary (nfo);
+
+ g_string_append_printf (buffer, " * %s: %s, %s\n", date, summary, temp);
+
+ g_free (date);
+ g_free (summary);
+ g_free (temp);
+ }
+
+ return g_string_free (buffer, FALSE);
+}
+
static ECalComponent *
create_weather (ECalBackendWeather *cbw,
GWeatherInfo *report,
@@ -436,7 +470,7 @@ create_weather (ECalBackendWeather *cbw,
e_cal_component_set_summary (cal_comp, &comp_summary);
g_free ((gchar *) comp_summary.value);
- tmp = gweather_info_get_forecast (report);
+ tmp = cal_weather_get_info_forecast_text (report);
comp_summary.value = gweather_info_get_weather_summary (report);
description = g_new0 (ECalComponentText, 1);
@@ -449,7 +483,7 @@ create_weather (ECalBackendWeather *cbw,
g_string_append (builder, comp_summary.value);
g_string_append_c (builder, '\n');
}
- if (tmp) {
+ if (tmp && *tmp) {
g_string_append (builder, _("Forecast"));
g_string_append_c (builder, ':');
if (!is_forecast)
diff --git a/calendar/backends/weather/e-weather-source.c b/calendar/backends/weather/e-weather-source.c
index 7af068f..340aa6e 100644
--- a/calendar/backends/weather/e-weather-source.c
+++ b/calendar/backends/weather/e-weather-source.c
@@ -121,7 +121,7 @@ e_weather_source_new (const gchar *location)
if (location == NULL)
return NULL;
- world = gweather_location_new_world (FALSE);
+ world = gweather_location_get_world ();
if (strncmp (location, "ccf/", 4) == 0)
location += 4;
@@ -144,7 +144,6 @@ e_weather_source_new (const gchar *location)
if (glocation != NULL)
gweather_location_ref (glocation);
- gweather_location_unref (world);
g_strfreev (tokens);
if (glocation == NULL)
diff --git a/configure.ac b/configure.ac
index b9cede5..f912c51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ m4_define([libical_minimum_version], [0.43])
dnl Optional Packages
m4_define([goa_minimum_version], [3.8])
-m4_define([gweather_minimum_version], [3.8])
+m4_define([gweather_minimum_version], [3.10])
m4_define([libaccounts_glib_minimum_version], [1.4])
m4_define([libsignon_glib_minimum_version], [1.8])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]