Remove gcal_event_set/get_original_timezones()
They are unused now. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/550>
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
d1ccbdf4fb
commit
63cf4374e4
@@ -1692,159 +1692,6 @@ gcal_event_get_recurrence (GcalEvent *self)
|
||||
return self->recurrence;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_event_get_original_timezones:
|
||||
* @self: a #GcalEvent
|
||||
* @out_start_timezone: (direction out)(nullable): the return location for the
|
||||
* previously stored start date timezone
|
||||
* @out_end_timezone: (direction out)(nullable): the return location for the
|
||||
* previously stored end date timezone
|
||||
*
|
||||
* Retrieves the start and end date timezones previously stored by
|
||||
* gcal_event_save_original_timezones().
|
||||
*
|
||||
* If gcal_event_save_original_timezones() wasn't called before,
|
||||
* it will use local timezones instead.
|
||||
*/
|
||||
void
|
||||
gcal_event_get_original_timezones (GcalEvent *self,
|
||||
GTimeZone **out_start_timezone,
|
||||
GTimeZone **out_end_timezone)
|
||||
{
|
||||
g_autoptr (GTimeZone) original_start_tz = NULL;
|
||||
g_autoptr (GTimeZone) original_end_tz = NULL;
|
||||
ICalComponent *icalcomp;
|
||||
ICalProperty *property;
|
||||
|
||||
g_return_if_fail (GCAL_IS_EVENT (self));
|
||||
g_assert (self->component != NULL);
|
||||
|
||||
icalcomp = e_cal_component_get_icalcomponent (self->component);
|
||||
|
||||
for (property = i_cal_component_get_first_property (icalcomp, I_CAL_X_PROPERTY);
|
||||
property;
|
||||
g_object_unref (property), property = i_cal_component_get_next_property (icalcomp, I_CAL_X_PROPERTY))
|
||||
{
|
||||
const gchar *value;
|
||||
|
||||
if (original_start_tz && original_end_tz)
|
||||
{
|
||||
g_object_unref (property);
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (i_cal_property_get_x_name (property), "X-GNOME-CALENDAR-ORIGINAL-TZ-START") == 0)
|
||||
{
|
||||
value = i_cal_property_get_x (property);
|
||||
original_start_tz = g_time_zone_new_identifier (value);
|
||||
|
||||
GCAL_TRACE_MSG ("Found X-GNOME-CALENDAR-ORIGINAL-TZ-START=%s", value);
|
||||
}
|
||||
else if (g_strcmp0 (i_cal_property_get_x_name (property), "X-GNOME-CALENDAR-ORIGINAL-TZ-END") == 0)
|
||||
{
|
||||
value = i_cal_property_get_x (property);
|
||||
original_end_tz = g_time_zone_new_identifier (value);
|
||||
|
||||
GCAL_TRACE_MSG ("Found X-GNOME-CALENDAR-ORIGINAL-TZ-END=%s", value);
|
||||
}
|
||||
}
|
||||
|
||||
if (!original_start_tz)
|
||||
original_start_tz = g_time_zone_new_local ();
|
||||
|
||||
if (!original_end_tz)
|
||||
original_end_tz = g_time_zone_new_local ();
|
||||
|
||||
g_assert (original_start_tz != NULL);
|
||||
g_assert (original_end_tz != NULL);
|
||||
|
||||
if (out_start_timezone)
|
||||
*out_start_timezone = g_steal_pointer (&original_start_tz);
|
||||
|
||||
if (out_end_timezone)
|
||||
*out_end_timezone = g_steal_pointer (&original_end_tz);
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_event_save_original_timezones:
|
||||
* @self: a #GcalEvent
|
||||
*
|
||||
* Stores the current timezones of the start and end dates of @self
|
||||
* into separate, GNOME Calendar specific fields. These fields can
|
||||
* be used by gcal_event_get_original_timezones() to retrieve the
|
||||
* previous timezones of the event later.
|
||||
*/
|
||||
void
|
||||
gcal_event_save_original_timezones (GcalEvent *self)
|
||||
{
|
||||
ICalComponent *icalcomp;
|
||||
ICalProperty *property;
|
||||
GTimeZone *tz;
|
||||
gboolean has_original_start_tz;
|
||||
gboolean has_original_end_tz;
|
||||
|
||||
GCAL_ENTRY;
|
||||
|
||||
g_return_if_fail (GCAL_IS_EVENT (self));
|
||||
g_assert (self->component != NULL);
|
||||
|
||||
has_original_start_tz = FALSE;
|
||||
has_original_end_tz = FALSE;
|
||||
icalcomp = e_cal_component_get_icalcomponent (self->component);
|
||||
|
||||
for (property = i_cal_component_get_first_property (icalcomp, I_CAL_X_PROPERTY);
|
||||
property && (!has_original_start_tz || !has_original_end_tz);
|
||||
g_object_unref (property), property = i_cal_component_get_next_property (icalcomp, I_CAL_X_PROPERTY))
|
||||
{
|
||||
if (g_strcmp0 (i_cal_property_get_x_name (property), "X-GNOME-CALENDAR-ORIGINAL-TZ-START") == 0)
|
||||
{
|
||||
tz = g_date_time_get_timezone (self->dt_start);
|
||||
i_cal_property_set_x (property, g_time_zone_get_identifier (tz));
|
||||
|
||||
GCAL_TRACE_MSG ("Reusing X-GNOME-CALENDAR-ORIGINAL-TZ-START property with %s", i_cal_property_get_x (property));
|
||||
|
||||
has_original_start_tz = TRUE;
|
||||
}
|
||||
else if (g_strcmp0 (i_cal_property_get_x_name (property), "X-GNOME-CALENDAR-ORIGINAL-TZ-END") == 0)
|
||||
{
|
||||
tz = g_date_time_get_timezone (self->dt_end);
|
||||
i_cal_property_set_x (property, g_time_zone_get_identifier (tz));
|
||||
|
||||
GCAL_TRACE_MSG ("Reusing X-GNOME-CALENDAR-ORIGINAL-TZ-END property with %s", i_cal_property_get_x (property));
|
||||
|
||||
has_original_end_tz = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
g_clear_object (&property);
|
||||
|
||||
if (!has_original_start_tz)
|
||||
{
|
||||
tz = g_date_time_get_timezone (self->dt_start);
|
||||
property = i_cal_property_new_x (g_time_zone_get_identifier (tz));
|
||||
i_cal_property_set_x_name (property, "X-GNOME-CALENDAR-ORIGINAL-TZ-START");
|
||||
|
||||
GCAL_TRACE_MSG ("Added new X-GNOME-CALENDAR-ORIGINAL-TZ-START property with %s", i_cal_property_get_x (property));
|
||||
|
||||
i_cal_component_take_property (icalcomp, property);
|
||||
}
|
||||
|
||||
if (!has_original_end_tz)
|
||||
{
|
||||
tz = g_date_time_get_timezone (self->dt_end);
|
||||
property = i_cal_property_new_x (g_time_zone_get_identifier (tz));
|
||||
i_cal_property_set_x_name (property, "X-GNOME-CALENDAR-ORIGINAL-TZ-END");
|
||||
|
||||
GCAL_TRACE_MSG ("Added new X-GNOME-CALENDAR-ORIGINAL-TZ-END property with %s", i_cal_property_get_x (property));
|
||||
|
||||
i_cal_component_take_property (icalcomp, property);
|
||||
}
|
||||
|
||||
e_cal_component_commit_sequence (self->component);
|
||||
|
||||
GCAL_EXIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_event_format_date:
|
||||
* @self: a #GcalEvent
|
||||
|
||||
@@ -128,12 +128,6 @@ void gcal_event_set_recurrence (GcalEvent
|
||||
|
||||
GcalRecurrence* gcal_event_get_recurrence (GcalEvent *self);
|
||||
|
||||
void gcal_event_save_original_timezones (GcalEvent *self);
|
||||
|
||||
void gcal_event_get_original_timezones (GcalEvent *self,
|
||||
GTimeZone **start_tz,
|
||||
GTimeZone **end_tz);
|
||||
|
||||
gchar* gcal_event_format_date (GcalEvent *self);
|
||||
|
||||
gboolean gcal_event_overlaps (GcalEvent *self,
|
||||
|
||||
Reference in New Issue
Block a user