[gnome-clocks/gnome-3-8] prevent creating clocks for locations with no timezone.



commit dda154f80ea12b8e3c7ea87ed81ff78553e2e554
Author: Evgeny Bobkin <evgen ibqn gmail com>
Date:   Mon May 6 12:10:43 2013 +0200

    prevent creating clocks for locations with no timezone.
    
    Here, by creating a new clock for a defined and matched location the OK button
    of the dialog remains disabled, if the time zone for this location is not
    known, so the user cannot add such a broken clock. In this case a
    warning message is produced.
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=699311

 src/world.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/world.vala b/src/world.vala
index dcc1385..de8af52 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -204,14 +204,22 @@ private class LocationDialog : Gtk.Dialog {
 
     private void location_changed () {
         GWeather.Location? l = null;
+        GWeather.Timezone? t = null;
         if (entry.get_text () == "") {
             entry.set_icon_from_gicon (Gtk.EntryIconPosition.SECONDARY, find_icon);
         } else {
             entry.set_icon_from_gicon (Gtk.EntryIconPosition.SECONDARY, clear_icon);
             l = entry.get_location ();
+            if (l != null) {
+                t = l.get_timezone ();
+
+                if (t == null) {
+                    GLib.warning ("Timezone not defined for %s. This is a bug in libgweather database", 
l.get_city_name ());
+                }
+            }
         }
 
-        set_response_sensitive(1, l != null);
+        set_response_sensitive(1, l != null && t != null);
     }
 
     public Item? get_location () {


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