From ed4bb8a09293f4eb59716f32ec62d3a39e33527a Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Fri, 22 Aug 2008 09:14:29 +0000 Subject: Make it show "Tasks" for printing tasks list and "Calendar" for printing a calendar. Patch by Rouslan Solomakhin . Fixes bug 547822. svn path=/trunk/; revision=36035 --- calendar/ChangeLog | 9 +++++++++ calendar/gui/print.c | 24 ++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8d1deed13d..630ae57896 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2008-08-22 Tobias Mueller + + * gui/print.c (print_table_draw_page): + Make it show "Tasks" for printing tasks list and "Calendar" for + printing a calendar. Patch by + Rouslan Solomakhin + + ** Fixes bug 547822 + 2008-08-18 Milan Crha ** Part of fix for bug #462242 diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 9caf4fbdf9..dd990739e6 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -2744,11 +2744,16 @@ print_title (GtkPrintContext *context, const gchar *text, gdouble page_width) pango_font_description_free (desc); } +struct print_opts { + EPrintable *printable; + gchar *print_header; +}; + static void print_table_draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, - EPrintable *printable) + struct print_opts *opts) { GtkPageSetup *setup; gdouble width; @@ -2759,13 +2764,15 @@ print_table_draw_page (GtkPrintOperation *operation, do { /* TODO Allow the user to customize the title. */ - print_title (context, _("Upcoming Appointments"), width); + print_title (context, opts->print_header, width); - if (e_printable_data_left (printable)) + if (e_printable_data_left (opts->printable)) e_printable_print_page ( - printable, context, width, 24, TRUE); + opts->printable, context, width, 24, TRUE); - } while (e_printable_data_left (printable)); + } while (e_printable_data_left (opts->printable)); + + free(opts); } void @@ -2774,6 +2781,7 @@ print_table (ETable *table, const gchar *dialog_title, { GtkPrintOperation *operation; EPrintable *printable; + struct print_opts *opts; printable = e_table_get_printable (table); g_object_ref_sink (printable); @@ -2782,9 +2790,13 @@ print_table (ETable *table, const gchar *dialog_title, operation = e_print_operation_new (); gtk_print_operation_set_n_pages (operation, 1); + opts = malloc(sizeof(struct print_opts)); + opts->printable = printable; + opts->print_header = print_header; + g_signal_connect ( operation, "draw_page", - G_CALLBACK (print_table_draw_page), printable); + G_CALLBACK (print_table_draw_page), opts); gtk_print_operation_run (operation, action, NULL, NULL); -- cgit