[libgweather/wip/hadess/3.28.3: 4/10] weather: Don't try to fetch weather for named timezones



commit c07c58848d33bc5bc204e9853309f2f30447d2db
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 8 12:28:26 2018 +0200

    weather: Don't try to fetch weather for named timezones
    
    Those would likely fail anyway, so return early.

 libgweather/weather-metar.c | 3 +++
 libgweather/weather-wx.c    | 3 +++
 2 files changed, 6 insertions(+)
---
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index aeb65ad..b22eaa9 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -629,6 +629,9 @@ metar_start_open (GWeatherInfo *info)
     priv->valid = priv->network_error = FALSE;
     loc = &priv->location;
 
+    if (!loc->latlon_valid)
+        return;
+
     msg = soup_form_request_new (
        "GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam";,
        "dataSource", "metars",
diff --git a/libgweather/weather-wx.c b/libgweather/weather-wx.c
index 2dee559..f1e57d7 100644
--- a/libgweather/weather-wx.c
+++ b/libgweather/weather-wx.c
@@ -86,6 +86,9 @@ wx_start_open (GWeatherInfo *info)
     priv->radar_loader = gdk_pixbuf_loader_new ();
     loc = &priv->location;
 
+    if (!loc->latlon_valid)
+       return;
+
     if (priv->radar_url)
        url = g_strdup (priv->radar_url);
     else {


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