diff options
author | Milan Crha <mcrha@redhat.com> | 2010-09-01 02:36:20 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-09-01 02:36:20 +0800 |
commit | 062a67cc1465d7a4d02b0308e4faaa5784d02af1 (patch) | |
tree | 64dd369215e2417da98676c92cda44978f2fb89d /calendar | |
parent | 96414281ab7be1080b1db902d6b5a6d83b256cc2 (diff) | |
download | gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar.gz gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar.bz2 gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar.lz gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar.xz gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.tar.zst gsoc2013-evolution-062a67cc1465d7a4d02b0308e4faaa5784d02af1.zip |
Bug #624021 - Honour weeks shown in a multi week view on print
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-cal-model.c | 4 | ||||
-rw-r--r-- | calendar/gui/print.c | 28 |
2 files changed, 28 insertions, 4 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index d0166b9f0e..a48fc5d8ca 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -2779,7 +2779,9 @@ e_cal_model_generate_instances (ECalModel *model, time_t start, time_t end, mdata.comp_data = comp_data; mdata.cb_data = cb_data; - e_cal_generate_instances_for_object (comp_data->client, comp_data->icalcomp, start, end, cb, &mdata); + + if (comp_data->instance_start < end && comp_data->instance_end > start) + e_cal_generate_instances_for_object (comp_data->client, comp_data->icalcomp, start, end, cb, &mdata); } } diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 1371f2d516..84ad29c8b9 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -1955,19 +1955,39 @@ print_month_summary (GtkPrintContext *context, GnomeCalendar *gcal, time_t whenc gchar buffer[100]; PangoFontDescription *font; gboolean compress_weekend; - gint columns, col, weekday, month; + gint columns, col, weekday, month, weeks; gdouble font_size, cell_width, x1, x2, y1, y2; weekday = calendar_config_get_week_start_day (); compress_weekend = calendar_config_get_compress_weekend (); + date = 0; + weeks = 6; + 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))) { + weeks = week_view->weeks_shown; + date = whence; + } + } + /* Remember which month we want. */ tt = icaltime_from_timet_with_zone (whence, FALSE, zone); month = tt.month - 1; /* Find the start of the month, and then the start of the week on or before that day. */ - date = time_month_begin_with_zone (whence, zone); + if (!date) + date = time_month_begin_with_zone (whence, zone); date = time_week_begin_with_zone (date, weekday, zone); /* If weekends are compressed then we can't start on a Sunday. */ @@ -2015,7 +2035,7 @@ print_month_summary (GtkPrintContext *context, GnomeCalendar *gcal, time_t whenc pango_font_description_free (font); top = y2; - print_week_summary (context, gcal, date, TRUE, 6, month, + print_week_summary (context, gcal, date, TRUE, weeks, month, MONTH_NORMAL_FONT_SIZE, left, right, top, bottom); } @@ -2517,6 +2537,8 @@ print_calendar (GnomeCalendar *gcal, start_tt.day = g_date_get_day (&date); start = icaltime_as_timet (start_tt); + } else if (week_view && week_view->multi_week_view) { + start = week_view->day_starts[0]; } } |