mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Update the Fancy Date Format
When the format is set to unset, the kvp data will now be removed and added a function to retrieve the 'Fancy Date Format' and test for it being valid, if not retrieve the preference date format.
This commit is contained in:
committed by
Geert Janssens
parent
03a11451bd
commit
354694b744
@@ -140,6 +140,7 @@
|
||||
(export gnc:options-for-each-general)
|
||||
(export gnc:lookup-option)
|
||||
(export gnc:generate-restore-forms)
|
||||
(export gnc:options-fancy-date)
|
||||
(export gnc:options-scm->kvp)
|
||||
(export gnc:options-kvp->scm)
|
||||
(export gnc:options-clear-changes)
|
||||
|
||||
@@ -1351,14 +1351,17 @@
|
||||
(lambda () (def-value))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (b p)
|
||||
(qof-book-set-option
|
||||
b (symbol->string (car value)) (append p '("fmt")))
|
||||
(qof-book-set-option
|
||||
b (symbol->string (cadr value)) (append p '("month")))
|
||||
(qof-book-set-option
|
||||
b (if (caddr value) 1 0) (append p '("years")))
|
||||
(qof-book-set-option
|
||||
b (cadddr value) (append p '("custom"))))
|
||||
(if (eq? (car value) 'unset)
|
||||
(qof-book-options-delete b p );; delete the kvp when unset
|
||||
(begin
|
||||
(qof-book-set-option
|
||||
b (symbol->string (car value)) (append p '("fmt")))
|
||||
(qof-book-set-option
|
||||
b (symbol->string (cadr value)) (append p '("month")))
|
||||
(qof-book-set-option
|
||||
b (if (caddr value) 1 0) (append p '("years")))
|
||||
(qof-book-set-option
|
||||
b (cadddr value) (append p '("custom"))))))
|
||||
(lambda (f p)
|
||||
(let ((fmt (qof-book-get-option f (append p '("fmt"))))
|
||||
(month (qof-book-get-option f (append p '("month"))))
|
||||
@@ -1843,9 +1846,15 @@
|
||||
(define (gnc:generate-restore-forms options options-string)
|
||||
((options 'generate-restore-forms) options-string))
|
||||
|
||||
(define (gnc:options-fancy-date book)
|
||||
(let ((date-format (gnc:fancy-date-info book gnc:*fancy-date-format*)))
|
||||
(if (boolean? date-format) ;; date-format does not exist
|
||||
(qof-date-format-get-string (qof-date-format-get))
|
||||
date-format)))
|
||||
|
||||
(define (gnc:options-scm->kvp options book clear-option?)
|
||||
(if clear-option?
|
||||
(qof-book-options-delete book))
|
||||
(qof-book-options-delete book '()))
|
||||
((options 'scm->kvp) book))
|
||||
|
||||
(define (gnc:options-kvp->scm options book)
|
||||
|
||||
@@ -477,6 +477,7 @@ gnc_date_format_refresh (GNCDateFormat *gdf)
|
||||
enable_custom = TRUE;
|
||||
break;
|
||||
|
||||
case QOF_DATE_FORMAT_UNSET:
|
||||
case QOF_DATE_FORMAT_LOCALE:
|
||||
case QOF_DATE_FORMAT_UTC:
|
||||
format = g_strdup(qof_date_format_get_string(sel_option));
|
||||
|
||||
Reference in New Issue
Block a user