gnc:make-account-list-limited example?

Larry Evans cppljevans at cox-internet.com
Sun Jul 30 16:00:50 EDT 2006


Anyone have an example of the use of this function.  I can't find any in
the 2.0.0:

cd /usr/share/gnucash/
find . -name \*.scm -exec grep make-account-list-limited {} \; -ls
;; Just like gnc:make-account-list-limited-option except it
   (gnc:make-account-list-limited-option
(define (gnc:make-account-list-limited-option
276926   60 -rw-r--r--   1 root     root        53439 Jul  9 23:36 
./scm/options.scm
(export gnc:make-account-list-limited-option)
341969    8 -rw-r--r--   1 root     root         7803 Jul  9 23:36 
./guile-modules/gnucash/app-utils.scm
     (gnc:make-account-list-limited-option
194774    0 lrwxrwxrwx   1 root     root           64 Jul 28 15:47 
./guile-modules/gnucash/report/ave-annualized-ror.scm -> 
../../../dev/guile-modules/gnucash/report/ave-annualized-ror.scm

Compilation finished at Sun Jul 30 14:52:48

except, of course, for my use; however, I'm getting an Error
when I attempt to change options.  The Error window has:

   The Application "gnucash" has quit
   unexpectedly.

The source code causing problem is:

  (pretty-print (list "length default-account-types=" (length 
default-account-types)))
   (pretty-print (list "list-ref default-account-types 1=" (list-ref 
default-account-types 1)))
   (pretty-print (list "get-type-string default-account-types 1=" 
(gnc:account-get-type-string (list-ref default-account-types 1))))

   ;; 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-limited-option
       pagename name-accounts
       (string-append sort-tag "c")
       (N_ "Report on these accounts, if display depth allows.")
       default-accounts
       #f ; value-validator
       #t ; mulitple-selection
       (if #f
         '()
         (vector
           (lambda () (length default-account-types))
           (lambda (x) (list-ref default-account-types x))
           (lambda (x) (gnc:account-get-type-string
                        (list-ref default-account-types x)))
           (lambda (x) (gnc:account-get-type-string
                        (list-ref default-account-types x)))
           (lambda (x) (list-lookup default-account-types x))
         )
       )
     )
   )
)

It only occurs with the '(if #f'.  When code is '(if #t' it works.
The output from the pretty prints is as expected, indicating the
default-account-types at least are valid.



More information about the gnucash-devel mailing list