76 lines
2.2 KiB
Diff
76 lines
2.2 KiB
Diff
From 8ab1e71acd1ca7efbca2d8a4085c2547abe17e26 Mon Sep 17 00:00:00 2001
|
|
From: David Shea <dshea@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
|
|
|