[libgweather/wip/hadess/fix-invalid-forecast: 1/5] tests: Print providers that we're setting when testing weather
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/fix-invalid-forecast: 1/5] tests: Print providers that we're setting when testing weather
- Date: Tue, 27 Aug 2019 12:31:08 +0000 (UTC)
commit deafa3e4c298e205d19f24337b54610b171cc4ea
Author: Bastien Nocera <hadess hadess net>
Date: Tue Aug 27 14:35:51 2019 +0300
tests: Print providers that we're setting when testing weather
libgweather/test_weather.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/libgweather/test_weather.c b/libgweather/test_weather.c
index 24e02d7..4ad8a1d 100644
--- a/libgweather/test_weather.c
+++ b/libgweather/test_weather.c
@@ -89,11 +89,37 @@ weather_updated (GWeatherInfo *info,
g_main_loop_quit (loop);
}
-static void
+#define ADD_PROVIDER_STR(x) { \
+ if (s->len != 0) \
+ g_string_append (s, ", "); \
+ g_string_append(s, x); \
+}
+
+static gboolean
set_providers (GWeatherInfo *info)
{
- //FIXME print the current providers
+ GString *s;
+
+ s = g_string_new (NULL);
+ if (providers & GWEATHER_PROVIDER_METAR)
+ ADD_PROVIDER_STR("METAR");
+ if (providers & GWEATHER_PROVIDER_IWIN)
+ ADD_PROVIDER_STR("IWIN");
+ if (providers & GWEATHER_PROVIDER_YAHOO)
+ ADD_PROVIDER_STR("YAHOO");
+ if (providers & GWEATHER_PROVIDER_YR_NO)
+ ADD_PROVIDER_STR("YR_NO");
+ if (providers & GWEATHER_PROVIDER_OWM)
+ ADD_PROVIDER_STR("OWM");
+ if (providers == GWEATHER_PROVIDER_NONE) {
+ g_string_free (s, TRUE);
+ g_warning ("No providers enabled, failing");
+ return FALSE;
+ }
+ g_message ("Enabling providers (%s)", s->str);
+ g_string_free (s, TRUE);
gweather_info_set_enabled_providers (info, providers);
+ return TRUE;
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]