Fix SVG visibility (jkonecny) (#1502915)

This commit is contained in:
David Shea 2017-10-20 12:47:16 -04:00
parent 6f7bb05aa4
commit 4f49cea177
28 changed files with 9 additions and 63814 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/timezone_pngs.tar.gz
/libtimezonemap_0.4.4.tar.gz
/libtimezonemap_0.4.5.tar.gz
/0.4.5.1.tar.gz

View File

@ -1,89 +0,0 @@
From 2aaaa1cd920da12be4604b5cdb9a6db2ed3f0f80 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Tue, 24 May 2016 15:28:18 -0400
Subject: [PATCH 01/24] Allow the image data directory to be overridden.
Look for the environment variable $DATADIR as the directory containing
the CcTimezoneMap image files, if set.
---
src/cc-timezone-map.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 2f3ecd2..bf7db8b 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -466,6 +466,18 @@ static const gchar * olsen_map_timezones[] = {
"Pacific/Wallis"
};
+/* Allow datadir to be overridden in the environment */
+static const gchar *
+get_datadir (void)
+{
+ const gchar *datadir = g_getenv("DATADIR");
+
+ if (datadir)
+ return datadir;
+ else
+ return DATADIR;
+}
+
static void
cc_timezone_map_get_property (GObject *object,
guint property_id,
@@ -731,7 +743,8 @@ cc_timezone_map_draw (GtkWidget *widget,
}
/* paint hilight */
- file = g_strdup_printf (DATADIR "/timezone_%s.png",
+ file = g_strdup_printf ("%s/timezone_%s.png",
+ get_datadir (),
g_ascii_formatd (buf, sizeof (buf),
"%g", priv->selected_offset));
orig_hilight = gdk_pixbuf_new_from_file (file, &err);
@@ -762,7 +775,9 @@ cc_timezone_map_draw (GtkWidget *widget,
}
/* load pin icon */
- pin = gdk_pixbuf_new_from_file (DATADIR "/pin.png", &err);
+ file = g_strdup_printf ("%s/pin.png", get_datadir ());
+ pin = gdk_pixbuf_new_from_file (file, &err);
+ g_free (file);
if (err)
{
@@ -1026,14 +1041,16 @@ cc_timezone_map_init (CcTimezoneMap *self)
{
CcTimezoneMapPrivate *priv;
GError *err = NULL;
+ gchar *file;
priv = self->priv = TIMEZONE_MAP_PRIVATE (self);
priv->previous_x = -1;
priv->previous_y = -1;
- priv->orig_background = gdk_pixbuf_new_from_file (DATADIR "/bg.png",
- &err);
+ file = g_strdup_printf ("%s/bg.png", get_datadir ());
+ priv->orig_background = gdk_pixbuf_new_from_file (file, &err);
+ g_free (file);
if (!priv->orig_background)
{
@@ -1042,8 +1059,9 @@ cc_timezone_map_init (CcTimezoneMap *self)
g_clear_error (&err);
}
- priv->olsen_map = gdk_pixbuf_new_from_file (DATADIR "/olsen_map.png",
- &err);
+ file = g_strdup_printf ("%s/olsen_map.png", get_datadir ());
+ priv->olsen_map = gdk_pixbuf_new_from_file (file, &err);
+ g_free (file);
if (!priv->olsen_map)
{
g_warning ("Could not load olsen map: %s",
--
2.5.5

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,88 +0,0 @@
From da929a5f69a414fce6f2b5f8e02e4c978b020bb3 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 8 Apr 2016 11:58:04 -0400
Subject: [PATCH 04/24] Fix memory leaks in tz.c
Use a stack-allocated block for the user_data struct passed to
parse_cities15000, since the struct itself is not needed after
parse_file, and no one can forget to free it if it's not dynamically
allocated the first place.
Use const strings in tz_data_file_get so that the return value does not
need to be duplicated and freed.
---
src/tz.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/tz.c b/src/tz.c
index 0b5f208..9aa9e8a 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -41,7 +41,7 @@ static float convert_pos (gchar *pos, int digits);
#endif
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 (gchar *env, gchar *defaultfile);
+static const gchar * tz_data_file_get (const gchar *env, const gchar *defaultfile);
void parse_file (const char * filename,
const guint ncolumns,
@@ -179,7 +179,7 @@ void parse_cities15000 (gpointer parsed_data,
TzDB *
tz_load_db (void)
{
- gchar *tz_data_file, *admin1_file, *country_file;
+ const gchar *tz_data_file, *admin1_file, *country_file;
TzDB *tz_db;
char buf[4096];
@@ -217,23 +217,19 @@ tz_load_db (void)
tz_db = g_new0 (TzDB, 1);
tz_db->locations = g_ptr_array_new ();
- Triple * triple = g_new (Triple, 1);
- triple->first = tz_db->locations;
- triple->second = stateHash;
- triple->third = countryHash;
+ Triple triple;
+ triple.first = tz_db->locations;
+ triple.second = stateHash;
+ triple.third = countryHash;
- parse_file (tz_data_file, 19, parse_cities15000, triple);
+ parse_file (tz_data_file, 19, parse_cities15000, &triple);
g_hash_table_destroy (stateHash);
g_hash_table_destroy (countryHash);
- triple->second = NULL;
- triple->third = NULL;
/* now sort by country */
sort_locations_by_country (tz_db->locations);
- g_free (tz_data_file);
-
return tz_db;
}
@@ -391,14 +387,14 @@ tz_info_free (TzInfo *tzinfo)
* Private functions *
* ----------------- */
-static gchar *
-tz_data_file_get (gchar *env, gchar *defaultfile)
+static const gchar *
+tz_data_file_get (const gchar *env, const gchar *defaultfile)
{
/* Allow passing this in at runtime, to support loading it from the build
* tree during tests. */
const gchar * filename = g_getenv (env);
- return filename ? g_strdup (filename) : g_strdup (defaultfile);
+ return filename ? filename : defaultfile;
}
#ifdef __sun
--
2.5.5

View File

@ -1,26 +0,0 @@
From 8b82b34623699afc5a20b083e68f2f428a8d4583 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 8 Apr 2016 11:52:47 -0400
Subject: [PATCH 05/24] Fix an invalid memory access
When truncating the list for the distance-based location search, do not
attempt to read the rest of the list after it has been freed.
---
src/cc-timezone-map.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index f47c870..f0b061d 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -1037,6 +1037,7 @@ get_loc_for_xy (GtkWidget * widget, gint x, gint y)
/* Cut the list off here */
node->prev->next = NULL;
g_list_free(node);
+ break;
}
node = g_list_next(node);
--
2.5.5

View File

@ -1,99 +0,0 @@
From 238e6d1bf29067eb705b372ed1f930b9bcb99fce Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 8 Apr 2016 15:20:10 -0400
Subject: [PATCH 06/24] Do not use tz_location_get_utc_offset
The function in tz.c to fetch the timezone offset for a given location
sets the TZ environment variable which, besides being potentially
surprising to the rest of the process, is not thread-safe. Instead,
skip the function entirely and use the glib functions for querying time
zone data.
Increase the required glib version to 2.26 for the GTimeZone functions.
---
debian/control | 4 ++--
src/cc-timezone-map.c | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/debian/control b/debian/control
index 0aca76c..61f0d6b 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Build-Depends: cdbs,
gir1.2-glib-2.0,
gir1.2-gtk-3.0,
intltool (>= 0.35.0),
- libglib2.0-dev (>= 2.25.0),
+ libglib2.0-dev (>= 2.26.0),
libgtk-3-dev (>= 3.1.4),
libcairo2-dev (>= 1.10),
libjson-glib-dev,
@@ -58,7 +58,7 @@ Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
libtimezonemap1 (= ${binary:Version}),
- libglib2.0-dev (>= 2.25.0),
+ libglib2.0-dev (>= 2.26.0),
libgtk-3-dev (>= 3.1.4),
librsvg2-dev,
libjson-glib-dev
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index f0b061d..b71d3cd 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -937,6 +937,39 @@ sort_locations (CcTimezoneLocation *a,
return 0;
}
+/* Return the UTC offset (in hours) for the standard (winter) time at a location */
+static gdouble
+get_location_offset (CcTimezoneLocation *location)
+{
+ const gchar *zone_name;
+ GTimeZone *zone;
+ gint interval;
+ gint64 curtime;
+ gint32 offset;
+
+ g_return_val_if_fail (location != NULL, 0);
+ zone_name = cc_timezone_location_get_zone (location);
+ g_return_val_if_fail (zone_name != NULL, 0);
+
+ zone = g_time_zone_new (zone_name);
+
+ /* Query the zone based on the current time, since otherwise the data
+ * may not make sense. */
+ curtime = g_get_real_time () / 1000; /* convert to seconds */
+ interval = g_time_zone_find_interval (zone, G_TIME_TYPE_UNIVERSAL, curtime);
+
+ offset = g_time_zone_get_offset (zone, interval);
+ if (g_time_zone_is_dst (zone, interval))
+ {
+ /* Subtract an hour's worth of seconds to get the standard time offset */
+ offset -= (60 * 60);
+ }
+
+ g_time_zone_unref (zone);
+
+ return offset / (60.0 * 60.0);
+}
+
static void
set_location (CcTimezoneMap *map,
CcTimezoneLocation *location)
@@ -948,11 +981,8 @@ set_location (CcTimezoneMap *map,
if (priv->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);
+ priv->selected_offset = get_location_offset (priv->location);
priv->show_offset = TRUE;
- tz_info_free (info);
}
else
{
--
2.5.5

View File

@ -1,82 +0,0 @@
From ab31d932b5d1b433dc091d688dadf0211f341a9e Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 24 Jun 2016 13:45:46 -0400
Subject: [PATCH 07/24] Make the test program more automake-y
Add a $DATADIR environment variable to allow test-timezone to be more
easily run from automake without arguments. Use the various check_* and
TEST variables to define and run the test program.
---
src/Makefile.am | 21 ++++++++++++++-------
src/test-timezone.c | 16 ++++++++++++++--
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9386d1d..9711706 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,15 +24,22 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = test-timezone
-test_timezone_SOURCES = test-timezone.c cc-timezone-location.c tz.c tz.h
-test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm
+
+all-local: check
+
+AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/cities15000.txt ; \
+ ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt ; \
+ COUNTRY_FILE=$(srcdir)/data/countryInfo.txt ; \
+ DATADIR=$(srcdir)/data ; \
+ export TZ_DATA_FILE ADMIN1_FILE COUNTRY_FILE DATADIR ;
+
+check_PROGRAMS = test-timezone
+
+test_timezone_SOURCES = test-timezone.c
+test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm libtimezonemap.la
test_timezone_CFLAGS = $(LIBTIMEZONEMAP_CFLAGS)
-all-local: check-local
-
-check-local: test-timezone
- TZ_DATA_FILE=$(srcdir)/data/cities15000.txt ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt COUNTRY_FILE=$(srcdir)/data/countryInfo.txt \
- $(builddir)/test-timezone $(srcdir)/data
+TESTS = test-timezone
lib_LTLIBRARIES = libtimezonemap.la
diff --git a/src/test-timezone.c b/src/test-timezone.c
index 504deb9..692c240 100644
--- a/src/test-timezone.c
+++ b/src/test-timezone.c
@@ -15,13 +15,25 @@ int main (int argc, char **argv)
RsvgHandle *svg;
gchar *path;
- setlocale (LC_ALL, "");
+ setlocale (LC_ALL, "");
if (argc == 2)
{
pixmap_dir = g_strdup (argv[1]);
} else if (argc == 1) {
- pixmap_dir = g_strdup ("data/");
+ const char *datadir = g_getenv("DATADIR");
+ if (datadir != NULL)
+ {
+ pixmap_dir = g_strdup (datadir);
+ } else {
+ pixmap_dir = g_strdup ("./data");
+ }
+
+ if (! g_file_test (pixmap_dir, G_FILE_TEST_IS_DIR))
+ {
+ g_message("Pixmap directory %s does not exist", pixmap_dir);
+ return 1;
+ }
} else {
g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]);
return 1;
--
2.5.5

View File

@ -1,357 +0,0 @@
From 35dc2c55166523e86249a518182776eba8d3f014 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 22 Jun 2016 13:06:47 -0400
Subject: [PATCH 08/24] Move all of the data into one place.
Move the backward file into src/data, and move the data files that were
in $(pkgdatadir)/ui to $(pkgdatadir), since there's really no reason for
them to be separate. Get rid of the old gnome-control-center #defines.
---
src/Makefile.am | 6 +--
src/backward | 118 --------------------------------------------------
src/cc-timezone-map.c | 7 ++-
src/data/README | 4 ++
src/data/backward | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/tz.h | 6 +--
6 files changed, 133 insertions(+), 126 deletions(-)
delete mode 100644 src/backward
create mode 100644 src/data/backward
diff --git a/src/Makefile.am b/src/Makefile.am
index 9711706..106f034 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
CLEANFILES =
-uidir = $(pkgdatadir)/ui
+uidir = $(pkgdatadir)
dist_ui_DATA = \
data/olsen_map.png \
data/pin.png \
@@ -10,15 +10,13 @@ dist_ui_DATA = \
data/countryInfo.txt
tzdatadir = $(pkgdatadir)/
-dist_tzdata_DATA = backward
+dist_tzdata_DATA = data/backward
pkgconfigdir = $(libdir)/pkgconfig
dist_pkgconfig_DATA = timezonemap.pc
AM_CPPFLAGS = \
$(LIBTIMEZONEMAP_CFLAGS) \
- -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DDATADIR="\"$(uidir)\"" \
$(NULL)
diff --git a/src/backward b/src/backward
deleted file mode 100644
index f1f95a8..0000000
--- a/src/backward
+++ /dev/null
@@ -1,118 +0,0 @@
-# <pre>
-# @(#)backward 8.9
-# This file is in the public domain, so clarified as of
-# 2009-05-17 by Arthur David Olson.
-
-# This file provides links between current names for time zones
-# and their old names. Many names changed in late 1993.
-
-Link Africa/Asmara Africa/Asmera
-Link Africa/Bamako Africa/Timbuktu
-Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
-Link America/Adak America/Atka
-Link America/Argentina/Buenos_Aires America/Buenos_Aires
-Link America/Argentina/Catamarca America/Catamarca
-Link America/Atikokan America/Coral_Harbour
-Link America/Argentina/Cordoba America/Cordoba
-Link America/Tijuana America/Ensenada
-Link America/Indiana/Indianapolis America/Fort_Wayne
-Link America/Indiana/Indianapolis America/Indianapolis
-Link America/Argentina/Jujuy America/Jujuy
-Link America/Indiana/Knox America/Knox_IN
-Link America/Kentucky/Louisville America/Louisville
-Link America/Argentina/Mendoza America/Mendoza
-Link America/Rio_Branco America/Porto_Acre
-Link America/Argentina/Cordoba America/Rosario
-Link America/St_Thomas America/Virgin
-Link Asia/Ashgabat Asia/Ashkhabad
-Link Asia/Chongqing Asia/Chungking
-Link Asia/Dhaka Asia/Dacca
-Link Asia/Kathmandu Asia/Katmandu
-Link Asia/Kolkata Asia/Calcutta
-Link Asia/Macau Asia/Macao
-Link Asia/Jerusalem Asia/Tel_Aviv
-Link Asia/Ho_Chi_Minh Asia/Saigon
-Link Asia/Thimphu Asia/Thimbu
-Link Asia/Makassar Asia/Ujung_Pandang
-Link Asia/Ulaanbaatar Asia/Ulan_Bator
-Link Atlantic/Faroe Atlantic/Faeroe
-Link Europe/Oslo Atlantic/Jan_Mayen
-Link Australia/Sydney Australia/ACT
-Link Australia/Sydney Australia/Canberra
-Link Australia/Lord_Howe Australia/LHI
-Link Australia/Sydney Australia/NSW
-Link Australia/Darwin Australia/North
-Link Australia/Brisbane Australia/Queensland
-Link Australia/Adelaide Australia/South
-Link Australia/Hobart Australia/Tasmania
-Link Australia/Melbourne Australia/Victoria
-Link Australia/Perth Australia/West
-Link Australia/Broken_Hill Australia/Yancowinna
-Link America/Rio_Branco Brazil/Acre
-Link America/Noronha Brazil/DeNoronha
-Link America/Sao_Paulo Brazil/East
-Link America/Manaus Brazil/West
-Link America/Halifax Canada/Atlantic
-Link America/Winnipeg Canada/Central
-Link America/Regina Canada/East-Saskatchewan
-Link America/Toronto Canada/Eastern
-Link America/Edmonton Canada/Mountain
-Link America/St_Johns Canada/Newfoundland
-Link America/Vancouver Canada/Pacific
-Link America/Regina Canada/Saskatchewan
-Link America/Whitehorse Canada/Yukon
-Link America/Santiago Chile/Continental
-Link Pacific/Easter Chile/EasterIsland
-Link America/Havana Cuba
-Link Africa/Cairo Egypt
-Link Europe/Dublin Eire
-Link Europe/London Europe/Belfast
-Link Europe/Chisinau Europe/Tiraspol
-Link Europe/London GB
-Link Europe/London GB-Eire
-Link Etc/GMT GMT+0
-Link Etc/GMT GMT-0
-Link Etc/GMT GMT0
-Link Etc/GMT Greenwich
-Link Asia/Hong_Kong Hongkong
-Link Atlantic/Reykjavik Iceland
-Link Asia/Tehran Iran
-Link Asia/Jerusalem Israel
-Link America/Jamaica Jamaica
-Link Asia/Tokyo Japan
-Link Pacific/Kwajalein Kwajalein
-Link Africa/Tripoli Libya
-Link America/Tijuana Mexico/BajaNorte
-Link America/Mazatlan Mexico/BajaSur
-Link America/Mexico_City Mexico/General
-Link Pacific/Auckland NZ
-Link Pacific/Chatham NZ-CHAT
-Link America/Denver Navajo
-Link Asia/Shanghai PRC
-Link Pacific/Pago_Pago Pacific/Samoa
-Link Pacific/Chuuk Pacific/Yap
-Link Pacific/Chuuk Pacific/Truk
-Link Pacific/Pohnpei Pacific/Ponape
-Link Europe/Warsaw Poland
-Link Europe/Lisbon Portugal
-Link Asia/Taipei ROC
-Link Asia/Seoul ROK
-Link Asia/Singapore Singapore
-Link Europe/Istanbul Turkey
-Link Etc/UCT UCT
-Link America/Anchorage US/Alaska
-Link America/Adak US/Aleutian
-Link America/Phoenix US/Arizona
-Link America/Chicago US/Central
-Link America/Indiana/Indianapolis US/East-Indiana
-Link America/New_York US/Eastern
-Link Pacific/Honolulu US/Hawaii
-Link America/Indiana/Knox US/Indiana-Starke
-Link America/Detroit US/Michigan
-Link America/Denver US/Mountain
-Link America/Los_Angeles US/Pacific
-Link Pacific/Pago_Pago US/Samoa
-Link Etc/UTC UTC
-Link Etc/UTC Universal
-Link Europe/Moscow W-SU
-Link Etc/UTC Zulu
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index b71d3cd..e0bf774 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -1103,11 +1103,16 @@ load_backward_tz (CcTimezoneMap *self)
{
GError *error = NULL;
char **lines, *contents;
+ gchar *file;
+ gboolean result;
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 "/backward", &contents, NULL, &error) == FALSE)
+ file = g_strdup_printf ("%s/backward", get_datadir ());
+ result = g_file_get_contents (file, &contents, NULL, &error);
+ g_free (file);
+ if (result == FALSE)
{
g_warning ("Failed to load 'backward' file: %s", error->message);
return;
diff --git a/src/data/README b/src/data/README
index 0d7aa11..1b1a737 100644
--- a/src/data/README
+++ b/src/data/README
@@ -8,6 +8,10 @@ admin1Codes.txt, cities15000.txt, countryInfo.txt
These three files come from the geonames.org database. Simply find the files
in http://download.geonames.org/export/dump/ and copy them to this directory.
+backward
+ This file lists links between current time zone names and obsolete time zone
+ names. It comes from the tzdata at https://www.iana.org/time-zones
+
olsen_map.png
This is a map of the tzdata timezones, with each zone encoded as a RGBA
value. The data source is probably the shapefiles provided at
diff --git a/src/data/backward b/src/data/backward
new file mode 100644
index 0000000..f1f95a8
--- /dev/null
+++ b/src/data/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/src/tz.h b/src/tz.h
index 8eb55d3..8d033de 100644
--- a/src/tz.h
+++ b/src/tz.h
@@ -31,13 +31,13 @@
#include "cc-timezone-location.h"
#ifndef __sun
-# define TZ_DATA_FILE "/usr/share/libtimezonemap/ui/cities15000.txt"
+# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
#else
# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
#endif
-# define ADMIN1_FILE "/usr/share/libtimezonemap/ui/admin1Codes.txt"
-# define COUNTRY_FILE "/usr/share/libtimezonemap/ui/countryInfo.txt"
+# define ADMIN1_FILE "/usr/share/libtimezonemap/admin1Codes.txt"
+# define COUNTRY_FILE "/usr/share/libtimezonemap/countryInfo.txt"
G_BEGIN_DECLS
--
2.5.5

View File

@ -1,140 +0,0 @@
From 380f1f88396e7c08da0d422b3416cb51c15d6a22 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 24 Jun 2016 16:15:51 -0400
Subject: [PATCH 09/24] Remove the sun specific tzdata path.
tz.c no longer uesrs tzdata so this is obsolete.
---
src/tz.c | 65 +---------------------------------------------------------------
src/tz.h | 6 +-----
2 files changed, 2 insertions(+), 69 deletions(-)
diff --git a/src/tz.c b/src/tz.c
index 9aa9e8a..30f688d 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -36,9 +36,6 @@
/* Forward declarations for private functions */
-#ifdef __sun
-static float convert_pos (gchar *pos, int digits);
-#endif
static int compare_country_names (const void *a, const void *b);
static void sort_locations_by_country (GPtrArray *locations);
static const gchar * tz_data_file_get (const gchar *env, const gchar *defaultfile);
@@ -131,42 +128,10 @@ void parse_cities15000 (gpointer parsed_data,
cc_timezone_location_set_latitude(loc, g_ascii_strtod(parsed_data_v[4], NULL));
cc_timezone_location_set_longitude(loc, g_ascii_strtod(parsed_data_v[5], NULL));
-#ifdef __sun
- gchar *latstr, *lngstr, *p;
-
- latstr = g_strdup (parsed_data_v[1]);
- p = latstr + 1;
- while (*p != '-' && *p != '+') p++;
- lngstr = g_strdup (p);
- *p = '\0';
-
- if (parsed_data_v[3] && *parsed_data_v[3] == '-' && parsed_data_v[4])
- loc->comment = g_strdup (parsed_data_v[4]);
-
- if (parsed_data_v[3] && *parsed_data_v[3] != '-' && !islower(loc->zone)) {
- CcTimezoneLocation *locgrp;
-
- /* duplicate entry */
- locgrp = cc_timezone_location_new ();
- locgrp->country = g_strdup (parsed_data_v[0]);
- locgrp->en_name = NULL;
- locgrp->zone = g_strdup (parsed_data_v[3]);
- locgrp->latitude = convert_pos (latstr, 2);
- locgrp->longitude = convert_pos (lngstr, 3);
- locgrp->comment = (parsed_data_v[4]) ? g_strdup (parsed_data_v[4]) : NULL;
-
- g_ptr_array_add (ptr_array, (gpointer) locgrp);
- }
-#else
cc_timezone_location_set_comment(loc, NULL);
-#endif
g_ptr_array_add (ptr_array, (gpointer) loc);
-#ifdef __sun
- g_free (latstr);
- g_free (lngstr);
-#endif
g_strfreev (parsed_data_v);
return;
@@ -350,7 +315,6 @@ tz_info_from_location (CcTimezoneLocation *loc)
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);
@@ -361,11 +325,6 @@ tz_info_from_location (CcTimezoneLocation *loc)
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;
@@ -397,30 +356,8 @@ tz_data_file_get (const gchar *env, const gchar *defaultfile)
return filename ? filename : defaultfile;
}
-#ifdef __sun
-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));
-}
-#endif
-
- static int
+static int
compare_country_names (const void *a, const void *b)
{
CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
diff --git a/src/tz.h b/src/tz.h
index 8d033de..b94a886 100644
--- a/src/tz.h
+++ b/src/tz.h
@@ -30,11 +30,7 @@
#include "cc-timezone-location.h"
-#ifndef __sun
-# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
-#else
-# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
-#endif
+# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
# define ADMIN1_FILE "/usr/share/libtimezonemap/admin1Codes.txt"
# define COUNTRY_FILE "/usr/share/libtimezonemap/countryInfo.txt"
--
2.5.5

View File

@ -1,285 +0,0 @@
From 830abfced87aefae3f574170a9948dcdc5d4bef2 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 24 Jun 2016 14:26:13 -0400
Subject: [PATCH 10/24] Add a new test to check whether all zones can be
selected.
Since the answer is "no", add some additional city data to provide
locations for currently unclickable zones.
---
configure.ac | 3 +
src/Makefile.am | 22 +++++--
src/data/README | 5 ++
src/data/citiesExtra.txt | 5 ++
src/test-clickability.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++
src/tz.h | 2 +-
7 files changed, 186 insertions(+), 5 deletions(-)
create mode 100644 src/data/citiesExtra.txt
create mode 100644 src/test-clickability.c
diff --git a/configure.ac b/configure.ac
index 7e647f0..31f8ffa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,9 @@ PKG_CHECK_MODULES(LIBTIMEZONEMAP, gio-2.0 >= $GIO_REQUIRED_VERSION
librsvg-2.0)
LIBTIMEZONEMAP_LIBS="$LIBTIMEZONEMAP_LIBS $LIBM"
+# Extra requirements for tests
+PKG_CHECK_MODULES(LIBXML, libxml-2.0)
+
GOBJECT_INTROSPECTION_CHECK([0.6.7])
###########################
diff --git a/src/Makefile.am b/src/Makefile.am
index 106f034..56e404a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,10 +5,19 @@ dist_ui_DATA = \
data/olsen_map.png \
data/pin.png \
data/time_zones_countryInfo-orig.svg \
- data/cities15000.txt \
data/admin1Codes.txt \
data/countryInfo.txt
+nodist_ui_DATA = \
+ data/citiesInfo.txt
+
+dist_noinst_DATA = \
+ data/cities15000.txt \
+ data/citiesExtra.txt
+
+data/citiesInfo.txt: data/cities15000.txt data/citiesExtra.txt
+ cat data/cities15000.txt data/citiesExtra.txt > $@
+
tzdatadir = $(pkgdatadir)/
dist_tzdata_DATA = data/backward
@@ -25,19 +34,24 @@ noinst_PROGRAMS = test-timezone
all-local: check
-AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/cities15000.txt ; \
+AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/citiesInfo.txt ; \
ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt ; \
COUNTRY_FILE=$(srcdir)/data/countryInfo.txt ; \
DATADIR=$(srcdir)/data ; \
export TZ_DATA_FILE ADMIN1_FILE COUNTRY_FILE DATADIR ;
-check_PROGRAMS = test-timezone
+check_PROGRAMS = test-timezone \
+ test-clickability
test_timezone_SOURCES = test-timezone.c
test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm libtimezonemap.la
test_timezone_CFLAGS = $(LIBTIMEZONEMAP_CFLAGS)
-TESTS = test-timezone
+test_clickability_SOURCES = test-clickability.c
+test_clickability_LDADD = $(LIBTIMEZONEMAP_LIBS) $(LIBXML_LIBS) libtimezonemap.la
+test_clickability_CFLAGS = $(LIBTIMEZONEMAP_CFLAGS) $(LIBXML_CFLAGS)
+
+TESTS = test-timezone test-clickability
lib_LTLIBRARIES = libtimezonemap.la
diff --git a/src/data/README b/src/data/README
index 1b1a737..a643fc1 100644
--- a/src/data/README
+++ b/src/data/README
@@ -8,6 +8,11 @@ admin1Codes.txt, cities15000.txt, countryInfo.txt
These three files come from the geonames.org database. Simply find the files
in http://download.geonames.org/export/dump/ and copy them to this directory.
+citiesExtra.txt
+ These are additional cities with populations less than 15,000 used to
+ provide clickable locations for sparesly populated timezones. It consists of
+ extra lines from the geonames database.
+
backward
This file lists links between current time zone names and obsolete time zone
names. It comes from the tzdata at https://www.iana.org/time-zones
diff --git a/src/data/citiesExtra.txt b/src/data/citiesExtra.txt
new file mode 100644
index 0000000..1df5349
--- /dev/null
+++ b/src/data/citiesExtra.txt
@@ -0,0 +1,5 @@
+7521902 Tabwakea Village Tabwakea Village 2.01643 -157.48773 P PPL KI 02 KT 1881 6 Pacific/Kiritimati 2010-10-22
+8063344 Taiohae Taiohae Hakapehi -8.91093 -140.09972 P PPLA PF 04 1224 23 Pacific/Marquesas 2013-08-10
+4032824 Tuku Tuku Te Tuku -44.06667 -176.65 H STM NZ NZ 0 101 Pacific/Chatham 1993-12-30
+7731015 Eucla Airport Eucla Airport EUC,Eucla Airport,YECL -31.70674 128.87718 S AIRP AU 08 53080 0 7 Australia/Eucla 2014-11-09
+2159558 Lord Howe Island Lord Howe Island Ile Lord Howe,Lord Howe,Lord Howe Island,Lord Howe-eiland,Lord Howeoen,Lord Howeön,Lord-Howe-Eiland,Lord-Howe-Insel,Ostrov lorda Howa,Île Lord Howe,ロード・ハウ島 -31.55455 159.08246 T ISL AU 02 0 59 Australia/Lord_Howe 2015-06-01
diff --git a/src/test-clickability.c b/src/test-clickability.c
new file mode 100644
index 0000000..2784b60
--- /dev/null
+++ b/src/test-clickability.c
@@ -0,0 +1,150 @@
+#include "config.h"
+#include "tz.h"
+
+#include <string.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
+/* For each offset png, check that there is at least one clickable location in
+ * the tzdb with the offset */
+int main(int argc, char **argv)
+{
+ TzDB *db;
+ GPtrArray *locs;
+ CcTimezoneLocation *loc;
+ TzInfo *info;
+ gdouble loc_offset;
+
+ xmlDocPtr doc;
+ xmlXPathContextPtr xpathCtx;
+ xmlXPathObjectPtr xpathObj;
+ xmlNodeSetPtr nodes;
+
+ const char *pixmap_dir;
+ gchar *path;
+
+ GError *error = NULL;
+ gchar *endptr;
+ gdouble timezone_offset;
+ int i, j;
+
+ int retval = 0;
+
+ if (argc == 2)
+ {
+ pixmap_dir = argv[1];
+ }
+ else if (argc == 1)
+ {
+ const char *datadir = g_getenv("DATADIR");
+ if (datadir != NULL)
+ {
+ pixmap_dir = datadir;
+ }
+ else
+ {
+ pixmap_dir = "./data";
+ }
+ }
+ else
+ {
+ g_message("Usage: %s [PIXMAP DIRECTORY]", argv[0]);
+ return 1;
+ }
+
+ if (! g_file_test(pixmap_dir, G_FILE_TEST_IS_DIR))
+ {
+ g_message("Pixmap directory %s does not exist", pixmap_dir);
+ return 1;
+ }
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+ g_type_init();
+#endif
+
+ xmlInitParser ();
+ path = g_build_filename (pixmap_dir, "time_zones_countryInfo-orig.svg", NULL);
+ doc = xmlParseFile (path);
+ if (doc == NULL)
+ {
+ g_message("Unable to parse '%s'", path);
+ g_free (path);
+ return 1;
+ }
+ g_free (path);
+
+ /* Iterate over each layer, which can be found as <g> element wit
+ * inkscape:groupmode="layer" */
+ xpathCtx = xmlXPathNewContext(doc);
+ xmlXPathRegisterNs(xpathCtx, "svg", "http://www.w3.org/2000/svg");
+ xmlXPathRegisterNs(xpathCtx, "inkscape", "http://www.inkscape.org/namespaces/inkscape");
+
+ xpathObj = xmlXPathEvalExpression("//svg:g[@inkscape:groupmode = 'layer']", xpathCtx);
+ if (!xpathObj)
+ {
+ g_message("Unable to evaluate xpath");
+ return 1;
+ }
+
+ nodes = xpathObj->nodesetval;
+ if (nodes == NULL)
+ {
+ g_message("Unable to find layers in SVG");
+ return 1;
+ }
+
+ db = tz_load_db ();
+ locs = tz_get_locations (db);
+
+ for (i = 0; i < nodes->nodeNr; i++)
+ {
+ char *id = xmlGetProp(nodes->nodeTab[i], "id");
+
+ if (id[0] != 'm' && id[0] != 'p')
+ {
+ continue;
+ }
+
+ timezone_offset = g_ascii_strtod (id+1, &endptr);
+ if (*endptr != '\0')
+ {
+ g_message ("Unable to parse layer name %s", id);
+ retval = 1;
+ }
+ if (id[0] == 'm')
+ {
+ timezone_offset = -timezone_offset;
+ }
+
+ /* Look for a location in tzdb with the same offset */
+ loc_offset = G_MAXDOUBLE;
+ for (j = 0; j < locs->len; j++)
+ {
+ loc = locs->pdata[j];
+ info = tz_info_from_location (loc);
+ loc_offset = tz_location_get_utc_offset (loc)
+ / (60.0 * 60.0) + ((info->daylight) ? -1.0 : 0.0);
+
+ if (loc_offset == timezone_offset)
+ {
+ break;
+ }
+ }
+
+ if (loc_offset != timezone_offset)
+ {
+ g_message ("Unable to find location for offset %.02f", timezone_offset);
+ retval = 1;
+ }
+ }
+
+ tz_db_free (db);
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+
+ return retval;
+}
diff --git a/src/tz.h b/src/tz.h
index b94a886..2b03e9e 100644
--- a/src/tz.h
+++ b/src/tz.h
@@ -30,7 +30,7 @@
#include "cc-timezone-location.h"
-# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
+# define TZ_DATA_FILE "/usr/share/libtimezonemap/citiesInfo.txt"
# define ADMIN1_FILE "/usr/share/libtimezonemap/admin1Codes.txt"
# define COUNTRY_FILE "/usr/share/libtimezonemap/countryInfo.txt"
--
2.5.5

File diff suppressed because one or more lines are too long

View File

@ -1,47 +0,0 @@
From f6f42da8e0e5d4733ed2e703eb7000e2bea9879a Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Mon, 27 Jun 2016 17:59:16 -0400
Subject: [PATCH 12/24] Ignore deprecation warnings
---
src/cc-timezone-map.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index e0bf774..1e53eec 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -759,7 +759,9 @@ cc_timezone_map_realize (GtkWidget *widget)
gdk_window_set_user_data (window, widget);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
cursor = gdk_cursor_new (GDK_HAND2);
+G_GNUC_END_IGNORE_DEPRECATIONS
gdk_window_set_cursor (window, cursor);
gtk_widget_set_window (widget, window);
@@ -818,14 +820,20 @@ cc_timezone_map_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &alloc);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
style = gtk_widget_get_style (widget);
+G_GNUC_END_IGNORE_DEPRECATIONS
/* Check if insensitive */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
alpha = 0.5;
+G_GNUC_END_IGNORE_DEPRECATIONS
/* paint background */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]);
+G_GNUC_END_IGNORE_DEPRECATIONS
cairo_paint (cr);
cairo_set_source (cr, priv->background);
cairo_paint_with_alpha (cr, alpha);
--
2.5.5

View File

@ -1,26 +0,0 @@
From 47f652ae147a21d22827399eae26fea660a849cb Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Mon, 27 Jun 2016 18:30:54 -0400
Subject: [PATCH 13/24] Fix the calculation of time zone offsets.
g_get_real_time returns microseconds, not milliseconds.
---
src/cc-timezone-map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 1e53eec..31a4876 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -963,7 +963,7 @@ get_location_offset (CcTimezoneLocation *location)
/* Query the zone based on the current time, since otherwise the data
* may not make sense. */
- curtime = g_get_real_time () / 1000; /* convert to seconds */
+ curtime = g_get_real_time () / 1000000; /* convert to seconds */
interval = g_time_zone_find_interval (zone, G_TIME_TYPE_UNIVERSAL, curtime);
offset = g_time_zone_get_offset (zone, interval);
--
2.5.5

View File

@ -1,31 +0,0 @@
From 417cd20b127ae50ecd7d7ec793f56fb89364c28d Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Tue, 28 Jun 2016 11:29:55 -0400
Subject: [PATCH 14/24] Fix convert_longtitude_to_x for points on the far
right.
convert_longtitude_to_x was returning negative x values for longitudes
between -168 and -180. Wrap these back to the right side of the map,
instead.
---
src/cc-timezone-map.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 31a4876..e64ec2b 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -777,6 +777,10 @@ convert_longtitude_to_x (gdouble longitude, gint map_width)
x = (map_width * (180.0 + longitude) / 360.0)
+ (map_width * xdeg_offset / 180.0);
+ /* If x is negative, wrap back to the beginning */
+ if (x < 0)
+ x = (gdouble) map_width + x;
+
return x;
}
--
2.5.5

View File

@ -1,52 +0,0 @@
From cfab41ba625306ecf2ebd93340c6e5f27dec2e03 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 8 Apr 2016 10:37:52 -0400
Subject: [PATCH 15/24] Make all private functions in tz.c static
---
src/tz.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/tz.c b/src/tz.c
index 30f688d..7c216fa 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -40,7 +40,7 @@ static int compare_country_names (const void *a, const void *b);
static void sort_locations_by_country (GPtrArray *locations);
static const gchar * tz_data_file_get (const gchar *env, const gchar *defaultfile);
-void parse_file (const char * filename,
+static void parse_file (const char * filename,
const guint ncolumns,
GFunc func,
gpointer user_data)
@@ -65,7 +65,7 @@ void parse_file (const char * filename,
fclose (fh);
}
-void parse_admin1Codes (gpointer parsed_data,
+static void parse_admin1Codes (gpointer parsed_data,
gpointer user_data)
{
gchar ** parsed_data_v = (gchar **) parsed_data;
@@ -79,7 +79,7 @@ void parse_admin1Codes (gpointer parsed_data,
}
-void parse_countrycode (gpointer parsed_data,
+static void parse_countrycode (gpointer parsed_data,
gpointer user_data)
{
gchar ** parsed_data_v = (gchar **) parsed_data;
@@ -98,7 +98,7 @@ typedef struct Triple {
gpointer third;
} Triple;
-void parse_cities15000 (gpointer parsed_data,
+static void parse_cities15000 (gpointer parsed_data,
gpointer user_data)
{
gchar ** parsed_data_v = (gchar **) parsed_data;
--
2.5.5

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +0,0 @@
From 2a3d8de902ad2adbcf3e4968cad766289da51713 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 22 Jun 2016 13:08:36 -0400
Subject: [PATCH 17/24] Update backward to the version in tzdata 2016e
---
src/data/backward | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/data/backward b/src/data/backward
index f1f95a8..aab237a 100644
--- a/src/data/backward
+++ b/src/data/backward
@@ -1,13 +1,12 @@
-# <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 TARGET LINK-NAME
+Link Africa/Nairobi Africa/Asmera
+Link Africa/Abidjan Africa/Timbuktu
Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
Link America/Adak America/Atka
Link America/Argentina/Buenos_Aires America/Buenos_Aires
@@ -21,17 +20,24 @@ 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/Toronto America/Montreal
Link America/Rio_Branco America/Porto_Acre
Link America/Argentina/Cordoba America/Rosario
-Link America/St_Thomas America/Virgin
+Link America/Tijuana America/Santa_Isabel
+Link America/Denver America/Shiprock
+Link America/Port_of_Spain America/Virgin
+Link Pacific/Auckland Antarctica/South_Pole
Link Asia/Ashgabat Asia/Ashkhabad
-Link Asia/Chongqing Asia/Chungking
+Link Asia/Kolkata Asia/Calcutta
+Link Asia/Shanghai Asia/Chongqing
+Link Asia/Shanghai Asia/Chungking
Link Asia/Dhaka Asia/Dacca
+Link Asia/Shanghai Asia/Harbin
+Link Asia/Urumqi Asia/Kashgar
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/Jerusalem Asia/Tel_Aviv
Link Asia/Thimphu Asia/Thimbu
Link Asia/Makassar Asia/Ujung_Pandang
Link Asia/Ulaanbaatar Asia/Ulan_Bator
@@ -89,10 +95,10 @@ Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link America/Denver Navajo
Link Asia/Shanghai PRC
+Link Pacific/Pohnpei Pacific/Ponape
Link Pacific/Pago_Pago Pacific/Samoa
-Link Pacific/Chuuk Pacific/Yap
Link Pacific/Chuuk Pacific/Truk
-Link Pacific/Pohnpei Pacific/Ponape
+Link Pacific/Chuuk Pacific/Yap
Link Europe/Warsaw Poland
Link Europe/Lisbon Portugal
Link Asia/Taipei ROC
--
2.5.5

View File

@ -1,157 +0,0 @@
From 4c87463e3b663b413c3be899bb15891aa7f0ee43 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Tue, 28 Jun 2016 13:49:14 -0400
Subject: [PATCH 18/24] Improve the location selected when setting the timezone
by name.
When setting the timezone from a name (e.g., Australia/Brisbane), try to
find the city that matches the timezone name. That way, in our example,
the pin will appear on Brisbane and not just some random city in eastern
Australia.
In addition, when cc_timezone_map_set_timezone is called for an unknown
timezone, set the offset highlight based on glib's view of timezones
(since this may be a low-population timezone without city data) and
unset the location.
---
src/cc-timezone-map.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 100 insertions(+), 3 deletions(-)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 11b14ea..5e4c210 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -28,6 +28,7 @@
#include <math.h>
#include "tz.h"
#include <librsvg/rsvg.h>
+#include <string.h>
G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
@@ -817,10 +818,42 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
const gchar *timezone)
{
GPtrArray *locations;
+ GList *zone_locations = NULL;
+ GList *location_node = NULL;
guint i;
- char *real_tz;
+ const char *real_tz;
+ const char *tz_city_start;
+ char *tz_city;
+ char *tmp;
+ gboolean found_location = FALSE;
real_tz = g_hash_table_lookup (map->priv->alias_db, timezone);
+ if (!real_tz)
+ real_tz = timezone;
+
+ tz_city_start = strrchr (timezone, '/');
+ if (tz_city_start)
+ {
+ /* Move to the first character after the / */
+ tz_city_start++;
+ }
+ else
+ {
+ tz_city_start = real_tz;
+ }
+
+ tz_city = g_strdup(tz_city_start);
+
+ /* Replace the underscores with spaces */
+ tmp = tz_city;
+ while (*tmp != '\0')
+ {
+ if (*tmp == '_')
+ {
+ *tmp = ' ';
+ }
+ tmp++;
+ }
locations = tz_get_locations (map->priv->tzdb);
@@ -828,12 +861,76 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
{
CcTimezoneLocation *loc = locations->pdata[i];
- if (!g_strcmp0 (cc_timezone_location_get_zone(loc), real_tz ? real_tz : timezone))
+ if (!g_strcmp0 (cc_timezone_location_get_zone (loc), real_tz))
{
- set_location (map, loc);
+ zone_locations = g_list_prepend (zone_locations, loc);
+ }
+ }
+
+ /* No location found. Use GLib to set the highlight. g_time_zone_new always
+ * returns a GTimeZone, so invalid zones will just be offset 0.
+ */
+ if (zone_locations == NULL)
+ {
+ CcTimezoneLocation *test_location = cc_timezone_location_new ();
+ gdouble offset;
+
+ cc_timezone_location_set_zone (test_location, real_tz);
+ offset = get_location_offset (test_location);
+ g_object_unref (test_location);
+
+ set_location (map, NULL);
+ cc_timezone_map_set_selected_offset (map, offset);
+
+ return;
+ }
+
+ /* Look for a location with a name that either starts or ends with the name
+ * of the zone
+ */
+ location_node = zone_locations;
+ while (location_node != NULL)
+ {
+ const gchar *name = cc_timezone_location_get_en_name (location_node->data);
+ if (!strncmp (name, tz_city, strlen (tz_city)) ||
+ ((strlen(name) > strlen(tz_city)) &&
+ !strncmp (name + (strlen(name) - strlen(tz_city)), tz_city, strlen (tz_city))))
+ {
+ set_location (map, location_node->data);
+ found_location = TRUE;
break;
}
+
+ location_node = location_node->next;
}
+
+ /* If that didn't work, try by state */
+ if (!found_location)
+ {
+ location_node = zone_locations;
+ while (location_node != NULL)
+ {
+ const gchar *state = cc_timezone_location_get_state (location_node->data);
+
+ if ((state != NULL) &&
+ !strncmp (state, tz_city, strlen (tz_city)))
+ {
+ set_location (map, location_node->data);
+ found_location = TRUE;
+ break;
+ }
+
+ location_node = location_node->next;
+ }
+ }
+
+ /* If nothing matched, just use the first location */
+ if (!found_location)
+ {
+ set_location (map, zone_locations->data);
+ }
+
+ g_list_free (zone_locations);
}
void
--
2.5.5

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,103 +0,0 @@
From c540bda8d9a3ae9079471cbe836af4463baede59 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 27 Nov 2013 11:22:42 -0500
Subject: [PATCH 21/24] Added a glade catalog file.
This allows CcTimezoneMap and CcTimezoneCompletion to be used in glade.
---
Makefile.am | 2 +-
configure.ac | 1 +
glade/Makefile.am | 2 ++
glade/TimezoneMap.xml | 47 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 glade/Makefile.am
create mode 100644 glade/TimezoneMap.xml
diff --git a/Makefile.am b/Makefile.am
index 960f89c..15740b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = src
+SUBDIRS = src glade
DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
diff --git a/configure.ac b/configure.ac
index 31f8ffa..118e1a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,7 @@ AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install all
AC_CONFIG_FILES([
Makefile
+glade/Makefile
src/Makefile
src/timezonemap.pc
])
diff --git a/glade/Makefile.am b/glade/Makefile.am
new file mode 100644
index 0000000..37bde31
--- /dev/null
+++ b/glade/Makefile.am
@@ -0,0 +1,2 @@
+gladedir = $(datadir)/glade/catalogs
+dist_glade_DATA = TimezoneMap.xml
diff --git a/glade/TimezoneMap.xml b/glade/TimezoneMap.xml
new file mode 100644
index 0000000..a43e925
--- /dev/null
+++ b/glade/TimezoneMap.xml
@@ -0,0 +1,47 @@
+<glade-catalog name="TimezoneMap"
+ version="0.4"
+ library="timezonemap"
+ domain="glade-3"
+ depends="gtk+">
+
+ <glade-widget-classes>
+ <glade-widget-class title="Timezone Map"
+ name="CcTimezoneMap"
+ icon-name="widget-gtk-image"
+ generic-name="TimezoneMap">
+ <signals>
+ <signal id="location-changed"/>
+ </signals>
+ </glade-widget-class>
+
+ <glade-widget-class title="Timezone Entry Complection"
+ name="CcTimezoneCompletion"
+ generic-name="TimezoneCompletion">
+ <!-- From GtkEntryCompletion -->
+ <add-child-verify-function>glade_gtk_cell_layout_add_verify</add-child-verify-function>
+ <add-child-function>glade_gtk_cell_layout_add_child</add-child-function>
+ <remove-child-function>glade_gtk_cell_layout_remove_child</remove-child-function>
+ <get-children-function>glade_gtk_cell_layout_get_children</get-children-function>
+ <read-child-function>glade_gtk_cell_layout_read_child</read-child-function>
+ <write-child-function>glade_gtk_cell_layout_write_child</write-child-function>
+ <action-activate-function>glade_gtk_cell_layout_action_activate</action-activate-function>
+ <child-set-property-function>glade_gtk_cell_layout_set_child_property</child-set-property-function>
+ <child-get-property-function>glade_gtk_cell_layout_get_child_property</child-get-property-function>
+
+ <properties>
+ <property id="model" disabled="True"/>
+ <property id="text-column" disabled="True"/>
+ <property id="popup-set-width" disabled="True"/>
+ </properties>
+
+ <actions>
+ <action stock="gtk-edit" important="True" id="launch_editor" name="Edit&#8230;"></action>
+ </actions>
+ </glade-widget-class>
+ </glade-widget-classes>
+
+ <glade-widget-group name="timezonemap-misc-widgets" title="TimezoneMap Widgets">
+ <glade-widget-class-ref name="CcTimezoneMap"/>
+ <glade-widget-class-ref name="CcTimezoneCompletion"/>
+ </glade-widget-group>
+</glade-catalog>
--
2.5.5

View File

@ -1,207 +0,0 @@
From 730120b2bfb81d2f65c0f8912c39c17ff3b5d2aa Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 29 Jun 2016 14:01:45 -0400
Subject: [PATCH 22/24] Fix compiler warnings
Remove unused code and cast around libxml signed char nitpickings
---
src/cc-timezone-location.c | 11 +---------
src/cc-timezone-map.c | 1 -
src/test-clickability.c | 23 ++++++++++++++-----
src/tz.c | 55 ----------------------------------------------
4 files changed, 18 insertions(+), 72 deletions(-)
diff --git a/src/cc-timezone-location.c b/src/cc-timezone-location.c
index 31ceb56..6fab52b 100644
--- a/src/cc-timezone-location.c
+++ b/src/cc-timezone-location.c
@@ -181,13 +181,6 @@ cc_timezone_location_dispose (GObject *object)
}
static void
-cc_timezone_location_finalize (GObject *object)
-{
- CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
- G_OBJECT_CLASS (cc_timezone_location_parent_class)->finalize (object);
-}
-
-static void
cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -196,7 +189,6 @@ cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
object_class->get_property = cc_timezone_location_get_property;
object_class->set_property = cc_timezone_location_set_property;
object_class->dispose = cc_timezone_location_dispose;
- object_class->finalize = cc_timezone_location_finalize;
g_object_class_install_property(object_class,
PROP_COUNTRY,
@@ -271,8 +263,7 @@ cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
static void
cc_timezone_location_init (CcTimezoneLocation *self) {
- CcTimezoneLocationPrivate *priv;
- priv = self->priv = TIMEZONE_LOCATION_PRIVATE (self);
+ self->priv = TIMEZONE_LOCATION_PRIVATE (self);
}
CcTimezoneLocation *
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 5e4c210..1bad664 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -589,7 +589,6 @@ set_location (CcTimezoneMap *map,
CcTimezoneLocation *location)
{
CcTimezoneMapPrivate *priv = map->priv;
- TzInfo *info;
priv->location = location;
diff --git a/src/test-clickability.c b/src/test-clickability.c
index 2784b60..1fc8007 100644
--- a/src/test-clickability.c
+++ b/src/test-clickability.c
@@ -26,7 +26,6 @@ int main(int argc, char **argv)
const char *pixmap_dir;
gchar *path;
- GError *error = NULL;
gchar *endptr;
gdouble timezone_offset;
int i, j;
@@ -79,10 +78,22 @@ int main(int argc, char **argv)
/* Iterate over each layer, which can be found as <g> element wit
* inkscape:groupmode="layer" */
xpathCtx = xmlXPathNewContext(doc);
- xmlXPathRegisterNs(xpathCtx, "svg", "http://www.w3.org/2000/svg");
- xmlXPathRegisterNs(xpathCtx, "inkscape", "http://www.inkscape.org/namespaces/inkscape");
+ xmlXPathRegisterNs(
+ xpathCtx,
+ (const xmlChar *) "svg",
+ (const xmlChar *) "http://www.w3.org/2000/svg"
+ );
+ xmlXPathRegisterNs(
+ xpathCtx,
+ (const xmlChar *) "inkscape",
+ (const xmlChar *) "http://www.inkscape.org/namespaces/inkscape"
+ );
+
+ xpathObj = xmlXPathEvalExpression(
+ (const xmlChar *)"//svg:g[@inkscape:groupmode = 'layer']",
+ xpathCtx
+ );
- xpathObj = xmlXPathEvalExpression("//svg:g[@inkscape:groupmode = 'layer']", xpathCtx);
if (!xpathObj)
{
g_message("Unable to evaluate xpath");
@@ -101,14 +112,14 @@ int main(int argc, char **argv)
for (i = 0; i < nodes->nodeNr; i++)
{
- char *id = xmlGetProp(nodes->nodeTab[i], "id");
+ xmlChar *id = xmlGetProp(nodes->nodeTab[i], (const xmlChar *) "id");
if (id[0] != 'm' && id[0] != 'p')
{
continue;
}
- timezone_offset = g_ascii_strtod (id+1, &endptr);
+ timezone_offset = g_ascii_strtod ((gchar *) id+1, &endptr);
if (*endptr != '\0')
{
g_message ("Unable to parse layer name %s", id);
diff --git a/src/tz.c b/src/tz.c
index 7c216fa..3ec64a3 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -146,7 +146,6 @@ tz_load_db (void)
{
const gchar *tz_data_file, *admin1_file, *country_file;
TzDB *tz_db;
- char buf[4096];
tz_data_file = tz_data_file_get ("TZ_DATA_FILE", TZ_DATA_FILE);
if (!tz_data_file)
@@ -206,42 +205,6 @@ tz_db_free (TzDB *db)
g_free (db);
}
-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;
-}
-
GPtrArray *
tz_get_locations (TzDB *db)
{
@@ -263,9 +226,6 @@ tz_location_get_utc_offset (CcTimezoneLocation *loc)
gint
tz_location_set_locally (CcTimezoneLocation *loc)
{
- time_t curtime;
- struct tm *curzone;
- gboolean is_dst = FALSE;
gint correction = 0;
const gchar *zone;
@@ -273,22 +233,7 @@ tz_location_set_locally (CcTimezoneLocation *loc)
zone = cc_timezone_location_get_zone(loc);
g_return_val_if_fail (zone != NULL, 0);
- curtime = time (NULL);
- curzone = localtime (&curtime);
- is_dst = curzone->tm_isdst;
-
setenv ("TZ", 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;
}
--
2.5.5

View File

@ -1,27 +0,0 @@
From 59cbfb1facf908f04312e59ac9ac1d5a25da12f9 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 29 Jun 2016 14:25:14 -0400
Subject: [PATCH 23/24] Do not run the checks as part of 'make all'
This breaks parallel make. The checks can (and should) be run separately
with 'make check'.
---
src/Makefile.am | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index afdb1ea..570b828 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,8 +31,6 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = test-timezone
-all-local: check
-
AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/citiesInfo.txt ; \
ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt ; \
COUNTRY_FILE=$(srcdir)/data/countryInfo.txt ; \
--
2.5.5

View File

@ -1,39 +0,0 @@
From b7714717a6073e7d8696737b1366aa2628182bc5 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 29 Jun 2016 14:30:04 -0400
Subject: [PATCH 24/24] Fix issues with 'make distcheck'
Ensure that citiesInfo is written to, read from, and cleaned from
$builddir.
---
src/Makefile.am | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 570b828..40a1f0b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,10 @@ dist_noinst_DATA = \
data/citiesExtra.txt
data/citiesInfo.txt: data/cities15000.txt data/citiesExtra.txt
- cat data/cities15000.txt data/citiesExtra.txt > $@
+ @$(MKDIR_P) $(builddir)/data
+ $(AM_V_GEN)cat $(srcdir)/data/cities15000.txt $(srcdir)/data/citiesExtra.txt > $@
+
+CLEANFILES = data/citiesInfo.txt
tzdatadir = $(pkgdatadir)/
dist_tzdata_DATA = data/backward
@@ -31,7 +34,7 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = test-timezone
-AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/citiesInfo.txt ; \
+AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(builddir)/data/citiesInfo.txt ; \
ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt ; \
COUNTRY_FILE=$(srcdir)/data/countryInfo.txt ; \
DATADIR=$(srcdir)/data ; \
--
2.5.5

View File

@ -1,46 +0,0 @@
From f312d9c6f6a4a81066264d85a8e2a663d6ed7d95 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 17 Aug 2016 13:49:37 -0400
Subject: [PATCH] Bring back the setting of $TZ.
Callers expect setting the map location to take effect for times within
the process, so just throw thread safety to the wind and do it.
---
src/cc-timezone-map.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 1bad664..d7c99d5 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -29,6 +29,7 @@
#include "tz.h"
#include <librsvg/rsvg.h>
#include <string.h>
+#include <stdlib.h>
G_DEFINE_TYPE (CcTimezoneMap, cc_timezone_map, GTK_TYPE_WIDGET)
@@ -596,16 +597,19 @@ set_location (CcTimezoneMap *map,
{
priv->selected_offset = get_location_offset (priv->location);
priv->show_offset = TRUE;
+ setenv("TZ", cc_timezone_location_get_zone(location), 1);
}
else
{
priv->show_offset = FALSE;
priv->selected_offset = 0.0;
+ unsetenv("TZ");
}
render_highlight (map);
gtk_widget_queue_draw (GTK_WIDGET (map));
+
g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
}
--
2.7.4

View File

@ -1,41 +1,12 @@
Name: libtimezonemap
Version: 0.4.5
Release: 8%{?dist}
Version: 0.4.5.1
Release: 1%{?dist}
Summary: Time zone map widget for Gtk+
Group: System Environment/Libraries
License: GPLv3
URL: https://launchpad.net/timezonemap
Source0: http://archive.ubuntu.com/ubuntu/pool/main/libt/libtimezonemap/%{name}_%{version}.tar.gz
# Flattened versions of diff from https://github.com/dashea/timezonemap
# The .bzrignore chunks have also been removed, since the source archive
# does not contain .bzrignore.
Patch1: 0001-Allow-the-image-data-directory-to-be-overridden.patch
Patch2: 0002-Render-the-map-directly-from-the-SVG.patch
Patch3: 0003-Optimize-the-SVG.patch
Patch4: 0004-Fix-memory-leaks-in-tz.c.patch
Patch5: 0005-Fix-an-invalid-memory-access.patch
Patch6: 0006-Do-not-use-tz_location_get_utc_offset.patch
Patch7: 0007-Make-the-test-program-more-automake-y.patch
Patch8: 0008-Move-all-of-the-data-into-one-place.patch
Patch9: 0009-Remove-the-sun-specific-tzdata-path.patch
Patch10: 0010-Add-a-new-test-to-check-whether-all-zones-can-be-sel.patch
Patch11: 0011-Moved-Venezuela-to-4.patch
Patch12: 0012-Ignore-deprecation-warnings.patch
Patch13: 0013-Fix-the-calculation-of-time-zone-offsets.patch
Patch14: 0014-Fix-convert_longtitude_to_x-for-points-on-the-far-ri.patch
Patch15: 0015-Make-all-private-functions-in-tz.c-static.patch
Patch16: 0016-Drop-the-map-of-tzdata-timezones.patch
Patch17: 0017-Update-backward-to-the-version-in-tzdata-2016e.patch
Patch18: 0018-Improve-the-location-selected-when-setting-the-timez.patch
Patch19: 0019-Removed-an-extra-line-from-p10.patch
Patch20: 0020-Moved-Chile-back-an-hour.patch
Patch21: 0021-Added-a-glade-catalog-file.patch
Patch22: 0022-Fix-compiler-warnings.patch
Patch23: 0023-Do-not-run-the-checks-as-part-of-make-all.patch
Patch24: 0024-Fix-issues-with-make-distcheck.patch
Patch25: 0025-Bring-back-the-setting-of-TZ.patch
Source0: https://github.com/dashea/timezonemap/archive/%{version}.tar.gz
BuildRequires: glib2-devel >= 2.26
BuildRequires: gtk3-devel >= 3.1.4
@ -45,9 +16,6 @@ BuildRequires: gnome-common
BuildRequires: libsoup-devel >= 2.42.0
BuildRequires: librsvg2-devel
# For applying the patches
BuildRequires: git
%description
libtimezonemap is a time zone map widget for Gtk+. The widget displays a world
map with a highlighted region representing the selected time zone, and the
@ -66,7 +34,7 @@ libtimezonemap is a time zone map widget for Gtk+. This package contains header
files used for building applications that use %{name}.
%prep
%autosetup -S git
%autosetup -n timezonemap-%{version}
%build
./autogen.sh
@ -96,6 +64,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_datadir}/glade/catalogs/TimezoneMap.xml
%changelog
* Fri Oct 20 2017 David Shea <dshea@redhat.com> - 0.4.5.1-1
- Fix SVG visibility (jkonecny) (#1502915)
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

View File

@ -1 +1 @@
054306fa998fe580f17b68aa1e16551b libtimezonemap_0.4.5.tar.gz
SHA512 (0.4.5.1.tar.gz) = 691fea4848769689542e61e868a8e7c119c5ce37470f321fb7173be1ed268ab876297b97b69baf1c0ece006b825809e5bbc1249c0a2cfd62cb9759ee5ecc5e0f