[evolution/kill-bonobo] Bug #324676 - Print preview displays preview of previous month



commit ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Aug 3 12:03:40 2009 +0200

    Bug #324676 - Print preview displays preview of previous month

 calendar/gui/print.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 1a8e5a1..b68320e 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -2390,7 +2390,8 @@ print_calendar_draw_page (GtkPrintOperation *operation,
 }
 
 void
-print_calendar (GnomeCalendar *gcal, GtkPrintOperationAction action,
+print_calendar (GnomeCalendar *gcal,
+                GtkPrintOperationAction action,
                 time_t start)
 {
 	GtkPrintOperation *operation;
@@ -2399,6 +2400,34 @@ print_calendar (GnomeCalendar *gcal, GtkPrintOperationAction action,
 	g_return_if_fail (gcal != NULL);
 	g_return_if_fail (GNOME_IS_CALENDAR (gcal));
 
+	if (gnome_calendar_get_view (gcal) == GNOME_CAL_MONTH_VIEW) {
+		GnomeCalendarViewType view_type;
+		ECalendarView *calendar_view;
+		EWeekView *week_view;
+
+		view_type = gnome_calendar_get_view (gcal);
+		calendar_view = gnome_calendar_get_calendar_view (gcal, view_type);
+		week_view = E_WEEK_VIEW (calendar_view);
+
+		if (week_view && week_view->multi_week_view &&
+			week_view->weeks_shown >= 4 &&
+			g_date_valid (&week_view->first_day_shown)) {
+
+			GDate date = week_view->first_day_shown;
+			struct icaltimetype start_tt;
+
+			g_date_add_days (&date, 7);
+
+			start_tt = icaltime_null_time ();
+			start_tt.is_date = TRUE;
+			start_tt.year = g_date_get_year (&date);
+			start_tt.month = g_date_get_month (&date);
+			start_tt.day = g_date_get_day (&date);
+
+			start = icaltime_as_timet (start_tt);
+		}
+	}
+
 	pcali.gcal = (GnomeCalendar *)gcal;
 	pcali.start = start;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]