[gnome-calendar/ui-rewrite] manager: add back dates marking range



commit c131c9ee80cc73131736a13610a599ef58e6ed24
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Wed Oct 15 00:34:42 2014 -0400

    manager: add back dates marking range

 src/gcal-manager.c |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index b36f2ce..2665f5a 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -400,6 +400,8 @@ on_view_objects_added (ECalClientView *view,
                      0,
                      events_data);
 
+      /* Releases only GcalEventData, the ECalComponent its passed
+       * into the event widgets */
       g_slist_free_full (events_data, g_free);
     }
 
@@ -582,6 +584,16 @@ gcal_manager_init (GcalManager *self)
   priv = gcal_manager_get_instance_private (self);
 
   priv->system_timezone = e_cal_util_get_system_timezone ();
+  priv->initial_date = g_new(icaltimetype, 1);
+  *(priv->initial_date) = icaltime_from_timet_with_zone (time (NULL),
+                                                         0,
+                                                         priv->system_timezone);
+  priv->final_date = gcal_dup_icaltime (priv->initial_date);
+
+  *(priv->initial_date) = icaltime_set_timezone (priv->initial_date,
+                                                 priv->system_timezone);
+  *(priv->final_date) = icaltime_set_timezone (priv->final_date,
+                                               priv->system_timezone);
 
   priv->clients = g_hash_table_new_full ((GHashFunc) e_source_hash,
                                          (GEqualFunc) e_source_equal,
@@ -638,6 +650,11 @@ gcal_manager_finalize (GObject *object)
 
   priv = gcal_manager_get_instance_private (GCAL_MANAGER (object));
 
+  if (priv->initial_date != NULL)
+    g_free (priv->initial_date);
+  if (priv->final_date != NULL)
+    g_free (priv->final_date);
+
   g_hash_table_destroy (priv->clients);
 }
 
@@ -909,14 +926,23 @@ gcal_manager_set_new_range (GcalManager        *manager,
 
   priv = gcal_manager_get_instance_private (manager);
 
+  /* updating query range */
+  if ((icaltime_compare (*(priv->initial_date), *initial_date)) == 1)
+    *(priv->initial_date) = *initial_date;
+
+  if (icaltime_compare (*(priv->final_date), *final_date) == -1)
+    *(priv->final_date) = *final_date;
+
   /* rebuild query */
   since_iso8601 =
-    isodate_from_time_t (icaltime_as_timet_with_zone (*initial_date,
-                                                      priv->system_timezone));
+    isodate_from_time_t (
+        icaltime_as_timet_with_zone (*(priv->initial_date),
+                                     priv->system_timezone));
 
   until_iso8601 =
-    isodate_from_time_t (icaltime_as_timet_with_zone (*final_date,
-                                                      priv->system_timezone));
+    isodate_from_time_t (
+        icaltime_as_timet_with_zone (*(priv->final_date),
+                                     priv->system_timezone));
 
   if (priv->query != NULL)
     g_free (priv->query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]