Simplify calendar views
We don't need a split subscription update step in GcalView anymore, since subscribers communicate range directly to the timeline now.
This commit is contained in:
@@ -1202,32 +1202,6 @@ gcal_month_view_get_children_by_uuid (GcalView *view,
|
||||
return filter_event_list_by_uid_and_modtype (children, mod, uuid);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_month_view_update_subscription (GcalView *view)
|
||||
{
|
||||
g_autoptr (GDateTime) date_start = NULL;
|
||||
g_autoptr (GDateTime) date_end = NULL;
|
||||
GcalMonthView *self;
|
||||
time_t range_start;
|
||||
time_t range_end;
|
||||
|
||||
self = GCAL_MONTH_VIEW (view);
|
||||
|
||||
g_assert (self->date != NULL);
|
||||
date_start = g_date_time_new_local (g_date_time_get_year (self->date),
|
||||
g_date_time_get_month (self->date),
|
||||
1, 0, 0, 0);
|
||||
range_start = g_date_time_to_unix (date_start);
|
||||
|
||||
date_end = g_date_time_add_months (date_start, 1);
|
||||
range_end = g_date_time_to_unix (date_end);
|
||||
|
||||
gcal_manager_set_subscriber (gcal_context_get_manager (self->context),
|
||||
E_CAL_DATA_MODEL_SUBSCRIBER (self),
|
||||
range_start,
|
||||
range_end);
|
||||
}
|
||||
|
||||
static GDateTime*
|
||||
gcal_month_view_get_next_date (GcalView *view)
|
||||
{
|
||||
@@ -1254,7 +1228,6 @@ gcal_view_interface_init (GcalViewInterface *iface)
|
||||
iface->set_date = gcal_month_view_set_date;
|
||||
iface->clear_marks = gcal_month_view_clear_marks;
|
||||
iface->get_children_by_uuid = gcal_month_view_get_children_by_uuid;
|
||||
iface->update_subscription = gcal_month_view_update_subscription;
|
||||
iface->get_next_date = gcal_month_view_get_next_date;
|
||||
iface->get_previous_date = gcal_month_view_get_previous_date;
|
||||
}
|
||||
|
||||
@@ -192,25 +192,6 @@ gcal_view_get_children_by_uuid (GcalView *view,
|
||||
return GCAL_VIEW_GET_IFACE (view)->get_children_by_uuid (view, mod, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_view_update_subscription:
|
||||
* @self: a #GcalView
|
||||
*
|
||||
* Asks @self to update its #ECalDataModel subscription range. This
|
||||
* is called after gcal_view_set_date(), and it's safe to assume that
|
||||
* @self's active date is correct.
|
||||
*/
|
||||
void
|
||||
gcal_view_update_subscription (GcalView *self)
|
||||
{
|
||||
g_return_if_fail (GCAL_IS_VIEW (self));
|
||||
g_return_if_fail (GCAL_VIEW_GET_IFACE (self)->update_subscription);
|
||||
|
||||
g_debug ("Updating subscription of %s", G_OBJECT_TYPE_NAME (self));
|
||||
|
||||
GCAL_VIEW_GET_IFACE (self)->update_subscription (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_view_get_next_date:
|
||||
* @self: a #GcalView
|
||||
|
||||
@@ -48,8 +48,6 @@ struct _GcalViewInterface
|
||||
void (*set_date) (GcalView *view,
|
||||
GDateTime *date);
|
||||
|
||||
void (*update_subscription) (GcalView *self);
|
||||
|
||||
GDateTime* (*get_next_date) (GcalView *self);
|
||||
|
||||
GDateTime* (*get_previous_date) (GcalView *self);
|
||||
@@ -75,8 +73,6 @@ GList* gcal_view_get_children_by_uuid (GcalView
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid);
|
||||
|
||||
void gcal_view_update_subscription (GcalView *self);
|
||||
|
||||
GDateTime* gcal_view_get_next_date (GcalView *self);
|
||||
|
||||
GDateTime* gcal_view_get_previous_date (GcalView *self);
|
||||
|
||||
@@ -230,28 +230,6 @@ gcal_week_view_clear_marks (GcalView *view)
|
||||
gcal_week_grid_clear_marks (GCAL_WEEK_GRID (self->week_grid));
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_week_view_update_subscription (GcalView *view)
|
||||
{
|
||||
g_autoptr (GDateTime) date_start = NULL;
|
||||
g_autoptr (GDateTime) date_end = NULL;
|
||||
GcalWeekView *self;
|
||||
time_t range_start;
|
||||
time_t range_end;
|
||||
|
||||
self = GCAL_WEEK_VIEW (view);
|
||||
date_start = gcal_date_time_get_start_of_week (self->date);
|
||||
range_start = g_date_time_to_unix (date_start);
|
||||
|
||||
date_end = gcal_date_time_get_end_of_week (self->date);
|
||||
range_end = g_date_time_to_unix (date_end);
|
||||
|
||||
gcal_manager_set_subscriber (gcal_context_get_manager (self->context),
|
||||
E_CAL_DATA_MODEL_SUBSCRIBER (self),
|
||||
range_start,
|
||||
range_end);
|
||||
}
|
||||
|
||||
static GDateTime*
|
||||
gcal_week_view_get_next_date (GcalView *view)
|
||||
{
|
||||
@@ -278,7 +256,6 @@ gcal_view_interface_init (GcalViewInterface *iface)
|
||||
iface->set_date = gcal_week_view_set_date;
|
||||
iface->get_children_by_uuid = gcal_week_view_get_children_by_uuid;
|
||||
iface->clear_marks = gcal_week_view_clear_marks;
|
||||
iface->update_subscription = gcal_week_view_update_subscription;
|
||||
iface->get_next_date = gcal_week_view_get_next_date;
|
||||
iface->get_previous_date = gcal_week_view_get_previous_date;
|
||||
}
|
||||
|
||||
@@ -1787,28 +1787,6 @@ gcal_year_view_get_children_by_uuid (GcalView *view,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_year_view_update_subscription (GcalView *view)
|
||||
{
|
||||
g_autoptr (GDateTime) date_start = NULL;
|
||||
g_autoptr (GDateTime) date_end = NULL;
|
||||
GcalYearView *self;
|
||||
time_t range_start;
|
||||
time_t range_end;
|
||||
|
||||
self = GCAL_YEAR_VIEW (view);
|
||||
date_start = g_date_time_new_local (g_date_time_get_year (self->date), 1, 1, 0, 0, 0);
|
||||
range_start = g_date_time_to_unix (date_start);
|
||||
|
||||
date_end = g_date_time_add_years (date_start, 1);
|
||||
range_end = g_date_time_to_unix (date_end);
|
||||
|
||||
gcal_manager_set_subscriber (gcal_context_get_manager (self->context),
|
||||
E_CAL_DATA_MODEL_SUBSCRIBER (self),
|
||||
range_start,
|
||||
range_end);
|
||||
}
|
||||
|
||||
static GDateTime*
|
||||
gcal_year_view_get_next_date (GcalView *view)
|
||||
{
|
||||
@@ -1831,11 +1809,9 @@ gcal_year_view_get_previous_date (GcalView *view)
|
||||
static void
|
||||
gcal_view_interface_init (GcalViewInterface *iface)
|
||||
{
|
||||
/* FIXME: implement what's needed */
|
||||
iface->get_date = gcal_year_view_get_date;
|
||||
iface->set_date = gcal_year_view_set_date;
|
||||
iface->get_children_by_uuid = gcal_year_view_get_children_by_uuid;
|
||||
iface->update_subscription = gcal_year_view_update_subscription;
|
||||
iface->get_next_date = gcal_year_view_get_next_date;
|
||||
iface->get_previous_date = gcal_year_view_get_previous_date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user