[gnome-calendar/new-year-view] month-view: optimize days_delay update
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/new-year-view] month-view: optimize days_delay update
- Date: Tue, 20 Jan 2015 15:01:59 +0000 (UTC)
commit 28cfda44805ac005b4567acd6dcae2418cb94966
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Tue Jan 20 01:08:55 2015 -0500
month-view: optimize days_delay update
No need of memory allocation and releasing which is costly.
src/gcal-month-view.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index ddcc7d0..56e5dd5 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -1692,19 +1692,12 @@ void
gcal_month_view_set_first_weekday (GcalMonthView *view,
gint day_nr)
{
- GcalMonthViewPrivate *priv;
- icaltimetype *date;
+ GcalMonthViewPrivate *priv = gcal_month_view_get_instance_private (view);
- priv = gcal_month_view_get_instance_private (view);
priv->first_weekday = day_nr;
-
/* update days_delay */
if (priv->date != NULL)
- {
- date = gcal_month_view_get_initial_date (GCAL_VIEW (view));
- priv->days_delay = (icaltime_day_of_week (*date) - priv->first_weekday + 6) % 7;
- g_free (date);
- }
+ priv->days_delay = (time_day_of_week (1, priv->date->month - 1, priv->date->year) - priv->first_weekday
+ 7) % 7;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]