[gnome-clocks] Create the Weather.Info with GObject.new



commit e091c4236002710d91e6d392b4fff4270e04165d
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Sep 21 09:36:28 2013 +0200

    Create the Weather.Info with GObject.new
    
    The normal constructor implicitely queries the online providers
    while we just want the static data.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708498

 src/world.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/world.vala b/src/world.vala
index c7e708f..3436c3b 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -139,8 +139,11 @@ private class Item : Object, ContentItem {
         local_time = wallclock.date_time;
         date_time = local_time.to_timezone (time_zone);
 
-        // We don't need to call update(), we're using only astronomical data
-        weather_info = new GWeather.Info (location, GWeather.ForecastType.LIST);
+        // We don't use the normal constructor since we only want static data
+        // and we do not want update() to be called.
+        weather_info = (GWeather.Info) Object.new (typeof (GWeather.Info),
+                                                   location: location,
+                                                   enabled_providers: GWeather.Provider.NONE);
     }
 
     public void get_thumb_properties (out string text, out string subtext, out Gdk.Pixbuf? pixbuf, out 
string css_class) {


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