Skip to content

Commit

Permalink
[options.scm] addendum ca6604c gnc:make-budget-option
Browse files Browse the repository at this point in the history
selection-budget changed from budget object to guid, handle other uses
as appropriate.
  • Loading branch information
christopherlam committed Dec 4, 2021
1 parent f771513 commit 33b6dfc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libgnucash/app-utils/options.scm
Original file line number Diff line number Diff line change
Expand Up @@ -508,21 +508,20 @@ the option '~a'."))
"(lambda (option) "
"(if option ((gnc:option-setter option) "
"(gnc-budget-lookup "
(gnc:value->string (gncBudgetGetGUID selection-budget))
(gnc:value->string selection-budget)
" (gnc-get-current-book)))))"))

;; scm->kvp -- commit the change
;; b -- book; p -- key-path
(lambda (b p)
(qof-book-set-option
b (gncBudgetGetGUID selection-budget) p))
(qof-book-set-option b selection-budget p))

;; kvp->scm -- get the stored value
(lambda (b p)
(let ((v (qof-book-get-option b p)))
(if (and v (string? v))
(begin
(set! selection-budget (gnc-budget-lookup v (gnc-get-current-book)))))))
(set! selection-budget (convert-to-guid
(gnc-budget-lookup v (gnc-get-current-book)))))))

;; value-validator -- returns (#t value) or (#f "failure message")
;; As no user-generated input, this legacy hard-wire is probably ok
Expand Down

0 comments on commit 33b6dfc

Please sign in to comment.