aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/print.c')
-rw-r--r--calendar/gui/print.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 48be727e40..e6563cd846 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -43,7 +43,6 @@
#include <e-util/e-print.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "e-cal-model.h"
#include "e-day-view.h"
@@ -677,7 +676,7 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
sprintf (buf, "%d", day);
/* this is a slow messy way to do this ... but easy ... */
- e_cal_model_generate_instances (gnome_calendar_get_calendar_model (gcal), now,
+ e_cal_model_generate_instances (gnome_calendar_get_model (gcal), now,
time_day_end_with_zone (now, zone),
instance_cb, &found);
@@ -1248,7 +1247,7 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
double font_size, max_font_size;
cairo_t *cr;
- ECalModel *model = gnome_calendar_get_calendar_model (gcal);
+ ECalModel *model = gnome_calendar_get_model (gcal);
start = time_day_begin_with_zone (whence, zone);
end = time_day_end_with_zone (start, zone);
@@ -1734,7 +1733,7 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
GArray *spans;
PangoFontDescription *font;
double cell_width, cell_height;
- ECalModel *model = gnome_calendar_get_calendar_model (gcal);
+ ECalModel *model = gnome_calendar_get_model (gcal);
psi.days_shown = weeks_shown * 7;
psi.events = g_array_new (FALSE, FALSE, sizeof (EWeekViewEvent));
@@ -1947,6 +1946,7 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal,
time_t start, time_t end,
double left, double right, double top, double bottom)
{
+#if 0 /* KILL-BONOBO */
PangoFontDescription *font_summary;
double y, yend, x, xend;
struct icaltimetype *tt;
@@ -2035,6 +2035,7 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal,
}
pango_font_description_free (font_summary);
+#endif
}
static void
@@ -2389,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;
@@ -2398,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;