Commit d97a9654 authored by Bastien Nocera's avatar Bastien Nocera

Add UTC and "Anywhere on Earth" clocks

Requires a newer libgweather, and some careful stepping around the fact
that there is no weather info for timezones.

https://bugzilla.gnome.org/show_bug.cgi?id=692243
parent 1698b5ff
......@@ -84,6 +84,7 @@
</child>
<child>
<object class="GWeatherLocationEntry" id="location_entry">
<property name="show-named-timezones">True</property>
<property name="width_request">400</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......
......@@ -14,7 +14,7 @@ gio = dependency('gio-2.0', version: '>=2.44')
gobject = dependency('gobject-2.0', version: '>=2.44')
gtk = dependency('gtk+-3.0', version: '>=3.20')
gsound = dependency('gsound', version: '>=0.98')
gweather = dependency('gweather-3.0', version: '>=3.14')
gweather = dependency('gweather-3.0', version: '>=3.27.2')
gnomedesktop = dependency('gnome-desktop-3.0', version: '>=3.8')
geocodeglib = dependency('geocode-glib-1.0', version: '>=1.0')
libgeoclue = dependency('libgeoclue-2.0', version: '>=2.4')
......
......@@ -77,12 +77,19 @@ public class Item : Object, ContentItem {
public bool is_daytime {
get {
return weather_info.is_daytime ();
if (weather_info != null) {
return weather_info.is_daytime ();
}
return true;
}
}
public string sunrise_label {
owned get {
if (weather_info == null) {
return "-";
}
ulong sunrise;
if (!weather_info.get_value_sunrise (out sunrise)) {
return "-";
......@@ -95,6 +102,10 @@ public class Item : Object, ContentItem {
public string sunset_label {
owned get {
if (weather_info == null) {
return "-";
}
ulong sunset;
if (!weather_info.get_value_sunset (out sunset)) {
return "-";
......@@ -153,9 +164,11 @@ public class Item : Object, ContentItem {
// 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);
if (location.has_coords ()) {
weather_info = (GWeather.Info) Object.new (typeof (GWeather.Info),
location: location,
enabled_providers: GWeather.Provider.NONE);
}
}
public void serialize (GLib.VariantBuilder builder) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment