gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Dec 23 13:07:13 EST 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/c8eb55bb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/40c55899 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cec27308 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/58147ea4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3c406c93 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e79fe2f2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/018d5d8d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/48259600 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/30b2c0bc (commit)
	from  https://github.com/Gnucash/gnucash/commit/80c015d6 (commit)



commit c8eb55bb34875545d22e55c261521858d7e05ccd
Merge: 80c015d6d 40c55899b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 23 10:04:46 2022 -0800

    Merge John Ralls's c++options reprise into master.


commit 40c55899bc0a48b981f5c345459df4a0342f96d2
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 23 10:01:52 2022 -0800

    [c++options] Convert remaining reports and tests to new API.

diff --git a/bindings/guile/options.scm b/bindings/guile/options.scm
index 50fb66095..f72c08deb 100644
--- a/bindings/guile/options.scm
+++ b/bindings/guile/options.scm
@@ -82,7 +82,7 @@
 (define-public (gnc:color-option->hex-string opt)
   (format #f "~a" (GncOption-get-value opt)))
 
-(define-public (gnc:option-get-value book category key)
+(define-public (gnc:book-get-option-value book category key)
   (define acc (if (pair? key) cons list))
   (qof-book-get-option book (acc category key)))
 
@@ -408,11 +408,11 @@
 
 (define (gnc:company-info book key)
   ;; Access company info from key-value pairs for current book
- (gnc:option-get-value book gnc:*business-label* key))
+ (gnc:book-get-option-value book gnc:*business-label* key))
 
 (define (gnc:fancy-date-info book key)
   ;; Access fancy date info from key-value pairs for current book
- (gnc:option-get-value book gnc:*business-label* (list gnc:*fancy-date-label* key)))
+ (gnc:book-get-option-value book gnc:*business-label* (list gnc:*fancy-date-label* key)))
 
 
 
diff --git a/gnucash/report/reports/example/average-balance.scm b/gnucash/report/reports/example/average-balance.scm
index a27217961..f5f0ec135 100644
--- a/gnucash/report/reports/example/average-balance.scm
+++ b/gnucash/report/reports/example/average-balance.scm
@@ -52,91 +52,78 @@
   ;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define (options-generator)
-  (let* ((options (gnc:new-options))
-         ;; register a configuration option for the report
-         (register-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))      
+  (let ((options (gnc-new-optiondb)))
 
     ;; General tab
     (gnc:options-add-date-interval!
      options gnc:pagename-general optname-from-date optname-to-date "a")
 
-    (gnc:options-add-interval-choice! 
+    (gnc:options-add-interval-choice!
      options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
 
     ;; Report's currency
-    (gnc:options-add-currency! 
+    (gnc:options-add-currency!
      options gnc:pagename-general optname-report-currency "c")
-    
-    (gnc:options-add-price-source! 
+
+    (gnc:options-add-price-source!
      options gnc:pagename-general
      optname-price-source "d" 'weighted-average)
 
     ;; Account tab
-    (register-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-subacct
-      "a" (N_ "Include sub-accounts of all selected accounts.") #t))
+      "a" (N_ "Include sub-accounts of all selected accounts.") #t)
 
-    (register-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-internal
       "b"
       (N_ "Exclude transactions that only involve two accounts, both of which are selected below. This only affects the profit and loss columns of the table.")
-      #f))
+      #f)
 
     ;; account(s) to do report on
-    (register-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts (N_ "Accounts")
       "c" (N_ "Do transaction report on this account.")
-      (lambda ()
-        ;; FIXME : gnc:get-current-accounts disappeared
-        (let ((current-accounts '()))
-          ;; If some accounts were selected, use those
-          (cond ((not (null? current-accounts)) 
-                 current-accounts)
-                (else
-                 ;; otherwise get some accounts -- here as an
-                 ;; example we get the asset and liability stuff
-                 (gnc:filter-accountlist-type
-                  (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
-                        ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
-                        ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE)
-                  ;; or: (list ACCT-TYPE-BANK ACCT-TYPE-CASH
-                  ;; ACCT-TYPE-CHECKING ACCT-TYPE-SAVINGS ACCT-TYPE-STOCK
-                  ;; ACCT-TYPE-MUTUAL ACCT-TYPE-MONEYMRKT)
-                  (gnc-account-get-children-sorted (gnc-get-current-root-account)))))))
-      #f #t))
+      (let ((current-accounts '()))
+        ;; If some accounts were selected, use those
+        (cond ((not (null? current-accounts)) 
+               current-accounts)
+              (else
+               ;; otherwise get some accounts -- here as an
+               ;; example we get the asset and liability stuff
+               (gnc-account-list-from-types (gnc-get-current-book)
+                (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
+                      ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
+                      ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE)
+                ;; or: (list ACCT-TYPE-BANK ACCT-TYPE-CASH
+                ;; ACCT-TYPE-CHECKING ACCT-TYPE-SAVINGS ACCT-TYPE-STOCK
+                ;; ACCT-TYPE-MUTUAL ACCT-TYPE-MONEYMRKT)
+                )))))
 
     ;; Display tab
-    (register-option
-     (gnc:make-simple-boolean-option
+     (gnc-register-simple-boolean-option options
       gnc:pagename-display (N_ "Show table")
-      "a" (N_ "Display a table of the selected data.") #f))
+      "a" (N_ "Display a table of the selected data.") #f)
 
-    (register-option
-     (gnc:make-simple-boolean-option
+     (gnc-register-simple-boolean-option options
       gnc:pagename-display (N_ "Show plot")
-      "b" (N_ "Display a graph of the selected data.") #t))
+      "b" (N_ "Display a graph of the selected data.") #t)
 
-    (register-option
-     (gnc:make-list-option
+     (gnc-register-list-option options
       gnc:pagename-display (N_ "Plot Type")
-      "c" (N_ "The type of graph to generate.") (list 'AvgBalPlot)
+      "c" (N_ "The type of graph to generate.") "AvgBalPlot"
       (list 
        (vector 'AvgBalPlot (N_ "Average"))
        (vector 'GainPlot (N_ "Profit"))
-       (vector 'GLPlot (N_ "Gain/Loss")))))
+       (vector 'GLPlot (N_ "Gain/Loss"))))
 
-    (gnc:options-add-plot-size! 
-     options gnc:pagename-display 
+    (gnc:options-add-plot-size!
+     options gnc:pagename-display
      optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
 
     ;; Set the general page as default option tab
-    (gnc:options-set-default-section options gnc:pagename-general)      
-    
+    (GncOptionDBPtr-set-default-section options gnc:pagename-general)
+
     options))
 
   ;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -273,8 +260,7 @@
 (define (renderer report-obj)
 
   (define (get-option section name)
-    (gnc:option-value 
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (gnc:report-starting reportname)
   (let* ((report-title (get-option gnc:pagename-general 
diff --git a/gnucash/report/reports/example/daily-reports.scm b/gnucash/report/reports/example/daily-reports.scm
index 239aa39cc..57772cd2a 100644
--- a/gnucash/report/reports/example/daily-reports.scm
+++ b/gnucash/report/reports/example/daily-reports.scm
@@ -66,47 +66,35 @@
 ;; is the list of account types that the account selection option
 ;; accepts.
 (define (options-generator account-types)
-  (let* ((options (gnc:new-options))
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     (gnc:options-add-date-interval!
      options gnc:pagename-general
      optname-from-date optname-to-date "a")
 
-    (gnc:options-add-currency! 
+    (gnc:options-add-currency!
      options gnc:pagename-general optname-report-currency "b")
-    
-    (gnc:options-add-price-source! 
+
+    (gnc:options-add-price-source!
      options gnc:pagename-general
      optname-price-source "c" 'weighted-average)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-subacct
-      "a" (N_ "Include sub-accounts of all selected accounts.") #t))
+      "a" (N_ "Include sub-accounts of all selected accounts.") #t)
 
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-limited-option options
       gnc:pagename-accounts optname-accounts
       "a"
       (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (gnc:filter-accountlist-type 
-         account-types
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (gnc:filter-accountlist-type
-               account-types
-               accounts)))
-      #t))
-
-    (add-option
-     (gnc:make-simple-boolean-option
+      (gnc:filter-accountlist-type
+       account-types
+       (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+      account-types)
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-total
-      "b" (N_ "Show the total balance in legend?") #t))
+      "b" (N_ "Show the total balance in legend?") #t)
 
     (gnc:options-add-plot-size!
      options gnc:pagename-display
@@ -126,9 +114,8 @@
                            account-types)
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) section name))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/example/hello-world.scm b/gnucash/report/reports/example/hello-world.scm
index 2313fbb63..a1a524978 100644
--- a/gnucash/report/reports/example/hello-world.scm
+++ b/gnucash/report/reports/example/hello-world.scm
@@ -37,14 +37,10 @@
 ;; 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.
-(define (options-generator)    
-  (let* ((options (gnc:new-options)) 
-         ;; This is just a helper function for making options.
-         ;; See libgnucash/app-utils/options.scm for details.
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
+(define (options-generator)
+  (let* ((options (gnc:new-options))
+         (optiondb (options #t))) ;; Hack to get the optiondb from options
+
     ;; This is a boolean option. It is in Section 'Hello, World!'
     ;; and is named 'Boolean Option'. Its sorting key is 'a',
     ;; thus it will come before options with sorting keys
@@ -52,155 +48,123 @@
     ;; is #t (true). The phrase 'This is a boolean option'
     ;; will be displayed as help text when the user puts
     ;; the mouse pointer over the option.
-    (add-option
-     (gnc:make-simple-boolean-option
-      (N_ "Hello, World!") (N_ "Boolean Option")
-      "a" (N_ "This is a boolean option.") #t))
-    
-    ;; This is a multichoice option. The user can choose between
-    ;; the values 'first, 'second, 'third, or 'fourth. These are guile
-    ;; symbols. The value 'first will be displayed as "First Option"
-    ;; and have a help string of "Help for first option.". The default
-    ;; value is 'third.
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-simple-boolean-option optiondb
+     (N_ "Hello, World!") (N_ "Boolean Option")
+     "a" (N_ "This is a boolean option.") #t)
+
+    ;; This is a multichoice option. The user can choose between the
+    ;; values 'first, 'second, 'third, or 'fourth. These are guile
+    ;; symbols. The value 'first will be displayed as "First Option".
+    ;; The default value is 'third.  Note that multichoice option is a
+    ;; special case where we need an intermediate scheme function to
+    ;; interpret the default value--'third in this case--because it
+    ;; can be either a symbol or a number.
+    (gnc-register-multichoice-option optiondb
       (N_ "Hello, World!") (N_ "Multi Choice Option")
-      "b" (N_ "This is a multi choice option.") 'third
+      "b" (N_ "This is a multi choice option.") "third"
       (list (vector 'first (N_ "First Option"))
             (vector 'second (N_ "Second Option"))
             (vector 'third (N_ "Third Option"))
-            (vector 'fourth (N_ "Fourth Options")))))
-    
+            (vector 'fourth (N_ "Fourth Options"))))
+
     ;; This is a string option. Users can type anything they want
     ;; as a value. The default value is "Hello, World". This is
     ;; in the same section as the option above. It will be shown
     ;; after the option above because its key is 'b' while the
     ;; other key is 'a'.
-    (add-option
-     (gnc:make-string-option
+    (gnc-register-string-option optiondb
       (N_ "Hello, World!") (N_ "String Option")
-      "c" (N_ "This is a string option.") (N_ "Hello, World")))
-    
-    ;; This is a date/time option. The user can pick a date and,
-    ;; possibly, a time. Times are stored as an integer specifying
-    ;; number of seconds measured from Jan 1, 1970, i.e.,
-    ;; Unix time. The last option is false, so the user can only
-    ;; select a date, not a time. The default value is the current
-    ;; time.
-    (add-option
-     (gnc:make-date-option
+      "c" (N_ "This is a string option.") (N_ "Hello, World"))
+
+    ;; The following are date options. There are three here reflecting
+    ;; the trhee types of date controls that can be displayed in the
+    ;; options dialog: Absolute, Relative, or Both. You'll usually
+    ;; want to use Both, which is the middle example. Other than the
+    ;; usual strings the two paramters are a list of relative date
+    ;; types and a boolean to indicate whether you want a Both date
+    ;; control. Note that to get an absolute control you pass a
+    ;; one-item list containing 'absolute and #f. If you pass (list
+    ;; 'absolute) #t you'll get a Both but the relative listbox will
+    ;; be empty. That will irritate users so avoid doing that.
+    (gnc-register-date-option-set optiondb
       (N_ "Hello, World!") (N_ "Just a Date Option")
       "d" (N_ "This is a date option.")
-      (lambda () (cons 'absolute (current-time)))
-      #f 'absolute #f ))
-    
-    (add-option
-     (gnc:make-date-option
+      (list 'absolute) #f )
+
+    (gnc-register-date-option-set optiondb
       (N_ "Hello, World!") (N_ "Combo Date Option")
       "y" (N_ "This is a combination date option.")
-      (lambda () (cons 'relative 'start-cal-year))
-      #f 'both '(start-cal-year start-prev-year end-prev-year) ))
-    
-    (add-option
-     (gnc:make-date-option
+      '(start-cal-year start-prev-year end-prev-year) #t)
+
+    (gnc-register-date-option-set optiondb
       (N_ "Hello, World!") (N_ "Relative Date Option")
       "x" (N_ "This is a relative date option.")
-      (lambda () (cons 'relative 'start-cal-year))
-      #f 'relative '(start-cal-year start-prev-year end-prev-year) ))
-    
+      '(start-cal-year start-prev-year end-prev-year) #f)
+
     ;; This is a number range option. The user can enter a number
     ;; between a lower and upper bound given below. There are also
-    ;; arrows the user can click to go up or down, the amount changed
-    ;; by a single click is given by the step size.
-    (add-option
-     (gnc:make-number-range-option
+    ;; arrows or + and - buttons depending on the icon theme that the
+    ;; user can click to go up or down, the amount changed by a single
+    ;; click is given by the step size.
+    (gnc-register-number-range-option optiondb
       (N_ "Hello, World!") (N_ "Number Option")
       "ee" (N_ "This is a number option.")
       1500.0  ;; default
       0.0     ;; lower bound
       10000.0 ;; upper bound
-      2.0     ;; number of decimals
       0.01    ;; step size
-      ))
-    
-    ;; This is a color option, defined by rgba values. A color value
-    ;; is a list where the elements are the red, green, blue, and
-    ;; alpha channel values respectively. The penultimate argument
-    ;; (255) is the allowed range of rgba values. The final argument
-    ;; (#f) indicates the alpha value should be ignored. You can get
-    ;; a color string from a color option with gnc:color-option->html,
-    ;; which will scale the values appropriately according the range.
-    (add-option
-     (gnc:make-color-option
+      )
+
+    ;; This is a color option, defined by rgb values. A color value is
+    ;; a string representing a 3-byte hex number with the bytes
+    ;; representing red, blue, and green values.
+    (gnc-register-color-option optiondb
       (N_ "Hello, World!") (N_ "Background Color")
       "f" (N_ "This is a color option.")
-      (list #xf6 #xff #xdb #xff)
-      255
-      #f))
-    
-    ;; This is an account list option. The user can select one
-    ;; or (possibly) more accounts from the list of accounts
-    ;; in the current file. Values are scheme handles to actual
-    ;; C pointers to accounts. 
-    ;; The #f value indicates that any account will be accepted.
-    ;; Instead of a #f values, you could provide a function that
-    ;; accepts a list of account values and returns a pair. If
-    ;; the first element is #t, the second element is the list
-    ;; of accounts actually accepted. If the first element is
-    ;; #f, the accounts are rejected and the second element is
-    ;; and error string. The last argument is #t which means
-    ;; the user is allowed to select more than one account.
-    ;; The default value for this option is the currently
-    ;; selected account in the main window, if any.
-    (add-option
-     (gnc:make-account-list-option
+      "f6ffdb")
+
+    ;; This is an account list option. The user can select one or more
+    ;; accounts from the list of accounts in the current file. Values
+    ;; are GUIDs of the selected accounts. Since those depend on the
+    ;; book in use you'll probably want to create a list from the
+    ;; account types as we've done here.  There's another function
+    ;; gnc-register-account-list-limited-option which takes as a
+    ;; second argument a list of account types; only accounts of the
+    ;; types in the list, similar to the list passed to
+    ;; gnc-account-list-from-types in this example, will be available
+    ;; for selection.
+
+    (gnc-register-account-list-option optiondb
       (N_ "Hello Again") (N_ "An account list option")
       "g" (N_ "This is an account list option.")
-      ;; FIXME : this used to be gnc:get-current-accounts, but 
-      ;; that doesn't exist any more.
-      (lambda () '())
-      #f #t))
-    
+      (gnc-account-list-from-types
+       (gnc-get-current-book)
+       (list ACCT-TYPE-ASSET ACCT-TYPE-EQUITY ACCT-TYPE-LIABILITY)))
+
     ;; This is a list option. The user can select one or (possibly)
     ;; more values from a list. The list of acceptable values is
     ;; the same format as a multichoice option. The value of the
     ;; option is a list of symbols.
-    (add-option
-     (gnc:make-list-option
+    (gnc-register-list-option optiondb
       (N_ "Hello Again") (N_ "A list option")
       "h" (N_ "This is a list option.")
-      '(good)
+      (symbol->string 'good)
       (list (vector 'good (N_ "The Good"))
             (vector 'bad (N_ "The Bad"))
-            (vector 'ugly (N_ "The Ugly")))))
-    
+            (vector 'ugly (N_ "The Ugly"))))
+
     ;; This option is for testing. When true, the report generates
     ;; an exception.
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option optiondb
       (N_ "Testing") (N_ "Crash the report")
-      "a" 
+      "a"
       (N_ "This is for testing. \
 Your reports probably shouldn't have an \
-option like this.") 
-      #f))
-
-    ;; This is a Radio Button option. The user can only select one 
-    ;; value from the list of buttons.
-    (add-option
-     (gnc:make-radiobutton-option
-      (N_ "Hello Again") "A Radio Button option" "z" (N_ "This is a Radio Button option.") 'good
-      (list (vector 'good
-                    (N_ "The Good")
-                    (N_ "Good option."))
-            (vector 'bad
-                    (N_ "The Bad")
-                    (N_ "Bad option."))
-            (vector 'ugly
-                    (N_ "The Ugly")
-                    (N_ "Ugly option.")))))
-
-    (gnc:options-set-default-section options "Hello, World!")      
+option like this.")
+      #f)
+
+    (GncOptionDBPtr-set-default-section optiondb "Hello, World!")
+ ;; We still need to return the function wrapper instead of the GncOptionDBPtr bfor all of the options functions in the reports system.
     options))
 
 ;; This is the rendering function. It accepts a database of options
@@ -210,12 +174,10 @@ option like this.")
 ;; to the function is one created by the options-generator function
 ;; defined above.
 (define (hello-world-renderer report-obj)
-  ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
-  
+  ;; Helper function for looking up option values.
   (define (op-value section name)
-    (gnc:option-value (get-op section name)))
+    (gnc-optiondb-lookup-value ((gnc:report-options report-obj) 'lookup)
+                                section name))
 
   ;; The first thing we do is make local variables for all the specific
   ;; options in the set of options given to the function. This set will
@@ -230,7 +192,7 @@ option like this.")
         (combo-date-val (gnc:date-option-absolute-time
                          (op-value "Hello, World!" "Combo Date Option")))
         (num-val      (op-value "Hello, World!" "Number Option"))
-        (bg-color-op  (get-op   "Hello, World!" "Background Color"))
+        (bg-color     (op-value "Hello, World!" "Background Color"))
         (accounts     (op-value "Hello Again"   "An account list option"))
         (list-val     (op-value "Hello Again"   "A list option"))
         (radio-val    (op-value "Hello Again"   "A Radio Button option"))
@@ -287,7 +249,7 @@ option like this.")
       
       (gnc:html-document-set-style!
        document "body" 
-       'attribute (list "bgcolor" (gnc:color-option->html bg-color-op)))
+       'attribute (list "bgcolor" (format #f "#~a" bg-color)))
       
       ;; the title of the report will be rendered by the 
       ;; selected style sheet.  All we have to do is set it in the
diff --git a/gnucash/report/reports/example/sample-graphs.scm b/gnucash/report/reports/example/sample-graphs.scm
index 7242f8ae3..d1df25836 100644
--- a/gnucash/report/reports/example/sample-graphs.scm
+++ b/gnucash/report/reports/example/sample-graphs.scm
@@ -117,7 +117,7 @@
     chart))
 
 (define (options-generator)
-  (gnc:new-options))
+  (gnc-new-optiondb))
 
 ;; This is the rendering function. It accepts a database of options
 ;; and generates an object of type <html-document>.  See the file
@@ -126,13 +126,6 @@
 ;; to the function is one created by the options-generator function
 ;; defined above.
 (define (test-graphing-renderer report-obj)
-  ;; These are some helper functions for looking up option values.
-  (define options (gnc:report-options report-obj))
-  (define (get-op section name)
-    (gnc:lookup-option options section name))
-  (define (op-value section name)
-    (gnc:option-value (get-op section name)))
-
   (let ((document (gnc:make-html-document)))
 
     (gnc:html-document-set-title! document (G_ reportname))
diff --git a/gnucash/report/reports/example/welcome-to-gnucash.scm b/gnucash/report/reports/example/welcome-to-gnucash.scm
index 80a2e0768..1401db4e9 100644
--- a/gnucash/report/reports/example/welcome-to-gnucash.scm
+++ b/gnucash/report/reports/example/welcome-to-gnucash.scm
@@ -30,7 +30,7 @@
 (use-modules (gnucash report))
 
 (define (options)
-  (gnc:new-options))
+  (gnc-new-optiondb))
 
 (define (renderer report-obj)
   (let ((doc (gnc:make-html-document)))
diff --git a/gnucash/report/reports/locale-specific/de_DE/taxtxf.scm b/gnucash/report/reports/locale-specific/de_DE/taxtxf.scm
index 843232825..a27da6a49 100644
--- a/gnucash/report/reports/locale-specific/de_DE/taxtxf.scm
+++ b/gnucash/report/reports/locale-specific/de_DE/taxtxf.scm
@@ -137,20 +137,17 @@
 (define tax-qtr-real-qtr-year 0)
 
 (define (tax-options-generator)
-  (define options (gnc:new-options))
-  (define (gnc:register-tax-option new-option)
-    (gnc:register-option options new-option))
+  (define options (gnc-new-optiondb))
 
   ;; date at which to report 
   (gnc:options-add-date-interval!
    options gnc:pagename-general 
    (N_ "From") (N_ "To") "a")
 
-  (gnc:register-tax-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-general (N_ "Alternate Period")
     "c" (N_ "Override or modify From: & To:.")
-    (if after-tax-day 'from-to 'last-year)
+    (if after-tax-day "from-to" "last-year")
     (list (vector 'from-to (N_ "Use From - To"))
           (vector '1st-est (N_ "1st Est Tax Quarter (Jan 1 - Mar 31)"))
           (vector '2nd-est (N_ "2nd Est Tax Quarter (Apr 1 - May 31)"))
@@ -160,24 +157,20 @@
           (vector '1st-last (N_ "Last Yr 1st Est Tax Qtr (Jan 1 - Mar 31)"))
           (vector '2nd-last (N_ "Last Yr 2nd Est Tax Qtr (Apr 1 - May 31)"))
           (vector '3rd-last (N_ "Last Yr 3rd Est Tax Qtr (Jun 1 - Aug 31)"))
-          (vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)")))))
+          (vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)"))))
 
-  (gnc:register-tax-option
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts (N_ "Select Accounts (none = all)")
     "d" (N_ "Select accounts.")
-    (lambda () '())
-    #f #t))
+    '())
   
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Suppress $0.00 values")
-    "f" (N_ "$0.00 valued Accounts won't be printed.") #t))
+    "f" (N_ "$0.00 valued Accounts won't be printed.") #t)
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Print Full account names")
-    "g" (N_ "Print all Parent account names.") #f))
+    "g" (N_ "Print all Parent account names.") #f)
 
   (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -451,9 +444,8 @@
                              tax-mode?)
 
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   ;; the number of account generations: children, grandchildren etc.
   (define (num-generations account gen)
@@ -748,7 +740,7 @@
 	  (to-year    (gnc-print-time64 to-value "%Y"))
           (today-date (gnc-print-time64 (time64CanonicalDayTime (current-time))
                                         "%d.%m.%Y"))
-	  (tax-nr (gnc:option-get-value book gnc:*tax-label* gnc:*tax-nr-label*)))
+	  (tax-nr (gnc:book-get-option-value book gnc:*tax-label* gnc:*tax-nr-label*)))
 
       ;; Now, the main body
       ;; Reset all the balance collectors
diff --git a/gnucash/report/reports/locale-specific/us/taxtxf.scm b/gnucash/report/reports/locale-specific/us/taxtxf.scm
index aeb495bcd..fcfb2fcc0 100644
--- a/gnucash/report/reports/locale-specific/us/taxtxf.scm
+++ b/gnucash/report/reports/locale-specific/us/taxtxf.scm
@@ -167,20 +167,17 @@
 (define tax-qtr-real-qtr-year 10000)
 
 (define (tax-options-generator)
-  (define options (gnc:new-options))
-  (define (gnc:register-tax-option new-option)
-    (gnc:register-option options new-option))
+  (define options (gnc-new-optiondb))
 
   ;; date at which to report
   (gnc:options-add-date-interval!
    options gnc:pagename-general
    (N_ "From") (N_ "To") "a")
 
-  (gnc:register-tax-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-general (N_ "Alternate Period")
     "c" (N_ "Override or modify From: & To:.")
-    (if after-tax-day 'from-to 'last-year)
+    (if after-tax-day "from-to" "last-year")
     (list (vector 'from-to (N_ "Use From - To"))
           (vector '1st-est (N_ "1st Est Tax Quarter (Jan 1 - Mar 31)"))
           (vector '2nd-est (N_ "2nd Est Tax Quarter (Apr 1 - May 31)"))
@@ -196,65 +193,53 @@
           ;; actual year's quarters! See the definition of
           ;; tax-qtr-real-qtr-year variable above.
           (vector '3rd-last (N_ "Last Yr 3rd Est Tax Qtr (Jun 1 - Aug 31)"))
-          (vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)")))))
+          (vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)"))))
 
-  (gnc:register-tax-option
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts (N_ "Select Accounts (none = all)")
     "d" (N_ "Select accounts.")
-    (lambda () '())
-    #f #t))
-
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+    '())
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Suppress $0.00 values")
-    "f" (N_ "$0.00 valued Tax codes won't be printed.") #f))
+    "f" (N_ "$0.00 valued Tax codes won't be printed.") #f)
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Do not print full account names")
-    "g" (N_ "Do not print all Parent account names.") #f))
+    "g" (N_ "Do not print all Parent account names.") #f)
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Print all Transfer To/From Accounts")
-    "h" (N_ "Print all split details for multi-split transactions.") #f))
+    "h" (N_ "Print all split details for multi-split transactions.") #f)
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Print TXF export parameters")
-    "i" (N_ "Show TXF export parameters for each TXF code/account on report.") #f))
+    "i" (N_ "Show TXF export parameters for each TXF code/account on report.") #f)
 
   (if (qof-book-use-split-action-for-num-field (gnc-get-current-book))
-      (gnc:register-tax-option
-       (gnc:make-simple-boolean-option
+      (gnc-register-simple-boolean-option options
         gnc:pagename-display (N_ "Do not print T-Num:Memo data")
-        "j" (N_ "Do not print T-Num:Memo data for transactions.") #f))
-      (gnc:register-tax-option
-       (gnc:make-simple-boolean-option
+        "j" (N_ "Do not print T-Num:Memo data for transactions.") #f)
+      (gnc-register-simple-boolean-option options
         gnc:pagename-display (N_ "Do not print Action:Memo data")
-        "j" (N_ "Do not print Action:Memo data for transactions.") #f)))
+        "j" (N_ "Do not print Action:Memo data for transactions.") #f))
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Do not print transaction detail")
-    "k" (N_ "Do not print transaction detail for accounts.") #f))
+    "k" (N_ "Do not print transaction detail for accounts.") #f)
 
-  (gnc:register-tax-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display (N_ "Do not use special date processing")
-    "l" (N_ "Do not print transactions out of specified dates.") #f))
+    "l" (N_ "Do not print transactions out of specified dates.") #f)
 
-  (gnc:register-tax-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-display (N_ "Currency conversion date")
     "m" (N_ "Select date to use for PriceDB lookups.")
-    'conv-to-tran-date
+    "conv-to-tran-date"
     (list (list->vector
            (list 'conv-to-tran-date (N_ "Nearest to transaction date")))
           (list->vector
            (list 'conv-to-report-date (N_ "Nearest to report date")))
-    )))
+    ))
 
   #t
 
@@ -1658,9 +1643,8 @@
                              tax-mode?)
 
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (define tax-entity-type (gnc-get-current-book-tax-type))
 
diff --git a/gnucash/report/reports/standard/account-piecharts.scm b/gnucash/report/reports/standard/account-piecharts.scm
index 76f660e4e..24e745e10 100644
--- a/gnucash/report/reports/standard/account-piecharts.scm
+++ b/gnucash/report/reports/standard/account-piecharts.scm
@@ -85,10 +85,7 @@ balance at a given time"))
 ;; is the list of account types that the account selection option
 ;; accepts.
 (define (options-generator account-types do-intervals? depth-based?)
-  (let* ((options (gnc:new-options)) 
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     (if do-intervals?
         (gnc:options-add-date-interval!
@@ -98,39 +95,31 @@ balance at a given time"))
          options gnc:pagename-general
          optname-to-date "a"))
 
-    (gnc:options-add-currency! 
+    (gnc:options-add-currency!
      options gnc:pagename-general optname-report-currency "b")
-    
-    (gnc:options-add-price-source! 
+
+    (gnc:options-add-price-source!
      options gnc:pagename-general
      optname-price-source "c" 'pricedb-nearest)
 
     (if do-intervals?
-        (add-option
-         (gnc:make-multichoice-option
+        (gnc-register-multichoice-option options
           gnc:pagename-general optname-averaging
           "f" opthelp-averaging
-          'None
+          "None"
           (list (vector 'None (N_ "No Averaging"))
                 (vector 'YearDelta (N_ "Yearly"))
                 (vector 'MonthDelta (N_ "Monthly"))
-                (vector 'WeekDelta (N_ "Weekly"))))))
+                (vector 'WeekDelta (N_ "Weekly")))))
 
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-limited-option options
       gnc:pagename-accounts optname-accounts
       "a"
       (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (gnc:filter-accountlist-type 
-         account-types
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (gnc:filter-accountlist-type
-               account-types
-               accounts)))
-      #t))
+      (gnc:filter-accountlist-type
+       account-types
+         (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+      account-types)
 
     (if depth-based?
       (gnc:options-add-account-levels!
@@ -138,38 +127,34 @@ balance at a given time"))
        (N_ "Maximum number of levels in the account tree displayed.")
        2))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-fullname
       "a"
       (if depth-based?
         (N_ "Show the full account name in legend?")
         (N_ "Show the full security name in the legend?"))
-      #f))
+      #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-total
-      "b" (N_ "Show the total balance in legend?") #t))
+      "b" (N_ "Show the total balance in legend?") #t)
 
 
-     (add-option
-      (gnc:make-simple-boolean-option
+     (gnc-register-simple-boolean-option options
        gnc:pagename-display optname-show-percent
-       "b" (N_ "Show the percentage in legend?") #t))
+       "b" (N_ "Show the percentage in legend?") #t)
 
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-display optname-slices
       "c" (N_ "Maximum number of slices in pie.") 7
-      2 24 0 1))
+      2 24 1)
 
-    (gnc:options-add-plot-size! 
-     options gnc:pagename-display 
+    (gnc:options-add-plot-size!
+     options gnc:pagename-display
      optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
 
-    (gnc:options-add-sort-method! 
+    (gnc:options-add-sort-method!
      options gnc:pagename-display
      optname-sort-method "e" 'amount)
 
@@ -307,10 +292,9 @@ balance at a given time"))
 
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value 
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) section name)))
-  
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) section name))
+
   (gnc:report-starting reportname)
 
   ;; Get all options
@@ -478,9 +462,8 @@ balance at a given time"))
                       (gnc:options-copy-values (gnc:report-options report-obj)
                                                options)
                       ;; and set the destination accounts
-                      (gnc:option-set-value
-                       (gnc:lookup-option options gnc:pagename-accounts
-                                          optname-accounts)
+                      (gnc-option-set-value
+                       options gnc:pagename-accounts optname-accounts
                        (map cadr finish))
                       (set! id (gnc:make-report report-guid options))
                       ;; set the URL.
diff --git a/gnucash/report/reports/standard/account-summary.scm b/gnucash/report/reports/standard/account-summary.scm
index c8d628b25..9c22fd473 100644
--- a/gnucash/report/reports/standard/account-summary.scm
+++ b/gnucash/report/reports/standard/account-summary.scm
@@ -142,13 +142,12 @@
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define (accsum-options-generator sx? reportname)
-  (let* ((options (gnc:new-options))
-         (odb (gnc:optiondb options)))
+  (let* ((options (gnc-new-optiondb)))
 
-   (gnc-register-string-option odb
+   (gnc-register-string-option options
       gnc:pagename-general optname-report-title
       "a" opthelp-report-title (G_ reportname))
-   (gnc-register-string-option odb
+   (gnc-register-string-option options
       gnc:pagename-general optname-party-name
       "b" opthelp-party-name "")
     ;; this should default to company name in (gnc-get-current-book)
@@ -163,7 +162,7 @@
          options gnc:pagename-general optname-date "c"))
 
     ;; accounts to work on
-   (gnc-register-account-list-option odb
+   (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
@@ -179,7 +178,7 @@
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 3)
 
-   (gnc-register-multichoice-option odb
+   (gnc-register-multichoice-option options
       gnc:pagename-accounts optname-bottom-behavior
       "c" opthelp-bottom-behavior "summarize"
       (list
@@ -196,19 +195,19 @@
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
 
-   (gnc-register-simple-boolean-option odb
+   (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign
       "c" opthelp-show-foreign #t)
 
-   (gnc-register-simple-boolean-option odb
+   (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
       "d" opthelp-show-rates #f)
 
     ;; what to show for zero-balance accounts
-   (gnc-register-simple-boolean-option odb
+   (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
       "a" opthelp-show-zb-accts #t)
-   (gnc-register-simple-boolean-option odb
+   (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
       "b" opthelp-omit-zb-bals #f)
     ;; what to show for non-leaf accounts
@@ -218,26 +217,26 @@
      "c")
 
     ;; some detailed formatting options
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
       "e" opthelp-account-links #t)
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
       "f" opthelp-use-rules #f)
 
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-bals
       "g" opthelp-show-bals #t)
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-code
       "h" opthelp-show-code #t)
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-desc
       "i" opthelp-show-desc #f)
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-type
       "j" opthelp-show-type #f)
-    (gnc-register-simple-boolean-option odb
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-notes
       "k" opthelp-show-notes #f)
 
@@ -252,9 +251,8 @@
 
 (define (accsum-renderer report-obj sx? reportname)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/standard/advanced-portfolio.scm b/gnucash/report/reports/standard/advanced-portfolio.scm
index 7a71127a7..e385f5b3d 100644
--- a/gnucash/report/reports/standard/advanced-portfolio.scm
+++ b/gnucash/report/reports/standard/advanced-portfolio.scm
@@ -59,12 +59,7 @@ by preventing negative stock balances.<br/>")
 (define units-denom 100000000)
 
 (define (options-generator)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See libgnucash/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; General Tab
     ;; date at which to report balance
@@ -75,88 +70,71 @@ by preventing negative stock balances.<br/>")
     (gnc:options-add-currency!
      options gnc:pagename-general (N_ "Report's currency") "c")
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-general optname-price-source
-      "d" (N_ "The source of price information.") 'pricedb-nearest
+      "d" (N_ "The source of price information.") "pricedb-nearest"
       (list (vector 'pricedb-latest (N_ "Most recent"))
-            (vector 'pricedb-nearest (N_ "Nearest to report date")))))
+            (vector 'pricedb-nearest (N_ "Nearest to report date"))))
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-general optname-basis-method
-      "e" (N_ "Basis calculation method.") 'average-basis
+      "e" (N_ "Basis calculation method.") "average-basis"
       (list (vector 'average-basis (N_ "Average cost of all shares"))
             (vector 'fifo-basis (N_ "First-in first-out"))
-            (vector 'filo-basis (N_ "Last-in first-out")))))
+            (vector 'filo-basis (N_ "Last-in first-out"))))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-prefer-pricelist "f"
       (N_ "Prefer use of price editor pricing over transactions, where applicable.")
-      #t))
+      #t)
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-general optname-brokerage-fees
-      "g" (N_ "How to report commissions and other brokerage fees.") 'include-in-basis
+      "g" (N_ "How to report commissions and other brokerage fees.")
+      "include-in-basis"
       (list (vector 'include-in-basis (N_ "Include in basis"))
             (vector 'include-in-gain (N_ "Include in gain/loss"))
-            (vector 'ignore-brokerage (N_ "Omit from report")))))
+            (vector 'ignore-brokerage (N_ "Omit from report"))))
 
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
 	gnc:pagename-display optname-show-symbol "a"
 	(N_ "Display the ticker symbols.")
-	#t))
+	#t)
 
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
 	gnc:pagename-display optname-show-listing "b"
 	(N_ "Display exchange listings.")
-	#t))
+	#t)
 
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
 	gnc:pagename-display optname-show-shares "c"
 	(N_ "Display numbers of shares in accounts.")
-	#t))
+	#t)
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-display optname-shares-digits
       "d" (N_ "The number of decimal places to use for share numbers.") 2
-      0 9 0 1))
+      0 9 1)
 
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
 	gnc:pagename-display optname-show-price "e"
 	(N_ "Display share prices.")
-	#t))
+	#t)
 
     ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-limited-option options
       gnc:pagename-accounts (N_ "Accounts")
       "b"
       (N_ "Stock Accounts to report on.")
-      (lambda () (filter gnc:account-is-stock?
-                         (gnc-account-get-descendants-sorted
-                          (gnc-get-current-root-account))))
-      (lambda (accounts) (list  #t
-                                (filter gnc:account-is-stock? accounts)))
-      #t))
-
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+      (filter gnc:account-is-stock?
+              (gnc-account-get-descendants-sorted
+               (gnc-get-current-root-account)))
+      (list ACCT-TYPE-STOCK))
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-zero-shares "e"
       (N_ "Include accounts that have a zero share balances.")
-      #f))
+      #f)
 
     (gnc:options-set-default-section options gnc:pagename-general)
     options))
@@ -176,11 +154,8 @@ by preventing negative stock balances.<br/>")
        (warn-price-dirty #f))
 
   ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
-
   (define (get-option section name)
-    (gnc:option-value (get-op section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (define (split-account-type? split type)
     (eq? type (xaccAccountGetType (xaccSplitGetAccount split))))
diff --git a/gnucash/report/reports/standard/balance-forecast.scm b/gnucash/report/reports/standard/balance-forecast.scm
index 603b14cac..83fcf017d 100644
--- a/gnucash/report/reports/standard/balance-forecast.scm
+++ b/gnucash/report/reports/standard/balance-forecast.scm
@@ -70,17 +70,14 @@ date point, a projected minimum balance including scheduled transactions."))
 
 ; Options generator
 (define (options-generator)
-  (let* ((options (gnc:new-options)))
+  (let* ((options (gnc-new-optiondb)))
     ; Account selector
-    (gnc:register-option options
-      (gnc:make-account-list-option
+    (gnc-register-account-list-option options
         gnc:pagename-accounts optname-accounts "a" opthelp-accounts
-        (lambda ()
-          (gnc:filter-accountlist-type
-            (list ACCT-TYPE-BANK ACCT-TYPE-CASH)
-            (gnc-account-get-descendants-sorted
-              (gnc-get-current-root-account))))
-        #f #t))
+        (gnc:filter-accountlist-type
+         (list ACCT-TYPE-BANK ACCT-TYPE-CASH)
+         (gnc-account-get-descendants-sorted
+          (gnc-get-current-root-account))))
 
     ; Date range
     (gnc:options-add-date-interval! options
@@ -100,29 +97,29 @@ date point, a projected minimum balance including scheduled transactions."))
       optname-plot-width optname-plot-height "a"
       (cons 'percent 100.0) (cons 'percent 100.0))
     ; Markers
-    (gnc:register-option options (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-show-markers "b" opthelp-show-markers #f))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-display optname-show-markers "b" opthelp-show-markers #f)
     ; Reserve line
-    (gnc:register-option options (gnc:make-complex-boolean-option
-      gnc:pagename-display optname-show-reserve "c" opthelp-show-reserve #f #f
+    (gnc-register-complex-boolean-option options
+      gnc:pagename-display optname-show-reserve "c" opthelp-show-reserve #f
       (lambda (x)
-        (gnc-option-db-set-option-selectable-by-name
-         options gnc:pagename-display optname-reserve x))))
-    (gnc:register-option options (gnc:make-number-range-option
+        (gnc-optiondb-set-option-selectable-by-name
+         options gnc:pagename-display optname-reserve x)))
+    (gnc-register-number-range-option options
       gnc:pagename-display optname-reserve "d" opthelp-reserve
-      0 -10E9 10E9 2 0.01))
+      0 -10E9 10E9 0.01)
     ; Purchasing power target
-    (gnc:register-option options (gnc:make-complex-boolean-option
-      gnc:pagename-display optname-show-target "e" opthelp-show-target #f #f
+    (gnc-register-complex-boolean-option options
+      gnc:pagename-display optname-show-target "e" opthelp-show-target #f
       (lambda (x)
-        (gnc-option-db-set-option-selectable-by-name
-         options gnc:pagename-display optname-target x))))
-    (gnc:register-option options (gnc:make-number-range-option
+        (gnc-optiondb-set-option-selectable-by-name
+         options gnc:pagename-display optname-target x)))
+    (gnc-register-number-range-option options
       gnc:pagename-display optname-target "f" opthelp-target
-      0 -10E9 10E9 2 0.01))
+      0 -10E9 10E9 0.01)
     ; Future minimum
-    (gnc:register-option options (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-show-minimum "g" opthelp-show-minimum #f))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-display optname-show-minimum "g" opthelp-show-minimum #f)
     (gnc:options-set-default-section options gnc:pagename-general)
     options)
 )
@@ -131,8 +128,8 @@ date point, a projected minimum balance including scheduled transactions."))
 (define (document-renderer report-obj)
   ; Option-getting helper function.
   (define (get-option pagename optname)
-    (gnc:option-value
-      (gnc:lookup-option (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
   (define report-title
     (get-option gnc:pagename-general gnc:optname-reportname))
 
diff --git a/gnucash/report/reports/standard/balance-sheet.scm b/gnucash/report/reports/standard/balance-sheet.scm
index 208383045..c7a931b30 100644
--- a/gnucash/report/reports/standard/balance-sheet.scm
+++ b/gnucash/report/reports/standard/balance-sheet.scm
@@ -144,43 +144,34 @@
 
 ;; options generator
 (define (balance-sheet-options-generator)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
-    (add-option
-      (gnc:make-string-option
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
+
+    (gnc-register-string-option options
       gnc:pagename-general optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-      (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       gnc:pagename-general optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
-    
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
+
     ;; date at which to report balance
     (gnc:options-add-report-date!
      options gnc:pagename-general optname-date "c")
-    
-    (add-option
-     (gnc:make-simple-boolean-option
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-report-form
-      "d" opthelp-report-form #t))
+      "d" opthelp-report-form #t)
 
-    (add-option
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
        gnc:pagename-general optname-standard-order
-       "dd" opthelp-standard-order #t))
+       "dd" opthelp-standard-order #t)
 
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
-	(gnc:filter-accountlist-type 
+      (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
                ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
                ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
@@ -188,43 +179,37 @@
                ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
                ACCT-TYPE-TRADING)
 	 (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 3)
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-bottom-behavior
-      "c" opthelp-bottom-behavior #f))
-    
+      "c" opthelp-bottom-behavior #f)
+
     ;; all about currencies
     (gnc:options-add-currency!
      options pagename-commodities
      optname-report-commodity "a")
-    
-    (gnc:options-add-price-source! 
+
+    (gnc:options-add-price-source!
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
-      pagename-commodities optname-show-foreign 
-      "c" opthelp-show-foreign #t))
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+
+    (gnc-register-simple-boolean-option options
+      pagename-commodities optname-show-foreign
+      "c" opthelp-show-foreign #t)
+
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
-    
+      "d" opthelp-show-rates #f)
+
     ;; what to show for zero-balance accounts
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
-      "a" opthelp-show-zb-accts #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "a" opthelp-show-zb-accts #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
-      "b" opthelp-omit-zb-bals #f))
+      "b" opthelp-omit-zb-bals #f)
     ;; what to show for non-leaf accounts
     (gnc:options-add-subtotal-view!
      options gnc:pagename-display
@@ -232,45 +217,37 @@
      "c")
 
     ;; some detailed formatting options
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "e" opthelp-account-links #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "e" opthelp-account-links #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
-      "f" opthelp-use-rules #f))
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "f" opthelp-use-rules #f)
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-assets
-      "g" opthelp-label-assets #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "g" opthelp-label-assets #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-assets
-      "h" opthelp-total-assets #t))
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "h" opthelp-total-assets #t)
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-liabilities
-      "i" opthelp-label-liabilities #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "i" opthelp-label-liabilities #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-liabilities
-      "j" opthelp-total-liabilities #t))
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "j" opthelp-total-liabilities #t)
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-equity
-      "k" opthelp-label-equity #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "k" opthelp-label-equity #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-equity
-      "l" opthelp-total-equity #t))
-    
+      "l" opthelp-total-equity #t)
+
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-accounts)
-    
+
     options))
 
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -282,9 +259,8 @@
 
 (define (balance-sheet-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/standard/balsheet-eg.scm b/gnucash/report/reports/standard/balsheet-eg.scm
index 7a414a18e..1421b009c 100644
--- a/gnucash/report/reports/standard/balsheet-eg.scm
+++ b/gnucash/report/reports/standard/balsheet-eg.scm
@@ -189,59 +189,66 @@
 
 ;; options generator
 (define (balsheet-options-generator)
-  (let* ((options (gnc:new-options))
-         (add-option
-           (lambda (new-option)
-             (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; Accounts options
-    (add-option (gnc:make-simple-boolean-option accounts-page optname-omit-zb-accts
-                                                "a" opthelp-omit-zb-accts #f))
-    (add-option (gnc:make-simple-boolean-option accounts-page optname-account-links
-                                                "b" opthelp-account-links #t))
+    (gnc-register-simple-boolean-option options
+                                        accounts-page optname-omit-zb-accts
+                                        "a" opthelp-omit-zb-accts #f)
+    (gnc-register-simple-boolean-option  options
+                                         accounts-page optname-account-links
+                                         "b" opthelp-account-links #t)
     (gnc:options-add-account-levels!  options accounts-page optname-depth-limit
                                       "c" opthelp-depth-limit 'all)
-    (add-option (gnc:make-simple-boolean-option accounts-page optname-flatten?
-                                                "d" opthelp-flatten? #f))
+    (gnc-register-simple-boolean-option options
+                                        accounts-page optname-flatten?
+                                        "d" opthelp-flatten? #f)
 
     ;; Commodity options
     (gnc:options-add-currency! options commodities-page optname-report-commodity "a")
     (gnc:options-add-price-source!  options commodities-page
                                     optname-price-source "b" 'average-cost)
-    (add-option (gnc:make-simple-boolean-option commodities-page optname-show-foreign
-                                                "c" opthelp-show-foreign #t))
+    (gnc-register-simple-boolean-option options
+                                        commodities-page optname-show-foreign
+                                        "c" opthelp-show-foreign #t)
 
     ;; Display options
-    (add-option (gnc:make-multichoice-option
-                  display-page optname-columns
-                  "a" opthelp-columns 'onecol
-                  (list (vector 'autocols (N_ "Adjust the layout to fit the width of the screen or page"))
-                        (vector 'onecol (N_ "Display liabilities and equity below assets"))
-                        (vector 'twocols (N_ "Display assets on the left, liabilities and equity on the right")))))
-    (add-option (gnc:make-multichoice-option
-                  display-page optname-neg-format
-                  "b" opthelp-neg-format 'negsign
-                  (list (vector 'negsign (N_ "Sign: -$10.00"))
-                        (vector 'negbrackets (N_ "Brackets: ($10.00)")))))
-
-    (add-option (gnc:make-string-option display-page optname-font-family "c"
-                                        opthelp-font-family "sans"))
-    (add-option (gnc:make-string-option display-page optname-font-size "d"
-                                        opthelp-font-size "medium"))
-    (add-option (gnc:make-string-option display-page optname-template-file "e"
-                                        opthelp-template-file "balsheet-eg.eguile.scm"))
-    (add-option (gnc:make-string-option display-page optname-css-file "f"
-                                        opthelp-css-file "balsheet-eg.css"))
+    (gnc-register-multichoice-option options
+                                     display-page optname-columns
+                                     "a" opthelp-columns "onecol"
+                                     (list (vector 'autocols (N_ "Adjust the layout to fit the width of the screen or page"))
+                                           (vector 'onecol (N_ "Display liabilities and equity below assets"))
+                                           (vector 'twocols (N_ "Display assets on the left, liabilities and equity on the right"))))
+    (gnc-register-multichoice-option options
+                                     display-page optname-neg-format
+                                     "b" opthelp-neg-format "negsign"
+                                     (list (vector 'negsign (N_ "Sign: -$10.00"))
+                                           (vector 'negbrackets (N_ "Brackets: ($10.00)"))))
+
+    (gnc-register-string-option options
+                                display-page optname-font-family "c"
+                                opthelp-font-family "sans")
+    (gnc-register-string-option options
+                                display-page optname-font-size "d"
+                                opthelp-font-size "medium")
+    (gnc-register-string-option options
+                                display-page optname-template-file "e"
+                                opthelp-template-file "balsheet-eg.eguile.scm")
+    (gnc-register-string-option options
+                                display-page optname-css-file "f"
+                                opthelp-css-file "balsheet-eg.css")
 
     ;; General options
-    (add-option (gnc:make-string-option general-page optname-report-title
-                                        "a" opthelp-report-title reportname))
+    (gnc-register-string-option options
+                                general-page optname-report-title
+                                "a" opthelp-report-title reportname)
     (gnc:options-add-report-date!  options general-page optname-date "b")
 
     ;; Notes options
-    (add-option (gnc:make-text-option notes-page optname-extra-notes
-                                      "a" opthelp-extra-notes
-                                      (N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br>Change the 'Extra Notes' option to get rid of this message)")))
+    (gnc-register-text-option options
+                              notes-page optname-extra-notes
+                              "a" opthelp-extra-notes
+                              (N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br>Change the 'Extra Notes' option to get rid of this message)"))
 
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options general-page)
@@ -253,9 +260,8 @@
 (define (balsheet-renderer report-obj)
 
   (define (get-option pagename optname)
-    (gnc:option-value
-      (gnc:lookup-option
-        (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+        (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
   (let* (
diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index a1d1aaa66..4f028f8fe 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -136,20 +136,16 @@ also show overall period profit & loss."))
 
 ;; options generator
 (define (multicol-report-options-generator report-type)
-  (let* ((options (gnc:new-options))
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; date at which to report balance
     (gnc:options-add-date-interval!
      options gnc:pagename-general optname-startdate optname-enddate "c")
 
-    (add-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-general optname-period
       "c2" opthelp-period
-      'disabled
+      "disabled"
       (list
        (vector 'disabled (G_ "Disabled"))
        (vector 'YearDelta (G_ "One Year"))
@@ -158,67 +154,59 @@ also show overall period profit & loss."))
        (vector 'MonthDelta (G_ "One Month"))
        (vector 'TwoWeekDelta (G_ "Two Weeks"))
        (vector 'WeekDelta (G_ "One Week")))
-      #f
       (lambda (x)
         (let ((x (not (eq? x 'disabled))))
-          (gnc-option-db-set-option-selectable-by-name
+          (gnc-optiondb-set-option-selectable-by-name
            options
            gnc:pagename-general optname-disable-amount-indent
            (not x))
-          (gnc-option-db-set-option-selectable-by-name
+          (gnc-optiondb-set-option-selectable-by-name
            options
            gnc:pagename-general optname-dual-columns
            (not x))
-          (gnc-option-db-set-option-selectable-by-name
+          (gnc-optiondb-set-option-selectable-by-name
            options gnc:pagename-general optname-reverse-chrono x)
           (case report-type
             ((balsheet)
-             (gnc-option-db-set-option-selectable-by-name
+             (gnc-optiondb-set-option-selectable-by-name
               options gnc:pagename-general optname-include-chart x)
 
-             (gnc-option-db-set-option-selectable-by-name
+             (gnc-optiondb-set-option-selectable-by-name
               options gnc:pagename-general optname-startdate x))
 
             ((pnl)
-             (gnc-option-db-set-option-selectable-by-name
-              options gnc:pagename-general optname-include-overall-period x)))))))
+             (gnc-optiondb-set-option-selectable-by-name
+              options gnc:pagename-general optname-include-overall-period x))))))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-disable-amount-indent
-      "c3" opthelp-disable-amount-indent #f))
+      "c3" opthelp-disable-amount-indent #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-include-chart
-      "c5" opthelp-include-chart #f))
+      "c5" opthelp-include-chart #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-dual-columns
-      "c4" opthelp-dual-columns #t))
+      "c4" opthelp-dual-columns #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-reverse-chrono
-      "c5" opthelp-reverse-chrono #t))
+      "c5" opthelp-reverse-chrono #t)
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-general optname-options-summary
       "d" opthelp-options-summary
-      'never
+      "never"
       (list (vector 'always (G_ "Always"))
-            (vector 'never (G_ "Never")))))
+            (vector 'never (G_ "Never"))))
 
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
-        (gnc:filter-accountlist-type
+      (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
                ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
                ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
@@ -226,7 +214,6 @@ also show overall period profit & loss."))
                ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
                ACCT-TYPE-TRADING)
          (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
 
     ;; the depth-limit option is not well debugged; it may be better
     ;; to disable it altogether
@@ -235,19 +222,18 @@ also show overall period profit & loss."))
      "b" opthelp-depth-limit 'all)
 
     ;; all about currencies
-    (add-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       pagename-commodities optname-common-currency
-      "b" opthelp-common-currency #f #f
+      "b" opthelp-common-currency #f
       (lambda (x)
         (for-each
          (lambda (optname)
-           (gnc-option-db-set-option-selectable-by-name
+           (gnc-optiondb-set-option-selectable-by-name
             options pagename-commodities optname x))
          (list optname-report-commodity
                optname-show-rates
                optname-show-foreign
-               optname-price-source)))))
+               optname-price-source))))
 
     (gnc:options-add-currency!
      options pagename-commodities
@@ -257,62 +243,51 @@ also show overall period profit & loss."))
      options pagename-commodities
      optname-price-source "d" 'pricedb-nearest)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign
-      "e" opthelp-show-foreign #t))
+      "e" opthelp-show-foreign #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "f" opthelp-show-rates #t))
+      "f" opthelp-show-rates #t)
 
     ;; what to show for zero-balance accounts
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
-      "a" opthelp-show-zb-accts #t))
+      "a" opthelp-show-zb-accts #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
-      "b" opthelp-omit-zb-bals #f))
+      "b" opthelp-omit-zb-bals #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-parent-balance-mode
-      "c" opthelp-parent-balance-mode #t))
+      "c" opthelp-parent-balance-mode #t)
 
     ;; some detailed formatting options
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "e" opthelp-account-links #t))
+      "e" opthelp-account-links #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-amount-links
-      "e5" opthelp-amount-links #t))
+      "e5" opthelp-amount-links #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-full-name
-      "f" opthelp-account-full-name #f))
+      "f" opthelp-account-full-name #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-label-sections "g" opthelp-label-sections #t))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-display optname-label-sections "g" opthelp-label-sections #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-total-sections "h" opthelp-total-sections #t))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-display optname-total-sections "h" opthelp-total-sections #t)
 
     (when (eq? report-type 'pnl)
       ;; include overall period column?
-      (add-option
-       (gnc:make-simple-boolean-option
+      (gnc-register-simple-boolean-option options
         gnc:pagename-general optname-include-overall-period
-        "c6" opthelp-include-overall-period #f)))
+        "c6" opthelp-include-overall-period #f))
 
     (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -651,9 +626,8 @@ also show overall period profit & loss."))
 
 (define (multicol-report-renderer report-obj report-type)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting (get-option gnc:pagename-general gnc:optname-reportname))
 
diff --git a/gnucash/report/reports/standard/budget-balance-sheet.scm b/gnucash/report/reports/standard/budget-balance-sheet.scm
index c7b6ed3b4..0eb5e055f 100644
--- a/gnucash/report/reports/standard/budget-balance-sheet.scm
+++ b/gnucash/report/reports/standard/budget-balance-sheet.scm
@@ -113,82 +113,67 @@
 
 ;; options generator
 (define (budget-balance-sheet-options-generator)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
-    (add-option
-      (gnc:make-string-option
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
+
+    (gnc-register-string-option options
       gnc:pagename-general optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-      (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       gnc:pagename-general optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
     
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-report-form
-      "c" opthelp-report-form #t))
+      "c" opthelp-report-form #t)
 
-    (add-option
-     (gnc:make-budget-option
+    (gnc-register-budget-option options
       gnc:pagename-general optname-budget
-      "d" opthelp-budget))
+      "d" opthelp-budget (gnc-budget-get-default book))
     
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
-	(gnc:filter-accountlist-type 
+      (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
                ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
                ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
                ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE
                ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
 	 (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
+
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 3)
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-bottom-behavior
-      "c" opthelp-bottom-behavior #f))
+      "c" opthelp-bottom-behavior #f)
     
     ;; all about currencies
     (gnc:options-add-currency!
      options pagename-commodities
-     optname-report-commodity "a")
-    
+     optname-report-commodity "a")    
     (gnc:options-add-price-source! 
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign 
-      "c" opthelp-show-foreign #t))
+      "c" opthelp-show-foreign #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
+      "d" opthelp-show-rates #f)
     
     ;; what to show for zero-balance accounts
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
-      "a" opthelp-show-zb-accts #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "a" opthelp-show-zb-accts #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
-      "b" opthelp-omit-zb-bals #f))
+      "b" opthelp-omit-zb-bals #f)
     ;; what to show for non-leaf accounts
     (gnc:options-add-subtotal-view!
      options gnc:pagename-display
@@ -196,46 +181,37 @@
      "c")
 
     ;; some detailed formatting options
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "d" opthelp-account-links #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "d" opthelp-account-links #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
-      "e" opthelp-use-rules #f))
+      "e" opthelp-use-rules #f)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-assets
-      "f" opthelp-label-assets #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "f" opthelp-label-assets #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-assets
-      "g" opthelp-total-assets #t))
+      "g" opthelp-total-assets #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-liabilities
-      "h" opthelp-label-liabilities #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "h" opthelp-label-liabilities #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-liabilities
-      "i" opthelp-total-liabilities #t))
+      "i" opthelp-total-liabilities #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-equity
-      "j" opthelp-label-equity #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "j" opthelp-label-equity #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-equity
-      "k" opthelp-total-equity #t))
+      "k" opthelp-total-equity #t)
 
-    (add-option
-      (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
        gnc:pagename-display optname-new-existing
-       "l" opthelp-new-existing #t))
+       "l" opthelp-new-existing #t)
     
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-accounts)
@@ -251,9 +227,8 @@
 
 (define (budget-balance-sheet-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (define (get-budget-account-budget-balance budget account)
     (let ((bal (gnc:budget-account-get-net budget account #f #f)))
diff --git a/gnucash/report/reports/standard/budget-barchart.scm b/gnucash/report/reports/standard/budget-barchart.scm
index f371cadf1..b34253b99 100644
--- a/gnucash/report/reports/standard/budget-barchart.scm
+++ b/gnucash/report/reports/standard/budget-barchart.scm
@@ -70,79 +70,69 @@
         (vector 'manual (N_ "Manual period selection"))))
 
 (define (options-generator)
-  (let ((options (gnc:new-options))
+  (let ((options (gnc-new-optiondb))
+        (book (gnc-get-current-book))
         (ui-start-period-type 'current)
         (ui-end-period-type 'next))
 
-    (define (add-option new-option)
-      (gnc:register-option options new-option))
-
     (define (set-option-enabled options page opt-name enabled)
-      (gnc-option-db-set-option-selectable-by-name options page opt-name enabled))
+      (gnc-optiondb-set-option-selectable-by-name options page opt-name enabled))
 
     ;; Option to select Budget
-    (add-option
-     (gnc:make-budget-option
-      gnc:pagename-general optname-budget "a" (N_ "Budget to use.")))
+    (gnc-register-budget-option options
+                                gnc:pagename-general optname-budget "a"
+                                (N_ "Budget to use.")
+                                (gnc-budget-get-default book))
 
-    (add-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-general optname-budget-period-start
-      "g1.1" opthelp-budget-period-start 'current period-options #f
+      "g1.1" opthelp-budget-period-start "current" period-options
       (lambda (new-val)
         (set-option-enabled options gnc:pagename-general
                             optname-budget-period-start-exact (eq? 'manual new-val))
-        (set! ui-start-period-type new-val))))
+        (set! ui-start-period-type new-val)))
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-start-exact
       "g1.2" opthelp-budget-period-start-exact
-      1 1 60 0 1))
+      1 1 60 1)
 
-    (add-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-general optname-budget-period-end
-      "g2.1" opthelp-budget-period-end 'next period-options #f
+      "g2.1" opthelp-budget-period-end "next" period-options
       (lambda (new-val)
         (set-option-enabled options gnc:pagename-general
                             optname-budget-period-end-exact (eq? 'manual new-val))
-        (set! ui-end-period-type new-val))))
+        (set! ui-end-period-type new-val)))
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-end-exact
       "g2.2" opthelp-budget-period-end-exact
-      1 1 60 0 1))
+      1 1 60 1)
 
     ;; Option to select the accounts to that will be displayed
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "c" (N_ "Report on these accounts.")
-      (lambda ()
-        (gnc:filter-accountlist-type
+      (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)
          (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
 
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit "d" opthelp-depth-limit 6)
 
     ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-running-sum "a"
-      (N_ "Calculate as running sum?")  #t))
+      (N_ "Calculate as running sum?")  #t)
 
     ;; Display tab
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-display optname-chart-type "b"
-      (N_ "Select which chart type to use.") 'bars
+      (N_ "Select which chart type to use.") "bars"
       (list
        (vector 'bars (N_ "Bar Chart"))
-       (vector 'lines (N_ "Line Chart")))))
+       (vector 'lines (N_ "Line Chart"))))
 
     (gnc:options-add-plot-size!
      options gnc:pagename-display
@@ -242,8 +232,8 @@
 
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value
+     (gnc:report-options report-obj) section name))
 
   ;; This is a helper function to find out the level of the account
   ;; with in the account tree
diff --git a/gnucash/report/reports/standard/budget-flow.scm b/gnucash/report/reports/standard/budget-flow.scm
index 6928733e2..8fc459bff 100644
--- a/gnucash/report/reports/standard/budget-flow.scm
+++ b/gnucash/report/reports/standard/budget-flow.scm
@@ -46,19 +46,16 @@
 
 ;; options generator
 (define (budget-report-options-generator)
-  (let ((options (gnc:new-options)))
+  (let ((options (gnc-new-optiondb)))
 
     ;; Option to select Budget
-    (gnc:register-option
-     options
-     (gnc:make-budget-option
+    (gnc-register-budget-option options
       gnc:pagename-general optname-budget
-      "a" (N_ "Budget to use.")))
+      "a" (N_ "Budget to use.")
+      (gnc-budget-get-default (gnc-get-current-book)))
 
     ;; Option to select Period of selected Budget
-    (gnc:register-option
-     options
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-periods
       ;; FIXME: It would be nice if the max number of budget periods (60) was
       ;; defined globally somewhere so we could reference it here.  However, it
@@ -67,7 +64,7 @@
       ;; FIXME: It would be even nicer if the max number of budget
       ;; periods was determined by the number of periods in the
       ;; currently selected budget
-      "b" (N_ "Period number.") 1 1 60 0 1))
+      "b" (N_ "Period number.") 1 1 60 1)
 
     ;; Option to select the currency the report will be shown in
     (gnc:options-add-currency!
@@ -79,15 +76,11 @@
      options gnc:pagename-general optname-price-source "c" 'pricedb-latest)
 
     ;;Option to select the accounts to that will be displayed
-    (gnc:register-option
-     options
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       (string-append "a" "c")
       (N_ "Report on these accounts.")
-      (lambda ()
-        (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
-      #f #t))
+      (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
 
     ;; Set the general page as default option tab
     (gnc:options-set-default-section options gnc:pagename-general)
@@ -255,9 +248,8 @@
 
   ;; Helper function retrieves options
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   ;; Update progress bar
   (gnc:report-starting reportname)
diff --git a/gnucash/report/reports/standard/budget-income-statement.scm b/gnucash/report/reports/standard/budget-income-statement.scm
index c239c313c..2bf6cb1c4 100644
--- a/gnucash/report/reports/standard/budget-income-statement.scm
+++ b/gnucash/report/reports/standard/budget-income-statement.scm
@@ -131,86 +131,74 @@
 
 ;; options generator
 (define (budget-income-statement-options-generator-internal reportname)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
-    (add-option
-      (gnc:make-string-option
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
+
+    (gnc-register-string-option options
       gnc:pagename-general optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-      (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       gnc:pagename-general optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
 
-    (add-option
-     (gnc:make-budget-option
+    (gnc-register-budget-option options
       gnc:pagename-general optname-budget
-      "c" opthelp-budget))
+      "c" opthelp-budget
+      (gnc-budget-get-default book))
 
-    (add-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-general
       optname-use-budget-period-range
       "d"
       opthelp-use-budget-period-range
       #f
-      #f
       ;; Make budget-period-start and budget-period-end option widgets
       ;; selectable only when we are running the report for a budget period
       ;; range.
       (lambda (value)
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
           options
           gnc:pagename-general
           optname-budget-period-start
           value)
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
           options
           gnc:pagename-general
           optname-budget-period-end
-          value))))
+          value)))
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-start
       "e" opthelp-budget-period-start
       ;; FIXME: It would be nice if the max number of budget periods (60) was
       ;; defined globally somewhere so we could reference it here.  However, it
       ;; only appears to be defined currently in src/gnome/glade/budget.glade.
-      1 1 60 0 1))
+      1 1 60 1)
     
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-end
       "f" opthelp-budget-period-end
       ;; FIXME: It would be nice if the max number of budget periods (60) was
       ;; defined globally somewhere so we could reference it here.  However, it
       ;; only appears to be defined currently in src/gnome/glade/budget.glade.
-      1 1 60 0 1))
+      1 1 60 1)
     
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
-	(gnc:filter-accountlist-type
+      (gnc:filter-accountlist-type
 	 ;; select, by default, only income and expense accounts
 	 (list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
 	 (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
+
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 3)
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-bottom-behavior
-      "c" opthelp-bottom-behavior #f))
+      "c" opthelp-bottom-behavior #f)
     
     ;; all about currencies
     (gnc:options-add-currency!
@@ -221,25 +209,21 @@
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign 
-      "c" opthelp-show-foreign #t))
+      "c" opthelp-show-foreign #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
+      "d" opthelp-show-rates #f)
     
     ;; what to show for zero-balance accounts
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
-      "a" opthelp-show-zb-accts #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "a" opthelp-show-zb-accts #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
-      "b" opthelp-omit-zb-bals #f))
+      "b" opthelp-omit-zb-bals #f)
     ;; what to show for non-leaf accounts
     (gnc:options-add-subtotal-view!
      options gnc:pagename-display
@@ -247,42 +231,34 @@
      "c")
 
     ;; some detailed formatting options
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "d" opthelp-account-links #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "d" opthelp-account-links #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
-      "e" opthelp-use-rules #f))
+      "e" opthelp-use-rules #f)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-revenue
-      "f" opthelp-label-revenue #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "f" opthelp-label-revenue #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-revenue
-      "g" opthelp-total-revenue #t))
+      "g" opthelp-total-revenue #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-expense
-      "h" opthelp-label-expense #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "h" opthelp-label-expense #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-expense
-      "i" opthelp-total-expense #t))
+      "i" opthelp-total-expense #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-two-column
-      "j" opthelp-two-column #f))
+      "j" opthelp-two-column #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-standard-order
-      "k" opthelp-standard-order #t))
+      "k" opthelp-standard-order #t)
     
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-accounts)
@@ -296,9 +272,8 @@
 
 (define (budget-income-statement-renderer-internal report-obj reportname)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
   
   (define (get-assoc-account-balances-budget
            budget accountlist period-start period-end get-balance-fn)
diff --git a/gnucash/report/reports/standard/budget.scm b/gnucash/report/reports/standard/budget.scm
index c574cc0ee..0bc0e2afc 100644
--- a/gnucash/report/reports/standard/budget.scm
+++ b/gnucash/report/reports/standard/budget.scm
@@ -94,19 +94,15 @@
 
 ;;List of common helper functions, that is not bound only to options generation or report evaluation
 (define (get-option-val options pagename optname)
-  (gnc:option-value
-   (gnc:lookup-option options pagename optname)))
+  (gnc-optiondb-lookup-value options pagename optname))
 
 (define (set-option-enabled options page opt-name enabled)
-  (gnc-option-db-set-option-selectable-by-name
+  (gnc-optiondb-set-option-selectable-by-name
    options page opt-name enabled))
 
 ;; options generator
 (define (budget-report-options-generator)
-  (let* ((options (gnc:new-options))
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option)))
+  (let* ((options (gnc-new-optiondb))
          (period-options
           (list (vector 'first (N_ "First budget period"))
                 (vector 'previous (N_ "Previous budget period"))
@@ -118,21 +114,18 @@
          (ui-start-period-type 'current)
          (ui-end-period-type 'next))
 
-    (gnc:register-option
-     options
-     (gnc:make-budget-option
+    (gnc-register-budget-option options
       gnc:pagename-general optname-budget
-      "a" (N_ "Budget to use.")))
+      "a" (N_ "Budget to use.")
+      (gnc-budget-get-default (gnc-get-current-book)))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-accumulate
-      "b" opthelp-accumulate #f))
+      "b" opthelp-accumulate #f)
 
-    (add-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-general optname-use-budget-period-range
-      "f" opthelp-use-budget-period-range #f #f
+      "f" opthelp-use-budget-period-range #f
       (lambda (value)
         (for-each
          (lambda (opt)
@@ -148,56 +141,50 @@
                             optname-budget-period-end-exact
                             (and value (eq? 'manual ui-end-period-type)))
 
-        (set! ui-use-periods value))))
+        (set! ui-use-periods value)))
 
-    (add-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-general optname-budget-period-start
-      "g1.1" opthelp-budget-period-start 'current period-options #f
+      "g1.1" opthelp-budget-period-start "current" period-options
       (lambda (new-val)
         (set-option-enabled options gnc:pagename-general
                             optname-budget-period-start-exact
                             (and ui-use-periods (eq? 'manual new-val)))
-        (set! ui-start-period-type new-val))))
+        (set! ui-start-period-type new-val)))
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-start-exact
       "g1.2" opthelp-budget-period-start-exact
       ;; FIXME: It would be nice if the max number of budget periods (60) was
       ;; defined globally somewhere so we could reference it here.  However, it
       ;; only appears to be defined currently in src/gnome/glade/budget.glade.
-      1 1 60 0 1))
+      1 1 60 1)
 
-    (add-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-general optname-budget-period-end
-      "g2.1" opthelp-budget-period-end 'next period-options #f
+      "g2.1" opthelp-budget-period-end "next" period-options
       (lambda (new-val)
         (set-option-enabled options gnc:pagename-general
                             optname-budget-period-end-exact
                             (and ui-use-periods (eq? 'manual new-val)))
-        (set! ui-end-period-type new-val))))
+        (set! ui-end-period-type new-val)))
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-budget-period-end-exact
       "g2.2" opthelp-budget-period-end-exact
       ;; FIXME: It would be nice if the max number of budget periods (60) was
       ;; defined globally somewhere so we could reference it here.  However, it
       ;; only appears to be defined currently in src/gnome/glade/budget.glade.
-      1 1 60 0 1))
+      1 1 60 1)
     ;; accounts to work on
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-period-collapse-before
-      "g3" opthelp-period-collapse-before #t))
+      "g3" opthelp-period-collapse-before #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-period-collapse-after
-      "g4" opthelp-period-collapse-after #t))
+      "g4" opthelp-period-collapse-after #t)
 
     (gnc:options-add-account-selection!
      options gnc:pagename-accounts optname-display-depth
@@ -209,38 +196,31 @@
         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
      #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-bottom-behavior
-      "c" opthelp-bottom-behavior #f))
+      "c" opthelp-bottom-behavior #f)
 
     ;; columns to display
-    (add-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-display optname-show-budget
-      "s1" opthelp-show-budget #t #f
+      "s1" opthelp-show-budget #t
       (lambda (x)
-        (set-option-enabled options gnc:pagename-display optname-show-notes x))))
-    (add-option
-     (gnc:make-simple-boolean-option
+        (set-option-enabled options gnc:pagename-display optname-show-notes x)))
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-notes
-      "s15" opthelp-show-notes #t))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "s15" opthelp-show-notes #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-actual
-      "s2" opthelp-show-actual #t))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "s2" opthelp-show-actual #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-difference
-      "s3" opthelp-show-difference #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "s3" opthelp-show-difference #f)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-totalcol
-      "s4" opthelp-show-totalcol #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "s4" opthelp-show-totalcol #f)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accounts
-      "s5" opthelp-show-zb-accounts #t))
+      "s5" opthelp-show-zb-accounts #t)
 
     ;; Set the general page as default option tab
     (gnc:options-set-default-section options gnc:pagename-general)
diff --git a/gnucash/report/reports/standard/cash-flow.scm b/gnucash/report/reports/standard/cash-flow.scm
index 5a08b5ac0..3ec0d0f3a 100644
--- a/gnucash/report/reports/standard/cash-flow.scm
+++ b/gnucash/report/reports/standard/cash-flow.scm
@@ -54,7 +54,7 @@
 
 ;; options generator
 (define (cash-flow-options-generator)
-  (let ((options (gnc:new-options)))
+  (let ((options (gnc-new-optiondb)))
 
     ;; date interval
     (gnc:options-add-date-interval!
@@ -70,17 +70,13 @@
      options gnc:pagename-general
      optname-price-source "c" 'pricedb-nearest)
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-show-rates
-      "d" (N_ "Show the exchange rates used.") #f))
+      "d" (N_ "Show the exchange rates used.") #f)
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-show-full-names
-      "e" (N_ "Show full account names (including parent accounts).") #t))
+      "e" (N_ "Show full account names (including parent accounts).") #t)
 
     ;; accounts to work on
     (gnc:options-add-account-selection!
@@ -95,11 +91,9 @@
      #f)
 
     ;; Trading accounts?
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-include-trading-accounts
-      "b" (N_ "Include transfers to and from Trading Accounts in the report.")  #f))
+      "b" (N_ "Include transfers to and from Trading Accounts in the report.")  #f)
 
     ;; Set the general page as default option tab
     (gnc:options-set-default-section options gnc:pagename-general)
@@ -113,9 +107,8 @@
 
 (define (cash-flow-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/standard/cashflow-barchart.scm b/gnucash/report/reports/standard/cashflow-barchart.scm
index 8addbacfd..2189bcfd7 100644
--- a/gnucash/report/reports/standard/cashflow-barchart.scm
+++ b/gnucash/report/reports/standard/cashflow-barchart.scm
@@ -61,10 +61,7 @@
 
 ;; options generator function
 (define (cashflow-barchart-options-generator)
-  (let* ((options (gnc:new-options))
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; General tab
     (gnc:options-add-date-interval!
@@ -82,47 +79,34 @@
      optname-price-source "d" 'pricedb-nearest)
 
     ;; Accounts tab
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a" (N_ "Report on these accounts.")
-      (lambda ()     ; account getter
-        (gnc:filter-accountlist-type
+      (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-ASSET
                ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
          (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-include-trading-accounts
-      "b" (N_ "Include transfers to and from Trading Accounts in the report.")  #f))
+      "b" (N_ "Include transfers to and from Trading Accounts in the report.")  #f)
 
     ;; Display tab
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-in
-      "a" (N_ "Show money in?") #t))
+      "a" (N_ "Show money in?") #t)
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-out
-      "b" (N_ "Show money out?") #t))
+      "b" (N_ "Show money out?") #t)
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-net
-      "c" (N_ "Show net money flow?") #t))
+      "c" (N_ "Show net money flow?") #t)
 
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-table
-      "d" (N_ "Display a table of the selected data.") #f))
+      "d" (N_ "Display a table of the selected data.") #f)
 
     ;; Plot size options
     (gnc:options-add-plot-size!
@@ -141,9 +125,8 @@
 
 (define (cashflow-barchart-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/standard/category-barchart.scm b/gnucash/report/reports/standard/category-barchart.scm
index 9efb57c77..4adbccf4a 100644
--- a/gnucash/report/reports/standard/category-barchart.scm
+++ b/gnucash/report/reports/standard/category-barchart.scm
@@ -94,10 +94,7 @@ developing over time"))
 (define opthelp-averaging (N_ "Select whether the amounts should be shown over the full time period or rather as the average e.g. per month."))
 
 (define (options-generator account-types do-intervals?)
-  (let* ((options (gnc:new-options))
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; General tab
     (gnc:options-add-date-interval!
@@ -115,31 +112,25 @@ developing over time"))
      optname-price-source "d" 'weighted-average)
 
     (if do-intervals?
-        (add-option
-         (gnc:make-multichoice-option
+        (gnc-register-multichoice-option options
           gnc:pagename-general optname-averaging
           "e" opthelp-averaging
-          'None
+          "None"
           (list (vector 'None (N_ "No Averaging"))
                 (vector 'MonthDelta (N_ "Monthly"))
                 (vector 'WeekDelta (N_ "Weekly"))
-                (vector 'DayDelta (N_ "Daily"))))))
+                (vector 'DayDelta (N_ "Daily")))))
 
 
     ;; Accounts tab
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-limited-option options
       gnc:pagename-accounts optname-accounts
       "a"
       (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (gnc:filter-accountlist-type
+      (gnc:filter-accountlist-type
          account-types
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (gnc:filter-accountlist-type account-types accounts)))
-      #t))
+         (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+      account-types)
 
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-levels "c"
@@ -147,47 +138,41 @@ developing over time"))
      2)
 
     ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-fullname
-      "a" (N_ "Show the full account name in legend?") #f))
+      "a" (N_ "Show the full account name in legend?") #f)
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-display optname-chart-type
       "b" "Select which chart type to use."
-      'barchart
+      "barchart"
       (list (vector 'barchart (N_ "Bar Chart"))
-            (vector 'linechart (N_ "Line Chart")))))
+            (vector 'linechart (N_ "Line Chart"))))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-stacked
       "c"
       (N_ "Show charts as stacked charts?")
-      #t))
+      #t)
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-display optname-slices
       "d" (N_ "Maximum number of stacks in the chart.") 8
-      2 24 0 1))
+      2 24 1)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display
       (N_ "Show table")
       "e" (N_ "Display a table of the selected data.")
-      #f))
+      #f)
 
     ;; contributed by https://github.com/exxus
     ;; https://github.com/Gnucash/gnucash/pull/1272
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display
       (N_ "Percentage chart")
       "e1" (N_ "Display account contributions as a percentage of the total value for the period.")
-      #f))
+      #f)
 
     (gnc:options-add-plot-size!
      options gnc:pagename-display
@@ -218,9 +203,7 @@ developing over time"))
                                     export-type)
   ;; A helper functions for looking up option values.
   (define (get-option section name)
-    (gnc-option-value
-     (gnc:optiondb
-      (gnc:report-options report-obj)) section name))
+    (gnc-option-value (gnc:report-options report-obj) section name))
 
   (gnc:report-starting reportname)
   (let* ((to-date-t64 (gnc:time64-end-day-time
@@ -567,10 +550,9 @@ Please deselect the accounts with negative balances."))
                     (gnc:options-copy-values
                      (gnc:report-options report-obj) options)
                     ;; and set the destination accounts
-                    (gnc:option-set-value
-                     (gnc:lookup-option options gnc:pagename-accounts
-                                        optname-accounts)
-                     (map car finish))
+                    (gnc-set-option options gnc:pagename-accounts
+                                    optname-accounts
+                                    (map car finish))
                     ;; Set the URL to point to this report.
                     (set! other-anchor
                       (gnc:report-anchor-text
@@ -745,4 +727,3 @@ Please deselect the accounts with negative balances."))
         (list ACCT-TYPE-LIABILITY ACCT-TYPE-PAYABLE ACCT-TYPE-CREDIT
               ACCT-TYPE-CREDITLINE)
         #f menuname-liabilities menutip-liabilities #t category-barchart-liability-uuid)))
-
diff --git a/gnucash/report/reports/standard/customer-summary.scm b/gnucash/report/reports/standard/customer-summary.scm
index 5c76335bc..7d570b55e 100644
--- a/gnucash/report/reports/standard/customer-summary.scm
+++ b/gnucash/report/reports/standard/customer-summary.scm
@@ -79,74 +79,59 @@
 
 
 (define (options-generator)
-  (define options (gnc:new-options))
-
-  (define (add-option new-option)
-    (gnc:register-option options new-option))
+  (define options (gnc-new-optiondb))
 
   (gnc:options-add-date-interval!
    options gnc:pagename-general optname-from-date optname-to-date "b")
 
-  (add-option
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     pagename-incomeaccounts optname-incomeaccounts
     "b" opthelp-incomeaccounts
-    (lambda ()
-      (gnc:filter-accountlist-type
-       (list ACCT-TYPE-INCOME)
-       (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-    #f #t))
-
-  (add-option
-   (gnc:make-account-list-option
+    (gnc:filter-accountlist-type
+     (list ACCT-TYPE-INCOME)
+     (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+
+  (gnc-register-account-list-option options
     pagename-expenseaccounts optname-expenseaccounts
     "b" opthelp-expenseaccounts
-    (lambda ()
-      (gnc:filter-accountlist-type
-       (list ACCT-TYPE-EXPENSE)
-       (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-    #f #t))
-
-  (add-option
-   (gnc:make-multichoice-option
+    (gnc:filter-accountlist-type
+     (list ACCT-TYPE-EXPENSE)
+     (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+
+  (gnc-register-multichoice-option options
     gnc:pagename-display optname-sortkey
     "a" opthelp-sortkey
-    'customername
+    "customername"
     (list
      (vector 'customername (N_ "Customer Name"))
      (vector 'profit (N_ "Profit"))
      (vector 'markup (N_ "Markup (which is profit amount divided by sales)"))
      (vector 'sales (N_ "Sales"))
-     (vector 'expense (N_ "Expense")))))
+     (vector 'expense (N_ "Expense"))))
 
-  (add-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-display optname-sortascending
     "b" opthelp-sortascending
-    'ascend
+    "ascend"
     (list
      (vector 'ascend (N_ "Ascending"))
-     (vector 'descend (N_ "Descending")))))
+     (vector 'descend (N_ "Descending"))))
 
-  (add-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display optname-show-own-address
-    "d" opthelp-show-own-address #t))
+    "d" opthelp-show-own-address #t)
 
-  (add-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display optname-show-zero-lines
-    "e" opthelp-show-zero-lines #f))
+    "e" opthelp-show-zero-lines #f)
 
-  (add-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display optname-show-inactive
-    "f" opthelp-show-inactive #f))
+    "f" opthelp-show-inactive #f)
 
-  (add-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-display optname-show-column-expense
-    "g" opthelp-show-column-expense #t))
+    "g" opthelp-show-column-expense #t)
 
   (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -231,8 +216,7 @@
 
 (define (reg-renderer report-obj)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (let* ((document (gnc:make-html-document))
          (report-title (opt-val gnc:pagename-general gnc:optname-reportname))
diff --git a/gnucash/report/reports/standard/dashboard.scm b/gnucash/report/reports/standard/dashboard.scm
index 6b3061c29..431dff7d0 100644
--- a/gnucash/report/reports/standard/dashboard.scm
+++ b/gnucash/report/reports/standard/dashboard.scm
@@ -46,8 +46,7 @@
          (options (gnc:report-options (gnc-report-find view))))
 
     (define (set-option! section name value)
-      (gnc:option-set-value
-       (gnc:lookup-option options section name) value))
+      (gnc-set-option (gnc:optiondb options) section name value))
 
     (set-option! "General" "Report name" (G_ "Dashboard"))
     (set-option! "General" "Number of columns" 2)
diff --git a/gnucash/report/reports/standard/equity-statement.scm b/gnucash/report/reports/standard/equity-statement.scm
index 8661214eb..254de62e1 100644
--- a/gnucash/report/reports/standard/equity-statement.scm
+++ b/gnucash/report/reports/standard/equity-statement.scm
@@ -98,20 +98,15 @@
 
 ;; options generator
 (define (equity-statement-options-generator)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
     
-    (add-option
-      (gnc:make-string-option
+    (gnc-register-string-option options
       (N_ "General") optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-      (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       (N_ "General") optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
     
     ;; date at which to report balance
     (gnc:options-add-date-interval!
@@ -119,13 +114,11 @@
      optname-start-date optname-end-date "c")
     
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
-	(gnc:filter-accountlist-type 
+      (gnc:filter-accountlist-type 
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
                ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
                ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
@@ -133,7 +126,6 @@
                ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
                ACCT-TYPE-TRADING)
          (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
     
     ;; all about currencies
     (gnc:options-add-currency!
@@ -144,38 +136,32 @@
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign 
-      "c" opthelp-show-foreign #t))
+      "c" opthelp-show-foreign #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
+      "d" opthelp-show-rates #f)
     
     ;; some detailed formatting options
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
-      "f" opthelp-use-rules #f))
+      "f" opthelp-use-rules #f)
     
     ;; closing entry match criteria
     ;; 
     ;; N.B.: transactions really should have a field where we can put
     ;; transaction types like "Adjusting/Closing/Correcting Entries"
-    (add-option
-      (gnc:make-string-option
+    (gnc-register-string-option options
       pagename-entries optname-closing-pattern
-      "a" opthelp-closing-pattern (G_ "Closing Entries")))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "a" opthelp-closing-pattern (G_ "Closing Entries"))
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-casing
-      "b" opthelp-closing-casing #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "b" opthelp-closing-casing #f)
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-regexp
-      "c" opthelp-closing-regexp #f))
+      "c" opthelp-closing-regexp #f)
     
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-accounts)
@@ -209,9 +195,8 @@
 
 (define (equity-statement-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
   
   (gnc:report-starting reportname)
   
diff --git a/gnucash/report/reports/standard/general-journal.scm b/gnucash/report/reports/standard/general-journal.scm
index 9d1e31d5d..781ad7610 100644
--- a/gnucash/report/reports/standard/general-journal.scm
+++ b/gnucash/report/reports/standard/general-journal.scm
@@ -46,8 +46,8 @@
          (query (qof-query-create-for-splits)))
 
     (define (set-option! section name value)
-      (gnc:option-set-default-value
-       (gnc:lookup-option options section name) value))
+      (GncOption-set-default-value
+       (gnc-lookup-option (gnc:optiondb options) section name) value))
 
     ;; Match, by default, all non-void transactions ever recorded in
     ;; all accounts....  Whether or not to match void transactions,
diff --git a/gnucash/report/reports/standard/ifrs-cost-basis.scm b/gnucash/report/reports/standard/ifrs-cost-basis.scm
index 4172dfcf8..c137c73a7 100644
--- a/gnucash/report/reports/standard/ifrs-cost-basis.scm
+++ b/gnucash/report/reports/standard/ifrs-cost-basis.scm
@@ -77,10 +77,7 @@ commissions in cumulative average cost and gain/loss after commission")
 the split action field to detect capitalized fees on stock activity")
 
 (define (options-generator)
-  (let ((options (gnc:new-options)))
-
-    (define (add-option new-option)
-      (gnc:register-option options new-option))
+  (let ((options (gnc-new-optiondb)))
 
     (gnc:options-add-date-interval!
      options gnc:pagename-general optname-startdate optname-enddate " ")
@@ -88,46 +85,37 @@ the split action field to detect capitalized fees on stock activity")
     (gnc:options-add-currency!
      options gnc:pagename-general optname-report-currency "a")
 
-    (add-option
-     (gnc:make-account-sel-limited-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-stock-acct "b" "Stock Account"
-      #f #f (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)))
+      '() (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
 
-    (add-option
-     (gnc:make-account-sel-limited-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-proceeds-acct "c" "Proceeds Account"
-      #f #f (list ACCT-TYPE-ASSET ACCT-TYPE-BANK)))
+      '() (list ACCT-TYPE-ASSET ACCT-TYPE-BANK))
 
-    (add-option
-     (gnc:make-account-sel-limited-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-dividend-acct "c" "Dividend Account"
-      #f #f (list ACCT-TYPE-INCOME)))
+      '() (list ACCT-TYPE-INCOME))
 
-    (add-option
-     (gnc:make-account-sel-limited-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-capgains-acct "d" "Cap Gains Account"
-      #f #f (list ACCT-TYPE-INCOME)))
+      '() (list ACCT-TYPE-INCOME))
 
-    (add-option
-     (gnc:make-account-sel-limited-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-fees-acct "c5" "Fees Account"
-      #f #f (list ACCT-TYPE-EXPENSE)))
+      '() (list ACCT-TYPE-EXPENSE))
 
-    (add-option
-     (gnc:make-string-option
-      gnc:pagename-general optname-cap-fee-action "d5" opthelp-cap-fee-action "Fee"))
+    (gnc-register-string-option options
+      gnc:pagename-general optname-cap-fee-action "d5" opthelp-cap-fee-action "Fee")
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-general optname-format-cells "e" opthelp-format-cells #t))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-general optname-format-cells "e" opthelp-format-cells #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-general optname-format-short "f" opthelp-format-short #t))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-general optname-format-short "f" opthelp-format-short #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-general optname-cap-purch-costs "g" opthelp-cap-purch-costs #t))
+    (gnc-register-simple-boolean-option options
+      gnc:pagename-general optname-cap-purch-costs "g" opthelp-cap-purch-costs #t)
 
     options))
 
@@ -297,8 +285,8 @@ the split action field to detect capitalized fees on stock activity")
 
 (define (ifrs-cost-basis-renderer report-obj)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value
+     (gnc:report-options report-obj) section name))
 
   (define opt-startdate (opt-val gnc:pagename-general optname-startdate))
   (define opt-enddate   (opt-val gnc:pagename-general optname-enddate))
diff --git a/gnucash/report/reports/standard/income-statement.scm b/gnucash/report/reports/standard/income-statement.scm
index ebc53a9cd..0bfc2e58e 100644
--- a/gnucash/report/reports/standard/income-statement.scm
+++ b/gnucash/report/reports/standard/income-statement.scm
@@ -136,20 +136,15 @@
 
 ;; options generator
 (define (income-statement-options-generator-internal reportname)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
-    (add-option
-      (gnc:make-string-option
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
+
+    (gnc-register-string-option options
       gnc:pagename-general optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-      (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       gnc:pagename-general optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
     
     ;; period over which to report income
     (gnc:options-add-date-interval!
@@ -157,24 +152,21 @@
      optname-start-date optname-end-date "c")
     
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
 	(gnc:filter-accountlist-type
 	 ;; select, by default, only income and expense accounts
 	 (list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
 	 (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
+
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 3)
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-bottom-behavior
-      "c" opthelp-bottom-behavior #f))
+      "c" opthelp-bottom-behavior #f)
     
     ;; all about currencies
     (gnc:options-add-currency!
@@ -184,26 +176,22 @@
     (gnc:options-add-price-source! 
      options pagename-commodities
      optname-price-source "b" 'pricedb-nearest)
-    
-    (add-option 
-     (gnc:make-simple-boolean-option
+
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign 
-      "c" opthelp-show-foreign #t))
+      "c" opthelp-show-foreign #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
-    
+      "d" opthelp-show-rates #f)
+
     ;; what to show for zero-balance accounts
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-show-zb-accts
-      "a" opthelp-show-zb-accts #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "a" opthelp-show-zb-accts #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-omit-zb-bals
-      "b" opthelp-omit-zb-bals #f))
+      "b" opthelp-omit-zb-bals #f)
     ;; what to show for non-leaf accounts
     (gnc:options-add-subtotal-view!
      options gnc:pagename-display
@@ -211,68 +199,55 @@
      "c")
 
     ;; some detailed formatting options
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "e" opthelp-account-links #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "e" opthelp-account-links #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-use-rules
-      "f" opthelp-use-rules #f))
+      "f" opthelp-use-rules #f)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-revenue
-      "g" opthelp-label-revenue #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "g" opthelp-label-revenue #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-revenue
-      "h" opthelp-total-revenue #t))
+      "h" opthelp-total-revenue #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-trading
-      "h1" opthelp-label-trading #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "h1" opthelp-label-trading #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-trading
-      "h2" opthelp-total-trading #t))
+      "h2" opthelp-total-trading #t)
     
-    (add-option 
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-label-expense
-      "i" opthelp-label-expense #t))
-    (add-option 
-     (gnc:make-simple-boolean-option
+      "i" opthelp-label-expense #t)
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-total-expense
-      "j" opthelp-total-expense #t))
+      "j" opthelp-total-expense #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-two-column
-      "k" opthelp-two-column #f))
+      "k" opthelp-two-column #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-standard-order
-      "l" opthelp-standard-order #t))
+      "l" opthelp-standard-order #t)
     
     ;; closing entry match criteria
     ;; 
     ;; N.B.: transactions really should have a field where we can put
     ;; transaction types like "Adjusting/Closing/Correcting Entries"
-    (add-option
-      (gnc:make-string-option
+    (gnc-register-string-option options
       pagename-entries optname-closing-pattern
-      "a" opthelp-closing-pattern (G_ "Closing Entries")))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "a" opthelp-closing-pattern (G_ "Closing Entries"))
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-casing
-      "b" opthelp-closing-casing #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "b" opthelp-closing-casing #f)
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-regexp
-      "c" opthelp-closing-regexp #f))
+      "c" opthelp-closing-regexp #f)
     
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-accounts)
@@ -286,9 +261,8 @@
 
 (define (income-statement-renderer-internal report-obj reportname)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option 
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
   
diff --git a/gnucash/report/reports/standard/invoice.scm b/gnucash/report/reports/standard/invoice.scm
index 02916ff7f..bbadce037 100644
--- a/gnucash/report/reports/standard/invoice.scm
+++ b/gnucash/report/reports/standard/invoice.scm
@@ -69,8 +69,7 @@
 
 (define (build-column-used options)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (vector
    (opt-val "Display Columns" "Date")
    (opt-val "Display Columns" "Description")
@@ -167,218 +166,178 @@
   (gnc:multiline-to-html-text str))
 
 (define (options-generator variant)
+  (let ((options (gnc-new-optiondb)))
 
-  (define gnc:*report-options* (gnc:new-options))
+    (gnc-register-invoice-option options
+                                 gnc:pagename-general
+                                 gnc:optname-invoice-number "x" "" '())
 
-  (define (gnc:register-inv-option new-option)
-    (gnc:register-option gnc:*report-options* new-option))
-
-  (gnc:register-inv-option
-   (gnc:make-invoice-option gnc:pagename-general gnc:optname-invoice-number "x" ""
-                            (lambda () '()) #f))
-
-  (gnc:register-inv-option
-   (gnc:make-string-option
+  (gnc-register-string-option options
     gnc:pagename-general (N_ "Custom Title")
     "z" (N_ "A custom string to replace Invoice, Bill or Expense Voucher.")
-    ""))
+    "")
 
-  (gnc:register-inv-option
-   (gnc:make-text-option
+  (gnc-register-text-option options
     (N_ "Layout") (N_ "CSS") "zz" (N_ "CSS code. This field specifies the CSS code \
 for styling the invoice. Please see the exported report for the CSS class names.")
-    (keylist-get-info variant-list variant 'css)))
+    (keylist-get-info variant-list variant 'css))
 
-  (gnc:register-inv-option
-   (gnc:make-pixmap-option
+  (gnc-register-pixmap-option options
     (N_ "Layout") (N_ "Picture Location") "zy" (N_ "Location for Picture")
-    ""))
+    "")
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Date")
-    "b" (N_ "Display the date?") #t))
+    "b" (N_ "Display the date?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Description")
-    "d" (N_ "Display the description?") #t))
+    "d" (N_ "Display the description?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Action")
-    "g" (N_ "Display the action?") #t))
+    "g" (N_ "Display the action?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Quantity")
-    "ha" (N_ "Display the quantity of items?") #t))
+    "ha" (N_ "Display the quantity of items?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Price")
-    "hb" (N_ "Display the price per item?") #t))
+    "hb" (N_ "Display the price per item?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Discount")
-    "k" (N_ "Display the entry's discount?") #t))
+    "k" (N_ "Display the entry's discount?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Taxable")
-    "l" (N_ "Display the entry's taxable status?") #t))
+    "l" (N_ "Display the entry's taxable status?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Tax Amount")
-    "m" (N_ "Display each entry's total total tax?") #f))
+    "m" (N_ "Display each entry's total total tax?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") (N_ "Total")
-    "n" (N_ "Display the entry's value?") #t))
+    "n" (N_ "Display the entry's value?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Due Date")
-    "c" (N_ "Display due date?") #t))
+    "c" (N_ "Display due date?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Subtotal")
-    "d" (N_ "Display the subtotals?") #t))
+    "d" (N_ "Display the subtotals?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-complex-boolean-option
+  (gnc-register-complex-boolean-option options
     (N_ "Display") (N_ "Payable to")
-    "ua1" (N_ "Display the Payable to: information.") #f #f
+    "ua1" (N_ "Display the Payable to: information.") #f
     (lambda (x)
-      (gnc-option-db-set-option-selectable-by-name
-       gnc:*report-options* "Display" "Payable to string" x))))
+      (gnc-optiondb-set-option-selectable-by-name
+       options "Display" "Payable to string" x)))
 
-  (gnc:register-inv-option
-   (gnc:make-text-option
+  (gnc-register-text-option options
     (N_ "Display") (N_ "Payable to string")
     "ua2" (N_ "The phrase for specifying to whom payments should be made.")
-    (G_ "Please make all checks payable to")))
+    (G_ "Please make all checks payable to"))
 
-  (gnc:register-inv-option
-   (gnc:make-complex-boolean-option
+  (gnc-register-complex-boolean-option options
     (N_ "Display") (N_ "Company contact")
-    "ub1" (N_ "Display the Company contact information.") #f #f
-    (lambda (x) (gnc-option-db-set-option-selectable-by-name
-                 gnc:*report-options* "Display" "Company contact string" x))))
+    "ub1" (N_ "Display the Company contact information.") #f
+    (lambda (x) (gnc-optiondb-set-option-selectable-by-name
+                 options "Display" "Company contact string" x)))
 
-  (gnc:register-inv-option
-   (gnc:make-text-option
+  (gnc-register-text-option options
     (N_ "Display") (N_ "Company contact string")
     "ub2" (N_ "The phrase used to introduce the company contact.")
-    (G_ "Please direct all enquiries to")))
+    (G_ "Please direct all enquiries to"))
 
-  (gnc:register-inv-option
-   (gnc:make-number-range-option
+  (gnc-register-number-range-option options
     (N_ "Display") (N_ "Minimum # of entries")
     "zz" (N_ "The minimum number of invoice entries to display.") 1
-    0 23 0 1))
+    0 23 1)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Use Detailed Tax Summary")
-    "o" (N_ "Display all tax categories separately (one per line) instead of one single tax line.?") #f))
+    "o" (N_ "Display all tax categories separately (one per line) instead of one single tax line.?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "References")
-    "s" (N_ "Display the invoice references?") #t))
+    "s" (N_ "Display the invoice references?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Billing Terms")
-    "t" (N_ "Display the invoice billing terms?") #t))
+    "t" (N_ "Display the invoice billing terms?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Billing ID")
-    "ta" (N_ "Display the billing id?") #t))
+    "ta" (N_ "Display the billing id?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Invoice owner ID")
-    "tam" (N_ "Display the customer/vendor id?") #f))
+    "tam" (N_ "Display the customer/vendor id?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Invoice Notes")
-    "tb" (N_ "Display the invoice notes?") #f))
+    "tb" (N_ "Display the invoice notes?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Payments")
-    "tc" (N_ "Display the payments applied to this invoice?") #t))
+    "tc" (N_ "Display the payments applied to this invoice?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Job Details")
-    "td" (N_ "Display the job name for this invoice?") #f))
+    "td" (N_ "Display the job name for this invoice?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-text-option
+  (gnc-register-text-option options
     (N_ "Display") (N_ "Extra Notes")
     "u" (N_ "Extra notes to put on the invoice.")
-    (G_ "Thank you for your patronage!")))
+    (G_ "Thank you for your patronage!"))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 1 Left")
     "1a" "1st row, left"
-    (keylist-get-info variant-list variant '1a)
-    (keylist->vectorlist layout-key-list)))
+    (symbol->string (keylist-get-info variant-list variant '1a))
+    (keylist->vectorlist layout-key-list))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 1 Right")
     "1b" "1st row, right"
-    (keylist-get-info variant-list variant '1b)
-    (keylist->vectorlist layout-key-list)))
+    (symbol->string (keylist-get-info variant-list variant '1b))
+    (keylist->vectorlist layout-key-list))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 2 Left")
     "2a" "2nd row, left"
-    (keylist-get-info variant-list variant '2a)
-    (keylist->vectorlist layout-key-list)))
+    (symbol->string (keylist-get-info variant-list variant '2a))
+    (keylist->vectorlist layout-key-list))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 2 Right")
     "2b" "2nd row, right"
-    (keylist-get-info variant-list variant '2b)
-    (keylist->vectorlist layout-key-list)))
+    (symbol->string (keylist-get-info variant-list variant '2b))
+    (keylist->vectorlist layout-key-list))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 3 Left")
     "3a" "3rd row, left"
-    (keylist-get-info variant-list variant '3a)
-    (keylist->vectorlist layout-key-list)))
+    (symbol->string (keylist-get-info variant-list variant '3a))
+    (keylist->vectorlist layout-key-list))
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Layout") (N_ "Row 3 Right")
     "3b" "3rd row, right"
-    (keylist-get-info variant-list variant '3b)
-    (keylist->vectorlist layout-key-list)))
-
-  (gnc:options-set-default-section gnc:*report-options* "General")
+    (symbol->string (keylist-get-info variant-list variant '3b))
+    (keylist->vectorlist layout-key-list))
 
-  gnc:*report-options*)
+  (gnc:options-set-default-section options "General")
 
+  options))
 
 (define (make-entry-table invoice options cust-doc? credit-note?)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
 
   (let ((show-payments (opt-val "Display" "Payments"))
         (display-all-taxes (opt-val "Display" "Use Detailed Tax Summary"))
@@ -574,8 +533,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
 (define (make-invoice-details-table invoice options)
   ;; dual-column. invoice date/due, billingID, terms, job name/number
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (let* ((invoice-details-table (gnc:make-html-table))
          (book (gncInvoiceGetBook invoice))
          (date-format (gnc:options-fancy-date book))
@@ -648,8 +606,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
 
 (define (make-client-table owner orders options)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   ;; this is a single-column table.
   (let ((table (gnc:make-html-table)))
 
@@ -702,7 +659,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
          (fax (gnc:company-info book gnc:*company-fax*))
          (email (gnc:company-info book gnc:*company-email*))
          (url (gnc:company-info book gnc:*company-url*))
-         (taxnr (gnc:option-get-value book gnc:*tax-label* gnc:*tax-nr-label*))
+         (taxnr (gnc:book-get-option-value book gnc:*tax-label* gnc:*tax-nr-label*))
          (taxid (gnc:company-info book gnc:*company-id*)))
 
     (if (and name (not (string-null? name)))
@@ -750,7 +707,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
 (define (reg-renderer report-obj)
   (let* ((document (gnc:make-html-document))
          (options (gnc:report-options report-obj))
-         (opt-val (lambda (section name) (gnc:option-value (gnc:lookup-option options section name))))
+         (opt-val (lambda (section name) (gnc-optiondb-lookup-value options section name)))
          (invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
          (references? (opt-val "Display" "References"))
          (custom-title (opt-val gnc:pagename-general "Custom Title")))
diff --git a/gnucash/report/reports/standard/lot-viewer.scm b/gnucash/report/reports/standard/lot-viewer.scm
index 0a09f0558..a16e2d201 100644
--- a/gnucash/report/reports/standard/lot-viewer.scm
+++ b/gnucash/report/reports/standard/lot-viewer.scm
@@ -44,25 +44,20 @@
         (cons TXN-TYPE-LINK "Link")))
 
 (define (options-generator)
-  (let ((options (gnc:new-options)))
-
-    (define (add-option new-option)
-      (gnc:register-option options new-option))
+  (let ((options (gnc-new-optiondb)))
 
     ;; General tab
     (gnc:options-add-date-interval!
      options gnc:pagename-general
      optname-from-date optname-to-date "a")
 
-    (add-option
-     (gnc:make-account-sel-option
+    (gnc-register-account-sel-limited-option options
       gnc:pagename-general optname-account "b"
       (N_ "The account to search for lots.")
-      #f #f))
+      '() '())
 
-    (add-option
-     (gnc:make-string-option
-      gnc:pagename-general optname-desc-filter "b" "Description Filter" ""))
+    (gnc-register-string-option options
+      gnc:pagename-general optname-desc-filter "b" "Description Filter" "")
 
     options))
 
@@ -70,8 +65,7 @@
 
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (define (get-all-lots splits)
     (define lots-seen (make-hash-table))
diff --git a/gnucash/report/reports/standard/net-charts.scm b/gnucash/report/reports/standard/net-charts.scm
index 1f58450f7..b5e1e5df9 100644
--- a/gnucash/report/reports/standard/net-charts.scm
+++ b/gnucash/report/reports/standard/net-charts.scm
@@ -62,12 +62,7 @@
 (define optname-y-grid (N_ "Grid"))
 
 (define (options-generator inc-exp? linechart?)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See libgnucash/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; General tab
     (gnc:options-add-date-interval!
@@ -85,54 +80,44 @@
      optname-price-source "d" 'weighted-average)
 
     ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
-      gnc:pagename-accounts optname-accounts
-      "a"
-      (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (filter
-         (if inc-exp?
-             gnc:account-is-inc-exp?
-             (lambda (account) (not (gnc:account-is-inc-exp? account))))
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (filter
-               (if inc-exp?
-                   gnc:account-is-inc-exp?
-                   (lambda (account)
-                     (not (gnc:account-is-inc-exp? account))))
-               accounts)))
-      #t))
+
+    (gnc-register-account-list-option
+     options gnc:pagename-accounts optname-accounts
+     "a"
+     (N_ "Report on these accounts, if chosen account level allows.")
+     (if inc-exp?
+         (gnc:filter-accountlist-type
+          (list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
+          (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+
+         (filter
+          (lambda (account) (not (gnc:account-is-inc-exp? account)))
+          (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))))
 
     ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display
       (if inc-exp? optname-inc-exp optname-sep-bars)
       "a"
       (if inc-exp?
           (N_ "Show Income and Expenses?")
           (N_ "Show the Asset and the Liability bars?"))
-      #t))
+      #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display
       (if inc-exp? optname-show-profit optname-net-bars)
       "b"
       (if inc-exp?
           (N_ "Show the net profit?")
           (N_ "Show a Net Worth bar?"))
-      #t))
+      #t)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display
       (N_ "Show table")
       "c" (N_ "Display a table of the selected data.")
-      #f))
+      #f)
 
     (gnc:options-add-plot-size!
      options gnc:pagename-display
@@ -141,30 +126,25 @@
     (if linechart?
         (begin
 
-          (add-option
-           (gnc:make-number-range-option
+          (gnc-register-number-range-option options
             gnc:pagename-display optname-line-width
             "e" opthelp-line-width
-            1.5 0.5 5 1 0.1 ))
+            1.5 0.5 5 0.1 )
 
-          (add-option
-           (gnc:make-simple-boolean-option
+          (gnc-register-simple-boolean-option options
             gnc:pagename-display optname-y-grid
             "f" (N_ "Add grid lines.")
-            #t))
+            #t)
 
-          ;;(add-option
-          ;; (gnc:make-simple-boolean-option
+          ;;(gnc-register-simple-boolean-option options
           ;;  gnc:pagename-display optname-x-grid
           ;;  "g" (N_ "Add vertical grid lines.")
           ;;  #f))
 
-          (add-option
-           (gnc:make-simple-boolean-option
+          (gnc-register-simple-boolean-option options
             gnc:pagename-display optname-markers
             "g" (N_ "Display a mark for each data point.")
-            #t))
-
+            #t)
           ))
 
     (gnc:options-set-default-section options gnc:pagename-general)
@@ -181,8 +161,7 @@
 
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (gnc:report-starting "INC/EXP & A/L Charts")
   (let* ((to-date-t64 (gnc:time64-end-day-time
diff --git a/gnucash/report/reports/standard/new-aging.scm b/gnucash/report/reports/standard/new-aging.scm
index 40d9ce9d2..57d4efd8f 100644
--- a/gnucash/report/reports/standard/new-aging.scm
+++ b/gnucash/report/reports/standard/new-aging.scm
@@ -76,60 +76,55 @@ exist but have no suitable transactions."))
   (qof-query-set-sort-increasing query #t #t #t))
 
 (define (aging-options-generator options)
-  (let* ((add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
     (gnc:options-add-report-date!
      options gnc:pagename-general optname-to-date "a")
 
     ;; Use a default report date of 'today'
-    (gnc:option-set-default-value
-     (gnc:lookup-option options gnc:pagename-general optname-to-date)
+    (GncOption-set-default-value
+     (gnc-lookup-option options gnc:pagename-general optname-to-date)
      (cons 'relative 'today))
 
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-sort-by "i" (N_ "Sort companies by.") 'name
+    (gnc-register-multichoice-option
+     options
+     gnc:pagename-general optname-sort-by "i" (N_ "Sort companies by.")
+     "name"
       (list
        (vector 'name (N_ "Name of the company"))
        (vector 'total (N_ "Total amount owed to/from Company"))
-       (vector 'oldest-bracket (N_ "Bracket Total Owed")))))
+       (vector 'oldest-bracket (N_ "Bracket Total Owed"))))
 
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-sort-order "ia" (N_ "Sort order.") 'increasing
-      (list
-       (vector 'increasing (N_ "Ascending"))
-       (vector 'decreasing (N_ "Descending")))))
+    (gnc-register-multichoice-option
+     options gnc:pagename-general optname-sort-order "ia" (N_ "Sort order.")
+     "increasing"
+     (list
+      (vector 'increasing (N_ "Ascending"))
+      (vector 'decreasing (N_ "Descending"))))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-general optname-show-zeros "j"
       (N_ "Show all vendors/customers even if they have a zero balance.")
-      #f))
+      #f)
 
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-date-driver "k" (N_ "Leading date.") 'duedate
+    (gnc-register-multichoice-option
+     options gnc:pagename-general optname-date-driver "k" (N_ "Leading date.")
+     "duedate"
       (list
        (vector 'duedate (N_ "Due Date"))
-       (vector 'postdate (N_ "Post Date")))))
+       (vector 'postdate (N_ "Post Date"))))
 
     (gnc:options-set-default-section options "General")
 
     (for-each
      (lambda (opt)
-       (add-option
-        (gnc:make-simple-boolean-option
-         gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f)))
+       (gnc-register-simple-boolean-option options
+         gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f))
      addr-options-list)
 
-    options))
+    options)
 
 (define (options->address options receivable? owner)
   (define (op-value name)
-    (gnc:option-value (gnc:lookup-option options gnc:pagename-display name)))
+    (gnc-optiondb-lookup-value options gnc:pagename-display name))
   (let* ((address-list-names (map car addr-options-list))
          (address-list-options (map op-value address-list-names))
          (addr-source (if receivable? (op-value optname-addr-source) 'billing))
@@ -173,7 +168,7 @@ exist but have no suitable transactions."))
 (define (aging-renderer report-obj receivable)
   (define options (gnc:report-options report-obj))
   (define (op-value section name)
-    (gnc:option-value (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
 
   (define make-heading-list
     (list (G_ "Company")
@@ -390,19 +385,18 @@ exist but have no suitable transactions."))
     document))
 
 (define (payable-options-generator)
-  (aging-options-generator (gnc:new-options)))
+  (aging-options-generator (gnc-new-optiondb)))
 
 (define (receivable-options-generator)
-  (let ((options (aging-options-generator (gnc:new-options))))
-    (define (add-option new-option)
-      (gnc:register-option options new-option))
-
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-display optname-addr-source "a" (N_ "Address source.") 'billing
-      (list
-       (vector 'billing (N_ "Billing address"))
-       (vector 'shipping (N_ "Shipping address")))))
+  (let ((options (aging-options-generator (gnc-new-optiondb))))
+
+    (gnc-register-multichoice-option
+     options gnc:pagename-display optname-addr-source "a"
+     (N_ "Address source.")
+     "billing"
+     (list
+      (vector 'billing (N_ "Billing address"))
+      (vector 'shipping (N_ "Shipping address"))))
     options))
 
 (define (payables-renderer report-obj)
@@ -433,19 +427,17 @@ exist but have no suitable transactions."))
  'in-menu? #t)
 
 (define (receivables-report-create-internal acct title show-zeros?)
-  (let* ((options (gnc:make-report-options receivables-aging-guid))
-         (zero-op (gnc:lookup-option options gnc:pagename-general optname-show-zeros))
-         (title-op (gnc:lookup-option options gnc:pagename-general gnc:optname-reportname)))
-    (when title (gnc:option-set-value title-op title))
-    (gnc:option-set-value zero-op show-zeros?)
+  (let* ((options (gnc:make-report-options receivables-aging-guid)))
+    (when title (gnc-set-option-set-value
+                 options gnc:pagename-general gnc:optname-reportname title))
+    (gnc-set-option options gnc:pagename-general optname-show-zeros show-zeros?)
     (gnc:make-report receivables-aging-guid options)))
 
 (define (payables-report-create-internal acct title show-zeros?)
-  (let* ((options (gnc:make-report-options payables-aging-guid))
-         (zero-op (gnc:lookup-option options gnc:pagename-general optname-show-zeros))
-         (title-op (gnc:lookup-option options gnc:pagename-general gnc:optname-reportname)))
-    (when title (gnc:option-set-value title-op title))
-    (gnc:option-set-value zero-op show-zeros?)
+  (let* ((options (gnc:make-report-options payables-aging-guid)))
+    (when title (gnc-set-option
+                 options gnc:pagename-general gnc:optname-reportname title))
+    (gnc-set-option options gnc:pagename-general optname-show-zeros show-zeros?)
     (gnc:make-report payables-aging-guid options)))
 
 (define (gnc:receivables-create-internal
diff --git a/gnucash/report/reports/standard/new-owner-report.scm b/gnucash/report/reports/standard/new-owner-report.scm
index a7f4de258..dbb16f85d 100644
--- a/gnucash/report/reports/standard/new-owner-report.scm
+++ b/gnucash/report/reports/standard/new-owner-report.scm
@@ -186,8 +186,7 @@
 
 (define (build-column-used options)
   (define (opt-val name)
-    (gnc:option-value
-     (gnc:lookup-option options "Display Columns" name)))
+    (gnc-optiondb-lookup-value options "Display Columns" name))
   (list->vector
    (map opt-val
         (list date-header due-date-header reference-header type-header
@@ -856,79 +855,62 @@ and do not match the transaction."))))))))
             sale))))))
 
 (define (options-generator owner-type)
+  (let ((options (gnc-new-optiondb)))
 
-  (define gnc:*report-options* (gnc:new-options))
-
-  (define (gnc:register-inv-option new-option)
-    (gnc:register-option gnc:*report-options* new-option))
-
-  (gnc:register-inv-option
-   (gnc:make-owner-option
+  (gnc-register-owner-option options
     owner-page (owner-string owner-type) "v"
-    (N_ "The company for this report.")
-    (lambda () '()) #f owner-type))
+    (N_ "The company for this report.") '() owner-type)
 
   (gnc:options-add-date-interval!
-   gnc:*report-options* gnc:pagename-general
+   options gnc:pagename-general
    optname-from-date optname-to-date "a")
 
   ;; Use a default report date of 'today'
-  (gnc:option-set-default-value
-   (gnc:lookup-option gnc:*report-options* gnc:pagename-general optname-to-date)
+  (GncOption-set-default-value
+   (gnc-lookup-option options gnc:pagename-general optname-to-date)
    (cons 'relative 'today))
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") date-header
-    "b" (N_ "Display the transaction date?") #t))
+    "b" (N_ "Display the transaction date?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") due-date-header
-    "c" (N_ "Display the transaction date?") #t))
+    "c" (N_ "Display the transaction date?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") reference-header
-    "d" (N_ "Display the transaction reference?") #t))
+    "d" (N_ "Display the transaction reference?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") type-header
-    "g" (N_ "Display the transaction type?") #t))
+    "g" (N_ "Display the transaction type?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") desc-header
-    "ha" (N_ "Display the transaction description?") #t))
+    "ha" (N_ "Display the transaction description?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") sale-header
-    "haa" (N_ "Display the sale amount column?") #f))
+    "haa" (N_ "Display the sale amount column?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") tax-header
-    "hab" (N_ "Display the tax column?") #f))
+    "hab" (N_ "Display the tax column?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") debit-header
-    "hac" (N_ "Display the period debits column?") #t))
+    "hac" (N_ "Display the period debits column?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") credit-header
-    "had" (N_ "Display the period credits column?") #t))
+    "had" (N_ "Display the period credits column?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") balance-header
-    "hb" (N_ "Display a running balance?") #t))
+    "hb" (N_ "Display a running balance?") #t)
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Display Columns") linked-txns-header
     "hc"
     (string-join
@@ -938,27 +920,25 @@ and do not match the transaction."))))))))
       (G_ "Invoices show if paid, payments show invoice numbers.")
       (G_ "Invoices show list of payments, payments show list of invoices and amounts."))
       "\n* ")
-    'none
+    "none"
     (list (vector 'none (N_ "Disabled"))
           (vector 'simple (N_ "Simple"))
-          (vector 'detailed (N_ "Detailed")))))
+          (vector 'detailed (N_ "Detailed"))))
 
-  (gnc:register-inv-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display Columns") doclink-header
-    "hd" (N_ "Display document link?") #f))
+    "hd" (N_ "Display document link?") #f)
 
-  (gnc:register-inv-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-general optname-date-driver "k"
-    (N_ "Leading date.") 'duedate
+    (N_ "Leading date.") "duedate"
     (list
      (vector 'duedate (N_ "Due Date"))
-     (vector 'postdate (N_ "Post Date")))))
+     (vector 'postdate (N_ "Post Date"))))
 
-  (gnc:options-set-default-section gnc:*report-options* "General")
+  (gnc:options-set-default-section options "General")
 
-  gnc:*report-options*)
+  options))
 
 (define (setup-query q owner accounts end-date job?)
   (let ((guid (gncOwnerReturnGUID (if job? owner (gncOwnerGetEndOwner owner))))
@@ -1020,8 +1000,7 @@ and do not match the transaction."))))))))
 (define (reg-renderer report-obj type)
   (define options (gnc:report-options report-obj))
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
 
   (let* ((start-date (gnc:time64-start-day-time
                       (gnc:date-option-absolute-time
@@ -1032,9 +1011,7 @@ and do not match the transaction."))))))))
          (book (gnc-get-current-book))
          (date-format (gnc:options-fancy-date (gnc-get-current-book)))
          (used-columns (build-column-used options))
-         (link-option
-          (gnc:option-value
-           (gnc:lookup-option options "Display Columns" linked-txns-header)))
+         (link-option (opt-val "Display Columns" linked-txns-header))
          (owner-descr (owner-string type))
          (date-type (opt-val gnc:pagename-general optname-date-driver))
          (owner (opt-val owner-page owner-descr))
@@ -1221,13 +1198,12 @@ and do not match the transaction."))))))))
 
 
 (define (owner-report-create-internal report-guid owner owner-type enddate)
-  (let* ((options (gnc:make-report-options report-guid))
-         (owner-op (gnc:lookup-option options owner-page (owner-string owner-type)))
-         (date-op (gnc:lookup-option options gnc:pagename-general optname-to-date)))
+  (let* ((options (gnc:make-report-options report-guid)))
 
-    (gnc:option-set-value owner-op owner)
+    (gnc-set-option options owner-page (owner-string owner-type) owner)
     (when enddate
-      (gnc:option-set-value date-op (cons 'absolute enddate)))
+      (gnc-set-option options gnc:pagename-general optname-to-date
+                      (cons 'absolute enddate)))
     (gnc:make-report report-guid options)))
 
 (define (owner-report-create-with-enddate owner account enddate)
diff --git a/gnucash/report/reports/standard/portfolio.scm b/gnucash/report/reports/standard/portfolio.scm
index 020e867de..37703a620 100644
--- a/gnucash/report/reports/standard/portfolio.scm
+++ b/gnucash/report/reports/standard/portfolio.scm
@@ -37,12 +37,7 @@
 (define optname-zero-shares (N_ "Include accounts with no shares"))
 
 (define (options-generator)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See libgnucash/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     ;; General Tab
     ;; date at which to report balance
@@ -57,31 +52,25 @@
      options gnc:pagename-general
      optname-price-source "d" 'pricedb-latest)
 
-    (add-option
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       gnc:pagename-general optname-shares-digits
       "e" (N_ "The number of decimal places to use for share numbers.") 2
-      0 9 0 1))
+      0 9 1)
 
     ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-limited-option options
       gnc:pagename-accounts (N_ "Accounts")
       "b"
       (N_ "Stock Accounts to report on.")
-      (lambda () (filter gnc:account-is-stock?
-                         (gnc-account-get-descendants-sorted
-                          (gnc-get-current-root-account))))
-      (lambda (accounts) (list  #t
-                                (filter gnc:account-is-stock? accounts)))
-      #t))
-
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
+      (gnc:filter-accountlist-type
+       (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
+       (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+      (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
+
+    (gnc-register-simple-boolean-option options
       gnc:pagename-accounts optname-zero-shares "e"
       (N_ "Include accounts that have a zero share balances.")
-      #f))
+      #f)
 
     (gnc:options-set-default-section options gnc:pagename-general)
     options))
@@ -98,11 +87,9 @@
        (work-to-do 0))
 
   ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
 
   (define (get-option section name)
-    (gnc:option-value (get-op section name)))
+    (gnc-optiondb-lookup-value  (gnc:report-options report-obj) section name))
 
   (define (table-add-stock-rows table accounts to-date currency
                                 exchange-fn price-fn include-empty collector)
diff --git a/gnucash/report/reports/standard/price-scatter.scm b/gnucash/report/reports/standard/price-scatter.scm
index c76c13545..1aef71ea2 100644
--- a/gnucash/report/reports/standard/price-scatter.scm
+++ b/gnucash/report/reports/standard/price-scatter.scm
@@ -49,11 +49,7 @@
 (define optname-plot-height (N_ "Plot Height"))
 
 (define (options-generator)
-  (let* ((options (gnc:new-options)) 
-         ;; This is just a helper function for making options.
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
+  (let* ((options (gnc-new-optiondb)))
 
     (gnc:options-add-date-interval!
      options gnc:pagename-general
@@ -65,28 +61,25 @@
     (gnc:options-add-currency! 
      options pagename-price optname-report-currency "d")
 
-    (add-option
-     (gnc:make-commodity-option 
+    (gnc-register-commodity-option  options
       pagename-price optname-price-commodity
       "e"
       (N_ "Calculate the price of this commodity.")
-      (gnc-locale-default-iso-currency-code)))
+      (gnc-locale-default-iso-currency-code))
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       pagename-price optname-price-source
       "f" (N_ "The source of price information.") 
-      'actual-transactions
+      "actual-transactions"
       (list (vector 'weighted-average (N_ "Weighted Average"))
             (vector 'actual-transactions (N_ "Actual Transactions"))
-            (vector 'pricedb (N_ "Price Database")))))
+            (vector 'pricedb (N_ "Price Database"))))
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-price optname-invert
       "g"
       (N_ "Plot commodity per currency rather than currency per commodity.")
-      #f))
+      #f)
 
     
     (gnc:options-add-plot-size! 
@@ -97,13 +90,11 @@
      options gnc:pagename-display 
      optname-marker "a" 'filledsquare)
 
-    (add-option
-     (gnc:make-color-option
+    (gnc-register-color-option options
       gnc:pagename-display optname-markercolor
       "b"
       (N_ "Color of the marker.")
-      (list #xb2 #x22 #x22 #xff)
-      255 #f))
+      "b22222")
 
     (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -115,8 +106,7 @@
 
   ;; This is a helper function for looking up option values.
   (define (get-option section name)
-    (gnc:option-value 
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (define intervals
     (list (list 'DayDelta (G_ "Days") 86400)
diff --git a/gnucash/report/reports/standard/receipt.scm b/gnucash/report/reports/standard/receipt.scm
index bdfef6b62..125d6928f 100644
--- a/gnucash/report/reports/standard/receipt.scm
+++ b/gnucash/report/reports/standard/receipt.scm
@@ -66,88 +66,85 @@
 
 (define (options-generator)
   ;; Options
-  (define report-options (gnc:new-options))
-  (define (add-option new-option)
-    (gnc:register-option report-options new-option))
+  (let ((options (gnc-new-optiondb)))
 
-  (add-option
-    (gnc:make-invoice-option ; defined in gnucash/scm/business-options.scm
-      generalpage gnc:optname-invoice-number
-      "a" "" (lambda () '()) #f))
+  (gnc-register-invoice-option
+   options generalpage gnc:optname-invoice-number "a" ""  '())
 
   ;; Display options
-  (add-option (gnc:make-string-option displaypage optname-template-file "a"
-    (N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
-    "receipt.eguile.scm"))
-  (add-option (gnc:make-string-option displaypage optname-css-file "b"
+  (gnc-register-string-option
+   options displaypage optname-template-file "a"
+   (N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
+    "receipt.eguile.scm")
+  (gnc-register-string-option options
+    displaypage optname-css-file "b"
     (N_ "The file name of the CSS stylesheet to use with this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
-    "receipt.css"))
-  (add-option (gnc:make-font-option
+    "receipt.css")
+  (gnc-register-font-option options
                 displaypage optname-heading-font "c"
-                (N_ "Font to use for the main heading.") "Sans Bold 14"))
-  (add-option (gnc:make-font-option
+                (N_ "Font to use for the main heading.") "Sans Bold 14")
+  (gnc-register-font-option options
                 displaypage optname-text-font "d"
-                (N_ "Font to use for everything else.") "Sans 10"))
-  (add-option (gnc:make-pixmap-option
+                (N_ "Font to use for everything else.") "Sans 10")
+  (gnc-register-pixmap-option options
                 displaypage optname-logofile-header "e"
                 (N_ "Name of a file containing a logo to be used on the header of the report")
-                "Receipt_header.jpg"))
-  (add-option (gnc:make-string-option
-                displaypage optname-logo-width-header "f" (N_ "Width of the header logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm"))
-  (add-option (gnc:make-pixmap-option
+                "Receipt_header.jpg")
+  (gnc-register-string-option options
+                displaypage optname-logo-width-header "f" (N_ "Width of the header logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm")
+  (gnc-register-pixmap-option options
                 displaypage optname-logofile-footer "g"
                 (N_ "Name of a file containing a logo to be used on the footer of the report")
-                "Receipt_footer.jpg"))
-  (add-option (gnc:make-string-option
-                displaypage optname-logo-width-footer "h" (N_ "Width of the footer logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm"))
+                "Receipt_footer.jpg")
+  (gnc-register-string-option options
+                displaypage optname-logo-width-footer "h" (N_ "Width of the footer logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm")
 
-  (add-option (gnc:make-string-option
+  (gnc-register-string-option options
                displaypage  optname-date-format "i"
                (N_ "The format for the date->string conversion for today's date.")
                ;; Translators: Boost::date_time format string
                ;; "%l:%M %P, %e %B %Y" means " 9:56 pm, 19 June 2019"
-               (G_ "%l:%M %P, %e %B %Y")))
+               (G_ "%l:%M %P, %e %B %Y"))
 
   ;; Heading options
-  (add-option (gnc:make-string-option
+  (gnc-register-string-option options
                 ; page / name / orderkey / tooltip / default
-                headingpage optname-report-title "a" "" (G_ "Invoice")))
-  (add-option (gnc:make-string-option
-                headingpage optname-units "b" "" (G_ "Units")))
-  (add-option (gnc:make-string-option
-                headingpage optname-qty "c" "" (G_ "Qty")))
-  (add-option (gnc:make-string-option
-                headingpage optname-unit-price "d" "" (G_ "Unit Price")))
-  (add-option (gnc:make-string-option
-                headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
-  (add-option (gnc:make-string-option
-                headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
-  (add-option (gnc:make-string-option
-                headingpage optname-net-price "g" "" (G_ "Net Price")))
-  (add-option (gnc:make-string-option
-                headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
-  (add-option (gnc:make-string-option
-                headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
-  (add-option (gnc:make-string-option
-                headingpage optname-total-price "j" "" (G_ "Total Price")))
-  (add-option (gnc:make-string-option
-                headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
-  (add-option (gnc:make-string-option
-                headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
-  (add-option (gnc:make-string-option
+                headingpage optname-report-title "a" "" (G_ "Invoice"))
+  (gnc-register-string-option options
+                headingpage optname-units "b" "" (G_ "Units"))
+  (gnc-register-string-option options
+                headingpage optname-qty "c" "" (G_ "Qty"))
+  (gnc-register-string-option options
+                headingpage optname-unit-price "d" "" (G_ "Unit Price"))
+  (gnc-register-string-option options
+                headingpage optname-disc-rate "e" "" (G_ "Discount Rate"))
+  (gnc-register-string-option options
+                headingpage optname-disc-amount "f" "" (G_ "Discount Amount"))
+  (gnc-register-string-option options
+                headingpage optname-net-price "g" "" (G_ "Net Price"))
+  (gnc-register-string-option options
+                headingpage optname-tax-rate "h" "" (G_ "Tax Rate"))
+  (gnc-register-string-option options
+                headingpage optname-tax-amount "i" "" (G_ "Tax Amount"))
+  (gnc-register-string-option options
+                headingpage optname-total-price "j" "" (G_ "Total Price"))
+  (gnc-register-string-option options
+                headingpage2 optname-subtotal "a" "" (G_ "Sub-total"))
+  (gnc-register-string-option options
+                headingpage2 optname-amount-due "b" "" (G_ "Amount Due"))
+  (gnc-register-string-option options
                 headingpage2 optname-payment-recd "c" ""
-                (G_ "Payment received, thank you!")))
+                (G_ "Payment received, thank you!"))
 
-  (add-option (gnc:make-text-option
+  (gnc-register-text-option options
                 notespage optname-extra-notes "a"
                 (N_ "Notes added at end of invoice -- may contain HTML markup")
-                ""))
+                "")
                 ;(N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br/>Change the 'Extra Notes' option to get rid of this message)")))
 
-  (gnc:options-set-default-section
-    report-options generalpage)
+  (gnc:options-set-default-section options generalpage)
 
-  report-options)
+  options))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Create the report
@@ -156,10 +153,7 @@
   ;; Create and return the report as either an HTML string
   ;; or an <html-document>
   (define (opt-value section name)
-    ; wrapper for option routines
-    (define (get-opt section name)
-      (gnc:lookup-option (gnc:report-options report-obj) section name))
-    (gnc:option-value (get-opt section name)))
+    (gnc-optiondb-lookup-value  (gnc:report-options report-obj) section name))
 
   ; Get all the options
   (let* ((document                  (gnc:make-html-document))
diff --git a/gnucash/report/reports/standard/register.scm b/gnucash/report/reports/standard/register.scm
index 62e24c8e3..18dcdf81a 100644
--- a/gnucash/report/reports/standard/register.scm
+++ b/gnucash/report/reports/standard/register.scm
@@ -72,8 +72,7 @@
 
 (define (build-column-used options)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (define (make-set-col col-vector)
     (let ((col 0))
       (lambda (used? index)
@@ -86,7 +85,7 @@
   (let* ((col-vector (make-vector columns-used-size #f))
          (set-col (make-set-col col-vector)))
     (set-col (opt-val "Display" "Date") 0)
-    (set-col (if (gnc:lookup-option options "Display" "Num")
+    (set-col (if (gnc-lookup-option options "Display" "Num")
                  (opt-val "Display" "Num")
                  (opt-val "Display" "Num/Action")) 1)
     (set-col
@@ -323,104 +322,86 @@
 
 
 (define (options-generator)
-
-  (define gnc:*report-options* (gnc:new-options))
-
-  (define (gnc:register-reg-option new-option)
-    (gnc:register-option gnc:*report-options* new-option))
-
-  (gnc:register-reg-option
-   (gnc:make-query-option "__reg" "query" '()))
-  (gnc:register-reg-option
-   (gnc:make-internal-option "__reg" "journal" #f))
-  (gnc:register-reg-option
-   (gnc:make-internal-option "__reg" "ledger-type" #f))
-  (gnc:register-reg-option
-   (gnc:make-internal-option "__reg" "double" #f))
-  (gnc:register-reg-option
-   (gnc:make-internal-option "__reg" "debit-string" (G_ "Debit")))
-  (gnc:register-reg-option
-   (gnc:make-internal-option "__reg" "credit-string" (G_ "Credit")))
-
-  (gnc:register-reg-option
-   (gnc:make-string-option
+  (let ((options (gnc-new-optiondb)))
+
+  (gnc-register-query-option options
+    "__reg" "query" '())
+  (gnc-register-internal-option options
+    "__reg" "journal" #f)
+  (gnc-register-internal-option options
+    "__reg" "ledger-type" #f)
+  (gnc-register-internal-option options
+    "__reg" "double" #f)
+  (gnc-register-internal-option options
+    "__reg" "debit-string" (G_ "Debit"))
+  (gnc-register-internal-option options
+    "__reg" "credit-string" (G_ "Credit"))
+
+  (gnc-register-string-option options
     (N_ "General") (N_ "Title")
     "a" (N_ "The title of the report.")
-    (N_ "Register Report")))
+    (N_ "Register Report"))
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Date")
-    "b" (N_ "Display the date?") #t))
+    "b" (N_ "Display the date?") #t)
 
   (if (qof-book-use-split-action-for-num-field (gnc-get-current-book))
-      (gnc:register-reg-option
-       (gnc:make-simple-boolean-option
+      (gnc-register-simple-boolean-option options
         (N_ "Display") (N_ "Num/Action")
-        "c" (N_ "Display the check number/action?") #t))
-      (gnc:register-reg-option
-       (gnc:make-simple-boolean-option
+        "c" (N_ "Display the check number/action?") #t)
+      (gnc-register-simple-boolean-option options
         (N_ "Display") (N_ "Num")
-        "c" (N_ "Display the check number?") #t)))
+        "c" (N_ "Display the check number?") #t))
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Description")
-    "d" (N_ "Display the description?") #t))
+    "d" (N_ "Display the description?") #t)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Memo")
-    "e" (N_ "Display the memo?") #t))
+    "e" (N_ "Display the memo?") #t)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Account")
-    "g" (N_ "Display the account?") #t))
+    "g" (N_ "Display the account?") #t)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Shares")
-    "ha" (N_ "Display the number of shares?") #f))
+    "ha" (N_ "Display the number of shares?") #f)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Lot")
-    "hb" (N_ "Display the name of lot the shares are in?") #f))
+    "hb" (N_ "Display the name of lot the shares are in?") #f)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Price")
-    "hc" (N_ "Display the shares price?") #f))
+    "hc" (N_ "Display the shares price?") #f)
 
-  (gnc:register-reg-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     (N_ "Display") (N_ "Amount")
     "ia" (N_ "Display the amount?")
-    'double
+    "double"
     (list
      (vector 'single (N_ "Single Column"))
-     (vector 'double (N_ "Two Columns")))))
+     (vector 'double (N_ "Two Columns"))))
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Value")
-    "ib" (N_ "Display the value in transaction currency?") #f))
+    "ib" (N_ "Display the value in transaction currency?") #f)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Running Balance")
-    "k" (N_ "Display a running balance?") #t))
+    "k" (N_ "Display a running balance?") #t)
 
-  (gnc:register-reg-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     (N_ "Display") (N_ "Totals")
-    "l" (N_ "Display the totals?") #t))
+    "l" (N_ "Display the totals?") #t)
 
 
-  (gnc:options-set-default-section gnc:*report-options* "General")
+  (gnc:options-set-default-section options "General")
 
-  gnc:*report-options*)
+  options))
 
 ;; -----------------------------------------------------------------
 ;; create the report result
@@ -432,7 +413,7 @@
   ;; local helper
   ;; ----------------------------------
   (define (opt-val section name)
-    (gnc:option-value (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (define (reg-report-journal?)
     (opt-val "__reg" "journal"))
   (define (reg-report-ledger-type?)
@@ -623,8 +604,7 @@
 
 (define (reg-renderer report-obj)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
 
   (let* ((document (gnc:make-html-document))
          (query-scm (opt-val "__reg" "query"))
@@ -674,7 +654,7 @@
                                              double? title debit-string credit-string)
   (define options (gnc:make-report-options register-report-guid))
   (define (set-option section name val)
-    (gnc:option-set-value (gnc:lookup-option options section name) val))
+    (gnc-set-option options section name val))
 
   (when invoice?
     (issue-deprecation-warning "gnc:register-report-create-internal: invoice \
diff --git a/gnucash/report/reports/standard/taxinvoice.scm b/gnucash/report/reports/standard/taxinvoice.scm
index 454dee676..dbe2f35e2 100644
--- a/gnucash/report/reports/standard/taxinvoice.scm
+++ b/gnucash/report/reports/standard/taxinvoice.scm
@@ -114,102 +114,120 @@
 
 (define (options-generator)
   ;; Options
-  (define report-options (gnc:new-options))
-  (define (add-option new-option)
-    (gnc:register-option report-options new-option))
+  (let ((options (gnc-new-optiondb)))
 
-  (add-option
-    (gnc:make-invoice-option ; defined in gnucash/scm/business-options.scm
-      gnc:pagename-general gnc:optname-invoice-number 
-      "a" "" (lambda () '()) #f))
+  (gnc-register-invoice-option options
+      gnc:pagename-general gnc:optname-invoice-number
+      "a" "" '())
 
   ;; Elements page options
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-col-date		"a" (N_ "Display the date?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-col-taxrate		"b" (N_ "Display the Tax Rate?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-col-units		"c" (N_ "Display the Units?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-row-contact		"d" (N_ "Display the contact?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-row-address		"e" (N_ "Display the address?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-row-invoice-number	"f" (N_ "Display the Invoice Number?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-row-company-name	"g" (N_ "Display the Company Name?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-invnum-next-to-title	"h" (N_ "Invoice Number next to title?") #f))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-jobname-show		"i" (N_ "Display Job name?") #t))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-jobnumber-show		"j" (N_ "Invoice Job number?") #f))
-(add-option (gnc:make-simple-boolean-option	elementspage	optname-netprice		"k" (N_ "Show net price?") #f))
+  (gnc-register-simple-boolean-option options
+                 elementspage	optname-col-date		"a" (N_ "Display the date?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-col-taxrate		"b" (N_ "Display the Tax Rate?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-col-units		"c" (N_ "Display the Units?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-row-contact		"d" (N_ "Display the contact?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-row-address		"e" (N_ "Display the address?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-row-invoice-number	"f" (N_ "Display the Invoice Number?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-row-company-name	"g" (N_ "Display the Company Name?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-invnum-next-to-title	"h" (N_ "Invoice Number next to title?") #f)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-jobname-show		"i" (N_ "Display Job name?") #t)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-jobnumber-show		"j" (N_ "Invoice Job number?") #f)
+(gnc-register-simple-boolean-option options
+               elementspage	optname-netprice		"k" (N_ "Show net price?") #f)
 
   ;; Display options
-  (add-option (gnc:make-string-option displaypage optname-template-file "a" 
+(gnc-register-string-option options
+               displaypage optname-template-file "a" 
     (N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
-    "taxinvoice.eguile.scm"))
-  (add-option (gnc:make-string-option displaypage optname-css-file "b" 
+    "taxinvoice.eguile.scm")
+  (gnc-register-string-option options
+                 displaypage optname-css-file "b" 
     (N_ "The file name of the CSS stylesheet to use with this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.") 
-    "taxinvoice.css"))
-  (add-option (gnc:make-font-option 
+    "taxinvoice.css")
+  (gnc-register-font-option  options
                 displaypage optname-heading-font "c" 
-                (N_ "Font to use for the main heading.") "Sans Bold 18"))
-  (add-option (gnc:make-font-option 
+                (N_ "Font to use for the main heading.") "Sans Bold 18")
+  (gnc-register-font-option  options
                 displaypage optname-text-font "d" 
-                (N_ "Font to use for everything else.") "Sans 10"))
-  (add-option (gnc:make-pixmap-option
+                (N_ "Font to use for everything else.") "Sans 10")
+  (gnc-register-pixmap-option options
                 displaypage optname-logofile "e" 
                 (N_ "Name of a file containing a logo to be used on the report.") 
-                ""))
-  (add-option (gnc:make-string-option
-                displaypage optname-logo-width "f" (N_ "Width of the logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") ""))
-(add-option (gnc:make-simple-boolean-option	displaypage	optname-border-collapse	"g" (N_ "Border-collapse?") #f))
-(add-option (gnc:make-string-option		displaypage	optname-border-color-th "h" (N_ "CSS color.") "black"))
-(add-option (gnc:make-string-option		displaypage	optname-border-color-td "i" (N_ "CSS color.") "black"))
+                "")
+  (gnc-register-string-option options
+                displaypage optname-logo-width "f" (N_ "Width of the logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "")
+  (gnc-register-simple-boolean-option options
+                 displaypage	optname-border-collapse	"g" (N_ "Border-collapse?") #f)
+(gnc-register-string-option options
+               displaypage	optname-border-color-th "h" (N_ "CSS color.") "black")
+(gnc-register-string-option options
+               displaypage	optname-border-color-td "i" (N_ "CSS color.") "black")
 
   ;; Heading options
-  (add-option (gnc:make-string-option
+  (gnc-register-string-option options
                 ; page / name / orderkey / tooltip / default
-                headingpage optname-report-title "a" "" (G_ "Invoice")))
-  (add-option (gnc:make-string-option
-                headingpage optname-units "b" "" (G_ "Units")))
-  (add-option (gnc:make-string-option
-                headingpage optname-qty "c" "" (G_ "Qty")))
-  (add-option (gnc:make-string-option
-                headingpage optname-unit-price "d" "" (G_ "Unit Price")))
-  (add-option (gnc:make-string-option
-                headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
-  (add-option (gnc:make-string-option
-                headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
-  (add-option (gnc:make-string-option
-                headingpage optname-net-price "g" "" (G_ "Net Price")))
-  (add-option (gnc:make-string-option
-                headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
-  (add-option (gnc:make-string-option
-                headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
-  (add-option (gnc:make-string-option
-                headingpage optname-total-price "j" "" (G_ "Total Price")))
-  (add-option (gnc:make-string-option
-                headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
-  (add-option (gnc:make-string-option
-                headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
-  (add-option (gnc:make-string-option
+                headingpage optname-report-title "a" "" (G_ "Invoice"))
+  (gnc-register-string-option options
+                headingpage optname-units "b" "" (G_ "Units"))
+  (gnc-register-string-option options
+                headingpage optname-qty "c" "" (G_ "Qty"))
+  (gnc-register-string-option options
+                headingpage optname-unit-price "d" "" (G_ "Unit Price"))
+  (gnc-register-string-option options
+                headingpage optname-disc-rate "e" "" (G_ "Discount Rate"))
+  (gnc-register-string-option options
+                headingpage optname-disc-amount "f" "" (G_ "Discount Amount"))
+  (gnc-register-string-option options
+                headingpage optname-net-price "g" "" (G_ "Net Price"))
+  (gnc-register-string-option options
+                headingpage optname-tax-rate "h" "" (G_ "Tax Rate"))
+  (gnc-register-string-option options
+                headingpage optname-tax-amount "i" "" (G_ "Tax Amount"))
+  (gnc-register-string-option options
+                headingpage optname-total-price "j" "" (G_ "Total Price"))
+  (gnc-register-string-option options
+                headingpage2 optname-subtotal "a" "" (G_ "Sub-total"))
+  (gnc-register-string-option options
+                headingpage2 optname-amount-due "b" "" (G_ "Amount Due"))
+  (gnc-register-string-option options
                 headingpage2 optname-payment-recd "c" "" 
-                (G_ "Payment received, thank you!")))
-  (add-option (gnc:make-string-option	headingpage2	optname-invoice-number-text
-    "d" "" (G_ "Invoice number:")))
-  (add-option (gnc:make-string-option	headingpage2	optname-to-text
-    "e" "" (G_ "To:")))
-  (add-option (gnc:make-string-option	headingpage2	optname-ref-text
-    "f" "" (G_ "Your ref:")))
-  (add-option (gnc:make-string-option	headingpage2	optname-jobnumber-text
-    "g" "" (G_ "Job number:")))
-  (add-option (gnc:make-string-option	headingpage2	optname-jobname-text
-    "h" "" (G_ "Job name:")))
+                (G_ "Payment received, thank you!"))
+  (gnc-register-string-option options
+                 headingpage2	optname-invoice-number-text
+    "d" "" (G_ "Invoice number:"))
+  (gnc-register-string-option options
+                 headingpage2	optname-to-text
+    "e" "" (G_ "To:"))
+  (gnc-register-string-option options
+                 headingpage2	optname-ref-text
+    "f" "" (G_ "Your ref:"))
+  (gnc-register-string-option options
+                 headingpage2	optname-jobnumber-text
+    "g" "" (G_ "Job number:"))
+  (gnc-register-string-option options
+                 headingpage2	optname-jobname-text
+    "h" "" (G_ "Job name:"))
 
-  (add-option (gnc:make-text-option
+  (gnc-register-text-option options
                 notespage optname-extra-notes "a"
                 (G_ "Notes added at end of invoice -- may contain HTML markup.") 
-                (G_ "Thank you for your patronage!")))
+                (G_ "Thank you for your patronage!"))
 
-  (add-option (gnc:make-text-option	notespage optname-extra-css "b"
-                (N_ "Embedded CSS.")	"h1.coyname { text-align: left; }"))
-  (gnc:options-set-default-section
-    report-options gnc:pagename-general)
+  (gnc-register-text-option options
+                 notespage optname-extra-css "b"
+                (N_ "Embedded CSS.")	"h1.coyname { text-align: left; }")
+  (gnc:options-set-default-section options gnc:pagename-general)
 
-  report-options)
+  options))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Create the report
@@ -218,10 +236,7 @@
   ;; Create and return the report as either an HTML string 
   ;; or an <html-document>
   (define (opt-value section name)
-    ; wrapper for option routines
-    (define (get-opt section name)
-      (gnc:lookup-option (gnc:report-options report-obj) section name))
-    (gnc:option-value (get-opt section name)))
+    (gnc-optiondb-lookup-value  (gnc:report-options report-obj) section name))
 
   ; Get all the options
   (let* ((document                  (gnc:make-html-document))
@@ -294,8 +309,7 @@
 
 (define (au-tax-options-generator)
   (define (set-opt options page name value)
-    (let ((option (gnc:lookup-option options page name)))
-         (gnc:option-set-value option value)))
+    (gnc-set-option options page name value))
 
   (let ((options (options-generator)))
        (set-opt options headingpage optname-report-title (G_ "Tax Invoice"))
diff --git a/gnucash/report/reports/standard/test/test-average-balance.scm b/gnucash/report/reports/standard/test/test-average-balance.scm
index 1ca9e3535..389d569ac 100644
--- a/gnucash/report/reports/standard/test/test-average-balance.scm
+++ b/gnucash/report/reports/standard/test/test-average-balance.scm
@@ -23,7 +23,7 @@
   (test-end "test-average-balance"))
 
 (define (set-option! options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option options page tag value))
 
 (define (teardown)
   (gnc-clear-current-session))
diff --git a/gnucash/report/reports/standard/trial-balance.scm b/gnucash/report/reports/standard/trial-balance.scm
index c3c543ae3..ddf7c24bb 100644
--- a/gnucash/report/reports/standard/trial-balance.scm
+++ b/gnucash/report/reports/standard/trial-balance.scm
@@ -174,20 +174,15 @@
 
 ;; options generator
 (define (trial-balance-options-generator)
-  (let* ((options (gnc:new-options))
-         (book (gnc-get-current-book))
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
-    (add-option
-     (gnc:make-string-option
+  (let* ((options (gnc-new-optiondb))
+         (book (gnc-get-current-book)))
+
+    (gnc-register-string-option options
       (N_ "General") optname-report-title
-      "a" opthelp-report-title (G_ reportname)))
-    (add-option
-     (gnc:make-string-option
+      "a" opthelp-report-title (G_ reportname))
+    (gnc-register-string-option options
       (N_ "General") optname-party-name
-      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
+      "b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
 
     ;; the period over which to collect adjusting/closing entries and
     ;; date at which to report the balance
@@ -195,22 +190,19 @@
      options gnc:pagename-general
      optname-start-date optname-end-date "c")
 
-    (add-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-general optname-report-variant
       "d" opthelp-report-variant
-      'current
+      "current"
       (list (vector 'current (N_ "General journal exact balances"))
             (vector 'pre-adj (N_ "No adjusting/closing entries"))
-            (vector 'work-sheet (N_ "Full end-of-period work sheet")))))
+            (vector 'work-sheet (N_ "Full end-of-period work sheet"))))
 
     ;; accounts to work on
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       gnc:pagename-accounts optname-accounts
       "a"
       opthelp-accounts
-      (lambda ()
         (gnc:filter-accountlist-type
          (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
                ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
@@ -219,30 +211,24 @@
                ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
                ACCT-TYPE-TRADING)
          (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      #f #t))
     (gnc:options-add-account-levels!
      options gnc:pagename-accounts optname-depth-limit
      "b" opthelp-depth-limit 1)
 
     ;; options for merchandising business work sheets
-    (add-option
-     (gnc:make-account-list-option
+    (gnc-register-account-list-option options
       pagename-merchandising optname-gross-adjustment-accounts
       "c"
       opthelp-gross-adjustment-accounts
-      (lambda ()
-        ;; Here, it would be useful to have an inventory account type.
-        ;; Lacking that, just select no accounts by default.
-        '())
-      #f #t))
-    (add-option
-     (gnc:make-account-list-option
+      ;; Here, it would be useful to have an inventory account type.
+      ;; Lacking that, just select no accounts by default.
+      '())
+
+    (gnc-register-account-list-option options
       pagename-merchandising optname-income-summary-accounts
       "d"
       opthelp-income-summary-accounts
-      (lambda ()
-        '())
-      #f #t))
+      '())
 
     ;; all about currencies
     (gnc:options-add-currency!
@@ -253,56 +239,46 @@
      options pagename-commodities
      optname-price-source "b" 'average-cost)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-foreign
-      "c" opthelp-show-foreign #f))
+      "c" opthelp-show-foreign #f)
 
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-commodities optname-show-rates
-      "d" opthelp-show-rates #f))
+      "d" opthelp-show-rates #f)
 
     ;; adjusting/closing entry match criteria
     ;;
     ;; N.B.: transactions really should have a field where we can put
     ;; transaction types like "Adjusting/Closing/Correcting Entries"
-    (add-option
-     (gnc:make-string-option
+    (gnc-register-string-option options
       pagename-entries optname-adjusting-pattern
-      "a" opthelp-adjusting-pattern (G_ "Adjusting Entries")))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "a" opthelp-adjusting-pattern (G_ "Adjusting Entries"))
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-adjusting-casing
-      "b" opthelp-adjusting-casing #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "b" opthelp-adjusting-casing #f)
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-adjusting-regexp
-      "c" opthelp-adjusting-regexp #f))
-    (add-option
-     (gnc:make-string-option
+      "c" opthelp-adjusting-regexp #f)
+    (gnc-register-string-option options
       pagename-entries optname-closing-pattern
-      "d" opthelp-closing-pattern (G_ "Closing Entries")))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "d" opthelp-closing-pattern (G_ "Closing Entries"))
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-casing
-      "e" opthelp-closing-casing #f))
-    (add-option
-     (gnc:make-simple-boolean-option
+      "e" opthelp-closing-casing #f)
+    (gnc-register-simple-boolean-option options
       pagename-entries optname-closing-regexp
-      "f" opthelp-closing-regexp #f))
+      "f" opthelp-closing-regexp #f)
 
     ;; what to show for zero-balance accounts
-    ;;(add-option
-    ;; (gnc:make-simple-boolean-option
+    ;;(gnc-register-simple-boolean-option options
     ;;  gnc:pagename-display optname-show-zb-accts
-    ;;  "a" opthelp-show-zb-accts #t))
+    ;;  "a" opthelp-show-zb-accts #t)
 
     ;; some detailed formatting options
-    (add-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display optname-account-links
-      "e" opthelp-account-links #t))
+      "e" opthelp-account-links #t)
 
     ;; Set the accounts page as default option tab
     (gnc:options-set-default-section options gnc:pagename-display)
@@ -318,9 +294,8 @@
 
 (define (trial-balance-renderer report-obj)
   (define (get-option pagename optname)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) pagename optname)))
+    (gnc-optiondb-lookup-value
+      (gnc:report-options report-obj) pagename optname))
 
   (gnc:report-starting reportname)
 
diff --git a/gnucash/report/reports/standard/view-column.scm b/gnucash/report/reports/standard/view-column.scm
index e075f2f48..757a83727 100644
--- a/gnucash/report/reports/standard/view-column.scm
+++ b/gnucash/report/reports/standard/view-column.scm
@@ -36,31 +36,24 @@
 (use-modules (gnucash html))
 
 (define (make-options)
-  (let* ((options (gnc:new-options))
-	 (opt-register
-	  (lambda (opt)
-	    (gnc:register-option options opt))))
+  (let* ((options (gnc-new-optiondb)))
     ;; the report-list is edited by a special add-on page for the
     ;; options editor.
-    (gnc-register-report-placement-option (gnc:optiondb options) "__general" "report-list")
+    (gnc-register-report-placement-option options "__general" "report-list")
     
-    (opt-register
-     (gnc:make-number-range-option 
+    (gnc-register-number-range-option options
       (N_ "General") (N_ "Number of columns") "a"
       (N_ "Number of columns before wrapping to a new row.")
-      1 0 20 0 1))
+      1 0 20 1)
     
     options))
 
 (define (render-view report)
   (let* ((view-doc (gnc:make-html-document))
 	 (options (gnc:report-options report))
-	 (report-opt (gnc:lookup-option options "__general" "report-list"))
-	 (reports (gnc:option-value report-opt))
+	 (reports (gnc-optiondb-lookup-value options "__general" "report-list"))
 	 (table-width 
-	  (gnc:option-value
-	   (gnc:lookup-option 
-	    options (N_ "General") (N_ "Number of columns"))))
+	  (gnc-optiondb-lookup-value options (N_ "General") (N_ "Number of columns")))
 	 (column-allocs (make-hash-table 11))
 	 (column-tab (gnc:make-html-table))
 	 (current-row '())
@@ -168,8 +161,7 @@
 (define (options-changed-cb report)
   (let* ((options (gnc:report-options report))
 	 (reports
-	  (gnc:option-value
-	   (gnc:lookup-option options "__general" "report-list"))))
+	  (gnc-optiondb-lookup-value options "__general" "report-list")))
     (for-each 
      (lambda (child)
        (gnc:report-set-dirty?! (gnc-report-find (car child)) #t))
@@ -177,10 +169,10 @@
 
 (define (cleanup-options report)
   (let* ((options (gnc:report-options report))
-	 (report-opt (gnc:lookup-option options "__general" "report-list")))
-    (let loop ((reports (gnc:option-value report-opt)) (new-reports '()))
+	 (report-opt (gnc-lookup-option options "__general" "report-list")))
+    (let loop ((reports (GncOption-get-value report-opt)) (new-reports '()))
       (match reports
-        (() (gnc:option-set-value report-opt (reverse new-reports)))
+        (() (GncOption-set-value report-opt (reverse new-reports)))
         (((child rowspan colspan _) . rest)
          (loop rest (cons (list child rowspan colspan #f) new-reports)))))))
 

commit cec27308d86da6b89a56c099d84d556def15140c
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 22 18:09:48 2022 -0800

    Convert non-trep-based report tests to new API

diff --git a/gnucash/report/reports/standard/test/test-account-summary.scm b/gnucash/report/reports/standard/test/test-account-summary.scm
index 9740fe40b..d46aea6b7 100644
--- a/gnucash/report/reports/standard/test/test-account-summary.scm
+++ b/gnucash/report/reports/standard/test/test-account-summary.scm
@@ -36,10 +36,9 @@
   (gnc:options->sxml uuid options "test-accsum" test-title))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option options section name)
+      (gnc-set-option options section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (accsum-tests)
   (let* ((account-alist (create-test-data))
diff --git a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm b/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
index fa2adf5ea..6213d80be 100644
--- a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
@@ -38,10 +38,9 @@
   (gnc:options->sxml uuid options "test-balsheet-pnl" test-title))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+        (gnc-set-option (gnc:optiondb options) section name value)
+        (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (mnemonic->commodity sym)
   (gnc-commodity-table-lookup
diff --git a/gnucash/report/reports/standard/test/test-budget.scm b/gnucash/report/reports/standard/test/test-budget.scm
index 93adc3a3f..621d1c3d5 100644
--- a/gnucash/report/reports/standard/test/test-budget.scm
+++ b/gnucash/report/reports/standard/test/test-budget.scm
@@ -55,7 +55,7 @@
   (test-end "budget"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (teardown)
   (gnc-clear-current-session))
diff --git a/gnucash/report/reports/standard/test/test-cashflow-barchart.scm b/gnucash/report/reports/standard/test/test-cashflow-barchart.scm
index df06204a0..b58ee9b43 100644
--- a/gnucash/report/reports/standard/test/test-cashflow-barchart.scm
+++ b/gnucash/report/reports/standard/test/test-cashflow-barchart.scm
@@ -38,7 +38,7 @@
   (test-null-txn))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (str->num str)
   (string->number
diff --git a/gnucash/report/reports/standard/test/test-charts.scm b/gnucash/report/reports/standard/test/test-charts.scm
index 99baec835..a60251caf 100644
--- a/gnucash/report/reports/standard/test/test-charts.scm
+++ b/gnucash/report/reports/standard/test/test-charts.scm
@@ -83,10 +83,9 @@
 
 (define (test-net-chart-variant variant)
   (define (set-option! options section name value)
-    (let ((option (gnc:lookup-option options section name)))
-      (if option
-          (gnc:option-set-value option value)
-          (test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f))))
+    (if (gnc-lookup-option (gnc:optiondb options) section name)
+        (gnc-set-option (gnc:optiondb options) section name value)
+        (test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f)))
   (let* ((uuid (variant->uuid variant))
          (inc-exp? (memq variant '(income-expense-barchart income-expense-linechart)))
          (env (create-test-env))
@@ -147,10 +146,9 @@
 
 (define (test-chart-variant variant)
   (define (set-option! options section name value)
-    (let ((option (gnc:lookup-option options section name)))
-      (if option
-          (gnc:option-set-value option value)
-          (test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f))))
+    (if (gnc-lookup-option (gnc:optiondb options) section name)
+        (gnc-set-option (gnc:optiondb options) section name value)
+        (test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f)))
   (let* ((uuid (variant->uuid variant))
          (env (create-test-env))
          (account-alist (env-create-account-structure-alist env structure))
@@ -254,4 +252,3 @@
 
       ((net-worth-barchart income-expense-barchart net-worth-linechart income-expense-linechart)
        (test-net-chart-variant variant)))))
-
diff --git a/gnucash/report/reports/standard/test/test-equity-statement.scm b/gnucash/report/reports/standard/test/test-equity-statement.scm
index 7e4646d83..24811f7e4 100644
--- a/gnucash/report/reports/standard/test/test-equity-statement.scm
+++ b/gnucash/report/reports/standard/test/test-equity-statement.scm
@@ -42,7 +42,7 @@
   (test-end "equity-statement"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (teardown)
   (gnc-clear-current-session))
diff --git a/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm b/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
index f7b1ec754..27539183a 100644
--- a/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
+++ b/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
@@ -27,10 +27,9 @@
   (gnc:options->sxml uuid options "test-ifrs-basis" test-title))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (null-test)
   ;; This null-test tests for the presence of report.
diff --git a/gnucash/report/reports/standard/test/test-invoice.scm b/gnucash/report/reports/standard/test/test-invoice.scm
index 96fb56efc..d7e04e3f8 100644
--- a/gnucash/report/reports/standard/test/test-invoice.scm
+++ b/gnucash/report/reports/standard/test/test-invoice.scm
@@ -52,10 +52,9 @@
    1 row col))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define structure
   (list "Root" (list (cons 'type ACCT-TYPE-ASSET)
diff --git a/gnucash/report/reports/standard/test/test-new-owner-report.scm b/gnucash/report/reports/standard/test/test-new-owner-report.scm
index 4dec7544a..e0acfd977 100644
--- a/gnucash/report/reports/standard/test/test-new-owner-report.scm
+++ b/gnucash/report/reports/standard/test/test-new-owner-report.scm
@@ -49,10 +49,9 @@
   (sxml->table-row-col sxml 3 row col))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (get-currency sym)
   (gnc-commodity-table-lookup
diff --git a/gnucash/report/reports/standard/test/test-owner-report.scm b/gnucash/report/reports/standard/test/test-owner-report.scm
index de8b157a6..5ebd3f1be 100644
--- a/gnucash/report/reports/standard/test/test-owner-report.scm
+++ b/gnucash/report/reports/standard/test/test-owner-report.scm
@@ -53,10 +53,9 @@
   (sxml->table-row-col sxml 3 row col))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (get-currency sym)
   (gnc-commodity-table-lookup
diff --git a/gnucash/report/reports/standard/test/test-portfolios.scm b/gnucash/report/reports/standard/test/test-portfolios.scm
index 8e71665bf..a939e01ec 100644
--- a/gnucash/report/reports/standard/test/test-portfolios.scm
+++ b/gnucash/report/reports/standard/test/test-portfolios.scm
@@ -50,10 +50,9 @@
   (gnc:options->sxml uuid options "test-apr" test-title))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define (teardown)
   (gnc-clear-current-session))
diff --git a/gnucash/report/reports/standard/test/test-register.scm b/gnucash/report/reports/standard/test/test-register.scm
index 59809cb26..bf3fe6fee 100644
--- a/gnucash/report/reports/standard/test/test-register.scm
+++ b/gnucash/report/reports/standard/test/test-register.scm
@@ -42,7 +42,7 @@
   (test-end "register"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (teardown)
   (gnc-clear-current-session))
diff --git a/gnucash/report/reports/standard/test/test-standard-category-report.scm b/gnucash/report/reports/standard/test/test-standard-category-report.scm
index 617fc93cb..eb73b0cd2 100644
--- a/gnucash/report/reports/standard/test/test-standard-category-report.scm
+++ b/gnucash/report/reports/standard/test/test-standard-category-report.scm
@@ -46,7 +46,7 @@
 (export run-category-asset-liability-test)
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (str->num str)
   (string->number
diff --git a/gnucash/report/reports/standard/test/test-standard-net-barchart.scm b/gnucash/report/reports/standard/test/test-standard-net-barchart.scm
index 862e5f340..89bec638a 100644
--- a/gnucash/report/reports/standard/test/test-standard-net-barchart.scm
+++ b/gnucash/report/reports/standard/test/test-standard-net-barchart.scm
@@ -38,7 +38,7 @@
   (test-end "standard-net-barchart"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (run-net-asset-income-test asset-report-uuid income-report-uuid)
   (null-test asset-report-uuid)
diff --git a/gnucash/report/reports/standard/test/test-standard-net-linechart.scm b/gnucash/report/reports/standard/test/test-standard-net-linechart.scm
index 600327ddd..4e9fc114b 100644
--- a/gnucash/report/reports/standard/test/test-standard-net-linechart.scm
+++ b/gnucash/report/reports/standard/test/test-standard-net-linechart.scm
@@ -38,7 +38,7 @@
   (test-end "standard-net-linechart"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (run-net-asset-test asset-report-uuid)
   (null-test asset-report-uuid)
diff --git a/gnucash/report/reports/standard/test/test-stress-options.scm b/gnucash/report/reports/standard/test/test-stress-options.scm
index 6c73f9216..79d0bc4ed 100644
--- a/gnucash/report/reports/standard/test/test-stress-options.scm
+++ b/gnucash/report/reports/standard/test/test-stress-options.scm
@@ -77,9 +77,9 @@
                   (else #f))
             (set! report-options-tested
               (cons (make-combo
-                     (gnc:option-section option)
-                     (gnc:option-name option)
-                     (case (gnc:option-type option)
+                     (GncOption-get-section option)
+                     (GncOption-get-name option)
+                     (case (GncOption-get-type option)
                        ((multichoice)
                         (map (cut GncOption-permissible-value option <>)
                              (iota (GncOption-num-permissible-values option))))
@@ -97,9 +97,8 @@
   (get-environment-variable "COMBINATORICS"))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value))))
+  (if (gnc-lookup-option (gnc:optiondb options) section name)
+      (gnc-set-option (gnc:optiondb options) section name value)))
 
 ;; code snippet to run report uuid, with options object
 (define (try-run-report uuid options option-summary)
@@ -130,10 +129,10 @@
     (newline)
     (for-each
      (lambda (idx)
-       (when (gnc:lookup-option options "General" "Start Date")
+       (when (gnc-lookup-option (gnc:optiondb options) "General" "Start Date")
          (set-option! options "General" "Start Date"
                       (cons 'absolute (gnc-dmy2time64 1 12 1969))))
-       (when (gnc:lookup-option options "General" "End Date")
+       (when (gnc-lookup-option (gnc:optiondb options) "General" "End Date")
          (set-option! options "General" "End Date"
                       (cons 'absolute (gnc-dmy2time64 1 1 1972))))
        (let loop ((report-options report-options)
@@ -174,10 +173,10 @@
                  (get-name option)))
        report-options)
       (newline)
-      (when (gnc:lookup-option options "General" "Start Date")
+      (when (gnc-lookup-option (gnc:optiondb options) "General" "Start Date")
         (set-option! options "General" "Start Date"
                      (cons 'absolute (gnc-dmy2time64 1 12 1969))))
-      (when (gnc:lookup-option options "General" "End Date")
+      (when (gnc-lookup-option (gnc:optiondb options) "General" "End Date")
         (set-option! options "General" "End Date"
                      (cons 'absolute (gnc-dmy2time64 1 1 1972))))
       ;; generate combinatorics
diff --git a/gnucash/report/reports/standard/test/test-trial-balance.scm b/gnucash/report/reports/standard/test/test-trial-balance.scm
index f378fd309..9591dcff9 100644
--- a/gnucash/report/reports/standard/test/test-trial-balance.scm
+++ b/gnucash/report/reports/standard/test/test-trial-balance.scm
@@ -42,7 +42,7 @@
   (test-end "trial-balance"))
 
 (define (set-option options page tag value)
-  ((gnc:option-setter (gnc:lookup-option options page tag)) value))
+  (gnc-set-option (gnc:optiondb options) page tag value))
 
 (define (teardown)
   (gnc-clear-current-session))

commit 58147ea4704f71996f0c3d54a44420bdc6861911
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 23 09:57:23 2022 -0800

    [c++options] Convert trep-engine, trep-based-reports, and tests to new API

diff --git a/gnucash/report/reports/standard/test/test-income-gst.scm b/gnucash/report/reports/standard/test/test-income-gst.scm
index 97c267ab4..fa2c5ae9c 100644
--- a/gnucash/report/reports/standard/test/test-income-gst.scm
+++ b/gnucash/report/reports/standard/test/test-income-gst.scm
@@ -43,10 +43,9 @@
   (gnc:options->sxml rpt-uuid options "test-gstr" test-title))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option options section name)
+      (gnc-set-option options section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define* (create-txn d m y desc splits #:optional txn-type)
   (let* ((splits (map (lambda (s) (vector (cdr s) (car s) (car s))) splits))
diff --git a/gnucash/report/reports/standard/test/test-transaction.scm b/gnucash/report/reports/standard/test/test-transaction.scm
index 4a0ffc43c..0f7a2e583 100644
--- a/gnucash/report/reports/standard/test/test-transaction.scm
+++ b/gnucash/report/reports/standard/test/test-transaction.scm
@@ -102,15 +102,13 @@
   (sxml->table-row-col sxml 1 row col))
 
 (define (set-option! options section name value)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-set-value option value)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option options section name)
+      (gnc-set-option options section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 (define (opt-val options section name)
-  (let ((option (gnc:lookup-option options section name)))
-    (if option
-        (gnc:option-value option)
-        (test-assert (format #f "wrong-option ~a ~a" section name) #f))))
+  (if (gnc-lookup-option options section name)
+      (gnc-get-option options section name value)
+      (test-assert (format #f "wrong-option ~a ~a" section name) #f)))
 
 (define structure
   (list "Root" (list (cons 'type ACCT-TYPE-ASSET))
diff --git a/gnucash/report/trep-engine.scm b/gnucash/report/trep-engine.scm
index c3b07a4a7..b68a4e911 100644
--- a/gnucash/report/trep-engine.scm
+++ b/gnucash/report/trep-engine.scm
@@ -990,9 +990,7 @@ be excluded from periodic reporting.")
   (gnc-register-internal-option options "__trep" "unique-transactions" #f)
 
   (GncOptionDBPtr-set-default-section options gnc:pagename-general)
-;; A temporary hack so that trep users will get the options type they expect.
-  (lambda (key)
-    options)))
+    options))
 
 ;; ;;;;;;;;;;;;;;;;;;;;
 ;; Here comes the big function that builds the whole table.

commit 3c406c93741441e2b24d99fd31463f80ddfa5ede
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 22 16:50:46 2022 -0800

    # This is a combination of 2 commits.
    # This is the 1st commit message:
    
    Convert trep-engine to the new options API.
    
    # This is the commit message #2:
    
    Update trep-based reports to new options API.

diff --git a/gnucash/report/reports/standard/general-ledger.scm b/gnucash/report/reports/standard/general-ledger.scm
index c76a52292..59582a989 100644
--- a/gnucash/report/reports/standard/general-ledger.scm
+++ b/gnucash/report/reports/standard/general-ledger.scm
@@ -49,8 +49,8 @@
 
     (define pagename-sorting (N_ "Sorting"))
     (define (set-option! section name value)
-      (gnc:option-set-default-value
-       (gnc:lookup-option options section name) value))
+      (GncOption-set-default-value
+       (gnc-lookup-option (gnc:optiondb options) section name) value))
     
     ;; set options in the accounts tab...
     (set-option! gnc:pagename-accounts "Filter Type" 'none)
diff --git a/gnucash/report/reports/standard/income-gst-statement.scm b/gnucash/report/reports/standard/income-gst-statement.scm
index 481766b82..0ebdd23fe 100644
--- a/gnucash/report/reports/standard/income-gst-statement.scm
+++ b/gnucash/report/reports/standard/income-gst-statement.scm
@@ -72,8 +72,8 @@ accounts may be tagged with *EUGOODS* in the account description."))
 
 (define* (gst-statement-renderer rpt #:optional export-type)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options rpt) section name)))
+    (gnc-optiondb-lookup-value
+     (gnc:report-options rpt) section name))
   (define sales-purch-accounts
     (append (opt-val "Accounts" "Sales") (opt-val "Accounts" "Purchases")))
   (define document
@@ -118,42 +118,32 @@ accounts may be tagged with *EUGOODS* in the account description."))
            (N_ "Display the tax payable (tax on sales - tax on purchases)") #f)))
 
   ;; Delete Accounts selector
-  (gnc:unregister-option options gnc:pagename-accounts (N_ "Accounts"))
+  (GncOptionDBPtr-unregister-option
+   options gnc:pagename-accounts (N_ "Accounts"))
 
   ;;  and recreate with limited account types
-  (gnc:register-option
-   options
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts (N_ "Sales") "a" (N_ "Report on these accounts.")
-    (lambda ()
-      (gnc:filter-accountlist-type
+    (gnc:filter-accountlist-type
        (list ACCT-TYPE-INCOME)
        all-accounts))
-    #f #t))
 
-  (gnc:register-option
-   options
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts (N_ "Purchases") "b" (N_ "Report on these accounts.")
-    (lambda ()
-      (gnc:filter-accountlist-type
+    (gnc:filter-accountlist-type
        (list ACCT-TYPE-EXPENSE)
-       all-accounts)) #f #t))
+       all-accounts))
 
-  (gnc:register-option
-   options
-   (gnc:make-account-list-limited-option
+  (gnc-register-account-list-limited-option options
     gnc:pagename-accounts (N_ "Tax Accounts")
     "b17" (N_ "Please find and select the accounts which will hold the tax collected or paid. \
 These accounts must contain splits which document the monies which are wholly sent or claimed \
 from tax authorities during periodic GST/VAT returns. These accounts must be of type ASSET \
 for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
-    (lambda () '()) #f #t
-    (list ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)))
+    '()
+    (list ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY))
 
-  (gnc:register-option
-   options
-   (gnc:make-multichoice-callback-option
+  (gnc-register-multichoice-callback-option options
     pagename-format (N_ "Report Format")
     "a"
     (string-join
@@ -167,76 +157,74 @@ accounts. EU rules may be used. Denote EU VAT accounts *EUVAT* in \
 account description, and denote EU goods sales and purchases accounts \
 with *EUGOODS* in the account description."))
      "\n* ")
-    'default
+    "default"
     (list (vector 'default (G_ "Default Format"))
           (vector 'au-bas (G_ "Australia BAS"))
           (vector 'uk-vat (G_ "UK VAT Return")))
-     #f
     (lambda (x)
       (for-each
        (match-lambda
          ((name . _)
-          (gnc-option-db-set-option-selectable-by-name
+          (gnc-optiondb-set-option-selectable-by-name
            options pagename-format name (eq? x 'default))))
-       format-options))))
+       format-options)))
 
   (for-each
    (match-lambda
      ((name sort help default)
-      (gnc:register-option options
-                           (gnc:make-simple-boolean-option
-                            pagename-format name sort help default))))
+      (gnc-register-simple-boolean-option
+       options pagename-format name sort help default)))
    format-options)
 
   ;; Enable option to retrieve unique transactions only
-  (gnc:option-set-default-value
-   (gnc:lookup-option options "__trep" "unique-transactions") #t)
+  (GncOption-set-default-value
+   (gnc-lookup-option options "__trep" "unique-transactions") #t)
   ;; Disable account filtering
-  (gnc:option-make-internal! options gnc:pagename-accounts "Filter Type")
-  (gnc:option-make-internal! options gnc:pagename-accounts "Filter By...")
-  (gnc:option-make-internal! options "Currency" "Show original currency amount")
+  (GncOptionDBPtr-make-internal options gnc:pagename-accounts "Filter Type")
+  (GncOptionDBPtr-make-internal options gnc:pagename-accounts "Filter By...")
+  (GncOptionDBPtr-make-internal options "Currency" "Show original currency amount")
 
   ;; Enforce compulsory common-currency. It's senseless to allow
   ;; multiple currencies in a government report. Plus, single currency
   ;; means only 1 amount per heading for CSV output.
-  (gnc:option-set-default-value
-   (gnc:lookup-option options "Currency" "Common Currency") #t)
-  (gnc:option-make-internal! options "Currency" "Common Currency")
+  (GncOption-set-default-value
+   (gnc-lookup-option options "Currency" "Common Currency") #t)
+  (GncOptionDBPtr-make-internal options "Currency" "Common Currency")
 
   ;; Set default dates to report on last quarter.
-  (gnc:option-set-default-value
-   (gnc:lookup-option options gnc:pagename-general "Start Date")
+  (GncOption-set-default-value
+   (gnc-lookup-option options gnc:pagename-general "Start Date")
    '(relative . start-prev-quarter))
-  (gnc:option-set-default-value
-   (gnc:lookup-option options gnc:pagename-general "End Date")
+  (GncOption-set-default-value
+   (gnc-lookup-option options gnc:pagename-general "End Date")
    '(relative . end-prev-quarter))
 
   ;; Disallow closing transactions
-  (gnc:option-make-internal! options pagename-filter "Closing transactions")
-  (gnc:option-set-default-value
-   (gnc:lookup-option options pagename-filter "Closing transactions")
+  (GncOptionDBPtr-make-internal options pagename-filter "Closing transactions")
+  (GncOption-set-default-value
+   (gnc-lookup-option options pagename-filter "Closing transactions")
    'exclude-closing)
 
   ;; Set good sorting options
-  (gnc:option-set-default-value
-   (gnc:lookup-option options pagename-sorting "Primary Key")
+  (GncOption-set-default-value
+   (gnc-lookup-option options pagename-sorting "Primary Key")
    'date)
-  (gnc:option-set-default-value
-   (gnc:lookup-option options pagename-sorting "Primary Subtotal for Date Key")
+  (GncOption-set-default-value
+   (gnc-lookup-option options pagename-sorting "Primary Subtotal for Date Key")
    'none)
-  (gnc:option-set-default-value
-   (gnc:lookup-option options pagename-sorting "Secondary Key")
+  (GncOption-set-default-value
+   (gnc-lookup-option options pagename-sorting "Secondary Key")
    'none)
 
   ;; Disable display options not being used anymore
-  (gnc:option-make-internal! options gnc:pagename-display "Shares")
-  (gnc:option-make-internal! options gnc:pagename-display "Price")
-  (gnc:option-make-internal! options gnc:pagename-display "Amount")
-  (gnc:option-make-internal! options gnc:pagename-display "Sign Reverses")
-  (gnc:option-make-internal! options gnc:pagename-display "Running Balance")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Shares")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Price")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Amount")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Sign Reverses")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Running Balance")
   ;; No multilines allowed
-  (gnc:option-make-internal! options gnc:pagename-display "Detail Level")
-  (gnc:option-make-internal! options pagename-sorting "Show Informal Debit/Credit Headers")
+  (GncOptionDBPtr-make-internal options gnc:pagename-display "Detail Level")
+  (GncOptionDBPtr-make-internal options pagename-sorting "Show Informal Debit/Credit Headers")
   options)
 
 (define (myadd a b)
@@ -253,7 +241,7 @@ with *EUGOODS* in the account description."))
 
 (define (gst-calculated-cells options)
   (define (opt-val section name)
-    (gnc:option-value (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (let* ((tax-accounts (opt-val gnc:pagename-accounts "Tax Accounts"))
          (accounts-tax-collected (accfilter tax-accounts ACCT-TYPE-LIABILITY))
          (accounts-tax-paid      (accfilter tax-accounts ACCT-TYPE-ASSET))
diff --git a/gnucash/report/reports/standard/reconcile-report.scm b/gnucash/report/reports/standard/reconcile-report.scm
index d45acbc41..38012dbce 100644
--- a/gnucash/report/reports/standard/reconcile-report.scm
+++ b/gnucash/report/reports/standard/reconcile-report.scm
@@ -33,28 +33,28 @@
 
 (define (reconcile-report-options-generator)
   (let ((options (gnc:trep-options-generator)))
-    (gnc:option-set-value
-     (gnc:lookup-option options "Sorting" "Primary Key") 'reconciled-status)
-    (gnc:option-set-value
-     (gnc:lookup-option options "Sorting" "Secondary Key")   'date)
-    (gnc:option-set-value
-     (gnc:lookup-option options "Sorting" "Secondary Subtotal for Date Key") 'none)
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-general "Start Date")
+    (GncOption-set-value
+     (gnc-lookup-option options "Sorting" "Primary Key") 'reconciled-status)
+    (GncOption-set-value
+     (gnc-lookup-option options "Sorting" "Secondary Key")   'date)
+    (GncOption-set-value
+     (gnc-lookup-option options "Sorting" "Secondary Subtotal for Date Key") 'none)
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-general "Start Date")
      (cons 'relative 'start-prev-quarter))
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-general "End Date")
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-general "End Date")
      (cons 'relative 'today))
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-general "Date Filter")
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-general "Date Filter")
      'reconciled)
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-display "Reconciled Date") #t)
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-display "Running Balance") #f)
-    (gnc:option-set-value
-     (gnc:lookup-option options gnc:pagename-display "Memo") #f)
-    (gnc:option-make-internal! options gnc:pagename-display "Running Balance")
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-display "Reconciled Date") #t)
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-display "Running Balance") #f)
+    (GncOption-set-value
+     (gnc-lookup-option options gnc:pagename-display "Memo") #f)
+    (GncOptionDBPtr-make-internal options gnc:pagename-display "Running Balance")
     options))
 
 (define reconcile-report-instructions
diff --git a/gnucash/report/trep-engine.scm b/gnucash/report/trep-engine.scm
index 77d62cfc8..c3b07a4a7 100644
--- a/gnucash/report/trep-engine.scm
+++ b/gnucash/report/trep-engine.scm
@@ -504,11 +504,8 @@ in the Options panel."))
 ;; Default Transaction Report
 ;;
 (define (gnc:trep-options-generator)
-  (define options (gnc:new-options))
   (define BOOK-SPLIT-ACTION
     (qof-book-use-split-action-for-num-field (gnc-get-current-book)))
-  (define (gnc:register-trep-option new-option)
-    (gnc:register-option options new-option))
 
   ;; (Feb 2018) Note to future hackers - this gnc:trep-options-generator
   ;; defines a long set of options to be assigned as an object in
@@ -516,39 +513,38 @@ in the Options panel."))
   ;; may be modified in a derived report (see income-gst-statement.scm)
   ;; via gnc:make-internal! and gnc-unregister-option to hide
   ;; and remove options, respectively. If an option is unregistered,
-  ;; don't forget to re-register them via gnc:register-option, unless
+  ;; don't forget to re-register them via gnc-register-option, unless
   ;; your derived report truly does not require them.
 
+  (let ((options (gnc-new-optiondb)))
+
   ;; General options
 
   (gnc:options-add-date-interval!
    options gnc:pagename-general optname-startdate optname-enddate "a")
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-general optname-date-source
     "a5" (G_ "Specify date to filter by...")
-    'posted
+    "posted"
     (list (vector 'posted (G_ "Date Posted"))
           (vector 'reconciled (G_ "Reconciled Date"))
-          (vector 'entered (G_ "Date Entered")))))
+          (vector 'entered (G_ "Date Entered"))))
 
-  (gnc:register-trep-option
-   (gnc:make-complex-boolean-option
+  (gnc-register-complex-boolean-option  options
     pagename-currency optname-common-currency
-    "a" (G_ "Convert all transactions into a common currency.") #f #f
+    "a" (G_ "Convert all transactions into a common currency.") #f
     (lambda (x)
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options pagename-currency optname-currency x)
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options pagename-currency optname-orig-currency x)
-      (gnc-option-db-set-option-selectable-by-name
-       options pagename-currency optname-price-source x))))
+      (gnc-optiondb-set-option-selectable-by-name
+       options pagename-currency optname-price-source x)))
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-currency optname-orig-currency
-    "b" (G_ "Also show original currency amounts") #f))
+    "b" (G_ "Also show original currency amounts") #f)
 
   (gnc:options-add-currency!
    options pagename-currency optname-currency "c")
@@ -556,110 +552,97 @@ in the Options panel."))
   (gnc:options-add-price-source!
    options pagename-currency optname-price-source "d" 'pricedb-nearest)
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     gnc:pagename-general optname-table-export
     "g" (G_ "Formats the table suitable for cut & paste exporting with extra cells.")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     gnc:pagename-general optname-infobox-display
     "h" (G_ "Add summary of options.")
-    'no-match
+    "no-match"
     ;; This is an alist of conditions for displaying the infobox
     ;; 'no-match for empty-report
     ;; 'match for generated report
     (list (vector 'no-match (G_ "If no transactions matched"))
           (vector 'always (G_ "Always"))
-          (vector 'never (G_ "Never")))))
+          (vector 'never (G_ "Never"))))
 
   ;; Filtering Options
 
-  (gnc:register-trep-option
-   (gnc:make-string-option
+  (gnc-register-string-option options
     pagename-filter optname-account-matcher
     "a5" (G_ "Show only accounts whose full name matches this filter e.g. ':Travel' will match \
 Expenses:Travel:Holiday and Expenses:Business:Travel. It can be left blank, which will \
 disable the filter.")
-    ""))
+    "")
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-filter optname-account-matcher-regex
     "a6"
     (G_ "By default the account filter will search substring only. Set this to true to \
 enable full POSIX regular expressions capabilities. 'Car|Flights' will match both \
 Expenses:Car and Expenses:Flights. Use a period (.) to match a single character e.g. \
 '20../.' will match 'Travel 2017/1 London'. ")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-filter optname-account-matcher-exclude "a7"
     (G_ "If this option is selected, accounts matching filter are excluded.")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-string-option
+  (gnc-register-string-option options
     pagename-filter optname-transaction-matcher
     "i1" (G_ "Show only transactions where description, notes, or memo matches this filter.
 e.g. '#gift' will find all transactions with #gift in description, notes or memo. It can be left \
 blank, which will disable the filter.")
-    ""))
+    "")
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-filter optname-transaction-matcher-regex
     "i2"
     (G_ "By default the transaction filter will search substring only. Set this to true to \
 enable full POSIX regular expressions capabilities. '#work|#family' will match both \
 tags within description, notes or memo.")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-filter optname-transaction-matcher-exclude
     "i3"
     (G_ "If this option is selected, transactions matching filter are excluded.")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option options
     pagename-filter optname-transaction-matcher-caseinsensitive
     "i4"
     (G_ "If this option is selected, transactions matching filter is not case sensitive.")
-    #f))
+    #f)
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     pagename-filter optname-reconcile-status
     "j1" (G_ "Filter by reconcile status.")
-    'all
-    (keylist->vectorlist reconcile-status-list)))
+    "all"
+    (keylist->vectorlist reconcile-status-list))
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     pagename-filter optname-void-transactions
     "k" (N_ "How to handle void transactions.")
-    'non-void-only
-    (keylist->vectorlist show-void-list)))
+    "non-void-only"
+    (keylist->vectorlist show-void-list))
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option options
     pagename-filter optname-closing-transactions
     "l" (G_ "By default most users should not include closing \
 transactions in a transaction report. Closing transactions are \
 transfers from income and expense accounts to equity, and must usually \
 be excluded from periodic reporting.")
-    'exclude-closing
-    (keylist->vectorlist show-closing-list)))
+    "exclude-closing"
+    (keylist->vectorlist show-closing-list))
 
   ;; Accounts options
 
   ;; account to do report on
-  (gnc:register-trep-option
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts optname-accounts
     "a" (G_ "Report on these accounts.")
     ;; select, by default, no accounts! Selecting all accounts will
@@ -667,29 +650,22 @@ be excluded from periodic reporting.")
     ;; is almost never useful. So we instead display the normal error
     ;; message saying "Click here", and the user knows how to
     ;; continue.
-    (lambda ()
-      '())
-    #f #t))
+    '())
 
-  (gnc:register-trep-option
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option options
     gnc:pagename-accounts optname-filterby
     "c1" (G_ "Filter on these accounts.")
-    (lambda ()
-      '())
-    #f #t))
+    '())
 
-  (gnc:register-trep-option
-   (gnc:make-multichoice-callback-option
+  (gnc-register-multichoice-callback-option options
     gnc:pagename-accounts optname-filtertype
     "c" (G_ "Filter account.")
-    'none
+    "none"
     (keylist->vectorlist filter-list)
-    #f
     (lambda (x)
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-accounts optname-filterby
-       (not (eq? x 'none))))))
+       (not (eq? x 'none)))))
 
   ;; Sorting options
 
@@ -713,182 +689,166 @@ be excluded from periodic reporting.")
               (SUBTOTAL-ENABLED? sec-sortkey BOOK-SPLIT-ACTION))
              (sec-date-sortingtype-enabled (memq sec-sortkey DATE-SORTING-TYPES)))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-prime-subtotal
          prime-sortkey-subtotal-enabled)
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-prime-sortorder
          prime-sortkey-enabled)
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-sec-subtotal
          sec-sortkey-subtotal-enabled)
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-sec-sortorder
          sec-sortkey-enabled)
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-full-account-name
          (or (and prime-sortkey-subtotal-enabled prime-sortkey-subtotal-true)
              (and sec-sortkey-subtotal-enabled sec-sortkey-subtotal-true)))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-show-account-code
          (or (and prime-sortkey-subtotal-enabled prime-sortkey-subtotal-true)
              (and sec-sortkey-subtotal-enabled sec-sortkey-subtotal-true)))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-show-account-description
          (or (and prime-sortkey-subtotal-enabled prime-sortkey-subtotal-true)
              (and sec-sortkey-subtotal-enabled sec-sortkey-subtotal-true)))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-indenting
          (or (and prime-sortkey-subtotal-enabled prime-sortkey-subtotal-true)
              (and sec-sortkey-subtotal-enabled sec-sortkey-subtotal-true)
              (and prime-date-sortingtype-enabled (not (eq? 'none prime-date-subtotal)))
              (and sec-date-sortingtype-enabled (not (eq? 'none sec-date-subtotal)))))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-show-subtotals-only
          (or (and prime-sortkey-subtotal-enabled prime-sortkey-subtotal-true)
              (and sec-sortkey-subtotal-enabled sec-sortkey-subtotal-true)
              (and prime-date-sortingtype-enabled (not (eq? 'none prime-date-subtotal)))
              (and sec-date-sortingtype-enabled (not (eq? 'none sec-date-subtotal)))))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-show-informal-headers
          (or (memq prime-sortkey (list 'account-name 'account-code))
              (memq sec-sortkey (list 'account-name 'account-code))))
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-prime-date-subtotal
          prime-date-sortingtype-enabled)
 
-        (gnc-option-db-set-option-selectable-by-name
+        (gnc-optiondb-set-option-selectable-by-name
          options pagename-sorting optname-sec-date-subtotal
          sec-date-sortingtype-enabled)))
 
     ;; primary sorting criterion
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       pagename-sorting optname-prime-sortkey
       "a" (G_ "Sort by this criterion first.")
-      prime-sortkey
-      key-choice-list #f
+      (symbol->string prime-sortkey)
+      key-choice-list
       (lambda (x)
         (set! prime-sortkey x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-full-account-name
       "j1"
       (G_ "Show the full account name for subtotals and subheadings?")
-      #f))
+      #f)
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-show-account-code
       "j2"
       (G_ "Show the account code for subtotals and subheadings?")
-      #f))
+      #f)
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-show-account-description
       "j3"
       (G_ "Show the account description for subheadings?")
-      #f))
+      #f)
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-show-informal-headers
       "j4"
       (G_ "Show the informal headers for debit/credit accounts?")
-      #f))
+      #f)
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-indenting
       "j5"
       (G_ "Add indenting columns with grouping and subtotals?")
-      #t))
+      #t)
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       pagename-sorting optname-show-subtotals-only
       "j6"
       (G_ "Show subtotals only, hiding transactional detail?")
-      #f))
+      #f)
 
-    (gnc:register-trep-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       pagename-sorting optname-prime-subtotal
       "e5"
-      (G_ "Subtotal according to the primary key?")
-      prime-sortkey-subtotal-true #f
+      (G_ "Subtotal according to the primary key?") prime-sortkey-subtotal-true
       (lambda (x)
         (set! prime-sortkey-subtotal-true x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+     (gnc-register-multichoice-callback-option options
       pagename-sorting optname-prime-date-subtotal
       "e2" (G_ "Do a date subtotal.")
-      prime-date-subtotal
-      date-subtotal-choice-list #f
+      (symbol->string prime-date-subtotal)
+      date-subtotal-choice-list
       (lambda (x)
         (set! prime-date-subtotal x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       pagename-sorting optname-prime-sortorder
       "e" (G_ "Order of primary sorting.")
-      'ascend
-      ascending-choice-list))
+      "ascend"
+      ascending-choice-list)
 
     ;; Secondary sorting criterion
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+    (gnc:register-multichoice-callback-option options
       pagename-sorting optname-sec-sortkey
       "f"
       (G_ "Sort by this criterion second.")
-      sec-sortkey
-      key-choice-list #f
+      (symbol->string sec-sortkey)
+      key-choice-list
       (lambda (x)
         (set! sec-sortkey x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       pagename-sorting optname-sec-subtotal
       "i5"
-      (G_ "Subtotal according to the secondary key?")
-      sec-sortkey-subtotal-true #f
+      (G_ "Subtotal according to the secondary key?") sec-sortkey-subtotal-true
       (lambda (x)
         (set! sec-sortkey-subtotal-true x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       pagename-sorting optname-sec-date-subtotal
       "i2" (G_ "Do a date subtotal.")
-      sec-date-subtotal
-      date-subtotal-choice-list #f
+      (symbol->string sec-date-subtotal)
+      date-subtotal-choice-list
       (lambda (x)
         (set! sec-date-subtotal x)
-        (apply-selectable-by-name-sorting-options))))
+        (apply-selectable-by-name-sorting-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       pagename-sorting optname-sec-sortorder
       "i" (G_ "Order of Secondary sorting.")
-      'ascend
-      ascending-choice-list)))
+      "ascend"
+      ascending-choice-list))
 
   ;; Display options
 
@@ -900,43 +860,42 @@ be excluded from periodic reporting.")
 
     (define (apply-selectable-by-name-display-options)
       (define detail-is-single? (eq? disp-detail-level? 'single))
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Use Full Account Name")
        disp-accname?)
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Other Account Name")
        detail-is-single?)
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Sign Reverses")
        (eq? amount-value 'single))
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display optname-grid
        (not (eq? amount-value 'none)))
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display "Enable Links"
        (not (eq? amount-value 'none)))
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Use Full Other Account Name")
        (and disp-other-accname? detail-is-single?))
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Other Account Code")
        detail-is-single?)
 
-      (gnc-option-db-set-option-selectable-by-name
+      (gnc-optiondb-set-option-selectable-by-name
        options gnc:pagename-display (N_ "Notes")
        disp-memo?))
 
     (for-each
      (lambda (l)
-       (gnc:register-trep-option
-        (gnc:make-simple-boolean-option
-         gnc:pagename-display (car l) (cadr l) (caddr l) (cadddr l))))
+       (gnc-register-simple-boolean-option options
+         gnc:pagename-display (car l) (cadr l) (caddr l) (cadddr l)))
      ;; One list per option here with: option-name, sort-tag,
      ;; help-string, default-value
      (list
@@ -963,86 +922,77 @@ be excluded from periodic reporting.")
       (list (N_ "Totals")                       "o"  (G_ "Display the totals?") #t)))
 
     (when BOOK-SPLIT-ACTION
-      (gnc:register-trep-option
-       (gnc:make-simple-boolean-option
+      (gnc-register-simple-boolean-option options
         gnc:pagename-display (N_ "Trans Number")
-        "b2" (G_ "Display the trans number?") #f)))
+        "b2" (G_ "Display the trans number?") #f))
 
     ;; Add an option to display the memo, and disable the notes option
     ;; when memos are not included.
-    (gnc:register-trep-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-display (N_ "Memo")
-      "d"  (G_ "Display the memo?") disp-memo? #f
+      "d"  (G_ "Display the memo?") disp-memo?
       (lambda (x)
         (set! disp-memo? x)
-        (apply-selectable-by-name-display-options))))
+        (apply-selectable-by-name-display-options)))
 
     ;; Ditto for Account Name #t -> Use Full Account Name is selectable
-    (gnc:register-trep-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-display (N_ "Account Name")
-      "e"  (G_ "Display the account name?") disp-accname? #f
+      "e"  (G_ "Display the account name?") disp-accname?
       (lambda (x)
         (set! disp-accname? x)
-        (apply-selectable-by-name-display-options))))
+        (apply-selectable-by-name-display-options)))
 
     ;; Ditto for Other Account Name #t -> Use Full Other Account Name is selectable
-    (gnc:register-trep-option
-     (gnc:make-complex-boolean-option
+    (gnc-register-complex-boolean-option options
       gnc:pagename-display (N_ "Other Account Name")
-      "h5"  (G_ "Display the other account name? (if this is a split transaction, this parameter is guessed).") disp-other-accname? #f
+      "h5"  (G_ "Display the other account name? (if this is a split transaction, this parameter is guessed).") disp-other-accname?
       (lambda (x)
         (set! disp-other-accname? x)
-        (apply-selectable-by-name-display-options))))
+        (apply-selectable-by-name-display-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-display optname-detail-level
       "h" (G_ "Amount of detail to display per transaction.")
-      disp-detail-level?
+      (symbol->string disp-detail-level?)
       (list (vector 'multi-line (G_ "One split per line"))
             (vector 'single (G_ "One transaction per line")))
-      #f
       (lambda (x)
         (set! disp-detail-level? x)
-        (apply-selectable-by-name-display-options))))
+        (apply-selectable-by-name-display-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-callback-option
+    (gnc-register-multichoice-callback-option options
       gnc:pagename-display (N_ "Amount")
       "m" (G_ "Display the amount?")
-      amount-value
+      (symbol->string amount-value)
       (list
        (vector 'none   (G_ "Hide"))
        (vector 'single (G_ "Single Column"))
        (vector 'double (G_ "Two Columns")))
-      #f
       (lambda (x)
         (set! amount-value x)
-        (apply-selectable-by-name-display-options))))
+        (apply-selectable-by-name-display-options)))
 
-    (gnc:register-trep-option
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       gnc:pagename-display (N_ "Enable Links")
-      "m2" (G_ "Enable hyperlinks in amounts.") #t))
+      "m2" (G_ "Enable hyperlinks in amounts.") #t)
 
-    (gnc:register-trep-option
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       gnc:pagename-display (N_ "Sign Reverses")
       "m1" (G_ "Reverse amount display for certain account types.")
-      'global
-      (keylist->vectorlist sign-reverse-list))))
+      "global"
+      (keylist->vectorlist sign-reverse-list)))
 
   ;; this hidden option will toggle whether the default
   ;; qof-query is run, or a different query which ensures
   ;; no transaction is duplicated. It can be enabled in
   ;; a derived report (eg income-gst-statement.scm)
-  (gnc:register-trep-option
-   (gnc:make-internal-option "__trep" "unique-transactions" #f))
+  (gnc-register-internal-option options "__trep" "unique-transactions" #f)
 
-  (gnc:options-set-default-section options gnc:pagename-general)
-  options)
+  (GncOptionDBPtr-set-default-section options gnc:pagename-general)
+;; A temporary hack so that trep users will get the options type they expect.
+  (lambda (key)
+    options)))
 
 ;; ;;;;;;;;;;;;;;;;;;;;
 ;; Here comes the big function that builds the whole table.
@@ -1051,10 +1001,8 @@ be excluded from periodic reporting.")
                           begindate enddate c_account_1)
 
   (define (opt-val section name)
-    (let ((option (gnc:lookup-option options section name)))
-      (if option
-          (gnc:option-value option)
-          (gnc:error "gnc:lookup-option error: " section "/" name))))
+    (gnc-optiondb-lookup-value (gnc:optiondb options) section name))
+
   (define BOOK-SPLIT-ACTION
     (qof-book-use-split-action-for-num-field (gnc-get-current-book)))
 
@@ -1977,7 +1925,7 @@ be excluded from periodic reporting.")
 
   (define options (gnc:report-options report-obj))
   (define (opt-val section name)
-    (gnc:option-value (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value (gnc:optiondb options) section name))
   (define BOOK-SPLIT-ACTION
     (qof-book-use-split-action-for-num-field (gnc-get-current-book)))
   (define (is-filter-member split account-list)

commit e79fe2f2d98d14e46341fd970fb9890b2f06c62f
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Aug 1 11:08:28 2022 -0700

    [options] Update stylesheets to use new API.

diff --git a/gnucash/report/stylesheets/css.scm b/gnucash/report/stylesheets/css.scm
index 8a93d7a88..135520c40 100644
--- a/gnucash/report/stylesheets/css.scm
+++ b/gnucash/report/stylesheets/css.scm
@@ -112,21 +112,19 @@ td.highlight {
 ")
 
 (define (css-options)
-  (let ((options (gnc:new-options)))
+  (let ((options (gnc-new-optiondb)))
 
-    (gnc:register-option
-     options
-     (gnc:make-text-option
+    (gnc-register-text-option options
       (N_ "General") (N_ "CSS") "a"
       (N_ "CSS code. This field specifies the CSS code for styling reports.")
-      default-css))
+      default-css)
 
     options))
 
 (define (css-renderer options doc)
 
   (let* ((ssdoc (gnc:make-html-document))
-         (css (gnc:option-value (gnc:lookup-option options "General" "CSS")))
+         (css (gnc-optiondb-lookup-value options "General" "CSS"))
          (report-css (or (gnc:html-document-style-text doc) ""))
          (all-css (string-append css report-css))
          (headline (or (gnc:html-document-headline doc)
diff --git a/gnucash/report/stylesheets/footer.scm b/gnucash/report/stylesheets/footer.scm
index c7b111296..c46d7ede5 100644
--- a/gnucash/report/stylesheets/footer.scm
+++ b/gnucash/report/stylesheets/footer.scm
@@ -43,151 +43,120 @@
 (use-modules (gnucash html))
 
 (define (easy-fancy-footer-options)
-  (let* ((options (gnc:new-options))
-         (opt-register
-          (lambda (opt)
-            (gnc:register-option options opt))))
+  (let* ((options (gnc-new-optiondb)))
 
-    (opt-register
-     (gnc:make-string-option
+    (gnc-register-string-option options
       (N_ "General")
       (N_ "Preparer") "a"
       (N_ "Name of person preparing the report.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-string-option
+    (gnc-register-string-option options
       (N_ "General")
       (N_ "Prepared for") "b"
       (N_ "Name of organization or company prepared for.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show preparer info") "c"
       (N_ "Name of organization or company.")
-      #f))
+      #f)
 
-    (opt-register
-     (gnc:make-simple-boolean-option
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Enable Links") "d"
       (N_ "Enable hyperlinks in reports.")
-      #t))
+      #t)
 
-    (opt-register
-     (gnc:make-text-option
+    (gnc-register-text-option options
       (N_ "General")
       (N_ "Footer") "e"
       (N_ "String to be placed as a footer.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-pixmap-option
+    (gnc-register-pixmap-option options
       (N_ "Images")
       (N_ "Background Tile") "a" (N_ "Background tile for reports.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-pixmap-option
+    (gnc-register-pixmap-option options
       (N_ "Images")
 ;;; Translators: Banner is an image like Logo.
       (N_ "Heading Banner") "b" (N_ "Banner for top of report.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-multichoice-option
+    (gnc-register-multichoice-option options
       (N_ "Images")
       (N_ "Heading Alignment") "c" (N_ "Banner for top of report.")
-      'left
+      "left"
       (list (vector 'left (N_ "Left"))
             (vector 'center (N_ "Center"))
-            (vector 'right (N_ "Right")))))
+            (vector 'right (N_ "Right"))))
 
-    (opt-register
-     (gnc:make-pixmap-option
+    (gnc-register-pixmap-option options
       (N_ "Images")
       (N_ "Logo") "d" (N_ "Company logo image.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Background Color") "a" (N_ "General background color for report.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Text Color") "b" (N_ "Normal body text color.")
-      (list #x00 #x00 #x00 #xff)
-      255 #f))
+      "000000")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Link Color") "c" (N_ "Link text color.")
-      (list #xb2 #x22 #x22 #xff)
-      255 #f))
+      "b22222")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Table Cell Color") "c" (N_ "Default background for table cells.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Alternate Table Cell Color") "d"
       (N_ "Default alternate background for table cells.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Subheading/Subtotal Cell Color") "e"
       (N_ "Default color for subtotal rows.")
-      (list #xee #xe8 #xaa #xff)
-      255 #f))
+      "eee8aa")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Sub-subheading/total Cell Color") "f"
       (N_ "Color for subsubtotals.")
-      (list #xfa #xfa #xd2 #xff)
-      255 #f))
+      "fafad2")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Grand Total Cell Color") "g"
       (N_ "Color for grand totals.")
-      (list #xff #xff #x00 #xff)
-      255 #f))
+      "ffff00")
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell spacing") "a" (N_ "Space between table cells.")
-      1 0 20 0 1))
+      1 0 20 1)
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content.")
-      1 0 20 0 1))
+      1 0 20 1)
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table border width") "c" (N_ "Bevel depth on tables.")
-      1 0 20 0 1))
+      1 0 20 1)
     (register-font-options options)
 
     options))
@@ -196,12 +165,11 @@
   (let* ((ssdoc (gnc:make-html-document))
          (opt-val
           (lambda (section name)
-            (gnc:option-value
-             (gnc:lookup-option options section name))))
+            (gnc-optiondb-lookup-value options section name)))
          (color-val
           (lambda (section name)
-            (gnc:color-option->html
-             (gnc:lookup-option options section name))))
+            (gnc:color->html
+             (gnc-optiondb-lookup-value options section name))))
          (preparer (opt-val "General" "Preparer"))
          (prepared-for (opt-val "General" "Prepared for"))
          (show-preparer? (opt-val "General" "Show preparer info"))
diff --git a/gnucash/report/stylesheets/head-or-tail.scm b/gnucash/report/stylesheets/head-or-tail.scm
index ce3d032f3..586217723 100644
--- a/gnucash/report/stylesheets/head-or-tail.scm
+++ b/gnucash/report/stylesheets/head-or-tail.scm
@@ -43,198 +43,159 @@
 (use-modules (gnucash html))
 
 (define (head-or-tail-options)
-  (let* ((options (gnc:new-options))
-         (opt-register
-          (lambda (opt)
-            (gnc:register-option options opt))))
-    (opt-register
-     (gnc:make-string-option
+  (let ((options (gnc-new-optiondb)))
+
+    (gnc-register-string-option options
       (N_ "General")
       (N_ "Preparer") "a"
       (N_ "Name of person preparing the report.")
-      ""))
-    (opt-register
-     (gnc:make-string-option
+      "")
+    (gnc-register-string-option options
       (N_ "General")
       (N_ "Prepared for") "b"
       (N_ "Name of organization or company prepared for.")
-      ""))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      "")
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show preparer info") "c"
       (N_ "Name of organization or company.")
-      #t))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #t)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show receiver info") "d"
       (N_ "Name of organization or company the report is prepared for.")
-      #t))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #t)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show date") "e"
       (N_ "The creation date for this report.")
-      #t))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #t)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show time in addition to date") "f"
       (N_ "The creation time for this report can only be shown if the date is shown.")
-      #t))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #t)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show GnuCash Version") "g"
       (N_ "Show the currently used GnuCash version.")
-      #t))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #t)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Enable Links") "h"
       (N_ "Enable hyperlinks in reports.")
-      #t))
+      #t)
     ;; FIXME: put this in a more sensible tab like Text or Header/Footer
-    (opt-register
-     (gnc:make-text-option
+    (gnc-register-text-option options
       (N_ "General")
       (N_ "Additional Comments") "i"
       (N_ "String for additional report information.")
-      ""))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      "")
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show preparer info at bottom") "j"
       (N_ "Per default the preparer info will be shown before the report data.")
-      #f))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #f)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show receiver info at bottom") "k"
       (N_ "Per default the receiver info will be shown before the report data.")
-      #f))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #f)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show date/time at bottom") "l"
       (N_ "Per default the date/time info will be shown before the report data.")
-      #f))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #f)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show comments at bottom") "m"
       (N_ "Per default the additional comments text will be shown before the report data.")
-      #f))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      #f)
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Show GnuCash version at bottom") "m"
       (N_ "Per default the GnuCash version will be shown before the report data.")
-      #f))
+      #f)
 
-    (opt-register
-     (gnc:make-pixmap-option
+    (gnc-register-pixmap-option options
       (N_ "Images")
       (N_ "Background Tile") "a" (N_ "Background tile for reports.")
-      ""))
-    (opt-register
-     (gnc:make-pixmap-option
+      "")
+    (gnc-register-pixmap-option options
       (N_ "Images")
 ;;; Translators: Banner is an image like Logo.
       (N_ "Heading Banner") "b" (N_ "Banner for top of report.")
-      ""))
-    (opt-register
-     (gnc:make-multichoice-option
+      "")
+    (gnc-register-multichoice-option options
       (N_ "Images")
       (N_ "Heading Alignment") "c" (N_ "Banner for top of report.")
-      'left
+      "left"
       (list (vector 'left (N_ "Left"))
             (vector 'center (N_ "Center"))
-            (vector 'right (N_ "Right")))))
-    (opt-register
-     (gnc:make-pixmap-option
+            (vector 'right (N_ "Right"))))
+    (gnc-register-pixmap-option options
       (N_ "Images")
       (N_ "Logo") "d" (N_ "Company logo image.")
-      ""))
+      "")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Background Color") "a" (N_ "General background color for report.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Text Color") "b" (N_ "Normal body text color.")
-      (list #x00 #x00 #x00 #xff)
-      255 #f))
+      "000000")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Link Color") "c" (N_ "Link text color.")
-      (list #xb2 #x22 #x22 #xff)
-      255 #f))
+      "b22222")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Table Cell Color") "c" (N_ "Default background for table cells.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Alternate Table Cell Color") "d"
       (N_ "Default alternate background for table cells.")
-      (list #xff #xff #xff #xff)
-      255 #f))
+      "ffffff")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Subheading/Subtotal Cell Color") "e"
       (N_ "Default color for subtotal rows.")
-      (list #xee #xe8 #xaa #xff)
-      255 #f))
+      "eexe8xaa")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Sub-subheading/total Cell Color") "f"
       (N_ "Color for subsubtotals.")
-      (list #xfa #xfa #xd2 #xff)
-      255 #f))
+      "fafad2")
 
-    (opt-register
-     (gnc:make-color-option
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Grand Total Cell Color") "g"
       (N_ "Color for grand totals.")
-      (list #xff #xff #x00 #xff)
-      255 #f))
+      "ffff00")
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell spacing") "a" (N_ "Space between table cells.")
-      1 0 20 0 1))
+      1 0 20 1)
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content.")
-      1 0 20 0 1))
+      1 0 20 1)
 
-    (opt-register
-     (gnc:make-number-range-option
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table border width") "c" (N_ "Bevel depth on tables.")
-      1 0 20 0 1))
+      1 0 20 1)
     (register-font-options options)
 
     options))
@@ -243,12 +204,11 @@
   (let* ((ssdoc (gnc:make-html-document))
          (opt-val
           (lambda (section name)
-            (gnc:option-value
-             (gnc:lookup-option options section name))))
+            (gnc-optiondb-lookup-value options section name)))
          (color-val
           (lambda (section name)
-            (gnc:color-option->html
-             (gnc:lookup-option options section name))))
+            (gnc:color->html
+             (gnc-optiondb-lookup-value options section name))))
          (preparer (opt-val "General" "Preparer"))
          (prepared-for (opt-val "General" "Prepared for"))
          (show-preparer? (opt-val "General" "Show preparer info"))
diff --git a/gnucash/report/stylesheets/plain.scm b/gnucash/report/stylesheets/plain.scm
index e1b9a1342..6dc7bc8c8 100644
--- a/gnucash/report/stylesheets/plain.scm
+++ b/gnucash/report/stylesheets/plain.scm
@@ -36,64 +36,51 @@
 ;; this should generally be the default style sheet for most reports.
 ;; it's supposed to be lightweight and unobtrusive.
 (define (plain-options)
-  (let* ((options (gnc:new-options))
-         (opt-register
-          (lambda (opt)
-            (gnc:register-option options opt))))
-    (opt-register
-     (gnc:make-color-option
+  (let* ((options (gnc-new-optiondb)))
+    (gnc-register-color-option options
       (N_ "General")
       (N_ "Background Color") "a" (N_ "Background color for reports.")
-      (list #xff #xff #xff #xff)
-      255 #f))
-    (opt-register
-     (gnc:make-pixmap-option
+      "ffffff")
+    (gnc-register-pixmap-option options
       (N_ "General")
       (N_ "Background Pixmap") "b" (N_ "Background tile for reports.")
-      ""))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      "")
+    (gnc-register-simple-boolean-option options
       (N_ "General")
       (N_ "Enable Links") "c" (N_ "Enable hyperlinks in reports.")
-      #t))
-    (opt-register
-     (gnc:make-color-option
+      #t)
+    (gnc-register-color-option options
       (N_ "Colors")
       (N_ "Alternate Table Cell Color") "a" (N_ "Background color for alternate lines.")
-      (list #xff #xff #xff #xff)
-      255 #f))
-    (opt-register
-     (gnc:make-number-range-option
+      "ffffff")
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell spacing") "a" (N_ "Space between table cells.")
-      0 0 20 0 1))
-    (opt-register
-     (gnc:make-number-range-option
+      0 0 20 1)
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content.")
-      4 0 20 0 1))
-    (opt-register
-     (gnc:make-number-range-option
+      4 0 20 1)
+    (gnc-register-number-range-option options
       (N_ "Tables")
       (N_ "Table border width") "c" (N_ "Bevel depth on tables.")
-      0 0 20 0 1))
+      0 0 20 1)
     (register-font-options options)
 
     options))
 
 (define (plain-renderer options doc)
   (define (opt-val section name)
-    (gnc:option-value
-     (gnc:lookup-option options section name)))
+    (gnc-optiondb-lookup-value options section name))
   (let* ((ssdoc (gnc:make-html-document))
          (bgcolor
-          (gnc:color-option->html
-           (gnc:lookup-option options "General" "Background Color")))
+          (gnc:color->html
+           (gnc-optiondb-lookup-value options "General" "Background Color")))
          (bgpixmap (opt-val "General" "Background Pixmap"))
          (links? (opt-val "General" "Enable Links"))
          (alternate-row-color
-          (gnc:color-option->html
-           (gnc:lookup-option options "Colors" "Alternate Table Cell Color")))
+          (gnc:color->html
+           (gnc-optiondb-lookup-value options "Colors" "Alternate Table Cell Color")))
          (spacing (opt-val "Tables" "Table cell spacing"))
          (padding (opt-val "Tables" "Table cell padding"))
          (border (opt-val "Tables" "Table border width")))

commit 018d5d8d8313e04bae72e21574cb7156c0a279db
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Aug 1 09:56:06 2022 -0700

    [options] Update documentation to reflect C++ options.

diff --git a/gnucash/report/doc/report-html.txt b/gnucash/report/doc/report-html.txt
index 81155218e..97a06de7c 100644
--- a/gnucash/report/doc/report-html.txt
+++ b/gnucash/report/doc/report-html.txt
@@ -355,23 +355,18 @@ We have three different kinds of style control information available:
 
      (let ()
       (define sample-options
-        (let* ((options (gnc:new-options))
-               (opt-register 
-                 (lambda (opt)
-                   (gnc:register-option options opt))))
-          (opt-register
-            (gnc:make-color-option
+        (let ((options (gnc-new-optiondb)))
+          (gnc-register-color-option options
               (_ "Style Sheet Options")
 	      (_ "Background Color") "a" (_ "Background color for reports.")
-	      (list #xff #xff #xff #xff)
-	      255 #f))
+	      "ffffff")
           options))
 
        (define (sample-renderer options doc)
          (let ((ssdoc (gnc:make-html-document))
                (bgcolor 
-                (gnc:color-option->html
-                 (gnc:lookup-option options 
+                (gnc:color->html
+                 (gnc-optiondb-lookup-value options 
                                     (_ "Style Sheet Options")
                                     (_ "Background Color")))))
 

commit 4825960089375cfcc3a3a2d7c914f2403d4711dd
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 22 16:19:19 2022 -0800

    Convert report core and html to new options API.

diff --git a/gnucash/report/html-fonts.scm b/gnucash/report/html-fonts.scm
index a249f5723..5a18afcb0 100644
--- a/gnucash/report/html-fonts.scm
+++ b/gnucash/report/html-fonts.scm
@@ -28,11 +28,13 @@
 
 (eval-when (compile load eval expand)
   (load-extension "libgnc-report" "scm_init_sw_report_module"))
+
 (use-modules (sw_report))
 
 (use-modules (gnucash core-utils))
-(use-modules (gnucash options))
+(use-modules (gnucash report report-core))
 (use-modules (gnucash report html-document))
+
 (use-modules (ice-9 regex))
 
 ;; html-fonts.scm
@@ -97,66 +99,57 @@
 
 ;; Registers font options
 (define (register-font-options options)
-  (define (opt-register opt)
-    (gnc:register-option options opt))
-  (let ((font-family (gnc-get-default-report-font-family)))
-    (opt-register
-     (gnc:make-font-option
+  (let ((font-family (gnc-get-default-report-font-family))
+        (odb (gnc:optiondb options)))
+     (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Title") "a" (N_ "Font info for the report title.")
-      (string-append font-family " Bold 15")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " Bold 15"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Account link") "b" (N_ "Font info for account name.")
-      (string-append font-family " Italic 10")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " Italic 10"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Number cell") "c" (N_ "Font info for regular number cells.")
-      (string-append font-family " 10")))
-    (opt-register
-     (gnc:make-simple-boolean-option
+      (string-append font-family " 10"))
+    (gnc-register-simple-boolean-option odb
       (N_ "Fonts")
       (N_ "Negative Values in Red") "d" (N_ "Display negative values in red.")
-      #t))
-    (opt-register
-     (gnc:make-font-option
+      #t)
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Number header") "e" (N_ "Font info for number headers.")
-      (string-append font-family " 10")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " 10"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Text cell") "f" (N_ "Font info for regular text cells.")
-      (string-append font-family " 10")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " 10"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Total number cell") "g"
       (N_ "Font info for number cells containing a total.")
-      (string-append font-family " Bold 12")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " Bold 12"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Total label cell") "h"
       (N_ "Font info for cells containing total labels.")
-      (string-append font-family " Bold 12")))
-    (opt-register
-     (gnc:make-font-option
+      (string-append font-family " Bold 12"))
+    (gnc-register-font-option odb
       (N_ "Fonts")
       (N_ "Centered label cell") "i" (N_ "Font info for centered label cells.")
-      (string-append font-family " Bold 12")))))
+      (string-append font-family " Bold 12"))))
 
 ;; Adds CSS style information to an html document
 (define (add-css-information-to-doc options ssdoc doc)
   (define (opt-font-val name)
-    (gnc:option-value (gnc:lookup-option options "Fonts" name)))
+    (gnc-optiondb-lookup-value (gnc:optiondb options) "Fonts" name))
   (define (opt-style-info name) (font-name-to-style-info (opt-font-val name)))
   (let* ((negative-red? (opt-font-val "Negative Values in Red"))
          (alternate-row-color
-          (gnc:color-option->html
-           (gnc:lookup-option options "Colors" "Alternate Table Cell Color")))
+          (gnc:color->html
+           (gnc-optiondb-lookup-value (gnc:optiondb options)
+                              "Colors" "Alternate Table Cell Color")))
          (title-info (opt-style-info "Title"))
          (account-link-info (opt-style-info "Account link"))
          (number-cell-info (opt-style-info "Number cell"))
diff --git a/gnucash/report/html-utilities.scm b/gnucash/report/html-utilities.scm
index 8b2c62be6..10d914b76 100644
--- a/gnucash/report/html-utilities.scm
+++ b/gnucash/report/html-utilities.scm
@@ -174,11 +174,7 @@
 	  (gnc:options-copy-values src-options options)
 	  (for-each
 	   (lambda (l)
-	     (let ((o (gnc:lookup-option options (car l) (cadr l))))
-	       (if o
-		   (gnc:option-set-value o (caddr l))
-		   (warn "gnc:make-report-anchor:" reportname
-			 " No such option: " (car l) (cadr l)))))
+             (gnc-set-option (gnc:optiondb options) (car l) (cadr l) (caddr l)))
 	   optionlist)
 	  (let ((id (gnc:make-report reportname options)))
 	    (gnc:report-anchor-text id)))
@@ -323,17 +319,16 @@
         (try gnc-budget-get-name)
         (format #f "~a" d)))
   (let ((render-list '())
-        (report-list (and=> (gnc:lookup-option options "__general" "report-list")
-                            gnc:option-value)))
+        (report-list (and=> (gnc-lookup-option (gnc:optiondb options) "__general" "report-list")
+                            GncOption-get-value)))
     (define (add-option-if-changed option)
-      (let* ((section (gnc:option-section option))
-             (name (gnc:option-name option))
-             (default-value (gnc:option-default-value option))
-             (value (gnc:option-value option))
+      (let* ((section (GncOption-get-section option))
+             (name (GncOption-get-name option))
+             (value (GncOption-get-value option))
              (retval (cons (format #f "~a / ~a" section name)
                            (disp value))))
-        (if (not (or (equal? default-value value)
-                     (char=? (string-ref section 0) #\_)))
+        (if (and (GncOption-is-changed option)
+                 (not (GncOption-is-internal option)))
             (addto! render-list retval))))
     (define (name-fn name) (if plaintext? name (gnc:html-markup-b name)))
     (define br (if plaintext? "\n" (gnc:html-markup-br)))
@@ -342,7 +337,7 @@
        (let ((report (gnc-report-find (car child))))
          (addto! render-list (cons "Embedded Report" (gnc:report-name report)))))
      (or report-list '()))
-    (gnc:options-for-each add-option-if-changed options)
+    (gnc-optiondb-foreach (gnc:optiondb options) add-option-if-changed)
     (let lp ((render-list (reverse render-list)) (acc '()))
       (match render-list
         (() (if plaintext? (string-concatenate acc) (apply gnc:make-html-text acc)))
diff --git a/gnucash/report/options-utilities.scm b/gnucash/report/options-utilities.scm
index eba662db9..88161fe3a 100644
--- a/gnucash/report/options-utilities.scm
+++ b/gnucash/report/options-utilities.scm
@@ -25,7 +25,7 @@
 
 (use-modules (gnucash core-utils))
 (use-modules (gnucash app-utils))
-(use-modules (gnucash options))
+(use-modules (gnucash report report-core))
 
 (export gnc:options-add-report-date!)
 (export gnc:options-add-date-interval!)
@@ -41,11 +41,13 @@
 
 ;; These are just a bunch of options which were useful in several
 ;; reports and hence they got defined in a separate function.
+(define (evaluate arg)
+  (if (procedure? arg) (arg) arg))
 
 ;; This is one single end-date of a report.
 (define (gnc:options-add-report-date!
 	 options pagename optname sort-tag)
-  (gnc:options-make-end-date! options pagename optname sort-tag
+  (gnc-register-end-date-option (gnc:optiondb options) pagename optname sort-tag
 			      (N_ "Select a date to report on.")))
 
 ;; This is a date-interval for a report.
@@ -59,18 +61,17 @@
 ;; A date interval multichoice option.
 (define (gnc:options-add-interval-choice! 
 	 options pagename optname sort-tag default)
-  (gnc:register-option 
-   options
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option (gnc:optiondb options)
     pagename optname
-    sort-tag (N_ "The amount of time between data points.") default
+    sort-tag (N_ "The amount of time between data points.")
+    (symbol->string (evaluate default))
     (list (vector 'DayDelta (N_ "One Day"))
           (vector 'WeekDelta (N_ "One Week"))
           (vector 'TwoWeekDelta (N_ "Two Weeks"))
           (vector 'MonthDelta (N_ "One Month"))
           (vector 'QuarterDelta (N_ "Quarter Year"))
           (vector 'HalfYearDelta (N_ "Half Year"))
-          (vector 'YearDelta (N_ "One Year"))))))
+          (vector 'YearDelta (N_ "One Year")))))
 
 ;; A multichoice option intended to chose the account level. Different
 ;; from the other functions the help string can still be given. Used
@@ -78,17 +79,18 @@
 (define (gnc:options-add-account-levels! 
 	 options pagename name-display-depth 
 	 sort-tag help-string default-depth)
-  (gnc:register-option 
-   options  
-   (gnc:make-multichoice-option
-    pagename name-display-depth sort-tag help-string default-depth
+  (gnc-register-multichoice-option
+   (gnc:optiondb options)
+   pagename name-display-depth sort-tag help-string
+   (let ((default (evaluate default-depth)))
+     (if (number? default) (number->string default) (symbol->string default)))
     (list (vector 'all (N_ "All"))
           (vector 1 "1")
           (vector 2 "2")
           (vector 3 "3")
           (vector 4 "4")
           (vector 5 "5")
-          (vector 6 "6")))))
+          (vector 6 "6"))))
 
 ;; These help for selecting a bunch of accounts.
 (define (gnc:options-add-account-selection! 
@@ -101,84 +103,75 @@
    (N_ "Show accounts to this depth, overriding any other option.") 
    default-depth)
     
-  (gnc:register-option 
-   options  
-   (gnc:make-simple-boolean-option
+  (gnc-register-simple-boolean-option (gnc:optiondb options)
     pagename name-show-subaccounts
     (string-append sort-tag "b")
     (N_ "Override account-selection and show sub-accounts of all selected accounts?") 
-    default-show-subaccounts))
+    default-show-subaccounts)
 
   ;; Semantics of the account selection, as used in the
   ;; gnc:html-build-acct-table: An account shows up if ( the
   ;; tree-depth is large enough AND ( it is selected in the account
   ;; selector OR ( always show sub-accounts is selected AND one of
   ;; the parents is selected in the account selector. )))
-  (gnc:register-option 
-   options  
-   (gnc:make-account-list-option
+  (gnc-register-account-list-option (gnc:optiondb options)
     pagename name-accounts
     (string-append sort-tag "c")
     (N_ "Report on these accounts, if display depth allows.")
-    default-accounts
-    #f #t)))
+    (evaluate default-accounts)))
 
 ;; To let the user select a currency for the report.
 (define (gnc:options-add-currency!
 	 options pagename name-report-currency sort-tag)
-  (gnc:register-option 
-   options 
-   (gnc:make-currency-option 
+  (gnc-register-currency-option (gnc:optiondb options)
     pagename name-report-currency
-    sort-tag 
+    sort-tag
     (N_ "Select the currency to display the values of this report in.")
-    (gnc-default-report-currency))))
+    (gnc-default-report-currency)))
 
 ;; A multichoice option for the source of prices
-(define (gnc:options-add-price-source! 
+(define (gnc:options-add-price-source!
 	 options pagename optname sort-tag default)
-  (gnc:register-option 
-   options
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option
+   (gnc:optiondb options)
     pagename optname
-    sort-tag (N_ "The source of price information.") default
+    sort-tag (N_ "The source of price information.")
+    (symbol->string (evaluate default))
     (list (vector 'average-cost (N_ "Average cost of purchases weighted by volume"))
           (vector 'weighted-average (N_ "Weighted average of all transactions in the past"))
           (vector 'pricedb-before (N_ "Last up through report date"))
           (vector 'pricedb-nearest (N_ "Closest to report date"))
-          (vector 'pricedb-latest (N_ "Most recent"))))))
+          (vector 'pricedb-latest (N_ "Most recent")))))
 
 ;; The width- and height- options for charts
 (define (gnc:options-add-plot-size!
 	 options pagename 
 	 name-width name-height sort-tag 
 	 default-width default-height)
-  (gnc:register-option
-   options
-   (gnc:make-number-plot-size-option
+  (let* ((widthv (evaluate default-width))
+         (heightv (evaluate default-height))
+         (width (if (pair? widthv) (cdr widthv) widthv))
+         (height (if (pair? heightv) (cdr heightv) heightv)))
+  (gnc-register-number-plot-size-option (gnc:optiondb options)
     pagename name-width
     (string-append sort-tag "a")
-    (N_ "Width of plot, 10 - 100 in percent, above in pixels.") default-width
-    100 20000 0 5))
+    (N_ "Width of plot, 10 - 100 in percent, above in pixels.")
+    width)
 
-  (gnc:register-option
-   options
-   (gnc:make-number-plot-size-option
+  (gnc-register-number-plot-size-option (gnc:optiondb options)
     pagename name-height
     (string-append sort-tag "b")
-    (N_ "Height of plot, 10 - 100 in percent, above in pixels.") default-height
-    100 20000 0 5)))
+    (N_ "Height of plot, 10 - 100 in percent, above in pixels.")
+    height)))
 
 ;; A multicoice option for the marker of a scatter plot.
 (define (gnc:options-add-marker-choice!
 	 options pagename optname sort-tag default)
-  (gnc:register-option
-   options
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option (gnc:optiondb options)
     pagename optname 
     sort-tag
     (N_ "Choose the marker for each data point.")
-    default
+    (symbol->string (evaluate default))
     (list
      (vector 'diamond (N_ "Diamond"))
      (vector 'circle (N_ "Circle"))
@@ -188,22 +181,19 @@
      (vector 'dash (N_ "Dash"))
      (vector 'filleddiamond (N_ "Filled diamond"))
      (vector 'filledcircle (N_ "Filled circle"))
-     (vector 'filledsquare (N_ "Filled square"))))))
-
+     (vector 'filledsquare (N_ "Filled square")))))
 
 (define (gnc:options-add-sort-method!
 	 options pagename optname sort-tag default)
-  (gnc:register-option
-   options
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option (gnc:optiondb options)
     pagename optname 
     sort-tag
     (N_ "Choose the method for sorting accounts.")
-    default
+    (symbol->string (evaluate default))
     (list
      (vector 'acct-code (N_ "Alphabetical by account code"))
      (vector 'alphabetical (N_ "Alphabetical by account name"))
-     (vector 'amount (N_ "Numerical by descending amount"))))))
+     (vector 'amount (N_ "Numerical by descending amount")))))
 
 
 ;; These control the calculation and view mode of subtotal balances
@@ -212,9 +202,7 @@
 	 optname-parent-balance-mode optname-parent-total-mode
 	 sort-tag)
   ;; what to show for non-leaf accounts
-  (gnc:register-option
-   options
-   (gnc:make-multichoice-option
+  (gnc-register-multichoice-option (gnc:optiondb options)
     pagename 
     ;; usually the option name is: (N_ "Parent account balances")
     optname-parent-balance-mode
@@ -225,13 +213,12 @@
       (G_ "Account Balance in the parent account, excluding any subaccounts.")
       (G_ "Do not show any balances of parent accounts."))
       "\n* ")
-    'immediate-bal
+    "immediate-bal"
     (list (vector 'immediate-bal (N_ "Account Balance"))
           (vector 'recursive-bal (N_ "Calculate Subtotal"))
-          (vector 'omit-bal (N_ "Do not show")))))
-  (gnc:register-option
-   options
-   (gnc:make-multichoice-option
+          (vector 'omit-bal (N_ "Do not show"))))
+
+  (gnc-register-multichoice-option (gnc:optiondb options)
     pagename
     ;; usually the option name is: (N_ "Parent account subtotals")
     optname-parent-total-mode
@@ -242,6 +229,6 @@
       (G_ "Show subtotals for selected parent accounts which have subaccounts.")
       (G_ "Do not show any subtotals for parent accounts."))
       "\n* ")
-    'f
+    "f"
     (list (vector 't (N_ "Show subtotals"))
-          (vector 'f (N_ "Do not show"))))))
+          (vector 'f (N_ "Do not show")))))
diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index 410b561e6..fa776d707 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -421,27 +421,22 @@ not found.")))
              (gnc:report-name report)))))
 
 (define (gnc:report-name report)
-  (let* ((opt (gnc:report-options report)))
+  (let* ((opt (gnc:optiondb (gnc:report-options report))))
     (and opt
-         (gnc:option-value
-          (gnc:lookup-option opt gnc:pagename-general gnc:optname-reportname)))))
+         (gnc-optiondb-lookup-value opt gnc:pagename-general gnc:optname-reportname))))
 
 (define (gnc:report-stylesheet report)
   (gnc:html-style-sheet-find
-   (symbol->string (gnc:option-value
-                    (gnc:lookup-option
-                     (gnc:report-options report)
+   (symbol->string (gnc-optiondb-lookup-value
+                    (gnc:optiondb (gnc:report-options report))
                      gnc:pagename-general
-                     gnc:optname-stylesheet)))))
+                     gnc:optname-stylesheet))))
 
 (define (gnc:report-set-stylesheet! report stylesheet)
-  (gnc:option-set-value
-   (gnc:lookup-option
-    (gnc:report-options report)
-    gnc:pagename-general
-    gnc:optname-stylesheet)
-   (string->symbol
-    (gnc:html-style-sheet-name stylesheet))))
+  (gnc-set-value
+   (gnc:optiondb (gnc:report-options report))
+   gnc:pagename-general gnc:optname-stylesheet
+   (string->symbol (gnc:html-style-sheet-name stylesheet))))
 
 
 ;; Load and save helper functions
@@ -566,8 +561,8 @@ not found.")))
              "      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
              "      (let*\n"
              "        (\n"
-             "          (option (gnc:lookup-option options \"__general\" \"report-list\"))\n"
-             "          (saved-report-list (gnc:option-value option))\n"
+             "          (option (gnc-lookup-option (gnc:optiondb options) \"__general\" \"report-list\"))\n"
+             "          (saved-report-list (GncOption-set-value option))\n"
              "        )\n"
              "        (\n"
              "          (lambda (option)\n"
@@ -753,9 +748,9 @@ not found.")))
 
 ;; return the list of reports embedded in the specified report
 (define (gnc:report-embedded-list options)
-  (let* ((option (gnc:lookup-option options "__general" "report-list")))
+  (let* ((option (gnc-lookup-option (gnc:optiondb options) "__general" "report-list")))
     (and option
-         (let ((opt-value (gnc:option-value option)))
+         (let ((opt-value (GncOption-get-value option)))
            (map car opt-value)))))
 
 ;; delete an existing report from the hash table and then call to
diff --git a/gnucash/report/reports/reports.scm b/gnucash/report/reports/reports.scm
index 0a71066fc..da2229c1c 100644
--- a/gnucash/report/reports/reports.scm
+++ b/gnucash/report/reports/reports.scm
@@ -69,10 +69,11 @@
     (if (gnc:find-report-template report-template-id)
         ;; We found the report template id, so instantiate a report
         ;; and set the invoice option accordingly.
-        (let* ((options (gnc:make-report-options report-template-id))
-               (invoice-op (gnc:lookup-option options gnc:pagename-general gnc:optname-invoice-number)))
-
-          (gnc:option-set-value invoice-op invoice)
+        (let* ((options (gnc:make-report-options report-template-id)))
+          (gnc-set-option
+           (gnc:optiondb options)
+           gnc:pagename-general gnc:optname-invoice-number
+           invoice)
           (gnc:make-report report-template-id options))
         ;; Invalid report-template-id, so let's return zero as an invalid report id.
         0
@@ -81,9 +82,8 @@
 (define budget-ID "810ed4b25ef0486ea43bbd3dddb32b11")
 (define (gnc:budget-report-create budget)
   (if (gnc:find-report-template budget-ID)
-      (let* ((options (gnc:make-report-options budget-ID))
-             (bgt-op (gnc:lookup-option options gnc:pagename-general "Budget")))
-        (gnc:option-set-value bgt-op budget)
+      (let* ((options (gnc:make-report-options budget-ID)))
+        (gnc-set-option options gnc:pagename-general "Budget" budget)
         (gnc:make-report budget-ID options))
       -1))
 
diff --git a/gnucash/report/reports/standard/category-barchart.scm b/gnucash/report/reports/standard/category-barchart.scm
index d90de8754..9efb57c77 100644
--- a/gnucash/report/reports/standard/category-barchart.scm
+++ b/gnucash/report/reports/standard/category-barchart.scm
@@ -218,9 +218,9 @@ developing over time"))
                                     export-type)
   ;; A helper functions for looking up option values.
   (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option
-      (gnc:report-options report-obj) section name)))
+    (gnc-option-value
+     (gnc:optiondb
+      (gnc:report-options report-obj)) section name))
 
   (gnc:report-starting reportname)
   (let* ((to-date-t64 (gnc:time64-end-day-time

commit 30b2c0bcac56b69a9f4fd3f9c3e98cf869664138
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Aug 26 11:50:40 2022 -0700

    [options] Provide gnc:register-multichoice-callback-option.
    
    Compatibility function for passing symbols or numbers as the default
    value.
    
    Note that this isn't used by GnuCash code and so isn't exercised or
    tested, it's provided only to simplify user-written code migration.

diff --git a/bindings/guile/options.scm b/bindings/guile/options.scm
index 458991f04..50fb66095 100644
--- a/bindings/guile/options.scm
+++ b/bindings/guile/options.scm
@@ -339,6 +339,14 @@
               (gnc-relative-date-to-time64 (cdr option-value)))
           option-value))
 
+(define-public (gnc:register-multichoice-callback-option options section name key docstring default multichoice widget-changed-cb)
+  (let ((defval (cond ((symbol? default)
+                       (symbol->string default))
+                      ((number? default)
+                       (number->string default))
+                     (else default))))
+  (gnc-register-multichoice-callback-option (gnc:optiondb options) section name key docstring defval multichoice widget-changed-cb)))
+
 ;; Scheme code for supporting options for the business modules
 ;;
 ;; Created by:	Derek Atkins <derek at ihtfp.com>



Summary of changes:
 bindings/guile/options.scm                         |  14 +-
 gnucash/report/doc/report-html.txt                 |  15 +-
 gnucash/report/html-fonts.scm                      |  61 ++--
 gnucash/report/html-utilities.scm                  |  23 +-
 gnucash/report/options-utilities.scm               | 113 +++----
 gnucash/report/report-core.scm                     |  31 +-
 gnucash/report/reports/example/average-balance.scm |  88 +++---
 gnucash/report/reports/example/daily-reports.scm   |  45 +--
 gnucash/report/reports/example/hello-world.scm     | 208 ++++++-------
 gnucash/report/reports/example/sample-graphs.scm   |   9 +-
 .../report/reports/example/welcome-to-gnucash.scm  |   2 +-
 .../reports/locale-specific/de_DE/taxtxf.scm       |  34 +--
 .../report/reports/locale-specific/us/taxtxf.scm   |  70 ++---
 gnucash/report/reports/reports.scm                 |  14 +-
 .../report/reports/standard/account-piecharts.scm  |  73 ++---
 .../report/reports/standard/account-summary.scm    |  38 ++-
 .../report/reports/standard/advanced-portfolio.scm |  89 ++----
 .../report/reports/standard/balance-forecast.scm   |  51 ++--
 gnucash/report/reports/standard/balance-sheet.scm  | 134 ++++-----
 gnucash/report/reports/standard/balsheet-eg.scm    |  86 +++---
 gnucash/report/reports/standard/balsheet-pnl.scm   | 128 ++++----
 .../reports/standard/budget-balance-sheet.scm      | 117 +++-----
 .../report/reports/standard/budget-barchart.scm    |  62 ++--
 gnucash/report/reports/standard/budget-flow.scm    |  28 +-
 .../reports/standard/budget-income-statement.scm   | 123 +++-----
 gnucash/report/reports/standard/budget.scm         | 100 +++---
 gnucash/report/reports/standard/cash-flow.scm      |  25 +-
 .../report/reports/standard/cashflow-barchart.scm  |  47 +--
 .../report/reports/standard/category-barchart.scm  |  69 ++---
 .../report/reports/standard/customer-summary.scm   |  68 ++---
 gnucash/report/reports/standard/dashboard.scm      |   3 +-
 .../report/reports/standard/equity-statement.scm   |  59 ++--
 .../report/reports/standard/general-journal.scm    |   4 +-
 gnucash/report/reports/standard/general-ledger.scm |   4 +-
 .../report/reports/standard/ifrs-cost-basis.scm    |  54 ++--
 .../reports/standard/income-gst-statement.scm      | 106 +++----
 .../report/reports/standard/income-statement.scm   | 124 +++-----
 gnucash/report/reports/standard/invoice.scm        | 223 ++++++--------
 gnucash/report/reports/standard/lot-viewer.scm     |  18 +-
 gnucash/report/reports/standard/net-charts.scm     |  77 ++---
 gnucash/report/reports/standard/new-aging.scm      |  92 +++---
 .../report/reports/standard/new-owner-report.scm   | 110 +++----
 gnucash/report/reports/standard/portfolio.scm      |  37 +--
 gnucash/report/reports/standard/price-scatter.scm  |  32 +-
 gnucash/report/reports/standard/receipt.scm        | 116 ++++---
 .../report/reports/standard/reconcile-report.scm   |  38 +--
 gnucash/report/reports/standard/register.scm       | 122 ++++----
 gnucash/report/reports/standard/taxinvoice.scm     | 178 ++++++-----
 .../reports/standard/test/test-account-summary.scm |   7 +-
 .../reports/standard/test/test-average-balance.scm |   2 +-
 .../reports/standard/test/test-balsheet-pnl.scm    |   7 +-
 .../report/reports/standard/test/test-budget.scm   |   2 +-
 .../standard/test/test-cashflow-barchart.scm       |   2 +-
 .../report/reports/standard/test/test-charts.scm   |  15 +-
 .../standard/test/test-equity-statement.scm        |   2 +-
 .../reports/standard/test/test-ifrs-cost-basis.scm |   7 +-
 .../reports/standard/test/test-income-gst.scm      |   7 +-
 .../report/reports/standard/test/test-invoice.scm  |   7 +-
 .../standard/test/test-new-owner-report.scm        |   7 +-
 .../reports/standard/test/test-owner-report.scm    |   7 +-
 .../reports/standard/test/test-portfolios.scm      |   7 +-
 .../report/reports/standard/test/test-register.scm |   2 +-
 .../test/test-standard-category-report.scm         |   2 +-
 .../standard/test/test-standard-net-barchart.scm   |   2 +-
 .../standard/test/test-standard-net-linechart.scm  |   2 +-
 .../reports/standard/test/test-stress-options.scm  |  19 +-
 .../reports/standard/test/test-transaction.scm     |  14 +-
 .../reports/standard/test/test-trial-balance.scm   |   2 +-
 gnucash/report/reports/standard/trial-balance.scm  | 105 +++----
 gnucash/report/reports/standard/view-column.scm    |  28 +-
 gnucash/report/stylesheets/css.scm                 |  10 +-
 gnucash/report/stylesheets/footer.scm              | 122 +++-----
 gnucash/report/stylesheets/head-or-tail.scm        | 168 ++++-------
 gnucash/report/stylesheets/plain.scm               |  53 ++--
 gnucash/report/trep-engine.scm                     | 334 +++++++++------------
 75 files changed, 1776 insertions(+), 2528 deletions(-)



More information about the gnucash-changes mailing list