[libtimezonemap/f20] Sync to the latest patches in lp:~dshea/timezonemap/trunk
David Shea
dshea at fedoraproject.org
Tue Nov 26 22:41:00 UTC 2013
commit 24e9263b058237bc09d64d34f693e788e9b6cd55
Author: David Shea <dshea at redhat.com>
Date: Tue Nov 26 17:25:16 2013 -0500
Sync to the latest patches in lp:~dshea/timezonemap/trunk
...ake-whitespace-and-indentation-consistent.patch | 1339 ++++++++++++++++++++
...the-GPL-comments-with-the-new-FSF-address.patch | 47 +-
...-Create-local-copies-of-string-properties.patch | 75 ++
...oved-CcTimezoneLocation-into-its-own-file.patch | 1157 +++++++++++++++++
0005-Don-t-close-a-NULL-file-pointer.patch | 26 +
0006-Turn-on-and-fix-g-ir-scanner-warnings.patch | 64 +
...rignore-file-to-ignore-all-the-files-gene.patch | 420 ++++++
0008-Ignore-the-INSTALL-file.patch | 21 +
...ction-to-clear-the-location-set-for-a-CcT.patch | 75 ++
...imezone-highlight-to-be-manually-set-sepa.patch | 171 +++
libtimezonemap.spec | 37 +-
11 files changed, 3414 insertions(+), 18 deletions(-)
---
diff --git a/0001-Make-whitespace-and-indentation-consistent.patch b/0001-Make-whitespace-and-indentation-consistent.patch
new file mode 100644
index 0000000..31680b0
--- /dev/null
+++ b/0001-Make-whitespace-and-indentation-consistent.patch
@@ -0,0 +1,1339 @@
+From 721adaf8332cf0a67843d8734e9e51a58894f8de Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain.lane at canonical.com>
+Date: Tue, 5 Nov 2013 11:31:07 +0000
+Subject: [PATCH 01/10] Make whitespace and indentation consistent
+
+---
+ src/cc-timezone-map.c | 87 +++----
+ src/test-timezone.c | 85 +++----
+ src/timezone-completion.c | 568 +++++++++++++++++++++++++---------------------
+ src/tz.c | 236 +++++++++----------
+ 4 files changed, 519 insertions(+), 457 deletions(-)
+
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index 652f838..4d7fa40 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
+@@ -974,40 +974,41 @@ get_loc_for_xy (GtkWidget * widget, gint x, gint y)
+ width = alloc.width;
+ height = alloc.height;
+
+- if (x == priv->previous_x && y == priv->previous_y) {
+- priv->distances = g_list_next (priv->distances);
+- location = (CcTimezoneLocation*) priv->distances->data;
+- } else {
+- g_list_free (priv->distances);
+- priv->distances = NULL;
+- for (i = 0; i < array->len; i++)
+- {
+- gdouble pointx, pointy, dx, dy;
+- CcTimezoneLocation *loc = array->pdata[i];
++ if (x == priv->previous_x && y == priv->previous_y)
++ {
++ priv->distances = g_list_next (priv->distances);
++ location = (CcTimezoneLocation*) priv->distances->data;
++ } else {
++ g_list_free (priv->distances);
++ priv->distances = NULL;
++ for (i = 0; i < array->len; i++)
++ {
++ gdouble pointx, pointy, dx, dy;
++ CcTimezoneLocation *loc = array->pdata[i];
+
+- g_object_get_property(G_OBJECT (loc), "longitude", &glon);
+- g_object_get_property(G_OBJECT (loc), "latitude", &glat);
+- pointx = convert_longtitude_to_x (g_value_get_double(&glon), width);
+- pointy = convert_latitude_to_y (g_value_get_double(&glat), height);
++ g_object_get_property(G_OBJECT (loc), "longitude", &glon);
++ g_object_get_property(G_OBJECT (loc), "latitude", &glat);
++ pointx = convert_longtitude_to_x (g_value_get_double(&glon), width);
++ pointy = convert_latitude_to_y (g_value_get_double(&glat), height);
+
+- dx = pointx - x;
+- dy = pointy - y;
++ dx = pointx - x;
++ dy = pointy - y;
+
+- g_value_set_double(&gdist, (gdouble) dx * dx + dy * dy);
+- g_object_set_property(G_OBJECT (loc), "dist", &gdist);
+- priv->distances = g_list_prepend (priv->distances, loc);
+- }
+- priv->distances = g_list_sort (priv->distances, (GCompareFunc) sort_locations);
+- location = (CcTimezoneLocation*) priv->distances->data;
+- priv->previous_x = x;
+- priv->previous_y = y;
+- }
++ g_value_set_double(&gdist, (gdouble) dx * dx + dy * dy);
++ g_object_set_property(G_OBJECT (loc), "dist", &gdist);
++ priv->distances = g_list_prepend (priv->distances, loc);
++ }
++ priv->distances = g_list_sort (priv->distances, (GCompareFunc) sort_locations);
++ location = (CcTimezoneLocation*) priv->distances->data;
++ priv->previous_x = x;
++ priv->previous_y = y;
++ }
+
+- g_value_unset (&glon);
+- g_value_unset (&glat);
+- g_value_unset (&gdist);
++ g_value_unset (&glon);
++ g_value_unset (&glat);
++ g_value_unset (&gdist);
+
+- return location;
++ return location;
+ }
+
+ static gboolean
+@@ -1199,20 +1200,20 @@ cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map, gdouble lon, gdouble
+ if (zone < G_N_ELEMENTS(olsen_map_timezones))
+ city = olsen_map_timezones[zone];
+
+- if (city != NULL) {
+- return city;
+- }
+- else {
+- GtkAllocation alloc;
+- GValue val_zone = {0};
+- g_value_init (&val_zone, G_TYPE_STRING);
+- gtk_widget_get_allocation (GTK_WIDGET (map), &alloc);
+- x = convert_longtitude_to_x(lon, alloc.width);
+- y = convert_latitude_to_y(lat, alloc.height);
+- CcTimezoneLocation * loc = get_loc_for_xy(GTK_WIDGET (map), x, y);
+- g_value_unset (&val_zone);
+- return g_value_get_string(&val_zone);
+- }
++ if (city != NULL)
++ {
++ return city;
++ } else {
++ GtkAllocation alloc;
++ GValue val_zone = {0};
++ g_value_init (&val_zone, G_TYPE_STRING);
++ gtk_widget_get_allocation (GTK_WIDGET (map), &alloc);
++ x = convert_longtitude_to_x(lon, alloc.width);
++ y = convert_latitude_to_y(lat, alloc.height);
++ CcTimezoneLocation * loc = get_loc_for_xy(GTK_WIDGET (map), x, y);
++ g_value_unset (&val_zone);
++ return g_value_get_string(&val_zone);
++ }
+ }
+
+ void
+diff --git a/src/test-timezone.c b/src/test-timezone.c
+index 9aaf707..a2271c4 100644
+--- a/src/test-timezone.c
++++ b/src/test-timezone.c
+@@ -5,58 +5,61 @@
+
+ int main (int argc, char **argv)
+ {
+- TzDB *db;
+- GPtrArray *locs;
+- guint i;
+- char *pixmap_dir;
+- int retval = 0;
++ 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;
+- }
++ 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;
++ }
+
+- g_type_init();
+- GValue zone = {0};
+- g_value_init(&zone, G_TYPE_STRING);
++ g_type_init();
++ GValue zone = {0};
++ g_value_init(&zone, G_TYPE_STRING);
+
+- db = tz_load_db ();
+- locs = tz_get_locations (db);
+- for (i = 0; i < locs->len ; i++) {
+- CcTimezoneLocation *loc = locs->pdata[i];
++ db = tz_load_db ();
++ locs = tz_get_locations (db);
++ for (i = 0; i < locs->len ; i++)
++ {
++ CcTimezoneLocation *loc = locs->pdata[i];
+
+- TzInfo *info;
+- char *filename, *path;
+- gdouble selected_offset;
+- char buf[16];
+- g_object_get_property(G_OBJECT (loc), "zone", &zone);
++ TzInfo *info;
++ char *filename, *path;
++ gdouble selected_offset;
++ char buf[16];
++ g_object_get_property(G_OBJECT (loc), "zone", &zone);
+
+- info = tz_info_from_location (loc);
+- selected_offset = tz_location_get_utc_offset (loc)
+- / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
++ 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",
++ filename = g_strdup_printf ("timezone_%s.png",
+ g_ascii_formatd (buf, sizeof (buf),
+ "%g", selected_offset));
+- path = g_build_filename (pixmap_dir, filename, NULL);
++ 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, g_value_get_string(&zone));
+- retval = 1;
+- }
++ if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE)
++ {
++ g_message ("File '%s' missing for zone '%s'", filename, g_value_get_string(&zone));
++ retval = 1;
++ }
+
+- g_free (filename);
+- g_free (path);
+- tz_info_free (info);
+- }
+- tz_db_free (db);
+- g_free (pixmap_dir);
++ g_free (filename);
++ g_free (path);
++ tz_info_free (info);
++ }
++ tz_db_free (db);
++ g_free (pixmap_dir);
+
+- return retval;
++ return retval;
+ }
+diff --git a/src/timezone-completion.c b/src/timezone-completion.c
+index 3d42168..f6ca8c8 100644
+--- a/src/timezone-completion.c
++++ b/src/timezone-completion.c
+@@ -138,13 +138,14 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+ g_cancellable_reset (priv->cancel);
+ }
+
+- if (error != NULL) {
+- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+- save_and_use_model (completion, priv->initial_model);
+- g_warning ("Could not parse geoname JSON data: %s", error->message);
+- g_error_free (error);
+- return;
+- }
++ if (error != NULL)
++ {
++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++ save_and_use_model (completion, priv->initial_model);
++ g_warning ("Could not parse geoname JSON data: %s", error->message);
++ g_error_free (error);
++ return;
++ }
+
+ GtkListStore * store = gtk_list_store_new (CC_TIMEZONE_COMPLETION_LAST,
+ G_TYPE_STRING,
+@@ -156,73 +157,85 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+
+ JsonReader * reader = json_reader_new (json_parser_get_root (JSON_PARSER (object)));
+
+- if (!json_reader_is_array (reader)) {
+- g_warning ("Could not parse geoname JSON data");
+- save_and_use_model (completion, priv->initial_model);
+- g_object_unref (G_OBJECT (reader));
+- return;
+- }
++ if (!json_reader_is_array (reader))
++ {
++ g_warning ("Could not parse geoname JSON data");
++ save_and_use_model (completion, priv->initial_model);
++ g_object_unref (G_OBJECT (reader));
++ return;
++ }
+
+ gint i, count = json_reader_count_elements (reader);
+- for (i = 0; i < count; ++i) {
+- if (!json_reader_read_element (reader, i))
+- continue;
++ for (i = 0; i < count; ++i)
++ {
++ if (!json_reader_read_element (reader, i))
++ continue;
+
+- if (json_reader_is_object (reader)) {
+- const gchar * name = NULL;
+- const gchar * admin1 = NULL;
+- const gchar * country = NULL;
+- const gchar * longitude = NULL;
+- const gchar * latitude = NULL;
+- gboolean skip = FALSE;
+- if (json_reader_read_member (reader, "name")) {
+- name = json_reader_get_string_value (reader);
+- json_reader_end_member (reader);
+- }
+- if (json_reader_read_member (reader, "admin1")) {
+- admin1 = json_reader_get_string_value (reader);
+- json_reader_end_member (reader);
+- }
+- if (json_reader_read_member (reader, "country")) {
+- country = json_reader_get_string_value (reader);
+- json_reader_end_member (reader);
+- }
+- if (json_reader_read_member (reader, "longitude")) {
+- longitude = json_reader_get_string_value (reader);
+- json_reader_end_member (reader);
+- }
+- if (json_reader_read_member (reader, "latitude")) {
+- latitude = json_reader_get_string_value (reader);
+- json_reader_end_member (reader);
+- }
++ if (json_reader_is_object (reader))
++ {
++ const gchar * name = NULL;
++ const gchar * admin1 = NULL;
++ const gchar * country = NULL;
++ const gchar * longitude = NULL;
++ const gchar * latitude = NULL;
++ gboolean skip = FALSE;
++ if (json_reader_read_member (reader, "name"))
++ {
++ name = json_reader_get_string_value (reader);
++ json_reader_end_member (reader);
++ }
++ if (json_reader_read_member (reader, "admin1"))
++ {
++ admin1 = json_reader_get_string_value (reader);
++ json_reader_end_member (reader);
++ }
++ if (json_reader_read_member (reader, "country"))
++ {
++ country = json_reader_get_string_value (reader);
++ json_reader_end_member (reader);
++ }
++ if (json_reader_read_member (reader, "longitude"))
++ {
++ longitude = json_reader_get_string_value (reader);
++ json_reader_end_member (reader);
++ }
++ if (json_reader_read_member (reader, "latitude"))
++ {
++ latitude = json_reader_get_string_value (reader);
++ json_reader_end_member (reader);
++ }
+
+ if (g_strcmp0(name, prev_name) == 0 &&
+ g_strcmp0(admin1, prev_admin1) == 0 &&
+- g_strcmp0(country, prev_country) == 0) {
+- // Sometimes the data will have duplicate entries that only differ
+- // in longitude and latitude. e.g. "rio de janeiro", "wellington"
+- skip = TRUE;
+- }
++ g_strcmp0(country, prev_country) == 0)
++ {
++ // Sometimes the data will have duplicate entries that only differ
++ // in longitude and latitude. e.g. "rio de janeiro", "wellington"
++ skip = TRUE;
++ }
+
+- if (!skip) {
+- GtkTreeIter iter;
+- gtk_list_store_append (store, &iter);
+- gtk_list_store_set (store, &iter,
+- CC_TIMEZONE_COMPLETION_ZONE, NULL,
+- CC_TIMEZONE_COMPLETION_NAME, name,
+- CC_TIMEZONE_COMPLETION_ADMIN1, admin1,
+- CC_TIMEZONE_COMPLETION_COUNTRY, country,
+- CC_TIMEZONE_COMPLETION_LONGITUDE, longitude,
+- CC_TIMEZONE_COMPLETION_LATITUDE, latitude,
+- -1);
+- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
+- CC_TIMEZONE_COMPLETION_NAME, sort_zone,
+- g_utf8_casefold(priv->request_text, -1),
+- g_free);
+- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+- CC_TIMEZONE_COMPLETION_NAME,
+- GTK_SORT_ASCENDING);
+- }
++ if (!skip)
++ {
++ GtkTreeIter iter;
++ gtk_list_store_append (store, &iter);
++ gtk_list_store_set (store, &iter,
++ CC_TIMEZONE_COMPLETION_ZONE, NULL,
++ CC_TIMEZONE_COMPLETION_NAME, name,
++ CC_TIMEZONE_COMPLETION_ADMIN1, admin1,
++ CC_TIMEZONE_COMPLETION_COUNTRY, country,
++ CC_TIMEZONE_COMPLETION_LONGITUDE, longitude,
++ CC_TIMEZONE_COMPLETION_LATITUDE, latitude,
++ -1);
++ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
++ CC_TIMEZONE_COMPLETION_NAME,
++ sort_zone,
++ g_utf8_casefold(priv->request_text,
++ -1),
++ g_free);
++ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
++ CC_TIMEZONE_COMPLETION_NAME,
++ GTK_SORT_ASCENDING);
++ }
+
+ prev_name = name;
+ prev_admin1 = admin1;
+@@ -232,19 +245,21 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+ json_reader_end_element (reader);
+ }
+
+- if (strlen (priv->request_text) < 4) {
+- gchar * lower_text = g_ascii_strdown (priv->request_text, -1);
+- if (g_strcmp0 (lower_text, "ut") == 0 ||
+- g_strcmp0 (lower_text, "utc") == 0) {
+- GtkTreeIter iter;
+- gtk_list_store_append (store, &iter);
+- gtk_list_store_set (store, &iter,
+- CC_TIMEZONE_COMPLETION_ZONE, "UTC",
+- CC_TIMEZONE_COMPLETION_NAME, "UTC",
+- -1);
++ if (strlen (priv->request_text) < 4)
++ {
++ gchar * lower_text = g_ascii_strdown (priv->request_text, -1);
++ if (g_strcmp0 (lower_text, "ut") == 0 ||
++ g_strcmp0 (lower_text, "utc") == 0)
++ {
++ GtkTreeIter iter;
++ gtk_list_store_append (store, &iter);
++ gtk_list_store_set (store, &iter,
++ CC_TIMEZONE_COMPLETION_ZONE, "UTC",
++ CC_TIMEZONE_COMPLETION_NAME, "UTC",
++ -1);
++ }
++ g_free (lower_text);
+ }
+- g_free (lower_text);
+- }
+
+ save_and_use_model (completion, GTK_TREE_MODEL (store));
+ g_object_unref (G_OBJECT (reader));
+@@ -260,17 +275,20 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+
+ stream = g_file_read_finish (G_FILE (object), res, &error);
+
+- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) {
+- g_cancellable_reset (priv->cancel);
+- }
++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel)
++ {
++ g_cancellable_reset (priv->cancel);
++ }
+
+- if (error != NULL) {
+- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+- save_and_use_model (completion, priv->initial_model);
+- g_warning ("Could not connect to geoname lookup server: %s", error->message);
+- g_error_free (error);
+- return;
+- }
++ if (error != NULL)
++ {
++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++ save_and_use_model (completion, priv->initial_model);
++ g_warning ("Could not connect to geoname lookup server: %s",
++ error->message);
++ g_error_free (error);
++ return;
++ }
+
+ JsonParser * parser = json_parser_new ();
+ json_parser_load_from_stream_async (parser, G_INPUT_STREAM (stream), priv->cancel,
+@@ -286,11 +304,12 @@ get_locale (void)
+ const gchar *env = NULL;
+ gint i;
+
+- for (i = 0; env_names[i]; i++) {
+- env = g_getenv (env_names[i]);
+- if (env != NULL && env[0] != 0)
+- break;
+- }
++ for (i = 0; env_names[i]; i++)
++ {
++ env = g_getenv (env_names[i]);
++ if (env != NULL && env[0] != 0)
++ break;
++ }
+
+ if (env == NULL)
+ return NULL;
+@@ -301,10 +320,11 @@ get_locale (void)
+ if (split == NULL)
+ return NULL;
+
+- if (split[0] == NULL) {
+- g_strfreev (split);
+- return NULL;
+- }
++ if (split[0] == NULL)
++ {
++ g_strfreev (split);
++ return NULL;
++ }
+
+ gchar *locale = g_strdup (split[0]);
+ g_strfreev (split);
+@@ -316,15 +336,16 @@ get_version (void)
+ {
+ static gchar *version = NULL;
+
+- if (version == NULL) {
+- gchar *stdout = NULL;
+- g_spawn_command_line_sync ("lsb_release -rs", &stdout, NULL, NULL, NULL);
++ if (version == NULL)
++ {
++ gchar *stdout = NULL;
++ g_spawn_command_line_sync ("lsb_release -rs", &stdout, NULL, NULL, NULL);
+
+- if (stdout != NULL)
+- version = g_strstrip (stdout);
+- else
+- version = g_strdup("");
+- }
++ if (stdout != NULL)
++ version = g_strstrip (stdout);
++ else
++ version = g_strdup("");
++ }
+
+ return version;
+ }
+@@ -336,15 +357,17 @@ request_zones (CcTimezoneCompletion * completion)
+
+ priv->queued_request = 0;
+
+- if (priv->entry == NULL) {
+- return FALSE;
+- }
++ if (priv->entry == NULL)
++ {
++ return FALSE;
++ }
+
+ /* Cancel any ongoing request */
+- if (priv->cancel) {
+- g_cancellable_cancel (priv->cancel);
+- g_cancellable_reset (priv->cancel);
+- }
++ if (priv->cancel)
++ {
++ g_cancellable_cancel (priv->cancel);
++ g_cancellable_reset (priv->cancel);
++ }
+ g_free (priv->request_text);
+
+ const gchar * text = gtk_entry_get_text (priv->entry);
+@@ -371,21 +394,26 @@ entry_changed (GtkEntry * entry, CcTimezoneCompletion * completion)
+ {
+ CcTimezoneCompletionPrivate * priv = completion->priv;
+
+- if (priv->queued_request) {
+- g_source_remove (priv->queued_request);
+- priv->queued_request = 0;
+- }
++ if (priv->queued_request)
++ {
++ g_source_remove (priv->queued_request);
++ priv->queued_request = 0;
++ }
+
+ /* See if we've already got this one */
+ const gchar * text = gtk_entry_get_text (priv->entry);
+ gpointer data;
+- if (g_hash_table_lookup_extended (priv->request_table, text, NULL, &data)) {
+- gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (data));
+- }
+- else {
+- priv->queued_request = g_timeout_add (300, (GSourceFunc)request_zones, completion);
+- gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), NULL);
+- }
++ if (g_hash_table_lookup_extended (priv->request_table, text, NULL, &data))
++ {
++ gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion),
++ GTK_TREE_MODEL (data));
++ }
++ else
++ {
++ priv->queued_request = g_timeout_add (300, (GSourceFunc)request_zones,
++ completion);
++ gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), NULL);
++ }
+ gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion));
+ }
+
+@@ -395,18 +423,21 @@ get_descendent (GtkWidget * parent, GType type)
+ if (g_type_is_a (G_OBJECT_TYPE (parent), type))
+ return parent;
+
+- if (GTK_IS_CONTAINER (parent)) {
+- GList * children = gtk_container_get_children (GTK_CONTAINER (parent));
+- GList * iter;
+- for (iter = children; iter; iter = iter->next) {
+- GtkWidget * found = get_descendent (GTK_WIDGET (iter->data), type);
+- if (found) {
+- g_list_free (children);
+- return found;
+- }
++ if (GTK_IS_CONTAINER (parent))
++ {
++ GList * children = gtk_container_get_children (GTK_CONTAINER (parent));
++ GList * iter;
++ for (iter = children; iter; iter = iter->next)
++ {
++ GtkWidget * found = get_descendent (GTK_WIDGET (iter->data), type);
++ if (found)
++ {
++ g_list_free (children);
++ return found;
++ }
++ }
++ g_list_free (children);
+ }
+- g_list_free (children);
+- }
+
+ return NULL;
+ }
+@@ -429,20 +460,26 @@ find_popup_treeview (GtkWidget * widget, GtkTreeModel * model)
+ GtkWindowGroup * group = gtk_window_get_group (GTK_WINDOW (toplevel));
+ GList * windows = gtk_window_group_list_windows (group);
+ GList * iter;
+- for (iter = windows; iter; iter = iter->next) {
+- if (iter->data == toplevel)
+- continue; // Skip our own window, we don't have it
+- GtkWidget * view = get_descendent (GTK_WIDGET (iter->data), GTK_TYPE_TREE_VIEW);
+- if (view != NULL) {
+- GtkTreeModel * tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+- if (GTK_IS_TREE_MODEL_FILTER (tree_model))
+- tree_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (tree_model));
+- if (tree_model == model) {
+- g_list_free (windows);
+- return GTK_TREE_VIEW (view);
+- }
++ for (iter = windows; iter; iter = iter->next)
++ {
++ if (iter->data == toplevel)
++ continue; // Skip our own window, we don't have it
++ GtkWidget * view = get_descendent (GTK_WIDGET (iter->data),
++ GTK_TYPE_TREE_VIEW);
++ if (view != NULL)
++ {
++ GtkTreeModel * tree_model =
++ gtk_tree_view_get_model (GTK_TREE_VIEW (view));
++ if (GTK_IS_TREE_MODEL_FILTER (tree_model))
++ tree_model = gtk_tree_model_filter_get_model (
++ GTK_TREE_MODEL_FILTER (tree_model));
++ if (tree_model == model)
++ {
++ g_list_free (windows);
++ return GTK_TREE_VIEW (view);
++ }
++ }
+ }
+- }
+ g_list_free (windows);
+
+ return NULL;
+@@ -453,26 +490,30 @@ entry_keypress (GtkEntry * entry, GdkEventKey *event, CcTimezoneCompletion * co
+ {
+ if (event->keyval == GDK_KEY_ISO_Enter ||
+ event->keyval == GDK_KEY_KP_Enter ||
+- event->keyval == GDK_KEY_Return) {
+- /* Make sure that user has a selection to choose, otherwise ignore */
+- GtkTreeModel * model = gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion));
+- GtkTreeView * view = find_popup_treeview (GTK_WIDGET (entry), model);
+- if (view == NULL) {
+- // Just beep if popup hasn't appeared yet.
+- gtk_widget_error_bell (GTK_WIDGET (entry));
+- return TRUE;
+- }
++ event->keyval == GDK_KEY_Return)
++ {
++ /* Make sure that user has a selection to choose, otherwise ignore */
++ GtkTreeModel * model = gtk_entry_completion_get_model (
++ GTK_ENTRY_COMPLETION (completion));
++ GtkTreeView * view = find_popup_treeview (GTK_WIDGET (entry), model);
++ if (view == NULL)
++ {
++ // Just beep if popup hasn't appeared yet.
++ gtk_widget_error_bell (GTK_WIDGET (entry));
++ return TRUE;
++ }
+
+- GtkTreeSelection * sel = gtk_tree_view_get_selection (view);
+- GtkTreeModel * sel_model = NULL;
+- if (!gtk_tree_selection_get_selected (sel, &sel_model, NULL)) {
+- // No selection, we should help them out and select first item in list
+- GtkTreeIter iter;
+- if (gtk_tree_model_get_iter_first (sel_model, &iter))
+- gtk_tree_selection_select_iter (sel, &iter);
+- // And fall through to normal handler code
++ GtkTreeSelection * sel = gtk_tree_view_get_selection (view);
++ GtkTreeModel * sel_model = NULL;
++ if (!gtk_tree_selection_get_selected (sel, &sel_model, NULL))
++ {
++ // No selection, we should help them out and select first item in list
++ GtkTreeIter iter;
++ if (gtk_tree_model_get_iter_first (sel_model, &iter))
++ gtk_tree_selection_select_iter (sel, &iter);
++ // And fall through to normal handler code
++ }
+ }
+- }
+
+ return FALSE;
+ }
+@@ -482,32 +523,37 @@ cc_timezone_completion_watch_entry (CcTimezoneCompletion * completion, GtkEntry
+ {
+ CcTimezoneCompletionPrivate * priv = completion->priv;
+
+- if (priv->queued_request) {
+- g_source_remove (priv->queued_request);
+- priv->queued_request = 0;
+- }
+- if (priv->entry) {
+- g_signal_handler_disconnect (priv->entry, priv->changed_id);
+- priv->changed_id = 0;
+- g_signal_handler_disconnect (priv->entry, priv->keypress_id);
+- priv->keypress_id = 0;
+- g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry);
+- gtk_entry_set_completion (priv->entry, NULL);
+- }
++ if (priv->queued_request)
++ {
++ g_source_remove (priv->queued_request);
++ priv->queued_request = 0;
++ }
++ if (priv->entry)
++ {
++ g_signal_handler_disconnect (priv->entry, priv->changed_id);
++ priv->changed_id = 0;
++ g_signal_handler_disconnect (priv->entry, priv->keypress_id);
++ priv->keypress_id = 0;
++ g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry);
++ gtk_entry_set_completion (priv->entry, NULL);
++ }
+
+ priv->entry = entry;
+
+- if (entry) {
+- guint id = g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), completion);
+- priv->changed_id = id;
++ if (entry)
++ {
++ guint id = g_signal_connect (entry, "changed",
++ G_CALLBACK (entry_changed), completion);
++ priv->changed_id = id;
+
+- id = g_signal_connect (entry, "key-press-event", G_CALLBACK (entry_keypress), completion);
+- priv->keypress_id = id;
++ id = g_signal_connect (entry, "key-press-event",
++ G_CALLBACK (entry_keypress), completion);
++ priv->keypress_id = id;
+
+- g_object_add_weak_pointer (G_OBJECT (entry), (gpointer *)&priv->entry);
++ g_object_add_weak_pointer (G_OBJECT (entry), (gpointer *)&priv->entry);
+
+- gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (completion));
+- }
++ gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (completion));
++ }
+ }
+
+ static GtkListStore *
+@@ -525,37 +571,38 @@ get_initial_model (void)
+ G_TYPE_STRING);
+
+ gint i;
+- for (i = 0; i < locations->len; ++i) {
+- CcTimezoneLocation * loc = g_ptr_array_index (locations, i);
+- GtkTreeIter iter;
+- gtk_list_store_append (store, &iter);
++ for (i = 0; i < locations->len; ++i)
++ {
++ CcTimezoneLocation * loc = g_ptr_array_index (locations, i);
++ GtkTreeIter iter;
++ gtk_list_store_append (store, &iter);
+
+- gchar * zone;
+- gchar * country;
+- gchar * en_name; // FIXME: need something better for non-English locales
+- gdouble longitude;
+- gdouble latitude;
+- g_object_get (loc, "zone", &zone, "country", &country, "en_name", &en_name,
+- "longitude", &longitude, "latitude", &latitude,
+- NULL);
++ gchar * zone;
++ gchar * country;
++ gchar * en_name; // FIXME: need something better for non-English locales
++ gdouble longitude;
++ gdouble latitude;
++ g_object_get (loc, "zone", &zone, "country", &country, "en_name", &en_name,
++ "longitude", &longitude, "latitude", &latitude,
++ NULL);
+
+- gchar * longitude_s = g_strdup_printf ("%f", longitude);
+- gchar * latitude_s= g_strdup_printf ("%f", latitude);
++ gchar * longitude_s = g_strdup_printf ("%f", longitude);
++ gchar * latitude_s= g_strdup_printf ("%f", latitude);
+
+- gtk_list_store_set (store, &iter,
+- CC_TIMEZONE_COMPLETION_ZONE, NULL,
+- CC_TIMEZONE_COMPLETION_NAME, en_name,
+- CC_TIMEZONE_COMPLETION_COUNTRY, country,
+- CC_TIMEZONE_COMPLETION_LONGITUDE, longitude_s,
+- CC_TIMEZONE_COMPLETION_LATITUDE, latitude_s,
+- -1);
++ gtk_list_store_set (store, &iter,
++ CC_TIMEZONE_COMPLETION_ZONE, NULL,
++ CC_TIMEZONE_COMPLETION_NAME, en_name,
++ CC_TIMEZONE_COMPLETION_COUNTRY, country,
++ CC_TIMEZONE_COMPLETION_LONGITUDE, longitude_s,
++ CC_TIMEZONE_COMPLETION_LATITUDE, latitude_s,
++ -1);
+
+- g_free (latitude_s);
+- g_free (longitude_s);
+- g_free (en_name);
+- g_free (country);
+- g_free (zone);
+- }
++ g_free (latitude_s);
++ g_free (longitude_s);
++ g_free (en_name);
++ g_free (country);
++ g_free (zone);
++ }
+
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+@@ -581,13 +628,14 @@ data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell,
+ -1);
+
+ gchar * user_name;
+- if (country == NULL || country[0] == 0) {
+- user_name = g_strdup (name);
+- } else if (admin1 == NULL || admin1[0] == 0) {
+- user_name = g_strdup_printf ("%s <small>(%s)</small>", name, country);
+- } else {
+- user_name = g_strdup_printf ("%s <small>(%s, %s)</small>", name, admin1, country);
+- }
++ if (country == NULL || country[0] == 0)
++ {
++ user_name = g_strdup (name);
++ } else if (admin1 == NULL || admin1[0] == 0) {
++ user_name = g_strdup_printf ("%s <small>(%s)</small>", name, country);
++ } else {
++ user_name = g_strdup_printf ("%s <small>(%s, %s)</small>", name, admin1, country);
++ }
+
+ g_object_set (G_OBJECT (cell), "markup", user_name, NULL);
+ }
+@@ -641,49 +689,57 @@ cc_timezone_completion_dispose (GObject * object)
+ CcTimezoneCompletion * completion = CC_TIMEZONE_COMPLETION (object);
+ CcTimezoneCompletionPrivate * priv = completion->priv;
+
+- if (priv->changed_id) {
+- if (priv->entry)
+- g_signal_handler_disconnect (priv->entry, priv->changed_id);
+- priv->changed_id = 0;
+- }
++ if (priv->changed_id)
++ {
++ if (priv->entry)
++ g_signal_handler_disconnect (priv->entry, priv->changed_id);
++ priv->changed_id = 0;
++ }
+
+- if (priv->keypress_id) {
+- if (priv->entry)
+- g_signal_handler_disconnect (priv->entry, priv->keypress_id);
+- priv->keypress_id = 0;
+- }
++ if (priv->keypress_id)
++ {
++ if (priv->entry)
++ g_signal_handler_disconnect (priv->entry, priv->keypress_id);
++ priv->keypress_id = 0;
++ }
+
+- if (priv->entry != NULL) {
+- gtk_entry_set_completion (priv->entry, NULL);
+- g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry);
+- priv->entry = NULL;
+- }
++ if (priv->entry != NULL)
++ {
++ gtk_entry_set_completion (priv->entry, NULL);
++ g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry);
++ priv->entry = NULL;
++ }
+
+- if (priv->initial_model != NULL) {
+- g_object_unref (G_OBJECT (priv->initial_model));
+- priv->initial_model = NULL;
+- }
++ if (priv->initial_model != NULL)
++ {
++ g_object_unref (G_OBJECT (priv->initial_model));
++ priv->initial_model = NULL;
++ }
+
+- if (priv->queued_request) {
+- g_source_remove (priv->queued_request);
+- priv->queued_request = 0;
+- }
++ if (priv->queued_request)
++ {
++ g_source_remove (priv->queued_request);
++ priv->queued_request = 0;
++ }
+
+- if (priv->cancel != NULL) {
+- g_cancellable_cancel (priv->cancel);
+- g_object_unref (priv->cancel);
+- priv->cancel = NULL;
+- }
++ if (priv->cancel != NULL)
++ {
++ g_cancellable_cancel (priv->cancel);
++ g_object_unref (priv->cancel);
++ priv->cancel = NULL;
++ }
+
+- if (priv->request_text != NULL) {
+- g_free (priv->request_text);
+- priv->request_text = NULL;
+- }
++ if (priv->request_text != NULL)
++ {
++ g_free (priv->request_text);
++ priv->request_text = NULL;
++ }
+
+- if (priv->request_table != NULL) {
+- g_hash_table_destroy (priv->request_table);
+- priv->request_table = NULL;
+- }
++ if (priv->request_table != NULL)
++ {
++ g_hash_table_destroy (priv->request_table);
++ priv->request_table = NULL;
++ }
+
+ return;
+ }
+diff --git a/src/tz.c b/src/tz.c
+index 2aa10ca..969119a 100644
+--- a/src/tz.c
++++ b/src/tz.c
+@@ -50,16 +50,16 @@ G_DEFINE_TYPE (CcTimezoneLocation, cc_timezone_location, G_TYPE_OBJECT)
+
+ struct _CcTimezoneLocationPrivate
+ {
+- gchar *country;
+- gchar *full_country;
+- gchar *en_name;
+- gchar *state;
+- gdouble latitude;
+- gdouble longitude;
+- gchar *zone;
+- gchar *comment;
++ gchar *country;
++ gchar *full_country;
++ gchar *en_name;
++ gchar *state;
++ gdouble latitude;
++ gdouble longitude;
++ gchar *zone;
++ gchar *comment;
+
+- gdouble dist; /* distance to clicked point for comparison */
++ gdouble dist; /* distance to clicked point for comparison */
+ };
+
+ enum {
+@@ -82,8 +82,7 @@ cc_timezone_location_get_property (GObject *object,
+ GParamSpec *pspec)
+ {
+ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+- switch (property_id)
+- {
++ switch (property_id) {
+ case PROP_COUNTRY:
+ g_value_set_string (value, priv->country);
+ break;
+@@ -123,8 +122,7 @@ cc_timezone_location_set_property (GObject *object,
+ GParamSpec *pspec)
+ {
+ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+- switch (property_id)
+- {
++ switch (property_id) {
+ case PROP_COUNTRY:
+ priv->country = g_value_get_string(value);
+ break;
+@@ -162,31 +160,31 @@ cc_timezone_location_dispose (GObject *object)
+ {
+ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+
+- if (priv->country)
++ if (priv->country)
+ {
+ g_free (priv->country);
+ priv->country = NULL;
+ }
+
+- if (priv->full_country)
++ if (priv->full_country)
+ {
+ g_free (priv->full_country);
+ priv->full_country = NULL;
+ }
+
+- if (priv->state)
++ if (priv->state)
+ {
+ g_free (priv->state);
+ priv->state = NULL;
+ }
+
+- if (priv->zone)
++ if (priv->zone)
+ {
+ g_free (priv->zone);
+ priv->zone = NULL;
+ }
+
+- if (priv->comment)
++ if (priv->comment)
+ {
+ g_free (priv->comment);
+ priv->comment = NULL;
+@@ -304,19 +302,20 @@ void parse_file (const char * filename,
+ FILE *fh = fopen (filename, "r");
+ char buf[4096];
+
+- if (!fh) {
++ if (!fh)
++ {
+ g_warning ("Could not open *%s*\n", filename);
+ fclose (fh);
+ return;
+- }
++ }
+
+- while (fgets (buf, sizeof(buf), fh))
+- {
++ while (fgets (buf, sizeof(buf), fh))
++ {
+ if (*buf == '#') continue;
+
+ g_strchomp (buf);
+ func (g_strsplit (buf,"\t", ncolumns), user_data);
+- }
++ }
+
+ fclose (fh);
+ }
+@@ -438,22 +437,25 @@ tz_load_db (void)
+ char buf[4096];
+
+ tz_data_file = tz_data_file_get ("TZ_DATA_FILE", TZ_DATA_FILE);
+- if (!tz_data_file) {
++ if (!tz_data_file)
++ {
+ g_warning ("Could not get the TimeZone data file name");
+ return NULL;
+- }
++ }
+
+ admin1_file = tz_data_file_get ("ADMIN1_FILE", ADMIN1_FILE);
+- if (!admin1_file) {
++ if (!admin1_file)
++ {
+ g_warning ("Could not get the admin1 data file name");
+ return NULL;
+- }
++ }
+
+ country_file = tz_data_file_get ("COUNTRY_FILE", COUNTRY_FILE);
+- if (!country_file) {
++ if (!country_file)
++ {
+ g_warning ("Could not get the country data file name");
+ return NULL;
+- }
++ }
+
+ GHashTable *stateHash = g_hash_table_new_full (g_str_hash,
+ g_str_equal, g_free, g_free);
+@@ -491,9 +493,9 @@ tz_load_db (void)
+ void
+ tz_db_free (TzDB *db)
+ {
+- g_ptr_array_foreach (db->locations, (GFunc) g_object_unref, NULL);
+- g_ptr_array_free (db->locations, TRUE);
+- g_free (db);
++ g_ptr_array_foreach (db->locations, (GFunc) g_object_unref, NULL);
++ g_ptr_array_free (db->locations, TRUE);
++ g_free (db);
+ }
+
+ static gint
+@@ -548,103 +550,103 @@ convert_latitude_to_y (gdouble latitude, gdouble map_height)
+ GPtrArray *
+ tz_get_locations (TzDB *db)
+ {
+- return db->locations;
++ return db->locations;
+ }
+
+-glong
++ glong
+ tz_location_get_utc_offset (CcTimezoneLocation *loc)
+ {
+- TzInfo *tz_info;
+- glong offset;
++ TzInfo *tz_info;
++ glong offset;
+
+- tz_info = tz_info_from_location (loc);
+- offset = tz_info->utc_offset;
+- tz_info_free (tz_info);
+- return 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 (CcTimezoneLocation *loc)
+ {
+- time_t curtime;
+- struct tm *curzone;
+- gboolean is_dst = FALSE;
+- gint correction = 0;
++ 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->priv->zone != NULL, 0);
+-
+- curtime = time (NULL);
+- curzone = localtime (&curtime);
+- is_dst = curzone->tm_isdst;
++ g_return_val_if_fail (loc != NULL, 0);
++ g_return_val_if_fail (loc->priv->zone != NULL, 0);
+
+- setenv ("TZ", loc->priv->zone, 1);
++ curtime = time (NULL);
++ curzone = localtime (&curtime);
++ is_dst = curzone->tm_isdst;
++
++ setenv ("TZ", loc->priv->zone, 1);
+ #if 0
+- curtime = time (NULL);
+- curzone = localtime (&curtime);
++ curtime = time (NULL);
++ curzone = localtime (&curtime);
+
+- if (!is_dst && curzone->tm_isdst) {
+- correction = (60 * 60);
+- }
+- else if (is_dst && !curzone->tm_isdst) {
+- correction = 0;
+- }
++ if (!is_dst && curzone->tm_isdst) {
++ correction = (60 * 60);
++ }
++ else if (is_dst && !curzone->tm_isdst) {
++ correction = 0;
++ }
+ #endif
+
+- return correction;
++ return correction;
+ }
+
+-TzInfo *
++ TzInfo *
+ tz_info_from_location (CcTimezoneLocation *loc)
+ {
+- TzInfo *tzinfo;
+- time_t curtime;
+- struct tm *curzone;
+-
+- g_return_val_if_fail (loc != NULL, NULL);
+- g_return_val_if_fail (loc->priv->zone != NULL, NULL);
+-
+- setenv ("TZ", loc->priv->zone, 1);
+-
++ TzInfo *tzinfo;
++ time_t curtime;
++ struct tm *curzone;
++
++ g_return_val_if_fail (loc != NULL, NULL);
++ g_return_val_if_fail (loc->priv->zone != NULL, NULL);
++
++ setenv ("TZ", loc->priv->zone, 1);
++
+ #if 0
+- tzset ();
++ tzset ();
+ #endif
+- tzinfo = g_new0 (TzInfo, 1);
++ tzinfo = g_new0 (TzInfo, 1);
+
+- curtime = time (NULL);
+- curzone = localtime (&curtime);
++ 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;
++ /* Currently this solution doesnt seem to work - I get that */
++ /* America/Phoenix uses daylight savings, which is wrong */
++ tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
++ if (curzone->tm_isdst)
++ tzinfo->tzname_daylight =
++ g_strdup (&curzone->tm_zone[curzone->tm_isdst]);
++ else
++ tzinfo->tzname_daylight = NULL;
+
+- tzinfo->utc_offset = curzone->tm_gmtoff;
++ tzinfo->utc_offset = curzone->tm_gmtoff;
+ #else
+- tzinfo->tzname_normal = NULL;
+- tzinfo->tzname_daylight = NULL;
+- tzinfo->utc_offset = 0;
++ tzinfo->tzname_normal = NULL;
++ tzinfo->tzname_daylight = NULL;
++ tzinfo->utc_offset = 0;
+ #endif
+
+- tzinfo->daylight = curzone->tm_isdst;
+-
+- return tzinfo;
++ tzinfo->daylight = curzone->tm_isdst;
++
++ return tzinfo;
+ }
+
+
+-void
++ 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);
++ 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);
+ }
+
+ /* ----------------- *
+@@ -665,38 +667,38 @@ tz_data_file_get (gchar *env, gchar *defaultfile)
+ 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;
++ gchar whole[10];
++ gchar *fraction;
++ gint i;
++ float t1, t2;
+
+- t1 = g_strtod (whole, NULL);
+- t2 = g_strtod (fraction, NULL);
++ if (!pos || strlen(pos) < 4 || digits > 9) return 0.0;
+
+- if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction));
+- else return t1 - t2/pow (10.0, strlen(fraction));
++ 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)
+ {
+- const CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
+- const CcTimezoneLocation *tzb = * (CcTimezoneLocation **) b;
+-
+- return strcmp (tza->priv->zone, tzb->priv->zone);
++ const CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
++ const CcTimezoneLocation *tzb = * (CcTimezoneLocation **) b;
++
++ return strcmp (tza->priv->zone, tzb->priv->zone);
+ }
+
+
+-static void
++ static void
+ sort_locations_by_country (GPtrArray *locations)
+ {
+- qsort (locations->pdata, locations->len, sizeof (gpointer),
+- compare_country_names);
++ qsort (locations->pdata, locations->len, sizeof (gpointer),
++ compare_country_names);
+ }
+--
+1.8.4.2
+
diff --git a/libtimezonemap-fsf-address.patch b/0002-Update-the-GPL-comments-with-the-new-FSF-address.patch
similarity index 70%
rename from libtimezonemap-fsf-address.patch
rename to 0002-Update-the-GPL-comments-with-the-new-FSF-address.patch
index dc43d12..cc8aae7 100644
--- a/libtimezonemap-fsf-address.patch
+++ b/0002-Update-the-GPL-comments-with-the-new-FSF-address.patch
@@ -1,6 +1,21 @@
-=== modified file 'src/cc-timezone-map.c'
---- src/cc-timezone-map.c 2013-11-05 11:31:07 +0000
-+++ src/cc-timezone-map.c 2013-11-13 21:02:55 +0000
+From 817161c4596df2fba45e5d801ed26ddc0bb4f4e2 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Thu, 14 Nov 2013 10:50:49 -0500
+Subject: [PATCH 02/10] Update the GPL comments with the new FSF address.
+
+The Free Software Foundation's address is now at 51 Franklin St. The
+rest of the GPL v2 boilerplate comment is unchanged.
+---
+ src/cc-timezone-map.c | 6 +++---
+ src/cc-timezone-map.h | 6 +++---
+ src/tz.c | 6 +++---
+ src/tz.h | 6 +++---
+ 4 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index 4d7fa40..60297e4 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
@@ -15,9 +15,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -14,10 +29,10 @@
*
* Author: Thomas Wood <thomas.wood at intel.com>
*
-
-=== modified file 'src/cc-timezone-map.h'
---- src/cc-timezone-map.h 2012-11-06 17:14:04 +0000
-+++ src/cc-timezone-map.h 2013-11-13 21:03:57 +0000
+diff --git a/src/cc-timezone-map.h b/src/cc-timezone-map.h
+index 8a6bf9c..ddb6961 100644
+--- a/src/cc-timezone-map.h
++++ b/src/cc-timezone-map.h
@@ -11,9 +11,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -31,10 +46,10 @@
*
* Author: Thomas Wood <thomas.wood at intel.com>
*
-
-=== modified file 'src/tz.c'
---- src/tz.c 2013-11-05 11:31:07 +0000
-+++ src/tz.c 2013-11-13 21:04:28 +0000
+diff --git a/src/tz.c b/src/tz.c
+index 969119a..c294b44 100644
+--- a/src/tz.c
++++ b/src/tz.c
@@ -17,9 +17,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -48,10 +63,10 @@
*/
-
-=== modified file 'src/tz.h'
---- src/tz.h 2013-11-05 09:49:32 +0000
-+++ src/tz.h 2013-11-13 21:04:35 +0000
+diff --git a/src/tz.h b/src/tz.h
+index 3ade1f8..005d72f 100644
+--- a/src/tz.h
++++ b/src/tz.h
@@ -17,9 +17,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -65,4 +80,6 @@
*/
+--
+1.8.4.2
diff --git a/0003-Create-local-copies-of-string-properties.patch b/0003-Create-local-copies-of-string-properties.patch
new file mode 100644
index 0000000..8684dd6
--- /dev/null
+++ b/0003-Create-local-copies-of-string-properties.patch
@@ -0,0 +1,75 @@
+From 94fb062ff98ba6eab156493b3ad7ef210d175a79 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Thu, 14 Nov 2013 10:50:49 -0500
+Subject: [PATCH 03/10] Create local copies of string properties.
+
+The string values passed to set_property are owned by the caller, so we
+need to create new copies of the strings to store in the private data
+structure.
+
+The dispose method already had code to free the private strings, but was
+missing a check for the en_name property: added one.
+---
+ src/tz.c | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/src/tz.c b/src/tz.c
+index c294b44..8d83d0a 100644
+--- a/src/tz.c
++++ b/src/tz.c
+@@ -124,16 +124,20 @@ cc_timezone_location_set_property (GObject *object,
+ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+ switch (property_id) {
+ case PROP_COUNTRY:
+- priv->country = g_value_get_string(value);
++ g_free(priv->country);
++ priv->country = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_FULL_COUNTRY:
+- priv->full_country = g_value_get_string(value);
++ g_free(priv->full_country);
++ priv->full_country = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_EN_NAME:
+- priv->en_name = g_value_get_string(value);
++ g_free(priv->en_name);
++ priv->en_name = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_STATE:
+- priv->state = g_value_get_string(value);
++ g_free(priv->state);
++ priv->state = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_LATITUDE:
+ priv->latitude = g_value_get_double(value);
+@@ -142,10 +146,12 @@ cc_timezone_location_set_property (GObject *object,
+ priv->longitude = g_value_get_double(value);
+ break;
+ case PROP_ZONE:
+- priv->zone = g_value_get_string(value);
++ g_strdup(priv->zone);
++ priv->zone = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_COMMENT:
+- priv->comment = g_value_get_string(value);
++ g_free(priv->comment);
++ priv->comment = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_DIST:
+ priv->dist = g_value_get_double(value);
+@@ -172,6 +178,12 @@ cc_timezone_location_dispose (GObject *object)
+ priv->full_country = NULL;
+ }
+
++ if (priv->en_name)
++ {
++ g_free (priv->en_name);
++ priv->en_name = NULL;
++ }
++
+ if (priv->state)
+ {
+ g_free (priv->state);
+--
+1.8.4.2
+
diff --git a/0004-Moved-CcTimezoneLocation-into-its-own-file.patch b/0004-Moved-CcTimezoneLocation-into-its-own-file.patch
new file mode 100644
index 0000000..522473b
--- /dev/null
+++ b/0004-Moved-CcTimezoneLocation-into-its-own-file.patch
@@ -0,0 +1,1157 @@
+From f2f3c519595467d34c4f2c5c199cee62439c7e77 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Thu, 14 Nov 2013 10:50:49 -0500
+Subject: [PATCH 04/10] Moved CcTimezoneLocation into its own file.
+
+Mixing GObject and non-GObject code in tz.c confuses g-ir-scanner and
+adds a lot non-introspectable identifiers to the .gir file.
+
+Added get and set functions for the CcTimezoneLocation properties.
+---
+ src/Makefile.am | 15 +-
+ src/cc-timezone-location.c | 393 +++++++++++++++++++++++++++++++++++++++++++++
+ src/cc-timezone-location.h | 95 +++++++++++
+ src/cc-timezone-map.c | 53 ++----
+ src/cc-timezone-map.h | 1 +
+ src/tz.c | 319 +++---------------------------------
+ src/tz.h | 44 +----
+ 7 files changed, 533 insertions(+), 387 deletions(-)
+ create mode 100644 src/cc-timezone-location.c
+ create mode 100644 src/cc-timezone-location.h
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 05dfb1a..b4461cd 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -63,7 +63,7 @@ AM_CPPFLAGS = \
+
+ noinst_PROGRAMS = test-timezone
+
+-test_timezone_SOURCES = test-timezone.c tz.c tz.h
++test_timezone_SOURCES = test-timezone.c cc-timezone-location.c tz.c tz.h
+ test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm
+ test_timezone_CFLAGS = $(LIBTIMEZONEMAP_CFLAGS)
+
+@@ -76,12 +76,11 @@ check-local: test-timezone
+
+ lib_LTLIBRARIES = libtimezonemap.la
+
+-libtimezonemap_la_SOURCES = \
+- cc-timezone-map.c \
+- cc-timezone-map.h \
+- timezone-completion.c \
+- timezone-completion.h \
+- tz.c tz.h
++libtimezonemap_GISOURCES = cc-timezone-map.c cc-timezone-map.h \
++ cc-timezone-location.c cc-timezone-location.h \
++ timezone-completion.c timezone-completion.h
++libtimezonemap_NONGISOURCES = tz.c tz.h
++libtimezonemap_la_SOURCES = $(libtimezonemap_GISOURCES) $(libtimezonemap_NONGISOURCES)
+
+ # Specify 'timezonemap' twice: once for package (so we could eventually add
+ # a timezonemap-gtk4 for example), and once for namespacing inside code so
+@@ -105,7 +104,7 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+ INTROSPECTION_GIRS = TimezoneMap-1.0.gir
+
+-introspection_sources = $(libtimezonemap_la_SOURCES)
++introspection_sources = $(libtimezonemap_GISOURCES)
+
+ TimezoneMap-1.0.gir: libtimezonemap.la
+ TimezoneMap_1_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 Json-1.0
+diff --git a/src/cc-timezone-location.c b/src/cc-timezone-location.c
+new file mode 100644
+index 0000000..3bf4cad
+--- /dev/null
++++ b/src/cc-timezone-location.c
+@@ -0,0 +1,393 @@
++/* -*- 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 at 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 "cc-timezone-location.h"
++
++G_DEFINE_TYPE (CcTimezoneLocation, cc_timezone_location, G_TYPE_OBJECT)
++
++#define TIMEZONE_LOCATION_PRIVATE(o) \
++ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationPrivate))
++
++struct _CcTimezoneLocationPrivate
++{
++ gchar *country;
++ gchar *full_country;
++ gchar *en_name;
++ gchar *state;
++ gdouble latitude;
++ gdouble longitude;
++ gchar *zone;
++ gchar *comment;
++
++ gdouble dist; /* distance to clicked point for comparison */
++};
++
++enum {
++ PROP_0,
++ PROP_COUNTRY,
++ PROP_FULL_COUNTRY,
++ PROP_EN_NAME,
++ PROP_STATE,
++ PROP_LATITUDE,
++ PROP_LONGITUDE,
++ PROP_ZONE,
++ PROP_COMMENT,
++ PROP_DIST,
++};
++
++static void
++cc_timezone_location_get_property (GObject *object,
++ guint property_id,
++ GValue *value,
++ GParamSpec *pspec)
++{
++ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
++ switch (property_id) {
++ case PROP_COUNTRY:
++ g_value_set_string (value, priv->country);
++ break;
++ case PROP_FULL_COUNTRY:
++ g_value_set_string (value, priv->full_country);
++ break;
++ case PROP_EN_NAME:
++ g_value_set_string (value, priv->en_name);
++ break;
++ case PROP_STATE:
++ g_value_set_string (value, priv->state);
++ break;
++ case PROP_LATITUDE:
++ g_value_set_double (value, priv->latitude);
++ break;
++ case PROP_LONGITUDE:
++ g_value_set_double (value, priv->longitude);
++ break;
++ case PROP_ZONE:
++ g_value_set_string (value, priv->zone);
++ break;
++ case PROP_COMMENT:
++ g_value_set_string (value, priv->comment);
++ break;
++ case PROP_DIST:
++ g_value_set_double (value, priv->dist);
++ break;
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
++ }
++}
++
++static void
++cc_timezone_location_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec)
++{
++ CcTimezoneLocation *loc = CC_TIMEZONE_LOCATION(object);
++ switch (property_id) {
++ case PROP_COUNTRY:
++ cc_timezone_location_set_country(loc, g_value_get_string(value));
++ break;
++ case PROP_FULL_COUNTRY:
++ cc_timezone_location_set_full_country(loc, g_value_get_string(value));
++ break;
++ case PROP_EN_NAME:
++ cc_timezone_location_set_en_name(loc, g_value_get_string(value));
++ break;
++ case PROP_STATE:
++ cc_timezone_location_set_state(loc, g_value_get_string(value));
++ break;
++ case PROP_LATITUDE:
++ cc_timezone_location_set_latitude(loc, g_value_get_double(value));
++ break;
++ case PROP_LONGITUDE:
++ cc_timezone_location_set_longitude(loc, g_value_get_double(value));
++ break;
++ case PROP_ZONE:
++ cc_timezone_location_set_zone(loc, g_value_get_string(value));
++ break;
++ case PROP_COMMENT:
++ cc_timezone_location_set_comment(loc, g_value_get_string(value));
++ break;
++ case PROP_DIST:
++ cc_timezone_location_set_dist(loc, g_value_get_double(value));
++ break;
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
++ }
++}
++
++static void
++cc_timezone_location_dispose (GObject *object)
++{
++ CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
++
++ if (priv->country)
++ {
++ g_free (priv->country);
++ priv->country = NULL;
++ }
++
++ if (priv->full_country)
++ {
++ g_free (priv->full_country);
++ priv->full_country = NULL;
++ }
++
++ if (priv->en_name)
++ {
++ g_free (priv->en_name);
++ priv->en_name = NULL;
++ }
++
++ if (priv->state)
++ {
++ g_free (priv->state);
++ priv->state = NULL;
++ }
++
++ if (priv->zone)
++ {
++ g_free (priv->zone);
++ priv->zone = NULL;
++ }
++
++ if (priv->comment)
++ {
++ g_free (priv->comment);
++ priv->comment = NULL;
++ }
++
++ G_OBJECT_CLASS (cc_timezone_location_parent_class)->dispose (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);
++ g_type_class_add_private (klass, sizeof (CcTimezoneLocationPrivate));
++
++ 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,
++ g_param_spec_string ("country",
++ "Country",
++ "The country for the location",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_FULL_COUNTRY,
++ g_param_spec_string ("full_country",
++ "Country (full name)",
++ "The full country name",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_EN_NAME,
++ g_param_spec_string ("en_name",
++ "English Name",
++ "The name of the location",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_STATE,
++ g_param_spec_string ("state",
++ "State",
++ "The state for the location",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_LATITUDE,
++ g_param_spec_double ("latitude",
++ "Latitude",
++ "The latitude for the location",
++ -90.0,
++ 90.0,
++ 0.0,
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_LONGITUDE,
++ g_param_spec_double ("longitude",
++ "Longitude",
++ "The longitude for the location",
++ -180.0,
++ 180.0,
++ 0.0,
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_ZONE,
++ g_param_spec_string ("zone",
++ "Zone",
++ "The time zone for the location",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_COMMENT,
++ g_param_spec_string ("Comment",
++ "Comment",
++ "A comment for the location",
++ "",
++ G_PARAM_READWRITE));
++ g_object_class_install_property(object_class,
++ PROP_DIST,
++ g_param_spec_double ("dist",
++ "Distance",
++ "The distance for the location",
++ 0.0,
++ DBL_MAX,
++ 0.0,
++ G_PARAM_READWRITE));
++}
++
++static void
++cc_timezone_location_init (CcTimezoneLocation *self) {
++ CcTimezoneLocationPrivate *priv;
++ priv = self->priv = TIMEZONE_LOCATION_PRIVATE (self);
++}
++
++CcTimezoneLocation *
++cc_timezone_location_new (void)
++{
++ return g_object_new (CC_TYPE_TIMEZONE_LOCATION, NULL);
++}
++
++const gchar *cc_timezone_location_get_country(CcTimezoneLocation *loc)
++{
++ return loc->priv->country;
++}
++
++void cc_timezone_location_set_country(CcTimezoneLocation *loc, const gchar *country)
++{
++ g_free(loc->priv->country);
++ loc->priv->country = g_strdup(country);
++
++ g_object_notify(G_OBJECT(loc), "country");
++}
++
++const gchar *cc_timezone_location_get_full_country(CcTimezoneLocation *loc)
++{
++ return loc->priv->full_country;
++}
++
++void cc_timezone_location_set_full_country(CcTimezoneLocation *loc, const gchar *full_country)
++{
++ g_free(loc->priv->full_country);
++ loc->priv->full_country = g_strdup(full_country);
++
++ g_object_notify(G_OBJECT(loc), "full_country");
++}
++
++const gchar *cc_timezone_location_get_en_name(CcTimezoneLocation *loc)
++{
++ return loc->priv->en_name;
++}
++
++void cc_timezone_location_set_en_name(CcTimezoneLocation *loc, const gchar *en_name)
++{
++ g_free(loc->priv->en_name);
++ loc->priv->full_country = g_strdup(en_name);
++
++ g_object_notify(G_OBJECT(loc), "en_name");
++}
++
++const gchar *cc_timezone_location_get_state(CcTimezoneLocation *loc)
++{
++ return loc->priv->state;
++}
++
++void cc_timezone_location_set_state(CcTimezoneLocation *loc, const gchar *state)
++{
++ g_free(loc->priv->state);
++ loc->priv->state = g_strdup(state);
++
++ g_object_notify(G_OBJECT(loc), "state");
++}
++
++gdouble cc_timezone_location_get_latitude(CcTimezoneLocation *loc)
++{
++ return loc->priv->latitude;
++}
++
++void cc_timezone_location_set_latitude(CcTimezoneLocation *loc, gdouble lat)
++{
++ loc->priv->latitude = lat;
++ g_object_notify(G_OBJECT(loc), "latitude");
++}
++
++gdouble cc_timezone_location_get_longitude(CcTimezoneLocation *loc)
++{
++ return loc->priv->longitude;
++}
++
++void cc_timezone_location_set_longitude(CcTimezoneLocation *loc, gdouble lng)
++{
++ loc->priv->longitude = lng;
++ g_object_notify(G_OBJECT(loc), "longitude");
++}
++
++const gchar *cc_timezone_location_get_zone(CcTimezoneLocation *loc)
++{
++ return loc->priv->zone;
++}
++
++void cc_timezone_location_set_zone(CcTimezoneLocation *loc, const gchar *zone)
++{
++ g_free(loc->priv->zone);
++ loc->priv->zone = g_strdup(zone);
++
++ g_object_notify(G_OBJECT(loc), "zone");
++}
++
++const gchar *cc_timezone_location_get_comment(CcTimezoneLocation *loc)
++{
++ return loc->priv->comment;
++}
++
++void cc_timezone_location_set_comment(CcTimezoneLocation *loc, const gchar *comment)
++{
++ g_free(loc->priv->comment);
++ loc->priv->comment = g_strdup(comment);
++
++ g_object_notify(G_OBJECT(loc), "Comment");
++}
++
++gdouble cc_timezone_location_get_dist(CcTimezoneLocation *loc)
++{
++ return loc->priv->dist;
++}
++
++void cc_timezone_location_set_dist(CcTimezoneLocation *loc, gdouble dist)
++{
++ loc->priv->dist = dist;
++ g_object_notify(G_OBJECT(loc), "dist");
++}
+diff --git a/src/cc-timezone-location.h b/src/cc-timezone-location.h
+new file mode 100644
+index 0000000..d322794
+--- /dev/null
++++ b/src/cc-timezone-location.h
+@@ -0,0 +1,95 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
++/* Timezone location information
++ *
++ * Copyright (C) 2000-2001 Ximian, Inc.
++ *
++ * Authors: Hans Petter Jansson <hpj at 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 _CC_TIMEZONE_LOCATION_H
++#define _CC_TIMEZONE_LOCATION_H
++
++#include <glib.h>
++#include <glib-object.h>
++
++G_BEGIN_DECLS
++
++#define CC_TYPE_TIMEZONE_LOCATION cc_timezone_location_get_type()
++
++#define CC_TIMEZONE_LOCATION(obj) \
++ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
++ CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocation))
++
++#define CC_TIMEZONE_LOCATION_CLASS(klass) \
++ (G_TYPE_CHECK_CLASS_CAST ((klass), \
++ CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationClass))
++
++#define CC_IS_TIMEZONE_LOCATION(obj) \
++ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
++ CC_TYPE_TIMEZONE_LOCATION))
++
++#define CC_IS_TIMEZONE_LOCATION_CLASS(klass) \
++ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
++ CC_TYPE_TIMEZONE_LOCATION))
++
++#define CC_TIMEZONE_LOCATION_GET_CLASS(obj) \
++ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
++ CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationClass))
++
++typedef struct _CcTimezoneLocation CcTimezoneLocation;
++typedef struct _CcTimezoneLocationClass CcTimezoneLocationClass;
++typedef struct _CcTimezoneLocationPrivate CcTimezoneLocationPrivate;
++
++struct _CcTimezoneLocation
++{
++ GObject parent;
++ CcTimezoneLocationPrivate *priv;
++};
++
++struct _CcTimezoneLocationClass
++{
++ GObjectClass parent_class;
++};
++
++GType cc_timezone_location_get_type (void) G_GNUC_CONST;
++
++CcTimezoneLocation *cc_timezone_location_new (void);
++
++const gchar *cc_timezone_location_get_country(CcTimezoneLocation *loc);
++void cc_timezone_location_set_country(CcTimezoneLocation *loc, const gchar *country);
++const gchar *cc_timezone_location_get_full_country(CcTimezoneLocation *loc);
++void cc_timezone_location_set_full_country(CcTimezoneLocation *loc, const gchar *full_country);
++const gchar *cc_timezone_location_get_en_name(CcTimezoneLocation *loc);
++void cc_timezone_location_set_en_name(CcTimezoneLocation *loc, const gchar *en_name);
++const gchar *cc_timezone_location_get_state(CcTimezoneLocation *loc);
++void cc_timezone_location_set_state(CcTimezoneLocation *loc, const gchar *state);
++gdouble cc_timezone_location_get_latitude(CcTimezoneLocation *loc);
++void cc_timezone_location_set_latitude(CcTimezoneLocation *loc, gdouble lat);
++gdouble cc_timezone_location_get_longitude(CcTimezoneLocation *loc);
++void cc_timezone_location_set_longitude(CcTimezoneLocation *loc, gdouble lng);
++const gchar *cc_timezone_location_get_zone(CcTimezoneLocation *loc);
++void cc_timezone_location_set_zone(CcTimezoneLocation *loc, const gchar *zone);
++const gchar *cc_timezone_location_get_comment(CcTimezoneLocation *loc);
++void cc_timezone_location_set_comment(CcTimezoneLocation *loc, const gchar *comment);
++gdouble cc_timezone_location_get_dist(CcTimezoneLocation *loc);
++void cc_timezone_location_set_dist(CcTimezoneLocation *loc, gdouble dist);
++
++G_END_DECLS
++
++#endif /* _CC_TIMEZONE_LOCATION_H */
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index 60297e4..a782089 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
+@@ -24,6 +24,7 @@
+ */
+
+ #include "cc-timezone-map.h"
++#include "cc-timezone-location.h"
+ #include <math.h>
+ #include "tz.h"
+
+@@ -822,16 +823,10 @@ cc_timezone_map_draw (GtkWidget *widget,
+ g_clear_error (&err);
+ }
+
+- GValue lat = {0};
+- GValue lon = {0};
+- g_value_init (&lat, G_TYPE_DOUBLE);
+- g_value_init (&lon, G_TYPE_DOUBLE);
+- g_object_get_property(G_OBJECT (priv->location), "latitude", &lat);
+- g_object_get_property(G_OBJECT (priv->location), "longitude", &lon);
+- pointx = convert_longtitude_to_x (g_value_get_double(&lon), alloc.width);
+- pointy = convert_latitude_to_y (g_value_get_double(&lat), alloc.height);
+- g_value_unset (&lon);
+- g_value_unset (&lat);
++ pointx = convert_longtitude_to_x (
++ cc_timezone_location_get_longitude(priv->location), alloc.width);
++ pointy = convert_latitude_to_y (
++ cc_timezone_location_get_latitude(priv->location), alloc.height);
+
+ if (pointy > alloc.height)
+ pointy = alloc.height;
+@@ -881,17 +876,9 @@ static gint
+ sort_locations (CcTimezoneLocation *a,
+ CcTimezoneLocation *b)
+ {
+- GValue val_a = {0};
+- GValue val_b = {0};
+ gdouble dist_a, dist_b;
+- g_value_init (&val_a, G_TYPE_DOUBLE);
+- g_value_init (&val_b, G_TYPE_DOUBLE);
+- g_object_get_property(G_OBJECT (a), "dist", &val_a);
+- g_object_get_property(G_OBJECT (b), "dist", &val_b);
+- dist_a = g_value_get_double(&val_a);
+- dist_b = g_value_get_double(&val_b);
+- g_value_unset (&val_a);
+- g_value_unset (&val_b);
++ dist_a = cc_timezone_location_get_dist(a);
++ dist_b = cc_timezone_location_get_dist(b);
+ if (dist_a > dist_b)
+ return 1;
+
+@@ -934,13 +921,6 @@ get_loc_for_xy (GtkWidget * widget, gint x, gint y)
+ GtkAllocation alloc;
+ CcTimezoneLocation* location;
+
+- GValue glon = {0};
+- GValue glat = {0};
+- GValue gdist = {0};
+- g_value_init (&glon, G_TYPE_DOUBLE);
+- g_value_init (&glat, G_TYPE_DOUBLE);
+- g_value_init (&gdist, G_TYPE_DOUBLE);
+-
+ rowstride = priv->visible_map_rowstride;
+ pixels = priv->visible_map_pixels;
+
+@@ -986,16 +966,13 @@ get_loc_for_xy (GtkWidget * widget, gint x, gint y)
+ gdouble pointx, pointy, dx, dy;
+ CcTimezoneLocation *loc = array->pdata[i];
+
+- g_object_get_property(G_OBJECT (loc), "longitude", &glon);
+- g_object_get_property(G_OBJECT (loc), "latitude", &glat);
+- pointx = convert_longtitude_to_x (g_value_get_double(&glon), width);
+- pointy = convert_latitude_to_y (g_value_get_double(&glat), height);
++ pointx = convert_longtitude_to_x (cc_timezone_location_get_longitude(loc), width);
++ pointy = convert_latitude_to_y (cc_timezone_location_get_latitude(loc), height);
+
+ dx = pointx - x;
+ dy = pointy - y;
+
+- g_value_set_double(&gdist, (gdouble) dx * dx + dy * dy);
+- g_object_set_property(G_OBJECT (loc), "dist", &gdist);
++ cc_timezone_location_set_dist(loc, (gdouble) dx * dx + dy * dy);
+ priv->distances = g_list_prepend (priv->distances, loc);
+ }
+ priv->distances = g_list_sort (priv->distances, (GCompareFunc) sort_locations);
+@@ -1004,10 +981,6 @@ get_loc_for_xy (GtkWidget * widget, gint x, gint y)
+ priv->previous_y = y;
+ }
+
+- g_value_unset (&glon);
+- g_value_unset (&glat);
+- g_value_unset (&gdist);
+-
+ return location;
+ }
+
+@@ -1143,8 +1116,6 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
+ GPtrArray *locations;
+ guint i;
+ char *real_tz;
+- GValue zone = {0};
+- g_value_init (&zone, G_TYPE_STRING);
+
+ real_tz = g_hash_table_lookup (map->priv->alias_db, timezone);
+
+@@ -1153,9 +1124,8 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
+ for (i = 0; i < locations->len; i++)
+ {
+ CcTimezoneLocation *loc = locations->pdata[i];
+- g_object_get_property(G_OBJECT (loc), "zone", &zone);
+
+- if (!g_strcmp0 (g_value_get_string(&zone), real_tz ? real_tz : timezone))
++ if (!g_strcmp0 (cc_timezone_location_get_zone(loc), real_tz ? real_tz : timezone))
+ {
+ set_location (map, loc);
+ break;
+@@ -1163,7 +1133,6 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
+ }
+
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+- g_value_unset (&zone);
+ }
+
+ void
+diff --git a/src/cc-timezone-map.h b/src/cc-timezone-map.h
+index ddb6961..15f2e0b 100644
+--- a/src/cc-timezone-map.h
++++ b/src/cc-timezone-map.h
+@@ -25,6 +25,7 @@
+
+ #include <gtk/gtk.h>
+ #include "tz.h"
++#include "cc-timezone-location.h"
+
+ G_BEGIN_DECLS
+
+diff --git a/src/tz.c b/src/tz.c
+index 8d83d0a..9393ba2 100644
+--- a/src/tz.c
++++ b/src/tz.c
+@@ -43,269 +43,6 @@ 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);
+
+-G_DEFINE_TYPE (CcTimezoneLocation, cc_timezone_location, G_TYPE_OBJECT)
+-
+-#define TIMEZONE_LOCATION_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationPrivate))
+-
+-struct _CcTimezoneLocationPrivate
+-{
+- gchar *country;
+- gchar *full_country;
+- gchar *en_name;
+- gchar *state;
+- gdouble latitude;
+- gdouble longitude;
+- gchar *zone;
+- gchar *comment;
+-
+- gdouble dist; /* distance to clicked point for comparison */
+-};
+-
+-enum {
+- PROP_0,
+- PROP_COUNTRY,
+- PROP_FULL_COUNTRY,
+- PROP_EN_NAME,
+- PROP_STATE,
+- PROP_LATITUDE,
+- PROP_LONGITUDE,
+- PROP_ZONE,
+- PROP_COMMENT,
+- PROP_DIST,
+-};
+-
+-static void
+-cc_timezone_location_get_property (GObject *object,
+- guint property_id,
+- GValue *value,
+- GParamSpec *pspec)
+-{
+- CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+- switch (property_id) {
+- case PROP_COUNTRY:
+- g_value_set_string (value, priv->country);
+- break;
+- case PROP_FULL_COUNTRY:
+- g_value_set_string (value, priv->full_country);
+- break;
+- case PROP_EN_NAME:
+- g_value_set_string (value, priv->en_name);
+- break;
+- case PROP_STATE:
+- g_value_set_string (value, priv->state);
+- break;
+- case PROP_LATITUDE:
+- g_value_set_double (value, priv->latitude);
+- break;
+- case PROP_LONGITUDE:
+- g_value_set_double (value, priv->longitude);
+- break;
+- case PROP_ZONE:
+- g_value_set_string (value, priv->zone);
+- break;
+- case PROP_COMMENT:
+- g_value_set_string (value, priv->comment);
+- break;
+- case PROP_DIST:
+- g_value_set_double (value, priv->dist);
+- break;
+- default:
+- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+- }
+-}
+-
+-static void
+-cc_timezone_location_set_property (GObject *object,
+- guint property_id,
+- const GValue *value,
+- GParamSpec *pspec)
+-{
+- CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+- switch (property_id) {
+- case PROP_COUNTRY:
+- g_free(priv->country);
+- priv->country = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_FULL_COUNTRY:
+- g_free(priv->full_country);
+- priv->full_country = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_EN_NAME:
+- g_free(priv->en_name);
+- priv->en_name = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_STATE:
+- g_free(priv->state);
+- priv->state = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_LATITUDE:
+- priv->latitude = g_value_get_double(value);
+- break;
+- case PROP_LONGITUDE:
+- priv->longitude = g_value_get_double(value);
+- break;
+- case PROP_ZONE:
+- g_strdup(priv->zone);
+- priv->zone = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_COMMENT:
+- g_free(priv->comment);
+- priv->comment = g_strdup(g_value_get_string(value));
+- break;
+- case PROP_DIST:
+- priv->dist = g_value_get_double(value);
+- break;
+- default:
+- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+- }
+-}
+-
+-static void
+-cc_timezone_location_dispose (GObject *object)
+-{
+- CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
+-
+- if (priv->country)
+- {
+- g_free (priv->country);
+- priv->country = NULL;
+- }
+-
+- if (priv->full_country)
+- {
+- g_free (priv->full_country);
+- priv->full_country = NULL;
+- }
+-
+- if (priv->en_name)
+- {
+- g_free (priv->en_name);
+- priv->en_name = NULL;
+- }
+-
+- if (priv->state)
+- {
+- g_free (priv->state);
+- priv->state = NULL;
+- }
+-
+- if (priv->zone)
+- {
+- g_free (priv->zone);
+- priv->zone = NULL;
+- }
+-
+- if (priv->comment)
+- {
+- g_free (priv->comment);
+- priv->comment = NULL;
+- }
+-
+- G_OBJECT_CLASS (cc_timezone_location_parent_class)->dispose (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);
+- g_type_class_add_private (klass, sizeof (CcTimezoneLocationPrivate));
+-
+- 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,
+- g_param_spec_string ("country",
+- "Country",
+- "The country for the location",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_FULL_COUNTRY,
+- g_param_spec_string ("full_country",
+- "Country (full name)",
+- "The full country name",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_EN_NAME,
+- g_param_spec_string ("en_name",
+- "English Name",
+- "The name of the location",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_STATE,
+- g_param_spec_string ("state",
+- "State",
+- "The state for the location",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_LATITUDE,
+- g_param_spec_double ("latitude",
+- "Latitude",
+- "The latitude for the location",
+- -90.0,
+- 90.0,
+- 0.0,
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_LONGITUDE,
+- g_param_spec_double ("longitude",
+- "Longitude",
+- "The longitude for the location",
+- -180.0,
+- 180.0,
+- 0.0,
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_ZONE,
+- g_param_spec_string ("zone",
+- "Zone",
+- "The time zone for the location",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_COMMENT,
+- g_param_spec_string ("Comment",
+- "Comment",
+- "A comment for the location",
+- "",
+- G_PARAM_READWRITE));
+- g_object_class_install_property(object_class,
+- PROP_DIST,
+- g_param_spec_double ("dist",
+- "Distance",
+- "The distance for the location",
+- 0.0,
+- DBL_MAX,
+- 0.0,
+- G_PARAM_READWRITE));
+-}
+-
+-static void
+-cc_timezone_location_init (CcTimezoneLocation *self) {
+- CcTimezoneLocationPrivate *priv;
+- priv = self->priv = TIMEZONE_LOCATION_PRIVATE (self);
+-}
+-
+-CcTimezoneLocation *
+-cc_timezone_location_new (void)
+-{
+- return g_object_new (CC_TYPE_TIMEZONE_LOCATION, NULL);
+-}
+-
+ void parse_file (const char * filename,
+ const guint ncolumns,
+ GFunc func,
+@@ -376,25 +113,24 @@ void parse_cities15000 (gpointer parsed_data,
+
+ CcTimezoneLocation *loc = cc_timezone_location_new ();
+
+- loc->priv->country = g_strdup (parsed_data_v[8]);
+- loc->priv->en_name = g_strdup (parsed_data_v[2]);
++ cc_timezone_location_set_country(loc, parsed_data_v[8]);
++ cc_timezone_location_set_en_name(loc, parsed_data_v[2]);
+
+- gchar * tmpState = g_strdup_printf ("%s.%s", loc->priv->country,
++ gchar * tmpState = g_strdup_printf ("%s.%s",
++ cc_timezone_location_get_country(loc),
+ parsed_data_v[10]);
+- loc->priv->state = g_strdup (
+- (gchar *) g_hash_table_lookup (
++ cc_timezone_location_set_state(loc, g_hash_table_lookup(
+ stateHash,
+ tmpState));
+ g_free (tmpState);
+
+- loc->priv->full_country = g_strdup (
+- (gchar *) g_hash_table_lookup (
++ cc_timezone_location_set_full_country(loc, g_hash_table_lookup(
+ countryHash,
+- loc->priv->country));
++ cc_timezone_location_get_country(loc)));
+
+- loc->priv->zone = g_strdup (parsed_data_v[17]);
+- loc->priv->latitude = g_ascii_strtod(parsed_data_v[4], NULL);
+- loc->priv->longitude = g_ascii_strtod(parsed_data_v[5], NULL);
++ cc_timezone_location_set_zone(loc, parsed_data_v[17]);
++ 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;
+@@ -423,7 +159,7 @@ void parse_cities15000 (gpointer parsed_data,
+ g_ptr_array_add (ptr_array, (gpointer) locgrp);
+ }
+ #else
+- loc->priv->comment = NULL;
++ cc_timezone_location_set_comment(loc, NULL);
+ #endif
+
+ g_ptr_array_add (ptr_array, (gpointer) loc);
+@@ -510,19 +246,6 @@ tz_db_free (TzDB *db)
+ g_free (db);
+ }
+
+-static gint
+-sort_locations (CcTimezoneLocation *a,
+- CcTimezoneLocation *b)
+-{
+- if (a->priv->dist > b->priv->dist)
+- return 1;
+-
+- if (a->priv->dist < b->priv->dist)
+- return -1;
+-
+- return 0;
+-}
+-
+ static gdouble
+ convert_longtitude_to_x (gdouble longitude, gint map_width)
+ {
+@@ -584,15 +307,17 @@ tz_location_set_locally (CcTimezoneLocation *loc)
+ struct tm *curzone;
+ gboolean is_dst = FALSE;
+ gint correction = 0;
++ const gchar *zone;
+
+ g_return_val_if_fail (loc != NULL, 0);
+- g_return_val_if_fail (loc->priv->zone != NULL, 0);
++ 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", loc->priv->zone, 1);
++ setenv ("TZ", zone, 1);
+ #if 0
+ curtime = time (NULL);
+ curzone = localtime (&curtime);
+@@ -614,11 +339,13 @@ tz_info_from_location (CcTimezoneLocation *loc)
+ TzInfo *tzinfo;
+ time_t curtime;
+ struct tm *curzone;
++ const gchar *zone;
+
+ g_return_val_if_fail (loc != NULL, NULL);
+- g_return_val_if_fail (loc->priv->zone != NULL, NULL);
++ zone = cc_timezone_location_get_zone(loc);
++ g_return_val_if_fail (zone != NULL, NULL);
+
+- setenv ("TZ", loc->priv->zone, 1);
++ setenv ("TZ", zone, 1);
+
+ #if 0
+ tzset ();
+@@ -701,10 +428,12 @@ convert_pos (gchar *pos, int digits)
+ static int
+ compare_country_names (const void *a, const void *b)
+ {
+- const CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
+- const CcTimezoneLocation *tzb = * (CcTimezoneLocation **) b;
++ CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
++ CcTimezoneLocation *tzb = * (CcTimezoneLocation **) b;
++ const gchar *zone_a = cc_timezone_location_get_zone(tza);
++ const gchar *zone_b = cc_timezone_location_get_zone(tzb);
+
+- return strcmp (tza->priv->zone, tzb->priv->zone);
++ return strcmp (zone_a, zone_b);
+ }
+
+
+diff --git a/src/tz.h b/src/tz.h
+index 005d72f..8eb55d3 100644
+--- a/src/tz.h
++++ b/src/tz.h
+@@ -27,7 +27,8 @@
+ #define _E_TZ_H
+
+ #include <glib.h>
+-#include <glib-object.h>
++
++#include "cc-timezone-location.h"
+
+ #ifndef __sun
+ # define TZ_DATA_FILE "/usr/share/libtimezonemap/ui/cities15000.txt"
+@@ -40,49 +41,8 @@
+
+ G_BEGIN_DECLS
+
+-#define CC_TYPE_TIMEZONE_LOCATION cc_timezone_location_get_type()
+-
+-#define CC_TIMEZONE_LOCATION(obj) \
+- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+- CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocation))
+-
+-#define CC_TIMEZONE_LOCATION_CLASS(klass) \
+- (G_TYPE_CHECK_CLASS_CAST ((klass), \
+- CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationClass))
+-
+-#define CC_IS_TIMEZONE_LOCATION(obj) \
+- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+- CC_TYPE_TIMEZONE_LOCATION))
+-
+-#define CC_IS_TIMEZONE_LOCATION_CLASS(klass) \
+- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+- CC_TYPE_TIMEZONE_LOCATION))
+-
+-#define CC_TIMEZONE_LOCATION_GET_CLASS(obj) \
+- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+- CC_TYPE_TIMEZONE_LOCATION, CcTimezoneLocationClass))
+-
+ typedef struct _TzDB TzDB;
+ typedef struct _TzInfo TzInfo;
+-typedef struct _CcTimezoneLocation CcTimezoneLocation;
+-typedef struct _CcTimezoneLocationClass CcTimezoneLocationClass;
+-typedef struct _CcTimezoneLocationPrivate CcTimezoneLocationPrivate;
+-
+-struct _CcTimezoneLocation
+-{
+- GObject parent;
+- CcTimezoneLocationPrivate *priv;
+-};
+-
+-struct _CcTimezoneLocationClass
+-{
+- GObjectClass parent_class;
+-};
+-
+-GType cc_timezone_location_get_type (void) G_GNUC_CONST;
+-
+-CcTimezoneLocation *cc_timezone_location_new (void);
+-
+
+ struct _TzDB
+ {
+--
+1.8.4.2
+
diff --git a/0005-Don-t-close-a-NULL-file-pointer.patch b/0005-Don-t-close-a-NULL-file-pointer.patch
new file mode 100644
index 0000000..42fa7f2
--- /dev/null
+++ b/0005-Don-t-close-a-NULL-file-pointer.patch
@@ -0,0 +1,26 @@
+From eddbdda3d7aecce37fb889ea1b9754659aae872c Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Thu, 14 Nov 2013 10:50:49 -0500
+Subject: [PATCH 05/10] Don't close a NULL file pointer.
+
+parse_file attempted to close a NULL pointer if it was unable to open
+the given file, causing a crash.
+---
+ src/tz.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/tz.c b/src/tz.c
+index 9393ba2..95bfca0 100644
+--- a/src/tz.c
++++ b/src/tz.c
+@@ -54,7 +54,6 @@ void parse_file (const char * filename,
+ if (!fh)
+ {
+ g_warning ("Could not open *%s*\n", filename);
+- fclose (fh);
+ return;
+ }
+
+--
+1.8.4.2
+
diff --git a/0006-Turn-on-and-fix-g-ir-scanner-warnings.patch b/0006-Turn-on-and-fix-g-ir-scanner-warnings.patch
new file mode 100644
index 0000000..4d4b1e8
--- /dev/null
+++ b/0006-Turn-on-and-fix-g-ir-scanner-warnings.patch
@@ -0,0 +1,64 @@
+From 7e33322d16f78ab613ffdd284274be580034023a Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Thu, 14 Nov 2013 10:50:49 -0500
+Subject: [PATCH 06/10] Turn on and fix g-ir-scanner warnings.
+
+A comment in timezone-completion opened with /** but did not include
+gtk-doc data. Removed the extra asterisk.
+
+cc_timezone_map_get_location needed transfer information since it
+returns a non-const object. Added a doc comment with transfer none.
+---
+ src/Makefile.am | 2 +-
+ src/cc-timezone-map.c | 8 ++++++++
+ src/timezone-completion.c | 2 +-
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index b4461cd..8b00c16 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -109,7 +109,7 @@ introspection_sources = $(libtimezonemap_GISOURCES)
+ TimezoneMap-1.0.gir: libtimezonemap.la
+ TimezoneMap_1_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 Json-1.0
+ TimezoneMap_1_0_gir_CFLAGS = $(INCLUDES)
+-TimezoneMap_1_0_gir_SCANNERFLAGS = --identifier-prefix=Cc
++TimezoneMap_1_0_gir_SCANNERFLAGS = --identifier-prefix=Cc --warn-all
+ TimezoneMap_1_0_gir_LIBS = libtimezonemap.la
+ TimezoneMap_1_0_gir_FILES = $(introspection_sources)
+
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index a782089..7fd7b08 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
+@@ -1195,6 +1195,14 @@ cc_timezone_map_set_watermark (CcTimezoneMap *map, const gchar * watermark)
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+ }
+
++/**
++ * cc_timezone_map_get_location:
++ * @map: A #CcTimezoneMap
++ *
++ * Returns the current location set for the map.
++ *
++ * Returns: (transfer none): the map location.
++ */
+ CcTimezoneLocation *
+ cc_timezone_map_get_location (CcTimezoneMap *map)
+ {
+diff --git a/src/timezone-completion.c b/src/timezone-completion.c
+index f6ca8c8..e7f88db 100644
+--- a/src/timezone-completion.c
++++ b/src/timezone-completion.c
+@@ -442,7 +442,7 @@ get_descendent (GtkWidget * parent, GType type)
+ return NULL;
+ }
+
+-/**
++/*
+ * The popup window and its GtkTreeView are private to our parent completion
+ * object. We can't get access to discover if there is a highlighted item or
+ * even if the window is showing right now. So this is a super hack to find
+--
+1.8.4.2
+
diff --git a/0007-Added-a-.bzrignore-file-to-ignore-all-the-files-gene.patch b/0007-Added-a-.bzrignore-file-to-ignore-all-the-files-gene.patch
new file mode 100644
index 0000000..c9654e7
--- /dev/null
+++ b/0007-Added-a-.bzrignore-file-to-ignore-all-the-files-gene.patch
@@ -0,0 +1,420 @@
+From c009e7cb89c0d45afc4e4c94e589d0154591fb89 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Tue, 26 Nov 2013 10:43:14 -0500
+Subject: [PATCH 07/10] Added a .bzrignore file to ignore all the files
+ generated by the build.
+
+Removed INSTALL from the repo since this file is copied in by automake.
+---
+ .bzrignore | 21 ++++
+ INSTALL | 370 -------------------------------------------------------------
+ 2 files changed, 21 insertions(+), 370 deletions(-)
+ create mode 100644 .bzrignore
+ delete mode 100644 INSTALL
+
+diff --git a/.bzrignore b/.bzrignore
+new file mode 100644
+index 0000000..e488bbc
+--- /dev/null
++++ b/.bzrignore
+@@ -0,0 +1,21 @@
++Makefile
++Makefile.in
++aclocal.m4
++autom4te.cache
++build-aux
++config.h
++config.h.in
++config.log
++config.status
++configure
++libtool
++stamp-h1
++m4/*.m4
++.deps
++.libs
++*.gir
++*.typelib
++*.lo
++*.la
++src/test-timezone
++src/timezonemap.pc
+diff --git a/INSTALL b/INSTALL
+deleted file mode 100644
+index a1e89e1..0000000
+--- a/INSTALL
++++ /dev/null
+@@ -1,370 +0,0 @@
+-Installation Instructions
+-*************************
+-
+-Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+-Inc.
+-
+- Copying and distribution of this file, with or without modification,
+-are permitted in any medium without royalty provided the copyright
+-notice and this notice are preserved. This file is offered as-is,
+-without warranty of any kind.
+-
+-Basic Installation
+-==================
+-
+- Briefly, the shell commands `./configure; make; make install' should
+-configure, build, and install this package. The following
+-more-detailed instructions are generic; see the `README' file for
+-instructions specific to this package. Some packages provide this
+-`INSTALL' file but do not implement all of the features documented
+-below. The lack of an optional feature in a given package is not
+-necessarily a bug. More recommendations for GNU packages can be found
+-in *note Makefile Conventions: (standards)Makefile Conventions.
+-
+- The `configure' shell script attempts to guess correct values for
+-various system-dependent variables used during compilation. It uses
+-those values to create a `Makefile' in each directory of the package.
+-It may also create one or more `.h' files containing system-dependent
+-definitions. Finally, it creates a shell script `config.status' that
+-you can run in the future to recreate the current configuration, and a
+-file `config.log' containing compiler output (useful mainly for
+-debugging `configure').
+-
+- It can also use an optional file (typically called `config.cache'
+-and enabled with `--cache-file=config.cache' or simply `-C') that saves
+-the results of its tests to speed up reconfiguring. Caching is
+-disabled by default to prevent problems with accidental use of stale
+-cache files.
+-
+- If you need to do unusual things to compile the package, please try
+-to figure out how `configure' could check whether to do them, and mail
+-diffs or instructions to the address given in the `README' so they can
+-be considered for the next release. If you are using the cache, and at
+-some point `config.cache' contains results you don't want to keep, you
+-may remove or edit it.
+-
+- The file `configure.ac' (or `configure.in') is used to create
+-`configure' by a program called `autoconf'. You need `configure.ac' if
+-you want to change it or regenerate `configure' using a newer version
+-of `autoconf'.
+-
+- The simplest way to compile this package is:
+-
+- 1. `cd' to the directory containing the package's source code and type
+- `./configure' to configure the package for your system.
+-
+- Running `configure' might take a while. While running, it prints
+- some messages telling which features it is checking for.
+-
+- 2. Type `make' to compile the package.
+-
+- 3. Optionally, type `make check' to run any self-tests that come with
+- the package, generally using the just-built uninstalled binaries.
+-
+- 4. Type `make install' to install the programs and any data files and
+- documentation. When installing into a prefix owned by root, it is
+- recommended that the package be configured and built as a regular
+- user, and only the `make install' phase executed with root
+- privileges.
+-
+- 5. Optionally, type `make installcheck' to repeat any self-tests, but
+- this time using the binaries in their final installed location.
+- This target does not install anything. Running this target as a
+- regular user, particularly if the prior `make install' required
+- root privileges, verifies that the installation completed
+- correctly.
+-
+- 6. You can remove the program binaries and object files from the
+- source code directory by typing `make clean'. To also remove the
+- files that `configure' created (so you can compile the package for
+- a different kind of computer), type `make distclean'. There is
+- also a `make maintainer-clean' target, but that is intended mainly
+- for the package's developers. If you use it, you may have to get
+- all sorts of other programs in order to regenerate files that came
+- with the distribution.
+-
+- 7. Often, you can also type `make uninstall' to remove the installed
+- files again. In practice, not all packages have tested that
+- uninstallation works correctly, even though it is required by the
+- GNU Coding Standards.
+-
+- 8. Some packages, particularly those that use Automake, provide `make
+- distcheck', which can by used by developers to test that all other
+- targets like `make install' and `make uninstall' work correctly.
+- This target is generally not run by end users.
+-
+-Compilers and Options
+-=====================
+-
+- Some systems require unusual options for compilation or linking that
+-the `configure' script does not know about. Run `./configure --help'
+-for details on some of the pertinent environment variables.
+-
+- You can give `configure' initial values for configuration parameters
+-by setting variables in the command line or in the environment. Here
+-is an example:
+-
+- ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+-
+- *Note Defining Variables::, for more details.
+-
+-Compiling For Multiple Architectures
+-====================================
+-
+- You can compile the package for more than one kind of computer at the
+-same time, by placing the object files for each architecture in their
+-own directory. To do this, you can use GNU `make'. `cd' to the
+-directory where you want the object files and executables to go and run
+-the `configure' script. `configure' automatically checks for the
+-source code in the directory that `configure' is in and in `..'. This
+-is known as a "VPATH" build.
+-
+- With a non-GNU `make', it is safer to compile the package for one
+-architecture at a time in the source code directory. After you have
+-installed the package for one architecture, use `make distclean' before
+-reconfiguring for another architecture.
+-
+- On MacOS X 10.5 and later systems, you can create libraries and
+-executables that work on multiple system types--known as "fat" or
+-"universal" binaries--by specifying multiple `-arch' options to the
+-compiler but only a single `-arch' option to the preprocessor. Like
+-this:
+-
+- ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+- CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+- CPP="gcc -E" CXXCPP="g++ -E"
+-
+- This is not guaranteed to produce working output in all cases, you
+-may have to build one architecture at a time and combine the results
+-using the `lipo' tool if you have problems.
+-
+-Installation Names
+-==================
+-
+- By default, `make install' installs the package's commands under
+-`/usr/local/bin', include files under `/usr/local/include', etc. You
+-can specify an installation prefix other than `/usr/local' by giving
+-`configure' the option `--prefix=PREFIX', where PREFIX must be an
+-absolute file name.
+-
+- You can specify separate installation prefixes for
+-architecture-specific files and architecture-independent files. If you
+-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+-PREFIX as the prefix for installing programs and libraries.
+-Documentation and other data files still use the regular prefix.
+-
+- In addition, if you use an unusual directory layout you can give
+-options like `--bindir=DIR' to specify different values for particular
+-kinds of files. Run `configure --help' for a list of the directories
+-you can set and what kinds of files go in them. In general, the
+-default for these options is expressed in terms of `${prefix}', so that
+-specifying just `--prefix' will affect all of the other directory
+-specifications that were not explicitly provided.
+-
+- The most portable way to affect installation locations is to pass the
+-correct locations to `configure'; however, many packages provide one or
+-both of the following shortcuts of passing variable assignments to the
+-`make install' command line to change installation locations without
+-having to reconfigure or recompile.
+-
+- The first method involves providing an override variable for each
+-affected directory. For example, `make install
+-prefix=/alternate/directory' will choose an alternate location for all
+-directory configuration variables that were expressed in terms of
+-`${prefix}'. Any directories that were specified during `configure',
+-but not in terms of `${prefix}', must each be overridden at install
+-time for the entire installation to be relocated. The approach of
+-makefile variable overrides for each directory variable is required by
+-the GNU Coding Standards, and ideally causes no recompilation.
+-However, some platforms have known limitations with the semantics of
+-shared libraries that end up requiring recompilation when using this
+-method, particularly noticeable in packages that use GNU Libtool.
+-
+- The second method involves providing the `DESTDIR' variable. For
+-example, `make install DESTDIR=/alternate/directory' will prepend
+-`/alternate/directory' before all installation names. The approach of
+-`DESTDIR' overrides is not required by the GNU Coding Standards, and
+-does not work on platforms that have drive letters. On the other hand,
+-it does better at avoiding recompilation issues, and works well even
+-when some directory options were not specified in terms of `${prefix}'
+-at `configure' time.
+-
+-Optional Features
+-=================
+-
+- If the package supports it, you can cause programs to be installed
+-with an extra prefix or suffix on their names by giving `configure' the
+-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+-
+- Some packages pay attention to `--enable-FEATURE' options to
+-`configure', where FEATURE indicates an optional part of the package.
+-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+-is something like `gnu-as' or `x' (for the X Window System). The
+-`README' should mention any `--enable-' and `--with-' options that the
+-package recognizes.
+-
+- For packages that use the X Window System, `configure' can usually
+-find the X include and library files automatically, but if it doesn't,
+-you can use the `configure' options `--x-includes=DIR' and
+-`--x-libraries=DIR' to specify their locations.
+-
+- Some packages offer the ability to configure how verbose the
+-execution of `make' will be. For these packages, running `./configure
+---enable-silent-rules' sets the default to minimal output, which can be
+-overridden with `make V=1'; while running `./configure
+---disable-silent-rules' sets the default to verbose, which can be
+-overridden with `make V=0'.
+-
+-Particular systems
+-==================
+-
+- On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+-CC is not installed, it is recommended to use the following options in
+-order to use an ANSI C compiler:
+-
+- ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+-
+-and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+-
+- HP-UX `make' updates targets which have the same time stamps as
+-their prerequisites, which makes it generally unusable when shipped
+-generated files such as `configure' are involved. Use GNU `make'
+-instead.
+-
+- On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+-parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+-a workaround. If GNU CC is not installed, it is therefore recommended
+-to try
+-
+- ./configure CC="cc"
+-
+-and if that doesn't work, try
+-
+- ./configure CC="cc -nodtk"
+-
+- On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+-directory contains several dysfunctional programs; working variants of
+-these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+-in your `PATH', put it _after_ `/usr/bin'.
+-
+- On Haiku, software installed for all users goes in `/boot/common',
+-not `/usr/local'. It is recommended to use the following options:
+-
+- ./configure --prefix=/boot/common
+-
+-Specifying the System Type
+-==========================
+-
+- There may be some features `configure' cannot figure out
+-automatically, but needs to determine by the type of machine the package
+-will run on. Usually, assuming the package is built to be run on the
+-_same_ architectures, `configure' can figure that out, but if it prints
+-a message saying it cannot guess the machine type, give it the
+-`--build=TYPE' option. TYPE can either be a short name for the system
+-type, such as `sun4', or a canonical name which has the form:
+-
+- CPU-COMPANY-SYSTEM
+-
+-where SYSTEM can have one of these forms:
+-
+- OS
+- KERNEL-OS
+-
+- See the file `config.sub' for the possible values of each field. If
+-`config.sub' isn't included in this package, then this package doesn't
+-need to know the machine type.
+-
+- If you are _building_ compiler tools for cross-compiling, you should
+-use the option `--target=TYPE' to select the type of system they will
+-produce code for.
+-
+- If you want to _use_ a cross compiler, that generates code for a
+-platform different from the build platform, you should specify the
+-"host" platform (i.e., that on which the generated programs will
+-eventually be run) with `--host=TYPE'.
+-
+-Sharing Defaults
+-================
+-
+- If you want to set default values for `configure' scripts to share,
+-you can create a site shell script called `config.site' that gives
+-default values for variables like `CC', `cache_file', and `prefix'.
+-`configure' looks for `PREFIX/share/config.site' if it exists, then
+-`PREFIX/etc/config.site' if it exists. Or, you can set the
+-`CONFIG_SITE' environment variable to the location of the site script.
+-A warning: not all `configure' scripts look for a site script.
+-
+-Defining Variables
+-==================
+-
+- Variables not defined in a site shell script can be set in the
+-environment passed to `configure'. However, some packages may run
+-configure again during the build, and the customized values of these
+-variables may be lost. In order to avoid this problem, you should set
+-them in the `configure' command line, using `VAR=value'. For example:
+-
+- ./configure CC=/usr/local2/bin/gcc
+-
+-causes the specified `gcc' to be used as the C compiler (unless it is
+-overridden in the site shell script).
+-
+-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+-an Autoconf bug. Until the bug is fixed you can use this workaround:
+-
+- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+-
+-`configure' Invocation
+-======================
+-
+- `configure' recognizes the following options to control how it
+-operates.
+-
+-`--help'
+-`-h'
+- Print a summary of all of the options to `configure', and exit.
+-
+-`--help=short'
+-`--help=recursive'
+- Print a summary of the options unique to this package's
+- `configure', and exit. The `short' variant lists options used
+- only in the top level, while the `recursive' variant lists options
+- also present in any nested packages.
+-
+-`--version'
+-`-V'
+- Print the version of Autoconf used to generate the `configure'
+- script, and exit.
+-
+-`--cache-file=FILE'
+- Enable the cache: use and save the results of the tests in FILE,
+- traditionally `config.cache'. FILE defaults to `/dev/null' to
+- disable caching.
+-
+-`--config-cache'
+-`-C'
+- Alias for `--cache-file=config.cache'.
+-
+-`--quiet'
+-`--silent'
+-`-q'
+- Do not print messages saying which checks are being made. To
+- suppress all normal output, redirect it to `/dev/null' (any error
+- messages will still be shown).
+-
+-`--srcdir=DIR'
+- Look for the package's source code in directory DIR. Usually
+- `configure' can determine that directory automatically.
+-
+-`--prefix=DIR'
+- Use DIR as the installation prefix. *note Installation Names::
+- for more details, including other options available for fine-tuning
+- the installation locations.
+-
+-`--no-create'
+-`-n'
+- Run the configure checks, but stop before creating any output
+- files.
+-
+-`configure' also accepts some other, not widely useful, options. Run
+-`configure --help' for more details.
+-
+--
+1.8.4.2
+
diff --git a/0008-Ignore-the-INSTALL-file.patch b/0008-Ignore-the-INSTALL-file.patch
new file mode 100644
index 0000000..aa2aec6
--- /dev/null
+++ b/0008-Ignore-the-INSTALL-file.patch
@@ -0,0 +1,21 @@
+From ff6a3c64c83326d53fb86c25b0f60f852f6257b5 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Tue, 26 Nov 2013 16:12:56 -0500
+Subject: [PATCH 08/10] Ignore the INSTALL file
+
+---
+ .bzrignore | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/.bzrignore b/.bzrignore
+index e488bbc..abe0491 100644
+--- a/.bzrignore
++++ b/.bzrignore
+@@ -19,3 +19,4 @@ m4/*.m4
+ *.la
+ src/test-timezone
+ src/timezonemap.pc
++INSTALL
+--
+1.8.4.2
+
diff --git a/0009-Added-a-function-to-clear-the-location-set-for-a-CcT.patch b/0009-Added-a-function-to-clear-the-location-set-for-a-CcT.patch
new file mode 100644
index 0000000..5adb3fa
--- /dev/null
+++ b/0009-Added-a-function-to-clear-the-location-set-for-a-CcT.patch
@@ -0,0 +1,75 @@
+From 8ab1e71acd1ca7efbca2d8a4085c2547abe17e26 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Tue, 26 Nov 2013 16:22:01 -0500
+Subject: [PATCH 09/10] Added a function to clear the location set for a
+ CcTimezoneMap
+
+---
+ src/cc-timezone-map.c | 31 ++++++++++++++++++++++++++-----
+ src/cc-timezone-map.h | 1 +
+ 2 files changed, 27 insertions(+), 5 deletions(-)
+
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index 7fd7b08..1eab640 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
+@@ -897,14 +897,20 @@ set_location (CcTimezoneMap *map,
+
+ 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);
++ 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);
++ tz_info_free (info);
++ }
++ else
++ {
++ priv->selected_offset = 0.0;
++ }
+
+ g_signal_emit (map, signals[LOCATION_CHANGED], 0, priv->location);
+
+- tz_info_free (info);
+ }
+
+ static CcTimezoneLocation *
+@@ -1208,3 +1214,18 @@ cc_timezone_map_get_location (CcTimezoneMap *map)
+ {
+ return map->priv->location;
+ }
++
++/**
++ * cc_timezone_map_clear_location:
++ * @map: A #CcTimezoneMap
++ *
++ * Clear the location currently set for the #CcTimezoneMap. This will remove
++ * the highlight and reset the map to its original state.
++ *
++ */
++void
++cc_timezone_map_clear_location (CcTimezoneMap *map)
++{
++ set_location(map, NULL);
++ gtk_widget_queue_draw (GTK_WIDGET (map));
++}
+diff --git a/src/cc-timezone-map.h b/src/cc-timezone-map.h
+index 15f2e0b..4737c0e 100644
+--- a/src/cc-timezone-map.h
++++ b/src/cc-timezone-map.h
+@@ -82,6 +82,7 @@ void cc_timezone_map_set_coords (CcTimezoneMap *map,
+ const gchar * cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map,
+ gdouble lon, gdouble lat);
+ CcTimezoneLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
++void cc_timezone_map_clear_location(CcTimezoneMap *map);
+
+ G_END_DECLS
+
+--
+1.8.4.2
+
diff --git a/0010-Allow-the-timezone-highlight-to-be-manually-set-sepa.patch b/0010-Allow-the-timezone-highlight-to-be-manually-set-sepa.patch
new file mode 100644
index 0000000..625397e
--- /dev/null
+++ b/0010-Allow-the-timezone-highlight-to-be-manually-set-sepa.patch
@@ -0,0 +1,171 @@
+From 7150253ea59ef6e3688057abc98abe9f9f1daf80 Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Tue, 26 Nov 2013 16:44:20 -0500
+Subject: [PATCH 10/10] Allow the timezone highlight to be manually set
+ separately from the location.
+
+Added selected-offset as a property and added get and set functions. Reworked
+the widget draw handler to allow drawing a highlight with no location.
+---
+ src/cc-timezone-map.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/cc-timezone-map.h | 2 ++
+ 2 files changed, 64 insertions(+), 1 deletion(-)
+
+diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
+index 1eab640..9d773ec 100644
+--- a/src/cc-timezone-map.c
++++ b/src/cc-timezone-map.c
+@@ -60,6 +60,7 @@ struct _CcTimezoneMapPrivate
+ gint olsen_map_rowstride;
+
+ gdouble selected_offset;
++ gboolean show_offset;
+
+ gchar *watermark;
+
+@@ -78,6 +79,11 @@ enum
+ LAST_SIGNAL
+ };
+
++enum {
++ PROP_0,
++ PROP_SELECTED_OFFSET,
++};
++
+ static guint signals[LAST_SIGNAL];
+
+
+@@ -513,8 +519,12 @@ cc_timezone_map_get_property (GObject *object,
+ GValue *value,
+ GParamSpec *pspec)
+ {
++ CcTimezoneMap *map = CC_TIMEZONE_MAP(object);
+ switch (property_id)
+ {
++ case PROP_SELECTED_OFFSET:
++ g_value_set_double(value, map->priv->selected_offset);
++ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+@@ -526,8 +536,12 @@ cc_timezone_map_set_property (GObject *object,
+ const GValue *value,
+ GParamSpec *pspec)
+ {
++ CcTimezoneMap *map = CC_TIMEZONE_MAP(object);
+ switch (property_id)
+ {
++ case PROP_SELECTED_OFFSET:
++ cc_timezone_map_set_selected_offset(map, g_value_get_double(value));
++ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+@@ -783,7 +797,7 @@ cc_timezone_map_draw (GtkWidget *widget,
+ cairo_stroke(cr);
+ }
+
+- if (!priv->location) {
++ if (!priv->show_offset) {
+ return TRUE;
+ }
+
+@@ -814,6 +828,10 @@ cc_timezone_map_draw (GtkWidget *widget,
+ g_object_unref (orig_hilight);
+ }
+
++ if (!priv->location) {
++ return TRUE;
++ }
++
+ /* load pin icon */
+ pin = gdk_pixbuf_new_from_file (DATADIR "/pin.png", &err);
+
+@@ -860,6 +878,14 @@ cc_timezone_map_class_init (CcTimezoneMapClass *klass)
+ widget_class->realize = cc_timezone_map_realize;
+ widget_class->draw = cc_timezone_map_draw;
+
++ g_object_class_install_property(G_OBJECT_CLASS(klass),
++ PROP_SELECTED_OFFSET,
++ g_param_spec_string ("selected-offset",
++ "Selected offset",
++ "The selecect offset from GMT in hours",
++ "",
++ G_PARAM_READWRITE));
++
+ signals[LOCATION_CHANGED] = g_signal_new ("location-changed",
+ CC_TYPE_TIMEZONE_MAP,
+ G_SIGNAL_RUN_FIRST,
+@@ -902,10 +928,12 @@ set_location (CcTimezoneMap *map,
+ 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->show_offset = TRUE;
+ tz_info_free (info);
+ }
+ else
+ {
++ priv->show_offset = FALSE;
+ priv->selected_offset = 0.0;
+ }
+
+@@ -1099,6 +1127,9 @@ cc_timezone_map_init (CcTimezoneMap *self)
+ priv->olsen_map_pixels = gdk_pixbuf_get_pixels (priv->olsen_map);
+ priv->olsen_map_rowstride = gdk_pixbuf_get_rowstride (priv->olsen_map);
+
++ priv->selected_offset = 0.0;
++ priv->show_offset = FALSE;
++
+ priv->tzdb = tz_load_db ();
+
+ g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event),
+@@ -1229,3 +1260,33 @@ cc_timezone_map_clear_location (CcTimezoneMap *map)
+ set_location(map, NULL);
+ gtk_widget_queue_draw (GTK_WIDGET (map));
+ }
++
++/**
++ * cc_timezone_map_get_selected_offset:
++ * @map: A #CcTimezoneMap
++ *
++ * Returns the currently selected offset in hours from GMT.
++ *
++ * Returns: The selected offset.
++ *
++ */
++gdouble cc_timezone_map_get_selected_offset(CcTimezoneMap *map)
++{
++ return map->priv->selected_offset;
++}
++
++/**
++ * cc_timezone_map_set_selected_offset:
++ * @map: A #CcTimezoneMap
++ * @offset: The offset from GMT in hours
++ *
++ * Set the currently selected offset for the map and redraw the highlighted
++ * time zone.
++ */
++void cc_timezone_map_set_selected_offset (CcTimezoneMap *map, gdouble offset)
++{
++ map->priv->selected_offset = offset;
++ map->priv->show_offset = TRUE;
++ g_object_notify(G_OBJECT(map), "selected-offset");
++ gtk_widget_queue_draw (GTK_WIDGET (map));
++}
+diff --git a/src/cc-timezone-map.h b/src/cc-timezone-map.h
+index 4737c0e..ba6bd37 100644
+--- a/src/cc-timezone-map.h
++++ b/src/cc-timezone-map.h
+@@ -83,6 +83,8 @@ const gchar * cc_timezone_map_get_timezone_at_coords (CcTimezoneMap *map,
+ gdouble lon, gdouble lat);
+ CcTimezoneLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
+ void cc_timezone_map_clear_location(CcTimezoneMap *map);
++gdouble cc_timezone_map_get_selected_offset(CcTimezoneMap *map);
++void cc_timezone_map_set_selected_offset (CcTimezoneMap *map, gdouble offset);
+
+ G_END_DECLS
+
+--
+1.8.4.2
+
diff --git a/libtimezonemap.spec b/libtimezonemap.spec
index 661796a..803b95c 100644
--- a/libtimezonemap.spec
+++ b/libtimezonemap.spec
@@ -1,13 +1,22 @@
Name: libtimezonemap
Version: 0.4.1
-Release: 1%{?dist}
+Release: 2%{?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
-Patch0: libtimezonemap-fsf-address.patch
+Patch0: 0001-Make-whitespace-and-indentation-consistent.patch
+Patch1: 0002-Update-the-GPL-comments-with-the-new-FSF-address.patch
+Patch2: 0003-Create-local-copies-of-string-properties.patch
+Patch3: 0004-Moved-CcTimezoneLocation-into-its-own-file.patch
+Patch4: 0005-Don-t-close-a-NULL-file-pointer.patch
+Patch5: 0006-Turn-on-and-fix-g-ir-scanner-warnings.patch
+Patch6: 0007-Added-a-.bzrignore-file-to-ignore-all-the-files-gene.patch
+Patch7: 0008-Ignore-the-INSTALL-file.patch
+Patch8: 0009-Added-a-function-to-clear-the-location-set-for-a-CcT.patch
+Patch9: 0010-Allow-the-timezone-highlight-to-be-manually-set-sepa.patch
BuildRequires: glib2-devel >= 2.26
BuildRequires: gtk3-devel >= 3.1.4
@@ -34,7 +43,16 @@ files used for building applications that use %{name}.
%prep
%setup -q
-%patch0 -p0
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
%build
./autogen.sh
@@ -62,5 +80,18 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_datadir}/gir-1.0/TimezoneMap-1.0.gir
%changelog
+* Tue Nov 26 2013 David Shea <dshea at redhat.com> - 0.4.1-2
+- Make whitespace and indentation consistent (iain.lane at canonical.com)
+- Switched to a git-formatted patch for the FSF address to make things easier
+ for me to track (dshea)
+- Create local copies of string properties. (dshea)
+- Moved CcTimezoneLocation into its own file. (dshea)
+- Don't close a NULL file pointer. (dshea)
+- Turn on and fix g-ir-scanner warnings. (dshea)
+- Added a .bzrignore file to ignore all the files generated by the build. (dshea)
+- Ignore the INSTALL file (dshea)
+- Added a function to clear the location set for a CcTimezoneMap (dshea)
+- Allow the timezone highlight to be manually set separately from the location. (dshea)
+
* Thu Nov 14 2013 David Shea <dshea at redhat.com> - 0.4.1-1
- Initial version
More information about the scm-commits
mailing list