dates (0.4.8-3) 05_timezone_of_today.patch

Summary

 src/dates_callbacks.c |    4 +++-
 src/dates_view.c      |   22 +++++++++++++++++++++-
 src/dates_view.h      |    1 +
 3 files changed, 25 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

Description: "today" was not compensating for the current timezone.
Author: Israel Cepeda
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=646035
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dates/+bug/696658

--- a/src/dates_callbacks.c
+++ b/src/dates_callbacks.c
@@ -94,7 +94,9 @@
 void
 dates_today_cb (GtkButton *button, DatesData *data)
 {
-    icaltimetype today = icaltime_today ();
+    icaltimezone* zone = dates_view_get_zone (data->view);
+    icaltimetype today = icaltime_current_time_with_zone (zone);
+    icaltime_adjust (&today, 0, today.hour * -1, today.minute * -1, today.second * -1);
     dates_view_set_date (data->view, &today);
 }
 
--- a/src/dates_view.c
+++ b/src/dates_view.c
@@ -1428,7 +1428,8 @@
 	gtk_widget_modify_bg (priv->top, GTK_STATE_NORMAL, &colour);
 	//priv->adjust = GTK_ADJUSTMENT (gtk_adjustment_new (8, 0, 13, 1, 1, 1));
 	priv->date = g_new (icaltimetype, 1);
-	*priv->date = icaltime_today ();
+	*priv->date = icaltime_current_time_with_zone (priv->zone);
+	icaltime_adjust (priv->date, 0, (*priv->date).hour * -1, (*priv->date).minute * -1, (*priv->date).second * -1);
 	dates_view_get_visible_span (view, &priv->start, &priv->end);
 	dates_view_get_visible_cspan (view, &priv->cstart, &priv->cend);
 	
@@ -5446,6 +5447,25 @@
 	return priv->date;
 }
 
+/** dates_view_get_zone:
+ * @view:	The #DatesView widget to get the selected zone of
+ *
+ * Retrieves the current active zone of @view
+ *
+ * Return value: @view's active zone
+ **/
+const icaltimezone *
+dates_view_get_zone (DatesView *view)
+{
+	DatesViewPrivate *priv;
+
+	g_return_val_if_fail (DATES_IS_VIEW (view), NULL);
+
+	priv = DATES_VIEW_GET_PRIVATE (view);
+
+	return priv->zone;
+}
+
 /** dates_view_get_use_list:
  * @view:	The #DatesView widget to get the view preference of
  *
--- a/src/dates_view.h
+++ b/src/dates_view.h
@@ -103,6 +103,7 @@
 guint 		dates_view_get_visible_days 	(DatesView *view);
 guint 		dates_view_get_visible_hours 	(DatesView *view);
 const icaltimetype *dates_view_get_date 	(DatesView *view);
+const icaltimezone *dates_view_get_zone 	(DatesView *view);
 gboolean	dates_view_get_use_list		(DatesView *view);
 gboolean	dates_view_get_use_24h		(DatesView *view);
 void            dates_view_get_visible_span     (DatesView *view,