[Xfce4-commits] <xfce4-weather-plugin:master> Improve auto-detected location name somewhat.

Harald Judt noreply at xfce.org
Tue Nov 20 20:18:18 CET 2012


Updating branch refs/heads/master
         to 613f4a23190fce19f0e2a342ed9fc7ab0b6603be (commit)
       from 75b4ab989f5749ac47a4badad4750b8e9f1eceab (commit)

commit 613f4a23190fce19f0e2a342ed9fc7ab0b6603be
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Nov 20 20:12:09 2012 +0100

    Improve auto-detected location name somewhat.
    
    Avoid entries like "(none)".

 panel-plugin/weather-search.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 3a83178..e0fa05f 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -353,13 +353,15 @@ cb_geolocation(SoupSession *session,
         return;
     }
 
-    if (geo->country_name && geo->city)
+    if (geo->country_name && geo->city && strcmp(geo->city, "(none)"))
         if (geo->country_code && !strcmp(geo->country_code, "US") &&
             geo->region_name)
             full_loc = g_strdup_printf("%s, %s", geo->city, geo->region_name);
         else
             full_loc = g_strdup_printf("%s, %s", geo->city, geo->country_name);
-    else if (geo->country_name)
+    else if (geo->region_name && strcmp(geo->region_name, "(none)"))
+        full_loc = g_strdup(geo->region_name);
+    else if (geo->country_name && strcmp(geo->country_name, "(none)"))
         full_loc = g_strdup(geo->country_name);
     else if (geo->latitude && geo->longitude) {
         /*


More information about the Xfce4-commits mailing list