view: Remove first weekday helpers when unecessary

Not all views need to know the first weekday, and those
who need, it can be stored internally.
This commit is contained in:
Georges Basile Stavracas Neto
2018-01-28 10:20:19 -02:00
parent 30ba757c40
commit 037567209c
10 changed files with 6 additions and 116 deletions
+3 -25
View File
@@ -2190,6 +2190,9 @@ gcal_month_view_init (GcalMonthView *self)
self->overflow_cells = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_list_free);
self->pending_event_allocation = FALSE;
/* First weekday */
self->first_weekday = get_first_weekday ();
/* Weekday header labels */
self->weekday_label[0] = self->label_0;
self->weekday_label[1] = self->label_1;
@@ -2216,28 +2219,3 @@ gcal_month_view_init (GcalMonthView *self)
self);
}
/* Public API */
/**
* gcal_month_view_set_first_weekday:
* @view: A #GcalMonthView instance
* @day_nr: Integer representing the first day of the week
*
* Set the first day of the week according to the locale, being
* 0 for Sunday, 1 for Monday and so on.
*/
void
gcal_month_view_set_first_weekday (GcalMonthView *self,
gint day_nr)
{
g_return_if_fail (GCAL_IS_MONTH_VIEW (self));
self->first_weekday = day_nr;
/* update days_delay */
if (self->date)
self->days_delay = (time_day_of_week (1, self->date->month - 1, self->date->year) - self->first_weekday + 7) % 7;
update_weekday_labels (self);
}