[gnome-calendar] gcal-month-view: fixed days number drawing
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] gcal-month-view: fixed days number drawing
- Date: Thu, 4 Dec 2014 22:27:39 +0000 (UTC)
commit 65bc0d1269c899bed659307e48cb6dedcd915e36
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Jul 4 09:04:46 2013 -0400
gcal-month-view: fixed days number drawing
Updated GcalMonthViewPrivate:days_delay on every day update
src/gcal-month-view.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index b6e9169..80e346f 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -229,11 +229,21 @@ gcal_month_view_set_property (GObject *object,
switch (property_id)
{
case PROP_DATE:
- if (priv->date != NULL)
- g_free (priv->date);
+ {
+ icaltimetype *first_of_month;
- priv->date = g_value_dup_boxed (value);
- break;
+ if (priv->date != NULL)
+ g_free (priv->date);
+
+ 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);
+
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -520,6 +530,7 @@ gcal_month_view_draw (GtkWidget *widget,
priv = gcal_month_view_get_instance_private (GCAL_MONTH_VIEW (widget));
+ /* fonts and colors selection */
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
@@ -557,6 +568,7 @@ gcal_month_view_draw (GtkWidget *widget,
gtk_style_context_restore (context);
+ /* calculations */
days = priv->days_delay + icaltime_days_in_month (priv->date->month, priv->date->year);
shown_rows = ceil (days / 7.0);
february_gap = shown_rows == 4 ? 1 : 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]