From cc97783a2a994e6e95205bf95730c64ee8a69af4 Mon Sep 17 00:00:00 2001 From: flywire Date: Mon, 6 Feb 2023 00:39:07 +1100 Subject: [PATCH] Report title option --- gnucash/report/reports/example/sample-report.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gnucash/report/reports/example/sample-report.scm b/gnucash/report/reports/example/sample-report.scm index cfebac08f8..c46630fc83 100644 --- a/gnucash/report/reports/example/sample-report.scm +++ b/gnucash/report/reports/example/sample-report.scm @@ -34,6 +34,10 @@ (debug-enable 'backtrace) +;; initialise values +(define optname-report-title (N_ "Report Title")) +(define opthelp-report-title (N_ "Title for this report.")) + ;; This function will generate a set of options that GnuCash ;; will use to display a dialog where the user can select ;; values for your report's parameters. @@ -163,6 +167,12 @@ Your reports probably shouldn't have an \ option like this.") #f) + ;; This is a Report Title option using constants defined at the + ;; beginning of the file. + (gnc-register-string-option optiondb + (N_ "Testing") optname-report-title + "c" opthelp-report-title (N_ "Report Title Default")) + ;; Setting a default section is optional but set in most reports. ;; If not set, the default section will be the first section. (gnc:options-set-default-section options "Tab B") @@ -200,6 +210,7 @@ option like this.") (list-val (op-value "Tab A" "A list option")) (radio-val (op-value "Tab A" "A Radio Button option")) (crash-val (op-value "Testing" "Crash the report")) + (report-title (op-value "Testing" optname-report-title)) ;; document will be the HTML document that we return. (document (gnc:make-html-document))) @@ -263,7 +274,7 @@ option like this.") ;; translation of the given string is available for the ;; current locale, then the translation is returned, ;; otherwise the original string is returned. - (gnc:html-document-set-title! document (G_ "Report Title")) + (gnc:html-document-set-title! document report-title) ;; we make a "text object" to add a bunch of text to. ;; the function gnc:make-html-text can take any number of