aboutsummaryrefslogtreecommitdiff
path: root/libmap
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-02-22 11:20:34 -0500
committerMichael Terry <mike@mterry.name>2011-02-22 11:20:34 -0500
commit45b1165f77cab0ac8dc40ce7d605e32c697fb22d (patch)
treeb803709c23f3e50dbca5b57ebb3a4215b0b45d58 /libmap
parent8754d980f2992a2596465d46b5d18d35846060fa (diff)
downloadayatana-indicator-datetime-45b1165f77cab0ac8dc40ce7d605e32c697fb22d.tar.gz
ayatana-indicator-datetime-45b1165f77cab0ac8dc40ce7d605e32c697fb22d.tar.bz2
ayatana-indicator-datetime-45b1165f77cab0ac8dc40ce7d605e32c697fb22d.zip
add initial timezone map implementation, borrowed from gnome-control-center
Diffstat (limited to 'libmap')
-rw-r--r--libmap/Makefile.am76
-rw-r--r--libmap/Makefile.in732
-rw-r--r--libmap/README5
-rw-r--r--libmap/backward118
-rw-r--r--libmap/cc-timezone-map.c711
-rw-r--r--libmap/cc-timezone-map.h79
-rw-r--r--libmap/data/bg.pngbin0 -> 213448 bytes
-rw-r--r--libmap/data/cc.pngbin0 -> 53948 bytes
-rw-r--r--libmap/data/pin.pngbin0 -> 561 bytes
-rw-r--r--libmap/data/timezone_-1.pngbin0 -> 8012 bytes
-rw-r--r--libmap/data/timezone_-10.pngbin0 -> 7783 bytes
-rw-r--r--libmap/data/timezone_-11.pngbin0 -> 7406 bytes
-rw-r--r--libmap/data/timezone_-2.pngbin0 -> 4333 bytes
-rw-r--r--libmap/data/timezone_-3.5.pngbin0 -> 740 bytes
-rw-r--r--libmap/data/timezone_-3.pngbin0 -> 13615 bytes
-rw-r--r--libmap/data/timezone_-4.5.pngbin0 -> 1900 bytes
-rw-r--r--libmap/data/timezone_-4.pngbin0 -> 15084 bytes
-rw-r--r--libmap/data/timezone_-5.5.pngbin0 -> 437 bytes
-rw-r--r--libmap/data/timezone_-5.pngbin0 -> 19166 bytes
-rw-r--r--libmap/data/timezone_-6.pngbin0 -> 13764 bytes
-rw-r--r--libmap/data/timezone_-7.pngbin0 -> 11977 bytes
-rw-r--r--libmap/data/timezone_-8.pngbin0 -> 6801 bytes
-rw-r--r--libmap/data/timezone_-9.5.pngbin0 -> 437 bytes
-rw-r--r--libmap/data/timezone_-9.pngbin0 -> 7908 bytes
-rw-r--r--libmap/data/timezone_0.pngbin0 -> 11074 bytes
-rw-r--r--libmap/data/timezone_1.pngbin0 -> 15458 bytes
-rw-r--r--libmap/data/timezone_10.5.pngbin0 -> 421 bytes
-rw-r--r--libmap/data/timezone_10.pngbin0 -> 12829 bytes
-rw-r--r--libmap/data/timezone_11.5.pngbin0 -> 446 bytes
-rw-r--r--libmap/data/timezone_11.pngbin0 -> 12113 bytes
-rw-r--r--libmap/data/timezone_12.75.pngbin0 -> 409 bytes
-rw-r--r--libmap/data/timezone_12.pngbin0 -> 7130 bytes
-rw-r--r--libmap/data/timezone_13.pngbin0 -> 621 bytes
-rw-r--r--libmap/data/timezone_2.pngbin0 -> 12854 bytes
-rw-r--r--libmap/data/timezone_3.5.pngbin0 -> 2142 bytes
-rw-r--r--libmap/data/timezone_3.pngbin0 -> 17475 bytes
-rw-r--r--libmap/data/timezone_4.5.pngbin0 -> 1773 bytes
-rw-r--r--libmap/data/timezone_4.pngbin0 -> 4954 bytes
-rw-r--r--libmap/data/timezone_5.5.pngbin0 -> 6099 bytes
-rw-r--r--libmap/data/timezone_5.75.pngbin0 -> 2885 bytes
-rw-r--r--libmap/data/timezone_5.pngbin0 -> 14539 bytes
-rw-r--r--libmap/data/timezone_6.5.pngbin0 -> 1609 bytes
-rw-r--r--libmap/data/timezone_6.pngbin0 -> 8441 bytes
-rw-r--r--libmap/data/timezone_7.pngbin0 -> 14412 bytes
-rw-r--r--libmap/data/timezone_8.pngbin0 -> 16725 bytes
-rw-r--r--libmap/data/timezone_9.5.pngbin0 -> 1959 bytes
-rw-r--r--libmap/data/timezone_9.pngbin0 -> 12608 bytes
-rw-r--r--libmap/datetime-module.c46
-rw-r--r--libmap/dt-lockbutton.c627
-rw-r--r--libmap/dt-lockbutton.h68
-rw-r--r--libmap/set-timezone.c481
-rw-r--r--libmap/set-timezone.h57
-rw-r--r--libmap/test-timezone.c55
-rw-r--r--libmap/tz.c350
-rw-r--r--libmap/tz.h86
55 files changed, 3491 insertions, 0 deletions
diff --git a/libmap/Makefile.am b/libmap/Makefile.am
new file mode 100644
index 0000000..0cdeb34
--- /dev/null
+++ b/libmap/Makefile.am
@@ -0,0 +1,76 @@
+uidir = $(pkgdatadir)/libmap/ui
+dist_ui_DATA = \
+ data/bg.png \
+ data/cc.png \
+ data/pin.png \
+ data/timezone_0.png \
+ data/timezone_-10.png \
+ data/timezone_10.png \
+ data/timezone_10.5.png \
+ data/timezone_-1.png \
+ data/timezone_1.png \
+ data/timezone_-11.png \
+ data/timezone_11.png \
+ data/timezone_11.5.png \
+ data/timezone_12.png \
+ data/timezone_12.75.png \
+ data/timezone_13.png \
+ data/timezone_-2.png \
+ data/timezone_2.png \
+ data/timezone_-3.png \
+ data/timezone_3.png \
+ data/timezone_-3.5.png \
+ data/timezone_3.5.png \
+ data/timezone_-4.png \
+ data/timezone_4.png \
+ data/timezone_-4.5.png \
+ data/timezone_4.5.png \
+ data/timezone_-5.png \
+ data/timezone_5.png \
+ data/timezone_-5.5.png \
+ data/timezone_5.5.png \
+ data/timezone_5.75.png \
+ data/timezone_-6.png \
+ data/timezone_6.png \
+ data/timezone_6.5.png \
+ data/timezone_-7.png \
+ data/timezone_7.png \
+ data/timezone_-8.png \
+ data/timezone_8.png \
+ data/timezone_-9.png \
+ data/timezone_9.png \
+ data/timezone_-9.5.png \
+ data/timezone_9.5.png
+
+tzdatadir = $(pkgdatadir)/libmap/datetime
+dist_tzdata_DATA = backward
+
+AM_CPPFLAGS = \
+ $(LIBMAP_CFLAGS) \
+ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
+ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)/libmap\"" \
+ -DDATADIR="\"$(uidir)\"" \
+ $(NULL)
+
+noinst_PROGRAMS = test-timezone
+
+test_timezone_SOURCES = test-timezone.c tz.c tz.h
+test_timezone_LDADD = $(LIBMAP_LIBS)
+test_timezone_CFLAGS = $(LIBMAP_CFLAGS)
+
+all-local: check-local
+
+# FIXME remove "|| :" when we have all the necessary pixmaps
+check-local: test-timezone
+ $(builddir)/test-timezone $(srcdir)/data || :
+
+noinst_LTLIBRARIES = libmap.la
+
+libmap_la_SOURCES = \
+ cc-timezone-map.c \
+ cc-timezone-map.h \
+ tz.c tz.h
+
+libmap_la_LIBADD = $(LIBMAP_LIBS)
+libmap_la_LDFLAGS = $(LIBMAP_LDFLAGS)
+
diff --git a/libmap/Makefile.in b/libmap/Makefile.in
new file mode 100644
index 0000000..b4ae6df
--- /dev/null
+++ b/libmap/Makefile.in
@@ -0,0 +1,732 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = test-timezone$(EXEEXT)
+subdir = libmap
+DIST_COMMON = README $(dist_tzdata_DATA) $(dist_ui_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libmap_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_libmap_la_OBJECTS = cc-timezone-map.lo tz.lo
+libmap_la_OBJECTS = $(am_libmap_la_OBJECTS)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+libmap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libmap_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(noinst_PROGRAMS)
+am_test_timezone_OBJECTS = test_timezone-test-timezone.$(OBJEXT) \
+ test_timezone-tz.$(OBJEXT)
+test_timezone_OBJECTS = $(am_test_timezone_OBJECTS)
+test_timezone_DEPENDENCIES = $(am__DEPENDENCIES_1)
+test_timezone_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_timezone_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libmap_la_SOURCES) $(test_timezone_SOURCES)
+DIST_SOURCES = $(libmap_la_SOURCES) $(test_timezone_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(tzdatadir)" "$(DESTDIR)$(uidir)"
+DATA = $(dist_tzdata_DATA) $(dist_ui_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUSSERVICEDIR = @DBUSSERVICEDIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNOMELOCALEDIR = @GNOMELOCALEDIR@
+GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
+INDICATORDIR = @INDICATORDIR@
+INDICATORICONSDIR = @INDICATORICONSDIR@
+INDICATOR_CFLAGS = @INDICATOR_CFLAGS@
+INDICATOR_LIBS = @INDICATOR_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBMAP_CFLAGS = @LIBMAP_CFLAGS@
+LIBMAP_LDFLAGS = @LIBMAP_LDFLAGS@
+LIBMAP_LIBS = @LIBMAP_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POFILES = @POFILES@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PREF_CFLAGS = @PREF_CFLAGS@
+PREF_LIBS = @PREF_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SERVICE_CFLAGS = @SERVICE_CFLAGS@
+SERVICE_LIBS = @SERVICE_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+uidir = $(pkgdatadir)/libmap/ui
+dist_ui_DATA = \
+ data/bg.png \
+ data/cc.png \
+ data/pin.png \
+ data/timezone_0.png \
+ data/timezone_-10.png \
+ data/timezone_10.png \
+ data/timezone_10.5.png \
+ data/timezone_-1.png \
+ data/timezone_1.png \
+ data/timezone_-11.png \
+ data/timezone_11.png \
+ data/timezone_11.5.png \
+ data/timezone_12.png \
+ data/timezone_12.75.png \
+ data/timezone_13.png \
+ data/timezone_-2.png \
+ data/timezone_2.png \
+ data/timezone_-3.png \
+ data/timezone_3.png \
+ data/timezone_-3.5.png \
+ data/timezone_3.5.png \
+ data/timezone_-4.png \
+ data/timezone_4.png \
+ data/timezone_-4.5.png \
+ data/timezone_4.5.png \
+ data/timezone_-5.png \
+ data/timezone_5.png \
+ data/timezone_-5.5.png \
+ data/timezone_5.5.png \
+ data/timezone_5.75.png \
+ data/timezone_-6.png \
+ data/timezone_6.png \
+ data/timezone_6.5.png \
+ data/timezone_-7.png \
+ data/timezone_7.png \
+ data/timezone_-8.png \
+ data/timezone_8.png \
+ data/timezone_-9.png \
+ data/timezone_9.png \
+ data/timezone_-9.5.png \
+ data/timezone_9.5.png
+
+tzdatadir = $(pkgdatadir)/libmap/datetime
+dist_tzdata_DATA = backward
+AM_CPPFLAGS = \
+ $(LIBMAP_CFLAGS) \
+ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
+ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)/libmap\"" \
+ -DDATADIR="\"$(uidir)\"" \
+ $(NULL)
+
+test_timezone_SOURCES = test-timezone.c tz.c tz.h
+test_timezone_LDADD = $(LIBMAP_LIBS)
+test_timezone_CFLAGS = $(LIBMAP_CFLAGS)
+noinst_LTLIBRARIES = libmap.la
+libmap_la_SOURCES = \
+ cc-timezone-map.c \
+ cc-timezone-map.h \
+ tz.c tz.h
+
+libmap_la_LIBADD = $(LIBMAP_LIBS)
+libmap_la_LDFLAGS = $(LIBMAP_LDFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libmap/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libmap/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmap.la: $(libmap_la_OBJECTS) $(libmap_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libmap_la_LINK) $(libmap_la_OBJECTS) $(libmap_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+test-timezone$(EXEEXT): $(test_timezone_OBJECTS) $(test_timezone_DEPENDENCIES)
+ @rm -f test-timezone$(EXEEXT)
+ $(AM_V_CCLD)$(test_timezone_LINK) $(test_timezone_OBJECTS) $(test_timezone_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cc-timezone-map.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_timezone-test-timezone.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_timezone-tz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tz.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+test_timezone-test-timezone.o: test-timezone.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -MT test_timezone-test-timezone.o -MD -MP -MF $(DEPDIR)/test_timezone-test-timezone.Tpo -c -o test_timezone-test-timezone.o `test -f 'test-timezone.c' || echo '$(srcdir)/'`test-timezone.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_timezone-test-timezone.Tpo $(DEPDIR)/test_timezone-test-timezone.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-timezone.c' object='test_timezone-test-timezone.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -c -o test_timezone-test-timezone.o `test -f 'test-timezone.c' || echo '$(srcdir)/'`test-timezone.c
+
+test_timezone-test-timezone.obj: test-timezone.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -MT test_timezone-test-timezone.obj -MD -MP -MF $(DEPDIR)/test_timezone-test-timezone.Tpo -c -o test_timezone-test-timezone.obj `if test -f 'test-timezone.c'; then $(CYGPATH_W) 'test-timezone.c'; else $(CYGPATH_W) '$(srcdir)/test-timezone.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_timezone-test-timezone.Tpo $(DEPDIR)/test_timezone-test-timezone.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-timezone.c' object='test_timezone-test-timezone.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -c -o test_timezone-test-timezone.obj `if test -f 'test-timezone.c'; then $(CYGPATH_W) 'test-timezone.c'; else $(CYGPATH_W) '$(srcdir)/test-timezone.c'; fi`
+
+test_timezone-tz.o: tz.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -MT test_timezone-tz.o -MD -MP -MF $(DEPDIR)/test_timezone-tz.Tpo -c -o test_timezone-tz.o `test -f 'tz.c' || echo '$(srcdir)/'`tz.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_timezone-tz.Tpo $(DEPDIR)/test_timezone-tz.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tz.c' object='test_timezone-tz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -c -o test_timezone-tz.o `test -f 'tz.c' || echo '$(srcdir)/'`tz.c
+
+test_timezone-tz.obj: tz.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -MT test_timezone-tz.obj -MD -MP -MF $(DEPDIR)/test_timezone-tz.Tpo -c -o test_timezone-tz.obj `if test -f 'tz.c'; then $(CYGPATH_W) 'tz.c'; else $(CYGPATH_W) '$(srcdir)/tz.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_timezone-tz.Tpo $(DEPDIR)/test_timezone-tz.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tz.c' object='test_timezone-tz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_timezone_CFLAGS) $(CFLAGS) -c -o test_timezone-tz.obj `if test -f 'tz.c'; then $(CYGPATH_W) 'tz.c'; else $(CYGPATH_W) '$(srcdir)/tz.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_tzdataDATA: $(dist_tzdata_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(tzdatadir)" || $(MKDIR_P) "$(DESTDIR)$(tzdatadir)"
+ @list='$(dist_tzdata_DATA)'; test -n "$(tzdatadir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(tzdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(tzdatadir)" || exit $$?; \
+ done
+
+uninstall-dist_tzdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_tzdata_DATA)'; test -n "$(tzdatadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(tzdatadir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(tzdatadir)" && rm -f $$files
+install-dist_uiDATA: $(dist_ui_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(uidir)" || $(MKDIR_P) "$(DESTDIR)$(uidir)"
+ @list='$(dist_ui_DATA)'; test -n "$(uidir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(uidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(uidir)" || exit $$?; \
+ done
+
+uninstall-dist_uiDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_ui_DATA)'; test -n "$(uidir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(uidir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(uidir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(tzdatadir)" "$(DESTDIR)$(uidir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_tzdataDATA install-dist_uiDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_tzdataDATA uninstall-dist_uiDATA
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \
+ clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-noinstPROGRAMS ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_tzdataDATA \
+ install-dist_uiDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-dist_tzdataDATA \
+ uninstall-dist_uiDATA
+
+
+all-local: check-local
+
+# FIXME remove "|| :" when we have all the necessary pixmaps
+check-local: test-timezone
+ $(builddir)/test-timezone $(srcdir)/data || :
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmap/README b/libmap/README
new file mode 100644
index 0000000..70d6f6c
--- /dev/null
+++ b/libmap/README
@@ -0,0 +1,5 @@
+This static library is a copied version of the code in GNOME 3.0's control center panel 'datetime', which itself is a version of Ubiquity's map ported to C.
+
+Ideally in the future, we can have all three packages using the same code. But for now, for time reasons (hah), it's just a copy.
+
+To update this copy, put newer versions of the code and data files in place; then fix up any GTK3-isms.
diff --git a/libmap/backward b/libmap/backward
new file mode 100644
index 0000000..f1f95a8
--- /dev/null
+++ b/libmap/backward
@@ -0,0 +1,118 @@
+# <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/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c
new file mode 100644
index 0000000..960a049
--- /dev/null
+++ b/libmap/cc-timezone-map.c
@@ -0,0 +1,711 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * Portions from Ubiquity, Copyright (C) 2009 Canonical Ltd.
+ * Written by Evan Dandrea <evand@ubuntu.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: Thomas Wood <thomas.wood@intel.com>
+ *
+ */
+
+#include "cc-timezone-map.h"
+#include <math.h>
+#include "tz.h"
+
+G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
+
+#define TIMEZONE_MAP_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_MAP, CcTimezoneMapPrivate))
+
+
+typedef struct
+{
+ gdouble offset;
+ guchar red;
+ guchar green;
+ guchar blue;
+ guchar alpha;
+} CcTimezoneMapOffset;
+
+struct _CcTimezoneMapPrivate
+{
+ 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;
+ GHashTable *alias_db;
+};
+
+enum
+{
+ LOCATION_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+
+static CcTimezoneMapOffset 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 }
+};
+
+
+static void
+cc_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
+cc_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
+cc_timezone_map_dispose (GObject *object)
+{
+ CcTimezoneMapPrivate *priv = CC_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;
+ }
+
+ if (priv->alias_db)
+ {
+ g_hash_table_destroy (priv->alias_db);
+ priv->alias_db = NULL;
+ }
+
+ G_OBJECT_CLASS (cc_timezone_map_parent_class)->dispose (object);
+}
+
+static void
+cc_timezone_map_finalize (GObject *object)
+{
+ CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (object)->priv;
+
+ if (priv->tzdb)
+ {
+ tz_db_free (priv->tzdb);
+ priv->tzdb = NULL;
+ }
+
+
+ G_OBJECT_CLASS (cc_timezone_map_parent_class)->finalize (object);
+}
+
+/* GtkWidget functions */
+#ifdef CCGTK3
+static void
+cc_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
+cc_timezone_map_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ CcTimezoneMapPrivate *priv = CC_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;
+}
+
+#else
+
+static void
+cc_timezone_map_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
+
+ if (!requisition)
+ return;
+
+ /* The + 20 here is a slight tweak to make the map fill the
+ * panel better without causing horizontal growing
+ */
+ requisition->height = 300 * gdk_pixbuf_get_height (priv->orig_background) / gdk_pixbuf_get_width (priv->orig_background) + 20;
+ requisition->width = 300;
+}
+#endif
+
+static void
+cc_timezone_map_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ CcTimezoneMapPrivate *priv = CC_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 (cc_timezone_map_parent_class)->size_allocate (widget,
+ allocation);
+}
+
+static void
+cc_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);
+
+ gtk_widget_set_style (widget,
+ gtk_style_attach (gtk_widget_get_style (widget),
+ window));
+
+ gdk_window_set_user_data (window, widget);
+
+ cursor = gdk_cursor_new (GDK_HAND2);
+ gdk_window_set_cursor (window, cursor);
+
+ 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
+cc_timezone_map_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ CcTimezoneMapPrivate *priv = CC_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 (DATADIR "/timezone_%s.png",
+ 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 */
+ pin = gdk_pixbuf_new_from_file (DATADIR "/pin.png", &err);
+
+ 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;
+}
+
+#ifndef CCGTK3
+static gboolean
+cc_timezone_map_expose_event (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ gboolean rv;
+ cairo_t *cr;
+ cr = gdk_cairo_create (widget->window);
+ rv = cc_timezone_map_draw (widget, cr);
+ cairo_destroy (cr);
+ return rv;
+}
+#endif
+
+
+static void
+cc_timezone_map_class_init (CcTimezoneMapClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CcTimezoneMapPrivate));
+
+ object_class->get_property = cc_timezone_map_get_property;
+ object_class->set_property = cc_timezone_map_set_property;
+ object_class->dispose = cc_timezone_map_dispose;
+ object_class->finalize = cc_timezone_map_finalize;
+
+#ifdef CCGTK3
+ widget_class->get_preferred_width = cc_timezone_map_get_preferred_width;
+ widget_class->get_preferred_height = cc_timezone_map_get_preferred_height;
+#else
+ widget_class->size_request = cc_timezone_map_size_request;
+#endif
+ widget_class->size_allocate = cc_timezone_map_size_allocate;
+ widget_class->realize = cc_timezone_map_realize;
+#ifdef CCGTK3
+ widget_class->draw = cc_timezone_map_draw;
+#else
+ widget_class->expose_event = cc_timezone_map_expose_event;
+#endif
+
+ signals[LOCATION_CHANGED] = g_signal_new ("location-changed",
+ CC_TYPE_TIMEZONE_MAP,
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+}
+
+
+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 (CcTimezoneMap *map,
+ TzLocation *location)
+{
+ CcTimezoneMapPrivate *priv = map->priv;
+ TzInfo *info;
+
+ priv->location = location;
+
+ info = tz_info_from_location (priv->location);
+
+ priv->selected_offset = tz_location_get_utc_offset (priv->location)
+ / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
+
+ g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
+
+ tz_info_free (info);
+}
+
+static gboolean
+button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ CcTimezoneMapPrivate *priv = CC_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 (CC_TIMEZONE_MAP (widget), (TzLocation*) distances->data);
+
+ g_list_free (distances);
+
+ return TRUE;
+}
+
+static void
+load_backward_tz (CcTimezoneMap *self)
+{
+ GError *error = NULL;
+ char **lines, *contents;
+ guint i;
+
+ self->priv->alias_db = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+ if (g_file_get_contents (GNOMECC_DATA_DIR "/datetime/backward", &contents, NULL, &error) == FALSE)
+ {
+ g_warning ("Failed to load 'backward' file: %s", error->message);
+ return;
+ }
+ 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]);
+
+ g_hash_table_insert (self->priv->alias_db, g_strdup (alias), g_strdup (real));
+ g_strfreev (items);
+ }
+ g_strfreev (lines);
+}
+
+static void
+cc_timezone_map_init (CcTimezoneMap *self)
+{
+ CcTimezoneMapPrivate *priv;
+ GError *err = NULL;
+
+ priv = self->priv = TIMEZONE_MAP_PRIVATE (self);
+
+ priv->orig_background = gdk_pixbuf_new_from_file (DATADIR "/bg.png",
+ &err);
+
+ if (!priv->orig_background)
+ {
+ g_warning ("Could not load background image: %s",
+ (err) ? err->message : "Unknown error");
+ g_clear_error (&err);
+ }
+
+ priv->orig_color_map = gdk_pixbuf_new_from_file (DATADIR "/cc.png",
+ &err);
+ 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);
+
+ load_backward_tz (self);
+}
+
+CcTimezoneMap *
+cc_timezone_map_new (void)
+{
+ return g_object_new (CC_TYPE_TIMEZONE_MAP, NULL);
+}
+
+void
+cc_timezone_map_set_timezone (CcTimezoneMap *map,
+ const gchar *timezone)
+{
+ GPtrArray *locations;
+ guint i;
+ char *real_tz;
+
+ real_tz = g_hash_table_lookup (map->priv->alias_db, timezone);
+
+ locations = tz_get_locations (map->priv->tzdb);
+
+ 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);
+ break;
+ }
+ }
+
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+}
+
+TzLocation *
+cc_timezone_map_get_location (CcTimezoneMap *map)
+{
+ return map->priv->location;
+}
diff --git a/libmap/cc-timezone-map.h b/libmap/cc-timezone-map.h
new file mode 100644
index 0000000..3c57b27
--- /dev/null
+++ b/libmap/cc-timezone-map.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * 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: Thomas Wood <thomas.wood@intel.com>
+ *
+ */
+
+
+#ifndef _CC_TIMEZONE_MAP_H
+#define _CC_TIMEZONE_MAP_H
+
+#include <gtk/gtk.h>
+#include "tz.h"
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_TIMEZONE_MAP cc_timezone_map_get_type()
+
+#define CC_TIMEZONE_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_TIMEZONE_MAP, CcTimezoneMap))
+
+#define CC_TIMEZONE_MAP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
+
+#define CC_IS_TIMEZONE_MAP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_TIMEZONE_MAP))
+
+#define CC_IS_TIMEZONE_MAP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_TIMEZONE_MAP))
+
+#define CC_TIMEZONE_MAP_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_TIMEZONE_MAP, CcTimezoneMapClass))
+
+typedef struct _CcTimezoneMap CcTimezoneMap;
+typedef struct _CcTimezoneMapClass CcTimezoneMapClass;
+typedef struct _CcTimezoneMapPrivate CcTimezoneMapPrivate;
+
+struct _CcTimezoneMap
+{
+ GtkWidget parent;
+
+ CcTimezoneMapPrivate *priv;
+};
+
+struct _CcTimezoneMapClass
+{
+ GtkWidgetClass parent_class;
+};
+
+GType cc_timezone_map_get_type (void) G_GNUC_CONST;
+
+CcTimezoneMap *cc_timezone_map_new (void);
+
+void cc_timezone_map_set_timezone (CcTimezoneMap *map,
+ const gchar *timezone);
+TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
+
+G_END_DECLS
+
+#endif /* _CC_TIMEZONE_MAP_H */
diff --git a/libmap/data/bg.png b/libmap/data/bg.png
new file mode 100644
index 0000000..4180ee8
--- /dev/null
+++ b/libmap/data/bg.png
Binary files differ
diff --git a/libmap/data/cc.png b/libmap/data/cc.png
new file mode 100644
index 0000000..54fb668
--- /dev/null
+++ b/libmap/data/cc.png
Binary files differ
diff --git a/libmap/data/pin.png b/libmap/data/pin.png
new file mode 100644
index 0000000..599a751
--- /dev/null
+++ b/libmap/data/pin.png
Binary files differ
diff --git a/libmap/data/timezone_-1.png b/libmap/data/timezone_-1.png
new file mode 100644
index 0000000..fb00d83
--- /dev/null
+++ b/libmap/data/timezone_-1.png
Binary files differ
diff --git a/libmap/data/timezone_-10.png b/libmap/data/timezone_-10.png
new file mode 100644
index 0000000..472eb88
--- /dev/null
+++ b/libmap/data/timezone_-10.png
Binary files differ
diff --git a/libmap/data/timezone_-11.png b/libmap/data/timezone_-11.png
new file mode 100644
index 0000000..5f8c5d6
--- /dev/null
+++ b/libmap/data/timezone_-11.png
Binary files differ
diff --git a/libmap/data/timezone_-2.png b/libmap/data/timezone_-2.png
new file mode 100644
index 0000000..30a1ec7
--- /dev/null
+++ b/libmap/data/timezone_-2.png
Binary files differ
diff --git a/libmap/data/timezone_-3.5.png b/libmap/data/timezone_-3.5.png
new file mode 100644
index 0000000..c1df00b
--- /dev/null
+++ b/libmap/data/timezone_-3.5.png
Binary files differ
diff --git a/libmap/data/timezone_-3.png b/libmap/data/timezone_-3.png
new file mode 100644
index 0000000..c22dbb6
--- /dev/null
+++ b/libmap/data/timezone_-3.png
Binary files differ
diff --git a/libmap/data/timezone_-4.5.png b/libmap/data/timezone_-4.5.png
new file mode 100644
index 0000000..9e3c134
--- /dev/null
+++ b/libmap/data/timezone_-4.5.png
Binary files differ
diff --git a/libmap/data/timezone_-4.png b/libmap/data/timezone_-4.png
new file mode 100644
index 0000000..4b5a431
--- /dev/null
+++ b/libmap/data/timezone_-4.png
Binary files differ
diff --git a/libmap/data/timezone_-5.5.png b/libmap/data/timezone_-5.5.png
new file mode 100644
index 0000000..b1c788d
--- /dev/null
+++ b/libmap/data/timezone_-5.5.png
Binary files differ
diff --git a/libmap/data/timezone_-5.png b/libmap/data/timezone_-5.png
new file mode 100644
index 0000000..06c15e6
--- /dev/null
+++ b/libmap/data/timezone_-5.png
Binary files differ
diff --git a/libmap/data/timezone_-6.png b/libmap/data/timezone_-6.png
new file mode 100644
index 0000000..8505fb1
--- /dev/null
+++ b/libmap/data/timezone_-6.png
Binary files differ
diff --git a/libmap/data/timezone_-7.png b/libmap/data/timezone_-7.png
new file mode 100644
index 0000000..fec235d
--- /dev/null
+++ b/libmap/data/timezone_-7.png
Binary files differ
diff --git a/libmap/data/timezone_-8.png b/libmap/data/timezone_-8.png
new file mode 100644
index 0000000..bdad7bf
--- /dev/null
+++ b/libmap/data/timezone_-8.png
Binary files differ
diff --git a/libmap/data/timezone_-9.5.png b/libmap/data/timezone_-9.5.png
new file mode 100644
index 0000000..b1c788d
--- /dev/null
+++ b/libmap/data/timezone_-9.5.png
Binary files differ
diff --git a/libmap/data/timezone_-9.png b/libmap/data/timezone_-9.png
new file mode 100644
index 0000000..04cb3cb
--- /dev/null
+++ b/libmap/data/timezone_-9.png
Binary files differ
diff --git a/libmap/data/timezone_0.png b/libmap/data/timezone_0.png
new file mode 100644
index 0000000..e59b773
--- /dev/null
+++ b/libmap/data/timezone_0.png
Binary files differ
diff --git a/libmap/data/timezone_1.png b/libmap/data/timezone_1.png
new file mode 100644
index 0000000..2053b7e
--- /dev/null
+++ b/libmap/data/timezone_1.png
Binary files differ
diff --git a/libmap/data/timezone_10.5.png b/libmap/data/timezone_10.5.png
new file mode 100644
index 0000000..6ec7f9f
--- /dev/null
+++ b/libmap/data/timezone_10.5.png
Binary files differ
diff --git a/libmap/data/timezone_10.png b/libmap/data/timezone_10.png
new file mode 100644
index 0000000..475dcf4
--- /dev/null
+++ b/libmap/data/timezone_10.png
Binary files differ
diff --git a/libmap/data/timezone_11.5.png b/libmap/data/timezone_11.5.png
new file mode 100644
index 0000000..afdedd7
--- /dev/null
+++ b/libmap/data/timezone_11.5.png
Binary files differ
diff --git a/libmap/data/timezone_11.png b/libmap/data/timezone_11.png
new file mode 100644
index 0000000..6168aa2
--- /dev/null
+++ b/libmap/data/timezone_11.png
Binary files differ
diff --git a/libmap/data/timezone_12.75.png b/libmap/data/timezone_12.75.png
new file mode 100644
index 0000000..4f74a85
--- /dev/null
+++ b/libmap/data/timezone_12.75.png
Binary files differ
diff --git a/libmap/data/timezone_12.png b/libmap/data/timezone_12.png
new file mode 100644
index 0000000..d0b3531
--- /dev/null
+++ b/libmap/data/timezone_12.png
Binary files differ
diff --git a/libmap/data/timezone_13.png b/libmap/data/timezone_13.png
new file mode 100644
index 0000000..fe2f134
--- /dev/null
+++ b/libmap/data/timezone_13.png
Binary files differ
diff --git a/libmap/data/timezone_2.png b/libmap/data/timezone_2.png
new file mode 100644
index 0000000..ec1e874
--- /dev/null
+++ b/libmap/data/timezone_2.png
Binary files differ
diff --git a/libmap/data/timezone_3.5.png b/libmap/data/timezone_3.5.png
new file mode 100644
index 0000000..2dc7399
--- /dev/null
+++ b/libmap/data/timezone_3.5.png
Binary files differ
diff --git a/libmap/data/timezone_3.png b/libmap/data/timezone_3.png
new file mode 100644
index 0000000..eda59dc
--- /dev/null
+++ b/libmap/data/timezone_3.png
Binary files differ
diff --git a/libmap/data/timezone_4.5.png b/libmap/data/timezone_4.5.png
new file mode 100644
index 0000000..e09ed90
--- /dev/null
+++ b/libmap/data/timezone_4.5.png
Binary files differ
diff --git a/libmap/data/timezone_4.png b/libmap/data/timezone_4.png
new file mode 100644
index 0000000..483dc53
--- /dev/null
+++ b/libmap/data/timezone_4.png
Binary files differ
diff --git a/libmap/data/timezone_5.5.png b/libmap/data/timezone_5.5.png
new file mode 100644
index 0000000..f904cc2
--- /dev/null
+++ b/libmap/data/timezone_5.5.png
Binary files differ
diff --git a/libmap/data/timezone_5.75.png b/libmap/data/timezone_5.75.png
new file mode 100644
index 0000000..827ce1a
--- /dev/null
+++ b/libmap/data/timezone_5.75.png
Binary files differ
diff --git a/libmap/data/timezone_5.png b/libmap/data/timezone_5.png
new file mode 100644
index 0000000..1bb6d20
--- /dev/null
+++ b/libmap/data/timezone_5.png
Binary files differ
diff --git a/libmap/data/timezone_6.5.png b/libmap/data/timezone_6.5.png
new file mode 100644
index 0000000..d307bf3
--- /dev/null
+++ b/libmap/data/timezone_6.5.png
Binary files differ
diff --git a/libmap/data/timezone_6.png b/libmap/data/timezone_6.png
new file mode 100644
index 0000000..460f9cf
--- /dev/null
+++ b/libmap/data/timezone_6.png
Binary files differ
diff --git a/libmap/data/timezone_7.png b/libmap/data/timezone_7.png
new file mode 100644
index 0000000..239115a
--- /dev/null
+++ b/libmap/data/timezone_7.png
Binary files differ
diff --git a/libmap/data/timezone_8.png b/libmap/data/timezone_8.png
new file mode 100644
index 0000000..3627686
--- /dev/null
+++ b/libmap/data/timezone_8.png
Binary files differ
diff --git a/libmap/data/timezone_9.5.png b/libmap/data/timezone_9.5.png
new file mode 100644
index 0000000..1c3290c
--- /dev/null
+++ b/libmap/data/timezone_9.5.png
Binary files differ
diff --git a/libmap/data/timezone_9.png b/libmap/data/timezone_9.png
new file mode 100644
index 0000000..65d2e46
--- /dev/null
+++ b/libmap/data/timezone_9.png
Binary files differ
diff --git a/libmap/datetime-module.c b/libmap/datetime-module.c
new file mode 100644
index 0000000..8217dc3
--- /dev/null
+++ b/libmap/datetime-module.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * 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: Thomas Wood <thomas.wood@intel.com>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-datetime-panel.h"
+
+#include <glib/gi18n-lib.h>
+
+#define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones"
+
+void
+g_io_module_load (GIOModule *module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ bindtextdomain (GETTEXT_PACKAGE_TIMEZONES, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8");
+
+ /* register the panel */
+ cc_date_time_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/libmap/dt-lockbutton.c b/libmap/dt-lockbutton.c
new file mode 100644
index 0000000..ecf4c12
--- /dev/null
+++ b/libmap/dt-lockbutton.c
@@ -0,0 +1,627 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Author: Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "dt-lockbutton.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#define P_(s) s
+
+struct _DtLockButtonPrivate
+{
+ GPermission *permission;
+
+ gchar *text_lock;
+ gchar *text_unlock;
+ gchar *text_not_authorized;
+
+ gchar *tooltip_lock;
+ gchar *tooltip_unlock;
+ gchar *tooltip_not_authorized;
+
+ GtkWidget *box;
+ GtkWidget *eventbox;
+ GtkWidget *image;
+ GtkWidget *button;
+ GtkWidget *notebook;
+
+ GtkWidget *label_lock;
+ GtkWidget *label_unlock;
+ GtkWidget *label_not_authorized;
+
+ GCancellable *cancellable;
+
+ gboolean constructed;
+};
+
+enum
+{
+ PROP_0,
+ PROP_PERMISSION,
+ PROP_TEXT_LOCK,
+ PROP_TEXT_UNLOCK,
+ PROP_TEXT_NOT_AUTHORIZED,
+ PROP_TOOLTIP_LOCK,
+ PROP_TOOLTIP_UNLOCK,
+ PROP_TOOLTIP_NOT_AUTHORIZED
+};
+
+static void update_state (DtLockButton *button);
+
+static void on_permission_changed (GPermission *permission,
+ GParamSpec *pspec,
+ gpointer user_data);
+
+static void on_clicked (GtkButton *button,
+ gpointer user_data);
+
+static void on_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data);
+
+G_DEFINE_TYPE (DtLockButton, dt_lock_button, GTK_TYPE_BIN);
+
+static void
+dt_lock_button_finalize (GObject *object)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (object);
+ DtLockButtonPrivate *priv = button->priv;
+
+ g_free (priv->text_lock);
+ g_free (priv->text_unlock);
+ g_free (priv->text_not_authorized);
+
+ g_free (priv->tooltip_lock);
+ g_free (priv->tooltip_unlock);
+ g_free (priv->tooltip_not_authorized);
+
+ if (priv->cancellable != NULL)
+ {
+ g_cancellable_cancel (priv->cancellable);
+ g_object_unref (priv->cancellable);
+ }
+
+ g_signal_handlers_disconnect_by_func (priv->permission,
+ on_permission_changed,
+ button);
+
+ g_object_unref (priv->permission);
+
+ G_OBJECT_CLASS (dt_lock_button_parent_class)->finalize (object);
+}
+
+static void
+dt_lock_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (object);
+ DtLockButtonPrivate *priv = button->priv;
+
+ switch (property_id)
+ {
+ case PROP_PERMISSION:
+ g_value_set_object (value, priv->permission);
+ break;
+
+ case PROP_TEXT_LOCK:
+ g_value_set_string (value, priv->text_lock);
+ break;
+
+ case PROP_TEXT_UNLOCK:
+ g_value_set_string (value, priv->text_unlock);
+ break;
+
+ case PROP_TEXT_NOT_AUTHORIZED:
+ g_value_set_string (value, priv->text_not_authorized);
+ break;
+
+ case PROP_TOOLTIP_LOCK:
+ g_value_set_string (value, priv->tooltip_lock);
+ break;
+
+ case PROP_TOOLTIP_UNLOCK:
+ g_value_set_string (value, priv->tooltip_unlock);
+ break;
+
+ case PROP_TOOLTIP_NOT_AUTHORIZED:
+ g_value_set_string (value, priv->tooltip_not_authorized);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+dt_lock_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (object);
+ DtLockButtonPrivate *priv = button->priv;
+
+ switch (property_id)
+ {
+ case PROP_PERMISSION:
+ priv->permission = g_value_get_object (value);
+ break;
+
+ case PROP_TEXT_LOCK:
+ g_free (priv->text_lock);
+ priv->text_lock = g_value_dup_string (value);
+ break;
+
+ case PROP_TEXT_UNLOCK:
+ g_free (priv->text_unlock);
+ priv->text_unlock = g_value_dup_string (value);
+ break;
+
+ case PROP_TEXT_NOT_AUTHORIZED:
+ g_free (priv->text_not_authorized);
+ priv->text_not_authorized = g_value_dup_string (value);
+ break;
+
+ case PROP_TOOLTIP_LOCK:
+ g_free (priv->tooltip_lock);
+ priv->tooltip_lock = g_value_dup_string (value);
+ break;
+
+ case PROP_TOOLTIP_UNLOCK:
+ g_free (priv->tooltip_unlock);
+ priv->tooltip_unlock = g_value_dup_string (value);
+ break;
+
+ case PROP_TOOLTIP_NOT_AUTHORIZED:
+ g_free (priv->tooltip_not_authorized);
+ priv->tooltip_not_authorized = g_value_dup_string (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+
+ if (priv->constructed)
+ update_state (button);
+}
+
+static void
+dt_lock_button_init (DtLockButton *button)
+{
+ button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
+ DT_TYPE_LOCK_BUTTON,
+ DtLockButtonPrivate);
+}
+
+static void
+dt_lock_button_constructed (GObject *object)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (object);
+ DtLockButtonPrivate *priv = button->priv;
+
+ priv->constructed = TRUE;
+
+ g_signal_connect (priv->permission, "notify",
+ G_CALLBACK (on_permission_changed), button);
+
+ priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_container_add (GTK_CONTAINER (button), priv->box);
+
+ priv->eventbox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->eventbox), FALSE);
+ gtk_container_add (GTK_CONTAINER (priv->box), priv->eventbox);
+ gtk_widget_show (priv->eventbox);
+
+ priv->image = gtk_image_new (); /* image is set in update_state() */
+ gtk_container_add (GTK_CONTAINER (priv->eventbox), priv->image);
+ gtk_widget_show (priv->image);
+
+ priv->notebook = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
+ gtk_widget_show (priv->notebook);
+
+ priv->button = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER (priv->button), priv->notebook);
+ gtk_widget_show (priv->button);
+
+ priv->label_lock = gtk_label_new (""); /* text is set in update_state */
+ gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_lock, NULL);
+ gtk_widget_show (priv->label_lock);
+
+ priv->label_unlock = gtk_label_new ("");
+ gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_unlock, NULL);
+ gtk_widget_show (priv->label_unlock);
+
+ priv->label_not_authorized = gtk_label_new ("");
+ gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->label_not_authorized, NULL);
+ gtk_widget_show (priv->label_not_authorized);
+
+ gtk_box_pack_start (GTK_BOX (priv->box), priv->button, FALSE, FALSE, 0);
+ gtk_widget_show (priv->button);
+
+ g_signal_connect (priv->eventbox, "button-press-event",
+ G_CALLBACK (on_button_press), button);
+ g_signal_connect (priv->button, "clicked",
+ G_CALLBACK (on_clicked), button);
+
+ gtk_widget_set_no_show_all (priv->box, TRUE);
+
+ update_state (button);
+
+ if (G_OBJECT_CLASS (dt_lock_button_parent_class)->constructed != NULL)
+ G_OBJECT_CLASS (dt_lock_button_parent_class)->constructed (object);
+}
+
+static void
+dt_lock_button_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
+
+ gtk_widget_get_preferred_width (priv->box, minimum, natural);
+}
+
+static void
+dt_lock_button_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
+
+ gtk_widget_get_preferred_height (priv->box, minimum, natural);
+}
+
+static void
+dt_lock_button_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ DtLockButtonPrivate *priv = DT_LOCK_BUTTON (widget)->priv;
+ GtkRequisition requisition;
+ GtkAllocation child_allocation;
+
+ gtk_widget_set_allocation (widget, allocation);
+ gtk_widget_get_preferred_size (priv->box, &requisition, NULL);
+ child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
+ child_allocation.width = requisition.width;
+ child_allocation.height = requisition.height;
+ gtk_widget_size_allocate (priv->box, &child_allocation);
+}
+
+static void
+dt_lock_button_class_init (DtLockButtonClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gobject_class->finalize = dt_lock_button_finalize;
+ gobject_class->get_property = dt_lock_button_get_property;
+ gobject_class->set_property = dt_lock_button_set_property;
+ gobject_class->constructed = dt_lock_button_constructed;
+
+ widget_class->get_preferred_width = dt_lock_button_get_preferred_width;
+ widget_class->get_preferred_height = dt_lock_button_get_preferred_height;
+ widget_class->size_allocate = dt_lock_button_size_allocate;
+
+ g_type_class_add_private (klass, sizeof (DtLockButtonPrivate));
+
+ g_object_class_install_property (gobject_class, PROP_PERMISSION,
+ g_param_spec_object ("permission",
+ P_("Permission"),
+ P_("The GPermission object controlling this button"),
+ G_TYPE_PERMISSION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TEXT_LOCK,
+ g_param_spec_string ("text-lock",
+ P_("Lock Text"),
+ P_("The text to display when prompting the user to lock"),
+ _("Lock"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TEXT_UNLOCK,
+ g_param_spec_string ("text-unlock",
+ P_("Unlock Text"),
+ P_("The text to display when prompting the user to unlock"),
+ _("Unlock"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TEXT_NOT_AUTHORIZED,
+ g_param_spec_string ("text-not-authorized",
+ P_("Not Authorized Text"),
+ P_("The text to display when prompting the user cannot obtain authorization"),
+ _("Locked"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TOOLTIP_LOCK,
+ g_param_spec_string ("tooltip-lock",
+ P_("Lock Tooltip"),
+ P_("The tooltip to display when prompting the user to lock"),
+ _("Dialog is unlocked.\nClick to prevent further changes"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TOOLTIP_UNLOCK,
+ g_param_spec_string ("tooltip-unlock",
+ P_("Unlock Tooltip"),
+ P_("The tooltip to display when prompting the user to unlock"),
+ _("Dialog is locked.\nClick to make changes"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TOOLTIP_NOT_AUTHORIZED,
+ g_param_spec_string ("tooltip-not-authorized",
+ P_("Not Authorized Tooltip"),
+ P_("The tooltip to display when prompting the user cannot obtain authorization"),
+ _("System policy prevents changes.\nContact your system administrator"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+}
+
+/**
+ * dt_lock_button_new:
+ * @permission: a #GPermission
+ *
+ * Creates a new lock button which reflects the @permission.
+ *
+ * Returns: a new #DtLockButton
+ *
+ * Since: 3.0
+ */
+GtkWidget *
+dt_lock_button_new (GPermission *permission)
+{
+ g_return_val_if_fail (permission != NULL, NULL);
+
+ return GTK_WIDGET (g_object_new (DT_TYPE_LOCK_BUTTON,
+ "permission", permission,
+ NULL));
+}
+
+static void
+update_state (DtLockButton *button)
+{
+ DtLockButtonPrivate *priv = button->priv;
+ gint page;
+ const gchar *tooltip;
+ gboolean sensitive;
+ gboolean visible;
+ GIcon *icon;
+
+ visible = TRUE;
+ sensitive = TRUE;
+
+ gtk_label_set_text (GTK_LABEL (priv->label_lock), priv->text_lock);
+ gtk_label_set_text (GTK_LABEL (priv->label_unlock), priv->text_unlock);
+ gtk_label_set_text (GTK_LABEL (priv->label_not_authorized), priv->text_not_authorized);
+
+ if (g_permission_get_allowed (priv->permission))
+ {
+ if (g_permission_get_can_release (priv->permission))
+ {
+ page = 0;
+ tooltip = priv->tooltip_lock;
+ sensitive = TRUE;
+ }
+ else
+ {
+ page = 0;
+ tooltip = "";
+ visible = FALSE;
+ }
+ }
+ else
+ {
+ if (g_permission_get_can_acquire (priv->permission))
+ {
+ page = 1;
+ tooltip = button->priv->tooltip_unlock;
+ sensitive = TRUE;
+ }
+ else
+ {
+ page = 2;
+ tooltip = button->priv->tooltip_not_authorized;
+ sensitive = FALSE;
+ }
+ }
+
+ if (g_permission_get_allowed (priv->permission))
+ {
+ gchar *names[3];
+
+ names[0] = "changes-allow-symbolic";
+ names[1] = "changes-allow";
+ names[2] = NULL;
+ icon = g_themed_icon_new_from_names (names, -1);
+ }
+ else
+ {
+ gchar *names[3];
+
+ names[0] = "changes-prevent-symbolic";
+ names[1] = "changes-prevent";
+ names[2] = NULL;
+ icon = g_themed_icon_new_from_names (names, -1);
+ }
+
+ gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon, GTK_ICON_SIZE_BUTTON);
+ g_object_unref (icon);
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page);
+ gtk_widget_set_tooltip_markup (priv->box, tooltip);
+
+ gtk_widget_set_sensitive (priv->box, sensitive);
+
+ if (visible)
+ gtk_widget_show (priv->box);
+ else
+ gtk_widget_hide (priv->box);
+}
+
+static void
+on_permission_changed (GPermission *permission,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (user_data);
+
+ update_state (button);
+}
+
+static void
+acquire_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (user_data);
+ DtLockButtonPrivate *priv = button->priv;
+ GError *error;
+
+ error = NULL;
+ g_permission_acquire_finish (priv->permission, result, &error);
+
+ if (error)
+ {
+ g_warning ("Error acquiring permission: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (priv->cancellable);
+ priv->cancellable = NULL;
+
+ update_state (button);
+}
+
+static void
+release_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ DtLockButton *button = DT_LOCK_BUTTON (user_data);
+ DtLockButtonPrivate *priv = button->priv;
+ GError *error;
+
+ error = NULL;
+ g_permission_release_finish (priv->permission, result, &error);
+
+ if (error)
+ {
+ g_warning ("Error releasing permission: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (priv->cancellable);
+ priv->cancellable = NULL;
+
+ update_state (button);
+}
+
+static void
+handle_click (DtLockButton *button)
+{
+ DtLockButtonPrivate *priv = button->priv;
+
+ if (!g_permission_get_allowed (priv->permission) &&
+ g_permission_get_can_acquire (priv->permission))
+ {
+ /* if we already have a pending interactive check, then do nothing */
+ if (priv->cancellable != NULL)
+ goto out;
+
+ priv->cancellable = g_cancellable_new ();
+
+ g_permission_acquire_async (priv->permission,
+ priv->cancellable,
+ acquire_cb,
+ button);
+ }
+ else if (g_permission_get_allowed (priv->permission) &&
+ g_permission_get_can_release (priv->permission))
+ {
+ /* if we already have a pending interactive check, then do nothing */
+ if (priv->cancellable != NULL)
+ goto out;
+
+ priv->cancellable = g_cancellable_new ();
+
+ g_permission_release_async (priv->permission,
+ priv->cancellable,
+ release_cb,
+ button);
+ }
+
+ out: ;
+}
+
+static void
+on_clicked (GtkButton *_button,
+ gpointer user_data)
+
+{
+ handle_click (DT_LOCK_BUTTON (user_data));
+}
+
+static void
+on_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+ handle_click (DT_LOCK_BUTTON (user_data));
+}
+
+/**
+ * dt_lock_button_get_permission:
+ * @button: a #DtLockButton
+ *
+ * Obtains the #GPermission object that controls @button.
+ *
+ * Returns: the #GPermission of @button
+ *
+ * Since: 3.0
+ */
+GPermission *
+dt_lock_button_get_permission (DtLockButton *button)
+{
+ g_return_val_if_fail (DT_IS_LOCK_BUTTON (button), NULL);
+
+ return button->priv->permission;
+}
+
diff --git a/libmap/dt-lockbutton.h b/libmap/dt-lockbutton.h
new file mode 100644
index 0000000..adab0a7
--- /dev/null
+++ b/libmap/dt-lockbutton.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Author: Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __DT_LOCK_BUTTON_H__
+#define __DT_LOCK_BUTTON_H__
+
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define DT_TYPE_LOCK_BUTTON (dt_lock_button_get_type ())
+#define DT_LOCK_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DT_TYPE_LOCK_BUTTON, DtLockButton))
+#define DT_LOCK_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DT_LOCK_BUTTON, DtLockButtonClass))
+#define DT_IS_LOCK_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DT_TYPE_LOCK_BUTTON))
+#define DT_IS_LOCK_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DT_TYPE_LOCK_BUTTON))
+#define DT_LOCK_BUTTON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DT_TYPE_LOCK_BUTTON, DtLockButtonClass))
+
+typedef struct _DtLockButton DtLockButton;
+typedef struct _DtLockButtonClass DtLockButtonClass;
+typedef struct _DtLockButtonPrivate DtLockButtonPrivate;
+
+struct _DtLockButton
+{
+ GtkBin parent;
+
+ DtLockButtonPrivate *priv;
+};
+
+struct _DtLockButtonClass
+{
+ GtkBinClass parent_class;
+
+ void (*reserved0) (void);
+ void (*reserved1) (void);
+ void (*reserved2) (void);
+ void (*reserved3) (void);
+ void (*reserved4) (void);
+ void (*reserved5) (void);
+ void (*reserved6) (void);
+ void (*reserved7) (void);
+};
+
+GType dt_lock_button_get_type (void) G_GNUC_CONST;
+GtkWidget *dt_lock_button_new (GPermission *permission);
+GPermission *dt_lock_button_get_permission (DtLockButton *button);
+
+
+G_END_DECLS
+
+#endif /* __DT_LOCK_BUTTON_H__ */
diff --git a/libmap/set-timezone.c b/libmap/set-timezone.c
new file mode 100644
index 0000000..5aafced
--- /dev/null
+++ b/libmap/set-timezone.c
@@ -0,0 +1,481 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
+ *
+ * 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.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/wait.h>
+
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "set-timezone.h"
+
+
+static DBusGConnection *
+get_system_bus (GError **err)
+{
+ GError *error;
+ static DBusGConnection *bus = NULL;
+
+ if (bus == NULL) {
+ error = NULL;
+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (bus == NULL) {
+ g_propagate_error (err, error);
+ }
+ }
+
+ return bus;
+}
+
+#define CACHE_VALIDITY_SEC 2
+
+typedef void (*CanDoFunc) (gint value);
+
+static void
+notify_can_do (DBusGProxy *proxy,
+ DBusGProxyCall *call,
+ void *user_data)
+{
+ CanDoFunc callback = user_data;
+ GError *error = NULL;
+ gint value;
+
+ if (dbus_g_proxy_end_call (proxy, call,
+ &error,
+ G_TYPE_INT, &value,
+ G_TYPE_INVALID)) {
+ callback (value);
+ }
+}
+
+static void
+refresh_can_do (const gchar *action, CanDoFunc callback)
+{
+ DBusGConnection *bus;
+ DBusGProxy *proxy;
+
+ bus = get_system_bus (NULL);
+ if (bus == NULL)
+ return;
+
+ proxy = dbus_g_proxy_new_for_name (bus,
+ "org.gnome.SettingsDaemon.DateTimeMechanism",
+ "/",
+ "org.gnome.SettingsDaemon.DateTimeMechanism");
+
+ dbus_g_proxy_begin_call_with_timeout (proxy,
+ action,
+ notify_can_do,
+ callback, NULL,
+ INT_MAX,
+ G_TYPE_INVALID);
+}
+
+static gint settimezone_cache = 0;
+static time_t settimezone_stamp = 0;
+
+static void
+update_can_settimezone (gint res)
+{
+ settimezone_cache = res;
+ time (&settimezone_stamp);
+}
+
+gint
+can_set_system_timezone (void)
+{
+ time_t now;
+
+ time (&now);
+ if (ABS (now - settimezone_stamp) > CACHE_VALIDITY_SEC) {
+ refresh_can_do ("CanSetTimezone", update_can_settimezone);
+ settimezone_stamp = now;
+ }
+
+ return settimezone_cache;
+}
+
+static gint settime_cache = 0;
+static time_t settime_stamp = 0;
+
+static void
+update_can_settime (gint res)
+{
+ settime_cache = res;
+ time (&settime_stamp);
+}
+
+gint
+can_set_system_time (void)
+{
+ time_t now;
+
+ time (&now);
+ if (ABS (now - settime_stamp) > CACHE_VALIDITY_SEC) {
+ refresh_can_do ("CanSetTime", update_can_settime);
+ settime_stamp = now;
+ }
+
+ return settime_cache;
+}
+
+static gint usingntp_cache = 0;
+static time_t usingntp_stamp = 0;
+
+static void
+update_can_usingntp (gint res)
+{
+ usingntp_cache = res;
+ time (&usingntp_stamp);
+}
+
+gint
+can_set_using_ntp (void)
+{
+ time_t now;
+
+ time (&now);
+ if (ABS (now - usingntp_stamp) > CACHE_VALIDITY_SEC) {
+ refresh_can_do ("CanSetUsingNtp", update_can_usingntp);
+ settime_stamp = now;
+ }
+
+ return usingntp_cache;
+}
+
+typedef struct {
+ gint ref_count;
+ gchar *call;
+ gint64 time;
+ gchar *tz;
+ gboolean using_ntp;
+ GFunc callback;
+ gpointer data;
+ GDestroyNotify notify;
+} SetTimeCallbackData;
+
+static void
+free_data (gpointer d)
+{
+ SetTimeCallbackData *data = d;
+
+ data->ref_count--;
+ if (data->ref_count == 0) {
+ if (data->notify)
+ data->notify (data->data);
+ g_free (data->tz);
+ g_free (data);
+ }
+}
+
+static void
+set_time_notify (DBusGProxy *proxy,
+ DBusGProxyCall *call,
+ void *user_data)
+{
+ SetTimeCallbackData *data = user_data;
+ GError *error = NULL;
+
+ if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
+ if (data->callback)
+ data->callback (data->data, NULL);
+ }
+ else {
+ if (error->domain == DBUS_GERROR &&
+ error->code == DBUS_GERROR_NO_REPLY) {
+ /* these errors happen because dbus doesn't
+ * use monotonic clocks
+ */
+ g_warning ("ignoring no-reply error when setting time");
+ g_error_free (error);
+ if (data->callback)
+ data->callback (data->data, NULL);
+ }
+ else {
+ if (data->callback)
+ data->callback (data->data, error);
+ else
+ g_error_free (error);
+ }
+ }
+}
+
+static void
+set_time_async (SetTimeCallbackData *data)
+{
+ DBusGConnection *bus;
+ DBusGProxy *proxy;
+ GError *err = NULL;
+
+ bus = get_system_bus (&err);
+ if (bus == NULL) {
+ if (err) {
+ if (data->callback)
+ data->callback (data->data, err);
+ g_clear_error (&err);
+ }
+ return;
+ }
+
+ proxy = dbus_g_proxy_new_for_name (bus,
+ "org.gnome.SettingsDaemon.DateTimeMechanism",
+ "/",
+ "org.gnome.SettingsDaemon.DateTimeMechanism");
+
+ data->ref_count++;
+ if (strcmp (data->call, "SetTime") == 0)
+ dbus_g_proxy_begin_call_with_timeout (proxy,
+ "SetTime",
+ set_time_notify,
+ data, free_data,
+ INT_MAX,
+ /* parameters: */
+ G_TYPE_INT64, data->time,
+ G_TYPE_INVALID,
+ /* return values: */
+ G_TYPE_INVALID);
+ else if (strcmp (data->call, "SetTimezone") == 0)
+ dbus_g_proxy_begin_call_with_timeout (proxy,
+ "SetTimezone",
+ set_time_notify,
+ data, free_data,
+ INT_MAX,
+ /* parameters: */
+ G_TYPE_STRING, data->tz,
+ G_TYPE_INVALID,
+ /* return values: */
+ G_TYPE_INVALID);
+ else if (strcmp (data->call, "SetUsingNtp") == 0)
+ dbus_g_proxy_begin_call_with_timeout (proxy,
+ "SetUsingNtp",
+ set_time_notify,
+ data, free_data,
+ INT_MAX,
+ /* parameters: */
+ G_TYPE_BOOLEAN, data->using_ntp,
+ G_TYPE_INVALID,
+ /* return values: */
+ G_TYPE_INVALID);
+}
+
+void
+set_system_time_async (gint64 time,
+ GFunc callback,
+ gpointer d,
+ GDestroyNotify notify)
+{
+ SetTimeCallbackData *data;
+
+ if (time == -1)
+ return;
+
+ data = g_new0 (SetTimeCallbackData, 1);
+ data->ref_count = 1;
+ data->call = "SetTime";
+ data->time = time;
+ data->tz = NULL;
+ data->callback = callback;
+ data->data = d;
+ data->notify = notify;
+
+ set_time_async (data);
+ free_data (data);
+}
+
+void
+set_system_timezone_async (const gchar *tz,
+ GFunc callback,
+ gpointer d,
+ GDestroyNotify notify)
+{
+ SetTimeCallbackData *data;
+
+ g_return_if_fail (tz != NULL);
+
+ data = g_new0 (SetTimeCallbackData, 1);
+ data->ref_count = 1;
+ data->call = "SetTimezone";
+ data->time = -1;
+ data->tz = g_strdup (tz);
+ data->callback = callback;
+ data->data = d;
+ data->notify = notify;
+
+ set_time_async (data);
+ free_data (data);
+}
+
+/* get timezone */
+
+typedef struct
+{
+ GetTimezoneFunc callback;
+ GDestroyNotify notify;
+
+ gpointer data;
+
+} GetTimezoneData;
+
+static void
+get_timezone_destroy_notify (GetTimezoneData *data)
+{
+ if (data->notify && data->data)
+ data->notify (data);
+
+ g_free (data);
+}
+
+static void
+get_timezone_notify (DBusGProxy *proxy,
+ DBusGProxyCall *call,
+ void *user_data)
+{
+ GError *error = NULL;
+ gboolean retval;
+ gchar *string = NULL;
+ GetTimezoneData *data = user_data;
+
+ retval = dbus_g_proxy_end_call (proxy, call, &error,
+ G_TYPE_STRING, &string,
+ G_TYPE_INVALID);
+
+ if (data->callback) {
+ if (!retval) {
+ data->callback (data->data, NULL, error);
+ g_error_free (error);
+ }
+ else {
+ data->callback (data->data, string, NULL);
+ g_free (string);
+ }
+ }
+}
+
+void
+get_system_timezone_async (GetTimezoneFunc callback,
+ gpointer user_data,
+ GDestroyNotify notify)
+{
+ DBusGConnection *bus;
+ DBusGProxy *proxy;
+ GetTimezoneData *data;
+ GError *error = NULL;
+
+ bus = get_system_bus (&error);
+ if (bus == NULL) {
+ if (error) {
+ if (callback)
+ callback (user_data, NULL, error);
+ g_clear_error (&error);
+ }
+ return;
+
+ }
+
+ data = g_new0 (GetTimezoneData, 1);
+ data->data = user_data;
+ data->notify = notify;
+ data->callback = callback;
+
+ proxy = dbus_g_proxy_new_for_name (bus,
+ "org.gnome.SettingsDaemon.DateTimeMechanism",
+ "/",
+ "org.gnome.SettingsDaemon.DateTimeMechanism");
+
+ dbus_g_proxy_begin_call (proxy,
+ "GetTimezone",
+ get_timezone_notify,
+ data,
+ (GDestroyNotify) get_timezone_destroy_notify,
+ /* parameters: */
+ G_TYPE_INVALID,
+ /* return values: */
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
+
+}
+
+gboolean
+get_using_ntp (void)
+{
+ static gboolean can_use_cache = FALSE;
+ static gboolean is_using_cache = FALSE;
+ static time_t last_refreshed = 0;
+ time_t now;
+ DBusGConnection *bus;
+ DBusGProxy *proxy;
+
+ time (&now);
+ if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) {
+ gboolean cu, iu;
+ bus = get_system_bus (NULL);
+ if (bus == NULL)
+ return FALSE;
+
+ proxy = dbus_g_proxy_new_for_name (bus,
+ "org.gnome.SettingsDaemon.DateTimeMechanism",
+ "/",
+ "org.gnome.SettingsDaemon.DateTimeMechanism");
+
+
+ if (dbus_g_proxy_call (proxy,
+ "GetUsingNtp",
+ NULL,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &cu,
+ G_TYPE_BOOLEAN, &iu,
+ G_TYPE_INVALID)) {
+ can_use_cache = cu;
+ is_using_cache = iu;
+ last_refreshed = now;
+ }
+ }
+
+ return is_using_cache;
+}
+
+void
+set_using_ntp_async (gboolean using_ntp,
+ GFunc callback,
+ gpointer d,
+ GDestroyNotify notify)
+{
+ SetTimeCallbackData *data;
+
+ data = g_new0 (SetTimeCallbackData, 1);
+ data->ref_count = 1;
+ data->call = "SetUsingNtp";
+ data->time = -1;
+ data->using_ntp = using_ntp;
+ data->callback = callback;
+ data->data = d;
+ data->notify = notify;
+
+ set_time_async (data);
+ free_data (data);
+}
diff --git a/libmap/set-timezone.h b/libmap/set-timezone.h
new file mode 100644
index 0000000..5e657e3
--- /dev/null
+++ b/libmap/set-timezone.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 David Zeuthen <david@fubar.dk>
+ *
+ * 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 __SET_SYSTEM_TIMEZONE_H__
+
+#include <config.h>
+
+#include <glib.h>
+#include <time.h>
+
+typedef void (*GetTimezoneFunc) (gpointer data,
+ const gchar *timezone,
+ GError *error);
+void get_system_timezone_async (GetTimezoneFunc callback,
+ gpointer data,
+ GDestroyNotify notify);
+
+gint can_set_system_timezone (void);
+
+gint can_set_system_time (void);
+
+gint can_set_using_ntp (void);
+
+void set_system_time_async (gint64 time,
+ GFunc callback,
+ gpointer data,
+ GDestroyNotify notify);
+
+void set_system_timezone_async (const gchar *tz,
+ GFunc callback,
+ gpointer data,
+ GDestroyNotify notify);
+
+gboolean get_using_ntp (void);
+
+void set_using_ntp_async (gboolean using_ntp,
+ GFunc callback,
+ gpointer data,
+ GDestroyNotify notify);
+#endif
diff --git a/libmap/test-timezone.c b/libmap/test-timezone.c
new file mode 100644
index 0000000..d667c42
--- /dev/null
+++ b/libmap/test-timezone.c
@@ -0,0 +1,55 @@
+#include <config.h>
+#include <locale.h>
+
+#include "tz.h"
+
+int main (int argc, char **argv)
+{
+ TzDB *db;
+ GPtrArray *locs;
+ guint i;
+ char *pixmap_dir;
+ int retval = 0;
+
+ setlocale (LC_ALL, "");
+
+ if (argc == 2) {
+ pixmap_dir = g_strdup (argv[1]);
+ } else if (argc == 1) {
+ pixmap_dir = g_strdup ("data/");
+ } else {
+ g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]);
+ return 1;
+ }
+
+ db = tz_load_db ();
+ locs = tz_get_locations (db);
+ for (i = 0; i < locs->len ; i++) {
+ TzLocation *loc = locs->pdata[i];
+ TzInfo *info;
+ char *filename, *path;
+ gdouble selected_offset;
+ char buf[16];
+
+ info = tz_info_from_location (loc);
+ selected_offset = tz_location_get_utc_offset (loc)
+ / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
+
+ filename = g_strdup_printf ("timezone_%s.png",
+ g_ascii_formatd (buf, sizeof (buf),
+ "%g", selected_offset));
+ path = g_build_filename (pixmap_dir, filename, NULL);
+
+ if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE) {
+ g_message ("File '%s' missing for zone '%s'", filename, loc->zone);
+ retval = 1;
+ }
+
+ g_free (filename);
+ g_free (path);
+ }
+ tz_db_free (db);
+ g_free (pixmap_dir);
+
+ return retval;
+}
diff --git a/libmap/tz.c b/libmap/tz.c
new file mode 100644
index 0000000..3e6c8ae
--- /dev/null
+++ b/libmap/tz.c
@@ -0,0 +1,350 @@
+/* -*- 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"
+
+
+/* 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);
+
+
+/* ---------------- *
+ * 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);
+
+#ifdef __sun
+ if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4])
+ loc->comment = g_strdup (tmpstrarr[4]);
+
+ if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !islower(loc->zone)) {
+ TzLocation *locgrp;
+
+ /* duplicate entry */
+ locgrp = g_new0 (TzLocation, 1);
+ locgrp->country = g_strdup (tmpstrarr[0]);
+ locgrp->zone = g_strdup (tmpstrarr[3]);
+ locgrp->latitude = convert_pos (latstr, 2);
+ locgrp->longitude = convert_pos (lngstr, 3);
+ locgrp->comment = (tmpstrarr[4]) ? g_strdup (tmpstrarr[4]) : NULL;
+
+ g_ptr_array_add (tz_db->locations, (gpointer) locgrp);
+ }
+#else
+ loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL;
+#endif
+
+ 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);
+
+ 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_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;
+}
+
+gint
+tz_location_set_locally (TzLocation *loc)
+{
+ time_t curtime;
+ struct tm *curzone;
+ gboolean is_dst = FALSE;
+ gint correction = 0;
+
+ g_return_val_if_fail (loc != NULL, 0);
+ g_return_val_if_fail (loc->zone != NULL, 0);
+
+ curtime = time (NULL);
+ curzone = localtime (&curtime);
+ is_dst = curzone->tm_isdst;
+
+ setenv ("TZ", loc->zone, 1);
+#if 0
+ curtime = time (NULL);
+ curzone = localtime (&curtime);
+
+ if (!is_dst && curzone->tm_isdst) {
+ correction = (60 * 60);
+ }
+ else if (is_dst && !curzone->tm_isdst) {
+ correction = 0;
+ }
+#endif
+
+ return correction;
+}
+
+TzInfo *
+tz_info_from_location (TzLocation *loc)
+{
+ TzInfo *tzinfo;
+ time_t curtime;
+ struct tm *curzone;
+
+ g_return_val_if_fail (loc != NULL, NULL);
+ g_return_val_if_fail (loc->zone != NULL, NULL);
+
+ setenv ("TZ", loc->zone, 1);
+
+#if 0
+ tzset ();
+#endif
+ tzinfo = g_new0 (TzInfo, 1);
+
+ curtime = time (NULL);
+ curzone = localtime (&curtime);
+
+#ifndef __sun
+ /* 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;
+#else
+ tzinfo->tzname_normal = NULL;
+ tzinfo->tzname_daylight = NULL;
+ tzinfo->utc_offset = 0;
+#endif
+
+ tzinfo->daylight = curzone->tm_isdst;
+
+ 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);
+}
+
+/* ----------------- *
+ * 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));
+}
+
+
+#if 0
+
+/* Currently not working */
+static void
+free_tzdata (TzLocation *tz)
+{
+
+ if (tz->country)
+ g_free(tz->country);
+ if (tz->zone)
+ g_free(tz->zone);
+ if (tz->comment)
+ g_free(tz->comment);
+
+ g_free(tz);
+}
+#endif
+
+
+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);
+}
diff --git a/libmap/tz.h b/libmap/tz.h
new file mode 100644
index 0000000..91281a5
--- /dev/null
+++ b/libmap/tz.h
@@ -0,0 +1,86 @@
+/* -*- 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>
+
+#ifndef __sun
+# define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"
+#else
+# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
+#endif
+
+typedef struct _TzDB TzDB;
+typedef struct _TzLocation TzLocation;
+typedef struct _TzInfo TzInfo;
+
+
+struct _TzDB
+{
+ GPtrArray *locations;
+};
+
+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);
+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