From 8531fedde9e19a00364d5c76969d65f37947877f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Wed, 5 Nov 2014 12:23:05 -0500 Subject: [PATCH] month-view: optimize set :date property There's no need to calculate first day of month date twice. --- src/gcal-month-view.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index d2cce1cb..17c9621a 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -233,7 +233,6 @@ gcal_month_view_set_property (GObject *object, { case PROP_DATE: { - icaltimetype *first_of_month; time_t range_start, range_end; icaltimetype *date; icaltimezone* default_zone; @@ -243,14 +242,11 @@ gcal_month_view_set_property (GObject *object, priv->date = g_value_dup_boxed (value); - first_of_month = gcal_dup_icaltime (priv->date); - first_of_month->day = 1; - priv->days_delay = icaltime_day_of_week (*first_of_month) - 1; - g_free (first_of_month); + date = gcal_view_get_initial_date (GCAL_VIEW (object)); + priv->days_delay = icaltime_day_of_week (*date) - 1; default_zone = gcal_manager_get_system_timezone (priv->manager); - date = gcal_view_get_initial_date (GCAL_VIEW (object)); range_start = icaltime_as_timet_with_zone (*date, default_zone); g_free (date);