aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-08-03 18:03:40 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-11 09:39:44 +0800
commitebb0e84a8c9d815eb23570c03f5fbcf416c4e35b (patch)
treecd6376ec966366424f36ab9fda314416a3f8449b
parent4d41e52eecf1810cbec3d371fe5dbe42e6167a05 (diff)
downloadgsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar.gz
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar.bz2
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar.lz
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar.xz
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.tar.zst
gsoc2013-evolution-ebb0e84a8c9d815eb23570c03f5fbcf416c4e35b.zip
Bug #324676 - Print preview displays preview of previous month
-rw-r--r--calendar/gui/print.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 1a8e5a1d76..b68320e449 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;