[libgweather] GWeatherLocation: Warn about duplicate countries



commit 3fd40c80052ac4af4c8aee3411b6222c6e147488
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 14 13:09:42 2017 +0100

    GWeatherLocation: Warn about duplicate countries
    
    So those can be merged.

 libgweather/gweather-location.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 34353e7..e68a737 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -348,6 +348,12 @@ location_new_from_xml (GWeatherParser *parser, GWeatherLocationLevel level,
 
     if (level == GWEATHER_LOCATION_COUNTRY) {
        if (loc->country_code) {
+           GWeatherLocation *existing;
+
+           existing = g_hash_table_lookup (parser->country_code_cache, loc->country_code);
+           if (existing)
+               g_warning ("A country with country code '%s' is already in the database",
+                          loc->country_code);
            g_hash_table_replace (parser->country_code_cache, loc->country_code,
                                  gweather_location_ref (loc));
        }


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