[gnome-clocks] prevent creating clocks for locations with no timezone.
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] prevent creating clocks for locations with no timezone.
- Date: Mon, 6 May 2013 12:12:29 +0000 (UTC)
commit e933881c3ed24c409b63e0b96e71d8324c7941d2
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]