manager: add back dates marking range
This commit is contained in:
+30
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user