[gnome-settings-daemon] color: Valid latitude range is between -90 and +90



commit 95e0df1eae416edf09cfb58ecb754fcab1ffc416
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 9 21:05:25 2017 +0000

    color: Valid latitude range is between -90 and +90

 ...settings-daemon.plugins.color.gschema.xml.in.in |    2 +-
 plugins/color/gsd-natural-light-common.c           |    4 ++--
 plugins/color/gsd-natural-light.c                  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in 
b/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in
index 7fb36a0..e1a0828 100644
--- a/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in
@@ -36,7 +36,7 @@
       <_description>When “natural-light-schedule-automatic” is disabled, use this end time in hours from 
midnight.</_description>
     </key>
     <key name="natural-light-last-coordinates" type="(dd)">
-      <default>(181,181)</default>
+      <default>(91,181)</default>
       <_summary>The last detected position</_summary>
       <_description>When location services are available this represents the last detected location. The 
default value is an invalid value to ensure it is always updated at startup.</_description>
     </key>
diff --git a/plugins/color/gsd-natural-light-common.c b/plugins/color/gsd-natural-light-common.c
index 9150de6..c0853ab 100644
--- a/plugins/color/gsd-natural-light-common.c
+++ b/plugins/color/gsd-natural-light-common.c
@@ -54,8 +54,8 @@ gsd_natural_light_get_sunrise_sunset (GDateTime *dt,
         g_autoptr(GDateTime) dt_zero = g_date_time_new_utc (1900, 1, 1, 0, 0, 0);
         GTimeSpan ts = g_date_time_difference (dt, dt_zero);
 
-        g_return_val_if_fail (pos_lat < 180.f && pos_lat > -180.f, FALSE);
-        g_return_val_if_fail (pos_long < 180.f && pos_long > -180.f, FALSE);
+        g_return_val_if_fail (pos_lat <= 90.f && pos_lat >= -90.f, FALSE);
+        g_return_val_if_fail (pos_long <= 180.f && pos_long >= -180.f, FALSE);
 
         gdouble tz_offset =  g_date_time_get_utc_offset (dt) / G_USEC_PER_SEC / 60 / 60; // B5
         gdouble date_as_number = ts / G_USEC_PER_SEC / 24 / 60 / 60 + 2;  // B7
diff --git a/plugins/color/gsd-natural-light.c b/plugins/color/gsd-natural-light.c
index dedbd74..091c27b 100644
--- a/plugins/color/gsd-natural-light.c
+++ b/plugins/color/gsd-natural-light.c
@@ -108,7 +108,7 @@ update_cached_sunrise_sunset (GsdNaturalLight *self)
         /* calculate the sunrise/sunset for the location */
         tmp = g_settings_get_value (self->settings, "natural-light-last-coordinates");
         g_variant_get (tmp, "(dd)", &latitude, &longitude);
-        if (latitude > 180.f || latitude < -180.f)
+        if (latitude > 90.f || latitude < -90.f)
                 return FALSE;
         if (longitude > 180.f || longitude < -180.f)
                 return FALSE;


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