[gnome-clocks] Use new GWeather API instead of manual utility



commit 69bdd7c57401765f65cb95c59eb9b5634a3297dc
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Aug 27 21:58:21 2014 +0200

    Use new GWeather API instead of manual utility

 configure.ac             |    2 +-
 src/search-provider.vala |    2 +-
 src/utils.vala           |   10 ----------
 src/world.vala           |    2 +-
 4 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index da7c7fe..9a994dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,7 @@ PKG_CHECK_MODULES(CLOCKS, [
     glib-2.0 >= 2.39
     gtk+-3.0 >= 3.9.11
     libcanberra >= 0.30
-    gweather-3.0 >= 3.9.91
+    gweather-3.0 >= 3.13.91
     gnome-desktop-3.0 >= 3.7.90
     geocode-glib-1.0 >= 0.99.4
     geoclue-2.0 >= 1.99.3
diff --git a/src/search-provider.vala b/src/search-provider.vala
index ca3dcd5..8529cde 100644
--- a/src/search-provider.vala
+++ b/src/search-provider.vala
@@ -38,7 +38,7 @@ public class SearchProvider : Object {
 
     private bool location_matches (GWeather.Location location, string[] normalized_terms) {
         string city = location.get_city_name ();
-        string country = Utils.get_country_name (location);
+        string country = location.get_country_name ();
         if (city == null || country == null) {
             return false;
         }
diff --git a/src/utils.vala b/src/utils.vala
index d37f67d..e14700a 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -51,16 +51,6 @@ public void time_to_hms (double t, out int h, out int m, out int s, out double r
     remainder = t - s;
 }
 
-public string? get_country_name (GWeather.Location location) {
-    var country = location;
-
-    while (country != null && country.get_level () != GWeather.LocationLevel.COUNTRY) {
-        country = country.get_parent ();
-    }
-
-    return country != null ? country.get_name () : null;
-}
-
 // TODO: For now we are wrapping Gnome's clock, but we should probably
 // implement our own class, maybe using gnome-datetime-source
 // Especially if we want to try to use CLOCK_REALTIME_ALARM
diff --git a/src/world.vala b/src/world.vala
index 81e6993..d04382d 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -56,7 +56,7 @@ public class Item : Object, ContentItem {
 
     public string? contry_name {
         owned get {
-            return Utils.get_country_name (location);
+            return location.get_country_name ();
         }
     }
 


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