Remove all of our TimezoneMap widget code and paraphernalia in favor of it being somebody else's problem.
For Etc timezones, remove the location pin and set the highlight. --- anaconda.spec.in | 4 +- po/POTFILES.in | 2 - pyanaconda/ui/gui/spokes/datetime_spoke.glade | 5 +- pyanaconda/ui/gui/spokes/datetime_spoke.py | 40 +- widgets/Makefile.am | 2 +- widgets/configure.ac | 3 +- widgets/data/tzmapdata/Makefile.am | 23 - widgets/data/tzmapdata/bg.png | Bin 213448 -> 0 bytes widgets/data/tzmapdata/cc.png | Bin 52271 -> 0 bytes widgets/data/tzmapdata/pin.png | Bin 561 -> 0 bytes widgets/data/tzmapdata/timezone_-1.png | Bin 8012 -> 0 bytes widgets/data/tzmapdata/timezone_-10.png | Bin 7783 -> 0 bytes widgets/data/tzmapdata/timezone_-11.png | Bin 8347 -> 0 bytes widgets/data/tzmapdata/timezone_-2.png | Bin 4333 -> 0 bytes widgets/data/tzmapdata/timezone_-3.5.png | Bin 740 -> 0 bytes widgets/data/tzmapdata/timezone_-3.png | Bin 13615 -> 0 bytes widgets/data/tzmapdata/timezone_-4.5.png | Bin 1900 -> 0 bytes widgets/data/tzmapdata/timezone_-4.png | Bin 15084 -> 0 bytes widgets/data/tzmapdata/timezone_-5.5.png | Bin 437 -> 0 bytes widgets/data/tzmapdata/timezone_-5.png | Bin 19166 -> 0 bytes widgets/data/tzmapdata/timezone_-6.png | Bin 13764 -> 0 bytes widgets/data/tzmapdata/timezone_-7.png | Bin 11977 -> 0 bytes widgets/data/tzmapdata/timezone_-8.png | Bin 6801 -> 0 bytes widgets/data/tzmapdata/timezone_-9.5.png | Bin 437 -> 0 bytes widgets/data/tzmapdata/timezone_-9.png | Bin 7908 -> 0 bytes widgets/data/tzmapdata/timezone_0.png | Bin 11074 -> 0 bytes widgets/data/tzmapdata/timezone_1.png | Bin 15458 -> 0 bytes widgets/data/tzmapdata/timezone_10.5.png | Bin 421 -> 0 bytes widgets/data/tzmapdata/timezone_10.png | Bin 12829 -> 0 bytes widgets/data/tzmapdata/timezone_11.5.png | Bin 446 -> 0 bytes widgets/data/tzmapdata/timezone_11.png | Bin 12113 -> 0 bytes widgets/data/tzmapdata/timezone_12.75.png | Bin 409 -> 0 bytes widgets/data/tzmapdata/timezone_12.png | Bin 7130 -> 0 bytes widgets/data/tzmapdata/timezone_13.png | Bin 621 -> 0 bytes widgets/data/tzmapdata/timezone_14.png | Bin 7722 -> 0 bytes widgets/data/tzmapdata/timezone_2.png | Bin 12854 -> 0 bytes widgets/data/tzmapdata/timezone_3.5.png | Bin 2142 -> 0 bytes widgets/data/tzmapdata/timezone_3.png | Bin 17475 -> 0 bytes widgets/data/tzmapdata/timezone_4.5.png | Bin 1773 -> 0 bytes widgets/data/tzmapdata/timezone_4.png | Bin 4954 -> 0 bytes widgets/data/tzmapdata/timezone_5.5.png | Bin 6099 -> 0 bytes widgets/data/tzmapdata/timezone_5.75.png | Bin 2885 -> 0 bytes widgets/data/tzmapdata/timezone_5.png | Bin 14539 -> 0 bytes widgets/data/tzmapdata/timezone_6.5.png | Bin 1609 -> 0 bytes widgets/data/tzmapdata/timezone_6.png | Bin 8441 -> 0 bytes widgets/data/tzmapdata/timezone_7.png | Bin 14412 -> 0 bytes widgets/data/tzmapdata/timezone_8.75.png | Bin 13993 -> 0 bytes widgets/data/tzmapdata/timezone_8.png | Bin 16050 -> 0 bytes widgets/data/tzmapdata/timezone_9.5.png | Bin 1959 -> 0 bytes widgets/data/tzmapdata/timezone_9.png | Bin 12608 -> 0 bytes widgets/data/tzmapdata/timezones_backward | 118 ----- widgets/doc/AnacondaWidgets-docs.xml | 1 - widgets/glade/AnacondaWidgets.xml | 10 - widgets/python/AnacondaWidgets.py | 8 - widgets/src/Makefile.am | 6 +- widgets/src/TimezoneMap.c | 630 -------------------------- widgets/src/TimezoneMap.h | 84 ---- widgets/src/tz.c | 435 ------------------ widgets/src/tz.h | 85 ---- 59 files changed, 41 insertions(+), 1415 deletions(-) delete mode 100644 widgets/data/tzmapdata/Makefile.am delete mode 100644 widgets/data/tzmapdata/bg.png delete mode 100644 widgets/data/tzmapdata/cc.png delete mode 100644 widgets/data/tzmapdata/pin.png delete mode 100644 widgets/data/tzmapdata/timezone_-1.png delete mode 100644 widgets/data/tzmapdata/timezone_-10.png delete mode 100644 widgets/data/tzmapdata/timezone_-11.png delete mode 100644 widgets/data/tzmapdata/timezone_-2.png delete mode 100644 widgets/data/tzmapdata/timezone_-3.5.png delete mode 100644 widgets/data/tzmapdata/timezone_-3.png delete mode 100644 widgets/data/tzmapdata/timezone_-4.5.png delete mode 100644 widgets/data/tzmapdata/timezone_-4.png delete mode 100644 widgets/data/tzmapdata/timezone_-5.5.png delete mode 100644 widgets/data/tzmapdata/timezone_-5.png delete mode 100644 widgets/data/tzmapdata/timezone_-6.png delete mode 100644 widgets/data/tzmapdata/timezone_-7.png delete mode 100644 widgets/data/tzmapdata/timezone_-8.png delete mode 100644 widgets/data/tzmapdata/timezone_-9.5.png delete mode 100644 widgets/data/tzmapdata/timezone_-9.png delete mode 100644 widgets/data/tzmapdata/timezone_0.png delete mode 100644 widgets/data/tzmapdata/timezone_1.png delete mode 100644 widgets/data/tzmapdata/timezone_10.5.png delete mode 100644 widgets/data/tzmapdata/timezone_10.png delete mode 100644 widgets/data/tzmapdata/timezone_11.5.png delete mode 100644 widgets/data/tzmapdata/timezone_11.png delete mode 100644 widgets/data/tzmapdata/timezone_12.75.png delete mode 100644 widgets/data/tzmapdata/timezone_12.png delete mode 100644 widgets/data/tzmapdata/timezone_13.png delete mode 100644 widgets/data/tzmapdata/timezone_14.png delete mode 100644 widgets/data/tzmapdata/timezone_2.png delete mode 100644 widgets/data/tzmapdata/timezone_3.5.png delete mode 100644 widgets/data/tzmapdata/timezone_3.png delete mode 100644 widgets/data/tzmapdata/timezone_4.5.png delete mode 100644 widgets/data/tzmapdata/timezone_4.png delete mode 100644 widgets/data/tzmapdata/timezone_5.5.png delete mode 100644 widgets/data/tzmapdata/timezone_5.75.png delete mode 100644 widgets/data/tzmapdata/timezone_5.png delete mode 100644 widgets/data/tzmapdata/timezone_6.5.png delete mode 100644 widgets/data/tzmapdata/timezone_6.png delete mode 100644 widgets/data/tzmapdata/timezone_7.png delete mode 100644 widgets/data/tzmapdata/timezone_8.75.png delete mode 100644 widgets/data/tzmapdata/timezone_8.png delete mode 100644 widgets/data/tzmapdata/timezone_9.5.png delete mode 100644 widgets/data/tzmapdata/timezone_9.png delete mode 100644 widgets/data/tzmapdata/timezones_backward delete mode 100644 widgets/src/TimezoneMap.c delete mode 100644 widgets/src/TimezoneMap.h delete mode 100644 widgets/src/tz.c delete mode 100644 widgets/src/tz.h
diff --git a/anaconda.spec.in b/anaconda.spec.in index 4a78530..81c93ab 100755 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -43,6 +43,7 @@ Source0: %{name}-%{version}.tar.bz2 %define rpmver 4.10.0 %define libarchivever 3.0.4 %define langtablever 0.0.18-1 +%define libtimezonemapver 0.4.1-2
BuildRequires: audit-libs-devel BuildRequires: gettext >= %{gettextver} @@ -77,6 +78,7 @@ BuildRequires: desktop-file-utils %ifarch s390 s390x BuildRequires: s390utils-devel %endif +BuildRequires: libtimezonemap-devel >= %{libtimezonemapver}
Requires: anaconda-core = %{version}-%{release} Requires: anaconda-gui = %{version}-%{release} @@ -111,6 +113,7 @@ Requires: python-nss Requires: pytz Requires: realmd Requires: teamd +Requires: libtimezonemap >= %{libtimezonemapver} %ifarch %livearches Requires: usermode %endif @@ -281,7 +284,6 @@ update-desktop-database &> /dev/null || : %{_libdir}/libAnacondaWidgets.so.* %{_libdir}/girepository*/AnacondaWidgets*typelib %{_libdir}/python*/site-packages/gi/overrides/* -%{_datadir}/anaconda/tzmapdata/*
%files widgets-devel %{_libdir}/libAnacondaWidgets.so diff --git a/po/POTFILES.in b/po/POTFILES.in index 4b76fca..af263f9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -89,11 +89,9 @@ widgets/src/MountpointSelector.c widgets/src/SpokeSelector.c widgets/src/SpokeWindow.c widgets/src/StandaloneWindow.c -widgets/src/TimezoneMap.c widgets/src/LayoutIndicator.c widgets/src/Lightbox.c widgets/src/glade-adaptor.c -widgets/src/tz.c widgets/src/widgets-common.c
# Interface files. diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade index 80e7e6e..1662e11 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade @@ -2,6 +2,7 @@ <!-- Generated with glade 3.16.0 on Thu Oct 17 10:57:29 2013 --> <interface> <!-- interface-requires gtk+ 3.2 --> + <!-- interface-requires TimezoneMap 0.4 --> <!-- interface-requires AnacondaWidgets 1.0 --> <object class="GtkImage" id="addImage"> <property name="visible">True</property> @@ -281,10 +282,10 @@ </packing> </child> <child> - <object class="AnacondaTimezoneMap" id="tzmap"> + <object class="CcTimezoneMap" id="tzmap"> <property name="visible">True</property> <property name="can_focus">False</property> - <signal name="timezone-changed" handler="on_timezone_changed" swapped="no"/> + <signal name="location-changed" handler="on_location_changed" swapped="no"/> </object> <packing> <property name="expand">True</property> diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index 9b4e187..dde6615 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -22,7 +22,7 @@ import logging log = logging.getLogger("anaconda")
-from gi.repository import GLib, Gdk +from gi.repository import GLib, Gdk, TimezoneMap
from pyanaconda.ui.communication import hubQ from pyanaconda.ui.common import FirstbootSpokeMixIn @@ -342,6 +342,11 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): icon = "preferences-system-time-symbolic" title = CN_("GUI|Spoke", "DATE & _TIME")
+ # Hack to get libtimezonemap loaded for GtkBuilder + # see https://bugzilla.gnome.org/show_bug.cgi?id=712184 + _hack = TimezoneMap.TimezoneMap() + del(_hack) + def __init__(self, *args): NormalSpoke.__init__(self, *args)
@@ -450,10 +455,12 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): return _("%s timezone") % get_xlated_timezone(self.data.timezone.timezone) else: return _("Invalid timezone") - elif self._tzmap.get_timezone(): - return _("%s timezone") % get_xlated_timezone(self._tzmap.get_timezone()) else: - return _("Nothing selected") + location = self._tzmap.get_location() + if location and location.get_property("zone"): + return _("%s timezone") % get_xlated_timezone(location.get_property("zone")) + else: + return _("Nothing selected")
def apply(self): # we could use self._tzmap.get_timezone() here, but it returns "" if @@ -870,12 +877,23 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): return
if region == "Etc": - # Etc timezones cannot be displayed on the map, so let's set the map - # to "" which sets it to "Europe/London" (UTC) without a city pin - self._tzmap.set_timezone("", no_signal=True) + # Etc timezones cannot be displayed on the map, so let's reset the + # location and manually set a highlight with no location pin. + self._tzmap.clear_location() + if city in ("GMT", "UTC"): + offset = 0.0 + # The tzdb data uses POSIX-style signs for the GMT zones, which is + # the opposite of whatever everyone else expects. GMT+4 indicates a + # zone four hours west of Greenwich; i.e., four hours before. Reverse + # the sign to match the libtimezone map. + else: + # Take the part after "GMT" + offset = -float(city[3:]) + + self._tzmap.set_selected_offset(offset) else: # we don't want the timezone-changed signal to be emitted - self._tzmap.set_timezone(timezone, no_signal=True) + self._tzmap.set_timezone(timezone)
# update "old" values self._old_city = city @@ -921,7 +939,11 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): self._stop_and_maybe_start_time_updating(interval=5) self._daysFilter.refilter()
- def on_timezone_changed(self, tz_map, timezone): + def on_location_changed(self, tz_map, location): + if not location: + return + + timezone = location.get_property('zone') if self._set_timezone(timezone): # timezone successfully set os.environ["TZ"] = timezone diff --git a/widgets/Makefile.am b/widgets/Makefile.am index ad80f87..3fc2d37 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -21,7 +21,7 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src python glade doc data +SUBDIRS = src python glade doc
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in config.sub \ configure depcomp gtk-doc.make install-sh ltmain.sh missing py-compile \ diff --git a/widgets/configure.ac b/widgets/configure.ac index fe8ab9f..87ae7fe 100644 --- a/widgets/configure.ac +++ b/widgets/configure.ac @@ -69,6 +69,5 @@ AC_CONFIG_FILES([Makefile src/Makefile python/Makefile data/Makefile - data/pixmaps/Makefile - data/tzmapdata/Makefile]) + data/pixmaps/Makefile]) AC_OUTPUT diff --git a/widgets/data/tzmapdata/Makefile.am b/widgets/data/tzmapdata/Makefile.am deleted file mode 100644 index 2dd6029..0000000 --- a/widgets/data/tzmapdata/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2012 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# Author: Vratislav Podzimek vpodzime@redhat.com - -timezonemap_datadir = $(datadir)/anaconda/tzmapdata -dist_timezonemap_data_DATA = $(srcdir)/*.png timezones_backward - -MAINTAINERCLEANFILES = Makefile.in - diff --git a/widgets/data/tzmapdata/bg.png b/widgets/data/tzmapdata/bg.png deleted file mode 100644 index 4180ee8..0000000 Binary files a/widgets/data/tzmapdata/bg.png and /dev/null differ diff --git a/widgets/data/tzmapdata/cc.png b/widgets/data/tzmapdata/cc.png deleted file mode 100644 index 9984d23..0000000 Binary files a/widgets/data/tzmapdata/cc.png and /dev/null differ diff --git a/widgets/data/tzmapdata/pin.png b/widgets/data/tzmapdata/pin.png deleted file mode 100644 index 599a751..0000000 Binary files a/widgets/data/tzmapdata/pin.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-1.png b/widgets/data/tzmapdata/timezone_-1.png deleted file mode 100644 index fb00d83..0000000 Binary files a/widgets/data/tzmapdata/timezone_-1.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-10.png b/widgets/data/tzmapdata/timezone_-10.png deleted file mode 100644 index 472eb88..0000000 Binary files a/widgets/data/tzmapdata/timezone_-10.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-11.png b/widgets/data/tzmapdata/timezone_-11.png deleted file mode 100644 index 1da3536..0000000 Binary files a/widgets/data/tzmapdata/timezone_-11.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-2.png b/widgets/data/tzmapdata/timezone_-2.png deleted file mode 100644 index 30a1ec7..0000000 Binary files a/widgets/data/tzmapdata/timezone_-2.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-3.5.png b/widgets/data/tzmapdata/timezone_-3.5.png deleted file mode 100644 index c1df00b..0000000 Binary files a/widgets/data/tzmapdata/timezone_-3.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-3.png b/widgets/data/tzmapdata/timezone_-3.png deleted file mode 100644 index c22dbb6..0000000 Binary files a/widgets/data/tzmapdata/timezone_-3.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-4.5.png b/widgets/data/tzmapdata/timezone_-4.5.png deleted file mode 100644 index 9e3c134..0000000 Binary files a/widgets/data/tzmapdata/timezone_-4.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-4.png b/widgets/data/tzmapdata/timezone_-4.png deleted file mode 100644 index 4b5a431..0000000 Binary files a/widgets/data/tzmapdata/timezone_-4.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-5.5.png b/widgets/data/tzmapdata/timezone_-5.5.png deleted file mode 100644 index b1c788d..0000000 Binary files a/widgets/data/tzmapdata/timezone_-5.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-5.png b/widgets/data/tzmapdata/timezone_-5.png deleted file mode 100644 index 06c15e6..0000000 Binary files a/widgets/data/tzmapdata/timezone_-5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-6.png b/widgets/data/tzmapdata/timezone_-6.png deleted file mode 100644 index 8505fb1..0000000 Binary files a/widgets/data/tzmapdata/timezone_-6.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-7.png b/widgets/data/tzmapdata/timezone_-7.png deleted file mode 100644 index fec235d..0000000 Binary files a/widgets/data/tzmapdata/timezone_-7.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-8.png b/widgets/data/tzmapdata/timezone_-8.png deleted file mode 100644 index bdad7bf..0000000 Binary files a/widgets/data/tzmapdata/timezone_-8.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-9.5.png b/widgets/data/tzmapdata/timezone_-9.5.png deleted file mode 100644 index b1c788d..0000000 Binary files a/widgets/data/tzmapdata/timezone_-9.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_-9.png b/widgets/data/tzmapdata/timezone_-9.png deleted file mode 100644 index 04cb3cb..0000000 Binary files a/widgets/data/tzmapdata/timezone_-9.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_0.png b/widgets/data/tzmapdata/timezone_0.png deleted file mode 100644 index e59b773..0000000 Binary files a/widgets/data/tzmapdata/timezone_0.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_1.png b/widgets/data/tzmapdata/timezone_1.png deleted file mode 100644 index 2053b7e..0000000 Binary files a/widgets/data/tzmapdata/timezone_1.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_10.5.png b/widgets/data/tzmapdata/timezone_10.5.png deleted file mode 100644 index 6ec7f9f..0000000 Binary files a/widgets/data/tzmapdata/timezone_10.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_10.png b/widgets/data/tzmapdata/timezone_10.png deleted file mode 100644 index 475dcf4..0000000 Binary files a/widgets/data/tzmapdata/timezone_10.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_11.5.png b/widgets/data/tzmapdata/timezone_11.5.png deleted file mode 100644 index afdedd7..0000000 Binary files a/widgets/data/tzmapdata/timezone_11.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_11.png b/widgets/data/tzmapdata/timezone_11.png deleted file mode 100644 index 6168aa2..0000000 Binary files a/widgets/data/tzmapdata/timezone_11.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_12.75.png b/widgets/data/tzmapdata/timezone_12.75.png deleted file mode 100644 index 4f74a85..0000000 Binary files a/widgets/data/tzmapdata/timezone_12.75.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_12.png b/widgets/data/tzmapdata/timezone_12.png deleted file mode 100644 index d0b3531..0000000 Binary files a/widgets/data/tzmapdata/timezone_12.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_13.png b/widgets/data/tzmapdata/timezone_13.png deleted file mode 100644 index fe2f134..0000000 Binary files a/widgets/data/tzmapdata/timezone_13.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_14.png b/widgets/data/tzmapdata/timezone_14.png deleted file mode 100644 index e91d4eb..0000000 Binary files a/widgets/data/tzmapdata/timezone_14.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_2.png b/widgets/data/tzmapdata/timezone_2.png deleted file mode 100644 index ec1e874..0000000 Binary files a/widgets/data/tzmapdata/timezone_2.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_3.5.png b/widgets/data/tzmapdata/timezone_3.5.png deleted file mode 100644 index 2dc7399..0000000 Binary files a/widgets/data/tzmapdata/timezone_3.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_3.png b/widgets/data/tzmapdata/timezone_3.png deleted file mode 100644 index eda59dc..0000000 Binary files a/widgets/data/tzmapdata/timezone_3.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_4.5.png b/widgets/data/tzmapdata/timezone_4.5.png deleted file mode 100644 index e09ed90..0000000 Binary files a/widgets/data/tzmapdata/timezone_4.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_4.png b/widgets/data/tzmapdata/timezone_4.png deleted file mode 100644 index 483dc53..0000000 Binary files a/widgets/data/tzmapdata/timezone_4.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_5.5.png b/widgets/data/tzmapdata/timezone_5.5.png deleted file mode 100644 index f904cc2..0000000 Binary files a/widgets/data/tzmapdata/timezone_5.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_5.75.png b/widgets/data/tzmapdata/timezone_5.75.png deleted file mode 100644 index 827ce1a..0000000 Binary files a/widgets/data/tzmapdata/timezone_5.75.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_5.png b/widgets/data/tzmapdata/timezone_5.png deleted file mode 100644 index 1bb6d20..0000000 Binary files a/widgets/data/tzmapdata/timezone_5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_6.5.png b/widgets/data/tzmapdata/timezone_6.5.png deleted file mode 100644 index d307bf3..0000000 Binary files a/widgets/data/tzmapdata/timezone_6.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_6.png b/widgets/data/tzmapdata/timezone_6.png deleted file mode 100644 index 460f9cf..0000000 Binary files a/widgets/data/tzmapdata/timezone_6.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_7.png b/widgets/data/tzmapdata/timezone_7.png deleted file mode 100644 index 239115a..0000000 Binary files a/widgets/data/tzmapdata/timezone_7.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_8.75.png b/widgets/data/tzmapdata/timezone_8.75.png deleted file mode 100644 index 2a2917f..0000000 Binary files a/widgets/data/tzmapdata/timezone_8.75.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_8.png b/widgets/data/tzmapdata/timezone_8.png deleted file mode 100644 index d210222..0000000 Binary files a/widgets/data/tzmapdata/timezone_8.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_9.5.png b/widgets/data/tzmapdata/timezone_9.5.png deleted file mode 100644 index 1c3290c..0000000 Binary files a/widgets/data/tzmapdata/timezone_9.5.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezone_9.png b/widgets/data/tzmapdata/timezone_9.png deleted file mode 100644 index 65d2e46..0000000 Binary files a/widgets/data/tzmapdata/timezone_9.png and /dev/null differ diff --git a/widgets/data/tzmapdata/timezones_backward b/widgets/data/tzmapdata/timezones_backward deleted file mode 100644 index f1f95a8..0000000 --- a/widgets/data/tzmapdata/timezones_backward +++ /dev/null @@ -1,118 +0,0 @@ -# <pre> -# @(#)backward 8.9 -# This file is in the public domain, so clarified as of -# 2009-05-17 by Arthur David Olson. - -# This file provides links between current names for time zones -# and their old names. Many names changed in late 1993. - -Link Africa/Asmara Africa/Asmera -Link Africa/Bamako Africa/Timbuktu -Link America/Argentina/Catamarca America/Argentina/ComodRivadavia -Link America/Adak America/Atka -Link America/Argentina/Buenos_Aires America/Buenos_Aires -Link America/Argentina/Catamarca America/Catamarca -Link America/Atikokan America/Coral_Harbour -Link America/Argentina/Cordoba America/Cordoba -Link America/Tijuana America/Ensenada -Link America/Indiana/Indianapolis America/Fort_Wayne -Link America/Indiana/Indianapolis America/Indianapolis -Link America/Argentina/Jujuy America/Jujuy -Link America/Indiana/Knox America/Knox_IN -Link America/Kentucky/Louisville America/Louisville -Link America/Argentina/Mendoza America/Mendoza -Link America/Rio_Branco America/Porto_Acre -Link America/Argentina/Cordoba America/Rosario -Link America/St_Thomas America/Virgin -Link Asia/Ashgabat Asia/Ashkhabad -Link Asia/Chongqing Asia/Chungking -Link Asia/Dhaka Asia/Dacca -Link Asia/Kathmandu Asia/Katmandu -Link Asia/Kolkata Asia/Calcutta -Link Asia/Macau Asia/Macao -Link Asia/Jerusalem Asia/Tel_Aviv -Link Asia/Ho_Chi_Minh Asia/Saigon -Link Asia/Thimphu Asia/Thimbu -Link Asia/Makassar Asia/Ujung_Pandang -Link Asia/Ulaanbaatar Asia/Ulan_Bator -Link Atlantic/Faroe Atlantic/Faeroe -Link Europe/Oslo Atlantic/Jan_Mayen -Link Australia/Sydney Australia/ACT -Link Australia/Sydney Australia/Canberra -Link Australia/Lord_Howe Australia/LHI -Link Australia/Sydney Australia/NSW -Link Australia/Darwin Australia/North -Link Australia/Brisbane Australia/Queensland -Link Australia/Adelaide Australia/South -Link Australia/Hobart Australia/Tasmania -Link Australia/Melbourne Australia/Victoria -Link Australia/Perth Australia/West -Link Australia/Broken_Hill Australia/Yancowinna -Link America/Rio_Branco Brazil/Acre -Link America/Noronha Brazil/DeNoronha -Link America/Sao_Paulo Brazil/East -Link America/Manaus Brazil/West -Link America/Halifax Canada/Atlantic -Link America/Winnipeg Canada/Central -Link America/Regina Canada/East-Saskatchewan -Link America/Toronto Canada/Eastern -Link America/Edmonton Canada/Mountain -Link America/St_Johns Canada/Newfoundland -Link America/Vancouver Canada/Pacific -Link America/Regina Canada/Saskatchewan -Link America/Whitehorse Canada/Yukon -Link America/Santiago Chile/Continental -Link Pacific/Easter Chile/EasterIsland -Link America/Havana Cuba -Link Africa/Cairo Egypt -Link Europe/Dublin Eire -Link Europe/London Europe/Belfast -Link Europe/Chisinau Europe/Tiraspol -Link Europe/London GB -Link Europe/London GB-Eire -Link Etc/GMT GMT+0 -Link Etc/GMT GMT-0 -Link Etc/GMT GMT0 -Link Etc/GMT Greenwich -Link Asia/Hong_Kong Hongkong -Link Atlantic/Reykjavik Iceland -Link Asia/Tehran Iran -Link Asia/Jerusalem Israel -Link America/Jamaica Jamaica -Link Asia/Tokyo Japan -Link Pacific/Kwajalein Kwajalein -Link Africa/Tripoli Libya -Link America/Tijuana Mexico/BajaNorte -Link America/Mazatlan Mexico/BajaSur -Link America/Mexico_City Mexico/General -Link Pacific/Auckland NZ -Link Pacific/Chatham NZ-CHAT -Link America/Denver Navajo -Link Asia/Shanghai PRC -Link Pacific/Pago_Pago Pacific/Samoa -Link Pacific/Chuuk Pacific/Yap -Link Pacific/Chuuk Pacific/Truk -Link Pacific/Pohnpei Pacific/Ponape -Link Europe/Warsaw Poland -Link Europe/Lisbon Portugal -Link Asia/Taipei ROC -Link Asia/Seoul ROK -Link Asia/Singapore Singapore -Link Europe/Istanbul Turkey -Link Etc/UCT UCT -Link America/Anchorage US/Alaska -Link America/Adak US/Aleutian -Link America/Phoenix US/Arizona -Link America/Chicago US/Central -Link America/Indiana/Indianapolis US/East-Indiana -Link America/New_York US/Eastern -Link Pacific/Honolulu US/Hawaii -Link America/Indiana/Knox US/Indiana-Starke -Link America/Detroit US/Michigan -Link America/Denver US/Mountain -Link America/Los_Angeles US/Pacific -Link Pacific/Pago_Pago US/Samoa -Link Etc/UTC UTC -Link Etc/UTC Universal -Link Europe/Moscow W-SU -Link Etc/UTC Zulu diff --git a/widgets/doc/AnacondaWidgets-docs.xml b/widgets/doc/AnacondaWidgets-docs.xml index 3ea50ae..200408c 100644 --- a/widgets/doc/AnacondaWidgets-docs.xml +++ b/widgets/doc/AnacondaWidgets-docs.xml @@ -40,7 +40,6 @@ <title>Miscellaneous Widgets</title> <xi:include href="xml/SpokeSelector.xml" /> <xi:include href="xml/LayoutIndicator.xml" /> - <xi:include href="xml/TimezoneMap.xml" /> </chapter>
<chapter id="hierarchy"> diff --git a/widgets/glade/AnacondaWidgets.xml b/widgets/glade/AnacondaWidgets.xml index 9d84f8d..7a496c3 100644 --- a/widgets/glade/AnacondaWidgets.xml +++ b/widgets/glade/AnacondaWidgets.xml @@ -130,15 +130,6 @@ </properties> </glade-widget-class>
- <glade-widget-class title="Timezone Map" - name="AnacondaTimezoneMap" - icon-name="widget-gtk-image" - generic-name="AnacondaTimezoneMap"> - <properties> - <property id="spacing" default="6" visible="False" /> - </properties> - </glade-widget-class> - <glade-widget-class title="Layout Indicator" name="AnacondaLayoutIndicator" icon-name="widget-gtk-label" @@ -161,7 +152,6 @@
<glade-widget-group name="anaconda-misc-widgets" title="Anaconda Miscellaneous Widgets"> <glade-widget-class-ref name="AnacondaSpokeSelector" /> - <glade-widget-class-ref name="AnacondaTimezoneMap" /> <glade-widget-class-ref name="AnacondaLayoutIndicator" /> </glade-widget-group> </glade-catalog> diff --git a/widgets/python/AnacondaWidgets.py b/widgets/python/AnacondaWidgets.py index ec87b3f..649be1c 100644 --- a/widgets/python/AnacondaWidgets.py +++ b/widgets/python/AnacondaWidgets.py @@ -86,11 +86,3 @@ class DiskOverview(Anaconda.DiskOverview):
DiskOverview = override(DiskOverview) __all__.append('DiskOverview') - -# pylint: disable-msg=W0232 -class TimezoneMap(Anaconda.TimezoneMap): - def set_timezone(self, timezone, no_signal=False): - Anaconda.TimezoneMap.set_timezone(self, timezone, no_signal) - -TimezoneMap = override(TimezoneMap) -__all__.append('TimezoneMap') diff --git a/widgets/src/Makefile.am b/widgets/src/Makefile.am index 81885c2..094c221 100644 --- a/widgets/src/Makefile.am +++ b/widgets/src/Makefile.am @@ -32,7 +32,6 @@ GISOURCES = BaseWindow.c \ SpokeSelector.c \ SpokeWindow.c \ StandaloneWindow.c \ - TimezoneMap.c \ LayoutIndicator.c \ Lightbox.c
@@ -43,13 +42,12 @@ GIHDRS = BaseWindow.h \ SpokeSelector.h \ SpokeWindow.h \ StandaloneWindow.h \ - TimezoneMap.h \ LayoutIndicator.h \ Lightbox.h
-NONGISOURCES = tz.c widgets-common.c +NONGISOURCES = widgets-common.c
-NONGIHDRS = tz.h widgets-common.h +NONGIHDRS = widgets-common.h
SOURCES = $(GISOURCES) $(NONGISOURCES)
diff --git a/widgets/src/TimezoneMap.c b/widgets/src/TimezoneMap.c deleted file mode 100644 index a939c3c..0000000 --- a/widgets/src/TimezoneMap.c +++ /dev/null @@ -1,630 +0,0 @@ -/* Copyright (C) 2012-2013 Red Hat, Inc - * - * Heavily based on the code from gnome-control-center, Copyright (C) 2010 Intel, Inc. - * Written by Thomas Wood thomas.wood@intel.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Author: Vratislav Podzimek vpodzime@redhat.com - * - */ - -#include "TimezoneMap.h" -#include <math.h> -#include <string.h> -#include <stdlib.h> -#include "tz.h" - -/** - * SECTION: TimezoneMap - * @title: AnacondaTimezoneMap - * @short_description: An interactive map for timezone selection - * - * A #AnacondaTimezoneMap is a widget that can be used for timezone selection. - * The most important is the ::timezone-changed signal that includes the newly - * selected timezone. - */ - -G_DEFINE_TYPE (AnacondaTimezoneMap, anaconda_timezone_map, GTK_TYPE_WIDGET) - -#define TIMEZONE_MAP_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), ANACONDA_TYPE_TIMEZONE_MAP, AnacondaTimezoneMapPrivate)) - - -typedef struct { - gdouble offset; - guchar red; - guchar green; - guchar blue; - guchar alpha; -} AnacondaTimezoneMapOffset; - -struct _AnacondaTimezoneMapPrivate { - GdkPixbuf *orig_background; - GdkPixbuf *orig_color_map; - - GdkPixbuf *background; - GdkPixbuf *color_map; - - guchar *visible_map_pixels; - gint visible_map_rowstride; - - gdouble selected_offset; - - TzDB *tzdb; - TzLocation *location; -}; - -enum { - TIMEZONE_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL]; - -static AnacondaTimezoneMapOffset color_codes[] = -{ - {-11.0, 43, 0, 0, 255 }, - {-10.0, 85, 0, 0, 255 }, - {-9.5, 102, 255, 0, 255 }, - {-9.0, 128, 0, 0, 255 }, - {-8.0, 170, 0, 0, 255 }, - {-7.0, 212, 0, 0, 255 }, - {-6.0, 255, 0, 1, 255 }, // north - {-6.0, 255, 0, 0, 255 }, // south - {-5.0, 255, 42, 42, 255 }, - {-4.5, 192, 255, 0, 255 }, - {-4.0, 255, 85, 85, 255 }, - {-3.5, 0, 255, 0, 255 }, - {-3.0, 255, 128, 128, 255 }, - {-2.0, 255, 170, 170, 255 }, - {-1.0, 255, 213, 213, 255 }, - {0.0, 43, 17, 0, 255 }, - {1.0, 85, 34, 0, 255 }, - {2.0, 128, 51, 0, 255 }, - {3.0, 170, 68, 0, 255 }, - {3.5, 0, 255, 102, 255 }, - {4.0, 212, 85, 0, 255 }, - {4.5, 0, 204, 255, 255 }, - {5.0, 255, 102, 0, 255 }, - {5.5, 0, 102, 255, 255 }, - {5.75, 0, 238, 207, 247 }, - {6.0, 255, 127, 42, 255 }, - {6.5, 204, 0, 254, 254 }, - {7.0, 255, 153, 85, 255 }, - {8.0, 255, 179, 128, 255 }, - {9.0, 255, 204, 170, 255 }, - {9.5, 170, 0, 68, 250 }, - {10.0, 255, 230, 213, 255 }, - {10.5, 212, 124, 21, 250 }, - {11.0, 212, 170, 0, 255 }, - {11.5, 249, 25, 87, 253 }, - {12.0, 255, 204, 0, 255 }, - {12.75, 254, 74, 100, 248 }, - {13.0, 255, 85, 153, 250 }, - {-100, 0, 0, 0, 0 } -}; - -/** - * anaconda_timezone_map_new: - * - * Creates a new #AnacondaTimezoneMap. - * - * Returns: A new #AnacondaTimezoneMap - */ -GtkWidget *anaconda_timezone_map_new () { - return g_object_new(ANACONDA_TYPE_TIMEZONE_MAP, NULL); -} - -static void -anaconda_timezone_map_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) { - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -anaconda_timezone_map_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) { - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -anaconda_timezone_map_dispose (GObject *object) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (object)->priv; - - if (priv->orig_background) { - g_object_unref (priv->orig_background); - priv->orig_background = NULL; - } - - if (priv->orig_color_map) { - g_object_unref (priv->orig_color_map); - priv->orig_color_map = NULL; - } - - if (priv->background) { - g_object_unref (priv->background); - priv->background = NULL; - } - - if (priv->color_map) { - g_object_unref (priv->color_map); - priv->color_map = NULL; - - priv->visible_map_pixels = NULL; - priv->visible_map_rowstride = 0; - } - - G_OBJECT_CLASS (anaconda_timezone_map_parent_class)->dispose (object); -} - -static void -anaconda_timezone_map_finalize (GObject *object) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (object)->priv; - - if (priv->tzdb) { - tz_db_free (priv->tzdb); - priv->tzdb = NULL; - } - - - G_OBJECT_CLASS (anaconda_timezone_map_parent_class)->finalize (object); -} - -/* GtkWidget functions */ -static void -anaconda_timezone_map_get_preferred_width (GtkWidget *widget, - gint *minimum, - gint *natural) { - /* choose a minimum size small enough to prevent the window - * from growing horizontally - */ - if (minimum != NULL) - *minimum = 300; - if (natural != NULL) - *natural = 300; -} - -static void -anaconda_timezone_map_get_preferred_height (GtkWidget *widget, - gint *minimum, - gint *natural) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (widget)->priv; - gint size; - - /* The + 20 here is a slight tweak to make the map fill the - * panel better without causing horizontal growing - */ - size = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20; - if (minimum != NULL) - *minimum = size; - if (natural != NULL) - *natural = size; -} - -static void -anaconda_timezone_map_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (widget)->priv; - - if (priv->background) - g_object_unref (priv->background); - - priv->background = gdk_pixbuf_scale_simple (priv->orig_background, - allocation->width, - allocation->height, - GDK_INTERP_BILINEAR); - - if (priv->color_map) - g_object_unref (priv->color_map); - - priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map, - allocation->width, - allocation->height, - GDK_INTERP_BILINEAR); - - priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map); - priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map); - - GTK_WIDGET_CLASS (anaconda_timezone_map_parent_class)->size_allocate (widget, - allocation); -} - -static void -anaconda_timezone_map_realize (GtkWidget *widget) { - GdkWindowAttr attr = { 0, }; - GtkAllocation allocation; - GdkCursor *cursor; - GdkWindow *window; - - gtk_widget_get_allocation (widget, &allocation); - - gtk_widget_set_realized (widget, TRUE); - - attr.window_type = GDK_WINDOW_CHILD; - attr.wclass = GDK_INPUT_OUTPUT; - attr.width = allocation.width; - attr.height = allocation.height; - attr.x = allocation.x; - attr.y = allocation.y; - attr.event_mask = gtk_widget_get_events (widget) - | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; - - window = gdk_window_new (gtk_widget_get_parent_window (widget), &attr, - GDK_WA_X | GDK_WA_Y); - - cursor = gdk_cursor_new (GDK_HAND2); - gdk_window_set_cursor (window, cursor); - - gdk_window_set_user_data (window, widget); - gtk_widget_set_window (widget, window); -} - - -static gdouble -convert_longtitude_to_x (gdouble longitude, gint map_width) { - const gdouble xdeg_offset = -6; - gdouble x; - - x = (map_width * (180.0 + longitude) / 360.0) - + (map_width * xdeg_offset / 180.0); - - return x; -} - -static gdouble -radians (gdouble degrees) { - return (degrees / 360.0) * G_PI * 2; -} - -static gdouble -convert_latitude_to_y (gdouble latitude, gdouble map_height) { - gdouble bottom_lat = -59; - gdouble top_lat = 81; - gdouble top_per, y, full_range, top_offset, map_range; - - top_per = top_lat / 180.0; - y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude))); - full_range = 4.6068250867599998; - top_offset = full_range * top_per; - map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset); - y = fabs (y - top_offset); - y = y / map_range; - y = y * map_height; - return y; -} - - -static gboolean -anaconda_timezone_map_draw (GtkWidget *widget, - cairo_t *cr) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (widget)->priv; - GdkPixbuf *hilight, *orig_hilight, *pin; - GtkAllocation alloc; - gchar *file; - GError *err = NULL; - gdouble pointx, pointy; - char buf[16]; - - gtk_widget_get_allocation (widget, &alloc); - - /* paint background */ - gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); - cairo_paint (cr); - - /* paint hilight */ - file = g_strdup_printf ("%s/" TZMAP_DATADIR "/timezone_%s.png", - get_widgets_datadir(), - g_ascii_formatd (buf, sizeof (buf), - "%g", priv->selected_offset)); - orig_hilight = gdk_pixbuf_new_from_file (file, &err); - g_free (file); - file = NULL; - - if (!orig_hilight) { - g_warning ("Could not load hilight: %s", - (err) ? err->message : "Unknown Error"); - if (err) - g_clear_error (&err); - } - else { - - hilight = gdk_pixbuf_scale_simple (orig_hilight, alloc.width, - alloc.height, GDK_INTERP_BILINEAR); - gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0); - - cairo_paint (cr); - g_object_unref (hilight); - g_object_unref (orig_hilight); - } - - /* load pin icon */ - - file = g_strdup_printf("%s/" TZMAP_DATADIR "/pin.png", get_widgets_datadir()); - pin = gdk_pixbuf_new_from_file (file, &err); - g_free(file); - - if (err) { - g_warning ("Could not load pin icon: %s", err->message); - g_clear_error (&err); - } - - if (priv->location) { - pointx = convert_longtitude_to_x (priv->location->longitude, alloc.width); - pointy = convert_latitude_to_y (priv->location->latitude, alloc.height); - - if (pointy > alloc.height) - pointy = alloc.height; - - if (pin) { - gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); - cairo_paint (cr); - } - } - - if (pin) { - g_object_unref (pin); - } - - return TRUE; -} - - -static void -anaconda_timezone_map_class_init (AnacondaTimezoneMapClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - g_type_class_add_private (klass, sizeof (AnacondaTimezoneMapPrivate)); - - object_class->get_property = anaconda_timezone_map_get_property; - object_class->set_property = anaconda_timezone_map_set_property; - object_class->dispose = anaconda_timezone_map_dispose; - object_class->finalize = anaconda_timezone_map_finalize; - - widget_class->get_preferred_width = anaconda_timezone_map_get_preferred_width; - widget_class->get_preferred_height = anaconda_timezone_map_get_preferred_height; - widget_class->size_allocate = anaconda_timezone_map_size_allocate; - widget_class->realize = anaconda_timezone_map_realize; - widget_class->draw = anaconda_timezone_map_draw; - - signals[TIMEZONE_CHANGED] = g_signal_new ("timezone-changed", - ANACONDA_TYPE_TIMEZONE_MAP, - G_SIGNAL_RUN_FIRST, - 0, - NULL, - NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); -} - - -static gint -sort_locations (TzLocation *a, - TzLocation *b) { - if (a->dist > b->dist) - return 1; - - if (a->dist < b->dist) - return -1; - - return 0; -} - -static void -set_location (AnacondaTimezoneMap *map, - TzLocation *location, - gboolean no_city, - gboolean no_signal) { - AnacondaTimezoneMapPrivate *priv = map->priv; - TzInfo *info; - - info = tz_info_from_location (location); - - priv->selected_offset = tz_location_get_utc_offset (location) - / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0); - - if (no_city) { - priv->location = NULL; - if (!no_signal) - g_signal_emit (map, signals[TIMEZONE_CHANGED], 0, ""); - } - else { - priv->location = location; - if (!no_signal) - g_signal_emit (map, signals[TIMEZONE_CHANGED], 0, priv->location->zone); - } - - tz_info_free (info); -} - -static gboolean -button_press_event (GtkWidget *widget, - GdkEventButton *event) { - AnacondaTimezoneMapPrivate *priv = ANACONDA_TIMEZONE_MAP (widget)->priv; - gint x, y; - guchar r, g, b, a; - guchar *pixels; - gint rowstride; - gint i; - - const GPtrArray *array; - gint width, height; - GList *distances = NULL; - GtkAllocation alloc; - - x = event->x; - y = event->y; - - - rowstride = priv->visible_map_rowstride; - pixels = priv->visible_map_pixels; - - r = pixels[(rowstride * y + x * 4)]; - g = pixels[(rowstride * y + x * 4) + 1]; - b = pixels[(rowstride * y + x * 4) + 2]; - a = pixels[(rowstride * y + x * 4) + 3]; - - - for (i = 0; color_codes[i].offset != -100; i++) { - if (color_codes[i].red == r && color_codes[i].green == g - && color_codes[i].blue == b && color_codes[i].alpha == a) { - priv->selected_offset = color_codes[i].offset; - } - } - - gtk_widget_queue_draw (widget); - - /* work out the co-ordinates */ - - array = tz_get_locations (priv->tzdb); - - gtk_widget_get_allocation (widget, &alloc); - width = alloc.width; - height = alloc.height; - - for (i = 0; i < array->len; i++) { - gdouble pointx, pointy, dx, dy; - TzLocation *loc = array->pdata[i]; - - pointx = convert_longtitude_to_x (loc->longitude, width); - pointy = convert_latitude_to_y (loc->latitude, height); - - dx = pointx - x; - dy = pointy - y; - - loc->dist = dx * dx + dy * dy; - distances = g_list_prepend (distances, loc); - - } - distances = g_list_sort (distances, (GCompareFunc) sort_locations); - - - set_location (ANACONDA_TIMEZONE_MAP (widget), (TzLocation*) distances->data, FALSE, FALSE); - - g_list_free (distances); - - return TRUE; -} - -static void -anaconda_timezone_map_init (AnacondaTimezoneMap *self) { - AnacondaTimezoneMapPrivate *priv; - GError *err = NULL; - gchar *file; - - priv = self->priv = TIMEZONE_MAP_PRIVATE (self); - - file = g_strdup_printf("%s/" TZMAP_DATADIR "/bg.png", get_widgets_datadir()); - priv->orig_background = gdk_pixbuf_new_from_file (file, &err); - g_free(file); - - if (!priv->orig_background) { - g_warning ("Could not load background image: %s", - (err) ? err->message : "Unknown error"); - g_clear_error (&err); - } - - file = g_strdup_printf("%s/" TZMAP_DATADIR "/cc.png", get_widgets_datadir()); - priv->orig_color_map = gdk_pixbuf_new_from_file (file, &err); - g_free(file); - - if (!priv->orig_color_map) { - g_warning ("Could not load background image: %s", - (err) ? err->message : "Unknown error"); - g_clear_error (&err); - } - - priv->tzdb = tz_load_db (); - - g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event), - NULL); -} - -/** - * anaconda_timezone_map_set_timezone: - * @map: an #AnacondaTimezoneMap - * @timezone: timezone name - * @no_signal: whether the timezone-changed signal should be emitted or not - * - * Modifies the map to show @timezone as selected. Also modifies the internal - * data of the @map. - * - * Returns: (transfer none): Whether the change was successfully completed. - */ -gboolean -anaconda_timezone_map_set_timezone (AnacondaTimezoneMap *map, - const gchar *timezone, - gboolean no_signal) { - GPtrArray *locations; - guint i; - char *real_tz; - gboolean ret; - gboolean no_city = FALSE; - - /* "" means reset to default -- Europe/London timezone without - * a pin (no_city) */ - if (!g_strcmp0 (timezone, "")) { - timezone = "Europe/London"; - no_city = TRUE; - } - - real_tz = tz_info_get_clean_name (map->priv->tzdb, timezone); - - locations = tz_get_locations (map->priv->tzdb); - ret = FALSE; - - for (i = 0; i < locations->len; i++) { - TzLocation *loc = locations->pdata[i]; - - if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone)) { - set_location (map, loc, no_city, no_signal); - ret = TRUE; - break; - } - } - - if (ret) - gtk_widget_queue_draw (GTK_WIDGET (map)); - - g_free (real_tz); - - return ret; -} - -/** - * anaconda_timezone_map_get_timezone: - * @map: an #AnacondaTimezoneMap - * - * Returns: (transfer none): the selected timezone - */ -gchar * -anaconda_timezone_map_get_timezone (AnacondaTimezoneMap *map) { - if (map->priv->location) - return map->priv->location->zone; - else - return ""; -} diff --git a/widgets/src/TimezoneMap.h b/widgets/src/TimezoneMap.h deleted file mode 100644 index 3a857bd..0000000 --- a/widgets/src/TimezoneMap.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2012-2013 Red Hat, Inc - * - * Heavily based on the gnome-control-center code, - * Copyright (c) 2010 Intel, Inc - * Written by Thomas Wood thomas.wood@intel.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Author: Vratislav Podzimek vpodzime@redhat.com - * - */ - -#ifndef _ANACONDA_TIMEZONE_MAP_H -#define _ANACONDA_TIMEZONE_MAP_H - -#include <gtk/gtk.h> -#include "tz.h" - -G_BEGIN_DECLS - -#define ANACONDA_TYPE_TIMEZONE_MAP anaconda_timezone_map_get_type() - -#define ANACONDA_TIMEZONE_MAP(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - ANACONDA_TYPE_TIMEZONE_MAP, AnacondaTimezoneMap)) - -#define ANACONDA_TIMEZONE_MAP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - ANACONDA_TYPE_TIMEZONE_MAP, AnacondaTimezoneMapClass)) - -#define ANACONDA_IS_TIMEZONE_MAP(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - ANACONDA_TYPE_TIMEZONE_MAP)) - -#define ANACONDA_IS_TIMEZONE_MAP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - ANACONDA_TYPE_TIMEZONE_MAP)) - -#define ANACONDA_TIMEZONE_MAP_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - ANACONDA_TYPE_TIMEZONE_MAP, AnacondaTimezoneMapClass)) - -typedef struct _AnacondaTimezoneMap AnacondaTimezoneMap; -typedef struct _AnacondaTimezoneMapClass AnacondaTimezoneMapClass; -typedef struct _AnacondaTimezoneMapPrivate AnacondaTimezoneMapPrivate; - -struct _AnacondaTimezoneMap -{ - GtkWidget parent; - - AnacondaTimezoneMapPrivate *priv; -}; - -struct _AnacondaTimezoneMapClass -{ - GtkWidgetClass parent_class; -}; - -GType anaconda_timezone_map_get_type (void) G_GNUC_CONST; - -GtkWidget *anaconda_timezone_map_new (void); - -gboolean anaconda_timezone_map_set_timezone (AnacondaTimezoneMap *map, - const gchar *timezone, - gboolean no_signal); - -gchar *anaconda_timezone_map_get_timezone (AnacondaTimezoneMap *map); - -G_END_DECLS - -#endif /* _ANACONDA_TIMEZONE_MAP_H */ diff --git a/widgets/src/tz.c b/widgets/src/tz.c deleted file mode 100644 index bf551b8..0000000 --- a/widgets/src/tz.c +++ /dev/null @@ -1,435 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Generic timezone utilities. - * - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Authors: Hans Petter Jansson hpj@ximian.com - * - * Largely based on Michael Fulbright's work on Anaconda. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - - -#include <glib.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <time.h> -#include <math.h> -#include <string.h> -#include "tz.h" -#include "widgets-common.h" - - -/* Forward declarations for private functions */ - -static float convert_pos (gchar *pos, int digits); -static int compare_country_names (const void *a, const void *b); -static void sort_locations_by_country (GPtrArray *locations); -static gchar * tz_data_file_get (void); -static void load_backward_tz (TzDB *tz_db); - -/* ---------------- * - * Public interface * - * ---------------- */ -TzDB * -tz_load_db (void) -{ - gchar *tz_data_file; - TzDB *tz_db; - FILE *tzfile; - char buf[4096]; - - tz_data_file = tz_data_file_get (); - if (!tz_data_file) { - g_warning ("Could not get the TimeZone data file name"); - return NULL; - } - tzfile = fopen (tz_data_file, "r"); - if (!tzfile) { - g_warning ("Could not open *%s*\n", tz_data_file); - g_free (tz_data_file); - return NULL; - } - - tz_db = g_new0 (TzDB, 1); - tz_db->locations = g_ptr_array_new (); - - while (fgets (buf, sizeof(buf), tzfile)) { - gchar **tmpstrarr; - gchar *latstr, *lngstr, *p; - TzLocation *loc; - - if (*buf == '#') continue; - - g_strchomp(buf); - tmpstrarr = g_strsplit(buf,"\t", 6); - - latstr = g_strdup (tmpstrarr[1]); - p = latstr + 1; - while (*p != '-' && *p != '+') p++; - lngstr = g_strdup (p); - *p = '\0'; - - loc = g_new0 (TzLocation, 1); - loc->country = g_strdup (tmpstrarr[0]); - loc->zone = g_strdup (tmpstrarr[2]); - loc->latitude = convert_pos (latstr, 2); - loc->longitude = convert_pos (lngstr, 3); - - loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL; - - g_ptr_array_add (tz_db->locations, (gpointer) loc); - - g_free (latstr); - g_free (lngstr); - g_strfreev (tmpstrarr); - } - - fclose (tzfile); - - /* now sort by country */ - sort_locations_by_country (tz_db->locations); - - g_free (tz_data_file); - - /* Load up the hashtable of backward links */ - load_backward_tz (tz_db); - - return tz_db; -} - -static void -tz_location_free (TzLocation *loc) -{ - g_free (loc->country); - g_free (loc->zone); - g_free (loc->comment); - - g_free (loc); -} - -void -tz_db_free (TzDB *db) -{ - g_ptr_array_foreach (db->locations, (GFunc) tz_location_free, NULL); - g_ptr_array_free (db->locations, TRUE); - g_hash_table_destroy (db->backward); - g_free (db); -} - -GPtrArray * -tz_get_locations (TzDB *db) -{ - return db->locations; -} - - -gchar * -tz_location_get_country (TzLocation *loc) -{ - return loc->country; -} - - -gchar * -tz_location_get_zone (TzLocation *loc) -{ - return loc->zone; -} - - -gchar * -tz_location_get_comment (TzLocation *loc) -{ - return loc->comment; -} - - -void -tz_location_get_position (TzLocation *loc, double *longitude, double *latitude) -{ - *longitude = loc->longitude; - *latitude = loc->latitude; -} - -glong -tz_location_get_utc_offset (TzLocation *loc) -{ - TzInfo *tz_info; - glong offset; - - tz_info = tz_info_from_location (loc); - offset = tz_info->utc_offset; - tz_info_free (tz_info); - return offset; -} - -TzInfo * -tz_info_from_location (TzLocation *loc) -{ - TzInfo *tzinfo; - time_t curtime; - struct tm *curzone; - gchar *tz_env_value; - - g_return_val_if_fail (loc != NULL, NULL); - g_return_val_if_fail (loc->zone != NULL, NULL); - - tz_env_value = g_strdup (getenv ("TZ")); - setenv ("TZ", loc->zone, 1); - - tzinfo = g_new0 (TzInfo, 1); - - curtime = time (NULL); - curzone = localtime (&curtime); - - /* Currently this solution doesnt seem to work - I get that */ - /* America/Phoenix uses daylight savings, which is wrong */ - tzinfo->tzname_normal = g_strdup (curzone->tm_zone); - if (curzone->tm_isdst) - tzinfo->tzname_daylight = - g_strdup (&curzone->tm_zone[curzone->tm_isdst]); - else - tzinfo->tzname_daylight = NULL; - - tzinfo->utc_offset = curzone->tm_gmtoff; - - tzinfo->daylight = curzone->tm_isdst; - - if (tz_env_value) - setenv ("TZ", tz_env_value, 1); - else - unsetenv ("TZ"); - - g_free (tz_env_value); - - return tzinfo; -} - - -void -tz_info_free (TzInfo *tzinfo) -{ - g_return_if_fail (tzinfo != NULL); - - if (tzinfo->tzname_normal) g_free (tzinfo->tzname_normal); - if (tzinfo->tzname_daylight) g_free (tzinfo->tzname_daylight); - g_free (tzinfo); -} - -struct { - const char *orig; - const char *dest; -} aliases[] = { - { "Asia/Istanbul", "Europe/Istanbul" }, /* Istanbul is in both Europe and Asia */ - { "Europe/Nicosia", "Asia/Nicosia" }, /* Ditto */ - { "EET", "Europe/Istanbul" }, /* Same tz as the 2 above */ - { "HST", "Pacific/Honolulu" }, - { "WET", "Europe/Brussels" }, /* Other name for the mainland Europe tz */ - { "CET", "Europe/Brussels" }, /* ditto */ - { "MET", "Europe/Brussels" }, - { "Etc/Zulu", "Etc/GMT" }, - { "Etc/UTC", "Etc/GMT" }, - { "GMT", "Etc/GMT" }, - { "Greenwich", "Etc/GMT" }, - { "Etc/UCT", "Etc/GMT" }, - { "Etc/GMT0", "Etc/GMT" }, - { "Etc/GMT+0", "Etc/GMT" }, - { "Etc/GMT-0", "Etc/GMT" }, - { "Etc/Universal", "Etc/GMT" }, - { "PST8PDT", "America/Los_Angeles" }, /* Other name for the Atlantic tz */ - { "EST", "America/New_York" }, /* Other name for the Eastern tz */ - { "EST5EDT", "America/New_York" }, /* ditto */ - { "CST6CDT", "America/Chicago" }, /* Other name for the Central tz */ - { "MST", "America/Denver" }, /* Other name for the mountain tz */ - { "MST7MDT", "America/Denver" }, /* ditto */ -}; - -static gboolean -compare_timezones (const char *a, - const char *b) -{ - if (g_str_equal (a, b)) - return TRUE; - if (strchr (b, '/') == NULL) { - char *prefixed; - - prefixed = g_strdup_printf ("/%s", b); - if (g_str_has_suffix (a, prefixed)) { - g_free (prefixed); - return TRUE; - } - g_free (prefixed); - } - - return FALSE; -} - -char * -tz_info_get_clean_name (TzDB *tz_db, - const char *tz) -{ - char *ret; - const char *timezone; - guint i; - gboolean replaced; - - /* Remove useless prefixes */ - if (g_str_has_prefix (tz, "right/")) - tz = tz + strlen ("right/"); - else if (g_str_has_prefix (tz, "posix/")) - tz = tz + strlen ("posix/"); - - /* Here start the crazies */ - replaced = FALSE; - - for (i = 0; i < G_N_ELEMENTS (aliases); i++) { - if (compare_timezones (tz, aliases[i].orig)) { - replaced = TRUE; - timezone = aliases[i].dest; - break; - } - } - - /* Try again! */ - if (!replaced) { - /* Ignore crazy solar times from the '80s */ - if (g_str_has_prefix (tz, "Asia/Riyadh") || - g_str_has_prefix (tz, "Mideast/Riyadh")) { - timezone = "Asia/Riyadh"; - replaced = TRUE; - } - } - - if (!replaced) - timezone = tz; - - ret = g_hash_table_lookup (tz_db->backward, timezone); - if (ret == NULL) - return g_strdup (timezone); - return g_strdup (ret); -} - -/* ----------------- * - * Private functions * - * ----------------- */ - -static gchar * -tz_data_file_get (void) -{ - gchar *file; - - file = g_strdup (TZ_DATA_FILE); - - return file; -} - -static float -convert_pos (gchar *pos, int digits) -{ - gchar whole[10]; - gchar *fraction; - gint i; - float t1, t2; - - if (!pos || strlen(pos) < 4 || digits > 9) return 0.0; - - for (i = 0; i < digits + 1; i++) whole[i] = pos[i]; - whole[i] = '\0'; - fraction = pos + digits + 1; - - t1 = g_strtod (whole, NULL); - t2 = g_strtod (fraction, NULL); - - if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction)); - else return t1 - t2/pow (10.0, strlen(fraction)); -} - -static int -compare_country_names (const void *a, const void *b) -{ - const TzLocation *tza = * (TzLocation **) a; - const TzLocation *tzb = * (TzLocation **) b; - - return strcmp (tza->zone, tzb->zone); -} - - -static void -sort_locations_by_country (GPtrArray *locations) -{ - qsort (locations->pdata, locations->len, sizeof (gpointer), - compare_country_names); -} - -static void -load_backward_tz (TzDB *tz_db) -{ - GError *error = NULL; - char **lines, *contents; - guint i; - gchar *file; - - tz_db->backward = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - - file = g_strdup_printf ("%s/" TZMAP_DATADIR "/timezones_backward", get_widgets_datadir()); - if (g_file_get_contents (file, &contents, NULL, &error) == FALSE) { - g_warning ("Failed to load 'backward' file: %s", error->message); - g_free(file); - return; - } - g_free(file); - - lines = g_strsplit (contents, "\n", -1); - g_free (contents); - for (i = 0; lines[i] != NULL; i++) { - char **items; - guint j; - char *real, *alias; - - if (g_ascii_strncasecmp (lines[i], "Link\t", 5) != 0) - continue; - - items = g_strsplit (lines[i], "\t", -1); - real = NULL; - alias = NULL; - /* Skip the "Link<tab>" part */ - for (j = 1; items[j] != NULL; j++) { - if (items[j][0] == '\0') - continue; - if (real == NULL) { - real = items[j]; - continue; - } - alias = items[j]; - break; - } - - if (real == NULL || alias == NULL) - g_warning ("Could not parse line: %s", lines[i]); - - /* We don't need more than one name for it */ - if (g_str_equal (real, "Etc/UTC") || - g_str_equal (real, "Etc/UCT")) - real = "Etc/GMT"; - - g_hash_table_insert (tz_db->backward, g_strdup (alias), g_strdup (real)); - g_strfreev (items); - } - g_strfreev (lines); -} - diff --git a/widgets/src/tz.h b/widgets/src/tz.h deleted file mode 100644 index ec8a569..0000000 --- a/widgets/src/tz.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Generic timezone utilities. - * - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Authors: Hans Petter Jansson hpj@ximian.com - * - * Largely based on Michael Fulbright's work on Anaconda. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _E_TZ_H -#define _E_TZ_H - -#include <glib.h> - -#define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab" - -typedef struct _TzDB TzDB; -typedef struct _TzLocation TzLocation; -typedef struct _TzInfo TzInfo; - -gchar *get_widgets_datadir(); - -struct _TzDB -{ - GPtrArray *locations; - GHashTable *backward; -}; - -struct _TzLocation -{ - gchar *country; - gdouble latitude; - gdouble longitude; - gchar *zone; - gchar *comment; - - gdouble dist; /* distance to clicked point for comparison */ -}; - -/* see the glibc info page information on time zone information */ -/* tzname_normal is the default name for the timezone */ -/* tzname_daylight is the name of the zone when in daylight savings */ -/* utc_offset is offset in seconds from utc */ -/* daylight if non-zero then location obeys daylight savings */ - -struct _TzInfo -{ - gchar *tzname_normal; - gchar *tzname_daylight; - glong utc_offset; - gint daylight; -}; - - -TzDB *tz_load_db (void); -void tz_db_free (TzDB *db); -char * tz_info_get_clean_name (TzDB *tz_db, - const char *tz); -GPtrArray *tz_get_locations (TzDB *db); -void tz_location_get_position (TzLocation *loc, - double *longitude, double *latitude); -char *tz_location_get_country (TzLocation *loc); -gchar *tz_location_get_zone (TzLocation *loc); -gchar *tz_location_get_comment (TzLocation *loc); -glong tz_location_get_utc_offset (TzLocation *loc); -gint tz_location_set_locally (TzLocation *loc); -TzInfo *tz_info_from_location (TzLocation *loc); -void tz_info_free (TzInfo *tz_info); - -#endif