gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Wed Feb 20 08:51:23 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/9ba0d965 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/918321aa (commit)
	 via  https://github.com/Gnucash/gnucash/commit/82edec26 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/76813223 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/971be339 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4a2b5e96 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f64586b8 (commit)
	from  https://github.com/Gnucash/gnucash/commit/6945e1c7 (commit)



commit 9ba0d9658da9d48deba823b2a326b7502ba1d091
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Feb 17 03:29:09 2019 +0800

    [test-extras] (create-transaction) adds price trading commodities/currency
    
    this will modify a test which was calibrated to record purchase price
    only. fix transaction creation to add prices for both purchase and
    sales, and also fix test which was assuming no sale price was bring
    recorded.

diff --git a/gnucash/report/report-system/test/test-commodity-utils.scm b/gnucash/report/report-system/test/test-commodity-utils.scm
index 728da7e81..8d59112d8 100644
--- a/gnucash/report/report-system/test/test-commodity-utils.scm
+++ b/gnucash/report/report-system/test/test-commodity-utils.scm
@@ -163,7 +163,7 @@
     (gnc-pricedb-create USD IBM (gnc-dmy2time64 1 1 2013) 19399/100)
     (gnc-pricedb-create USD AAPL (gnc-dmy2time64 1 1 2014) 7728/100)
     (gnc-pricedb-create USD MSFT (gnc-dmy2time64 1 1 2014) 3691/100)
-    (gnc-pricedb-create USD IBM (gnc-dmy2time64 1 1 2014) 18664/100)
+    (gnc-pricedb-create USD IBM (gnc-dmy2time64 1 1 2014) 18669/100)
     (gnc-pricedb-create USD AAPL (gnc-dmy2time64 1 1 2015) 10933/100)
     (gnc-pricedb-create USD MSFT (gnc-dmy2time64 1 1 2015) 4676/100)
     (gnc-pricedb-create USD IBM (gnc-dmy2time64 1 1 2015) 16206/100)
@@ -498,7 +498,7 @@
                             (gnc:make-gnc-monetary MSFT 1) USD
                             (gnc-dmy2time64 11 9 2016))))
      (test-equal "IBM nearest 1 July 2014"
-                 18664/100 (gnc:gnc-monetary-amount
+                 18663/100 (gnc:gnc-monetary-amount
                             (gnc:exchange-by-pricedb-nearest
                              (gnc:make-gnc-monetary IBM 1) USD
                              (gnc-dmy2time64 1 7 2014))))
diff --git a/libgnucash/engine/test/test-extras.scm b/libgnucash/engine/test/test-extras.scm
index 00e7889a3..2e06707db 100644
--- a/libgnucash/engine/test/test-extras.scm
+++ b/libgnucash/engine/test/test-extras.scm
@@ -267,7 +267,7 @@
                 (xaccSplitSetReconcile newsplit (car reconcile))
                 (xaccSplitSetDateReconciledSecs newsplit (cdr reconcile)))
               (if (and pricedb?
-                       (positive? amt)
+                       (not (zero? amt))
                        (not (gnc-commodity-equiv
                              (xaccAccountGetCommodity first-split)
                              (xaccAccountGetCommodity acc))))

commit 918321aafadcaa9ea68bf34d7d322c96dacc4c52
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Feb 15 14:13:05 2019 +0800

    [test-extras] for tests: (env-create-multisplit-transaction)
    
    This is the general case for any transaction creation.  Rewrite other
    transaction creation routines to use it.  All tests still work
    unchanged, which confirms this function works well.
    
    This will allow tests to create multisplit transactions, of an
    arbitrary number of splits. If the list-of-split's values are not
    balanced (i.e. total 0), the engine will create an Imbalance-CUR
    split.
    
    The motivation is to allow creation of complex multisplit
    multicommodity transactions eg USD50 + GBP20 (USD25) = EUR66 (USD75)
    as well as their prices GBP/USD = 25/20 and EUR/USD = 75/66.
    
    * USD -50
    * USD -25 = GBP -20
    * USD +75 = EUR +66
    
    This will be useful in creating tests for stock-based reports, whereby
    stock sales need splits in STOCK/ASSET/INCOME accounts.

diff --git a/gnucash/report/standard-reports/test/test-transaction.scm b/gnucash/report/standard-reports/test/test-transaction.scm
index 2f428e24e..f2a24e1f1 100644
--- a/gnucash/report/standard-reports/test/test-transaction.scm
+++ b/gnucash/report/standard-reports/test/test-transaction.scm
@@ -214,28 +214,13 @@
     ;; $100 from bank
     ;;  $80 to expenses
     ;;  $20 to wallet
-    (let ((txn (xaccMallocTransaction (gnc-get-current-book)))
-          (split-1 (xaccMallocSplit  (gnc-get-current-book)))
-          (split-2 (xaccMallocSplit  (gnc-get-current-book)))
-          (split-3 (xaccMallocSplit  (gnc-get-current-book))))
-      (xaccTransBeginEdit txn)
-      (xaccTransSetDescription txn "$100bank -> $80expenses + $20wallet")
-      (xaccTransSetCurrency txn (xaccAccountGetCommodity bank))
-      (xaccTransSetDate txn 14 02 1971)
-      (xaccSplitSetParent split-1 txn)
-      (xaccSplitSetParent split-2 txn)
-      (xaccSplitSetParent split-3 txn)
-      (xaccSplitSetAccount split-1 bank)
-      (xaccSplitSetAccount split-2 expense)
-      (xaccSplitSetAccount split-3 wallet)
-      (xaccSplitSetValue split-1 -100)
-      (xaccSplitSetValue split-2 80)
-      (xaccSplitSetValue split-3 20)
-      (xaccSplitSetAmount split-1 -100)
-      (xaccSplitSetAmount split-2 80)
-      (xaccSplitSetAmount split-3 20)
-      (xaccTransSetNotes txn "multisplit")
-      (xaccTransCommitEdit txn))
+    (env-create-multisplit-transaction
+     env 14 02 1971
+     (list (vector bank  -100 -100)
+           (vector expense 80   80)
+           (vector wallet  20   20))
+     #:description "$100bank -> $80expenses + $20wallet"
+     #:notes "multisplit")
 
     ;; A single closing transaction
     (let ((closing-txn (env-transfer env 31 12 1999 expense equity 111 #:description "Closing")))
diff --git a/libgnucash/engine/test/test-extras.scm b/libgnucash/engine/test/test-extras.scm
index 44de727af..00e7889a3 100644
--- a/libgnucash/engine/test/test-extras.scm
+++ b/libgnucash/engine/test/test-extras.scm
@@ -41,6 +41,7 @@
 (export env-any-date)
 (export env-transfer)
 (export env-transfer-foreign)
+(export env-create-multisplit-transaction)
 (export env-create-transaction)
 (export env-create-account)
 (export env-create-root-account)
@@ -183,44 +184,17 @@
           notes            ; string: notes       (def = null)
           memo             ; string: memo        (def = null)
           )
-  (let ((txn (xaccMallocTransaction (gnc-get-current-book)))
-	(split-1 (xaccMallocSplit  (gnc-get-current-book)))
-	(split-2 (xaccMallocSplit  (gnc-get-current-book))))
-    (xaccTransBeginEdit txn)
-    (xaccTransSetDescription txn (or description "ponies"))
-    (xaccTransSetCurrency txn (xaccAccountGetCommodity debit))
-    (xaccTransSetDate txn DD MM YY)
-    (xaccSplitSetParent split-1 txn)
-    (xaccSplitSetParent split-2 txn)
-    (xaccSplitSetAccount split-1 debit)
-    (xaccSplitSetAccount split-2 credit)
-    (xaccSplitSetValue split-1 (- amount1))
-    (xaccSplitSetValue split-2 amount1)
-    (xaccSplitSetAmount split-1 (- amount1))
-    (xaccSplitSetAmount split-2 amount2)
-    (if reconcile
-        (begin
-          (xaccSplitSetReconcile split-1 (car reconcile))
-          (xaccSplitSetReconcile split-2 (car reconcile))
-          (xaccSplitSetDateReconciledSecs split-1 (cdr reconcile))
-          (xaccSplitSetDateReconciledSecs split-2 (cdr reconcile))))
-    (if num
-        (begin
-          (gnc-set-num-action txn split-1 num num)
-          (gnc-set-num-action txn split-2 num num)))
-    (if void-reason (xaccTransVoid txn void-reason))
-    (if notes (xaccTransSetNotes txn notes))
-    (if memo
-        (begin
-          (xaccSplitSetMemo split-1 memo)
-          (xaccSplitSetMemo split-2 memo)))
-    (if (> amount2 0)
-        (gnc-pricedb-create (xaccAccountGetCommodity debit)
-                        (xaccAccountGetCommodity credit)
-                        (gnc-dmy2time64 DD MM YY)
-                        (/ amount1 amount2)))
-    (xaccTransCommitEdit txn)
-    txn))
+  (env-create-multisplit-transaction
+   env
+   DD MM YY
+   (list (vector debit (- amount1) (- amount1))
+         (vector credit amount1 amount2))
+   #:description description
+   #:void-reason void-reason
+   #:reconcile reconcile
+   #:num num
+   #:memo memo
+   #:notes notes))
 
 (define* (env-transfer
           env
@@ -234,10 +208,13 @@
           reconcile        ; char  : reconciled  (default = n)
           num              ; string: num field   (def = null)
           notes            ; string: notes       (def = null)
-          memo             ; string: memo        (def = null)
-          )
-  (env-transfer-foreign
-   env DD MM YY debit credit amount amount
+          memo)            ; string: memo        (def = null)
+  (env-create-multisplit-transaction
+   env
+   DD MM YY
+   (list
+    (vector debit (- amount) (- amount))
+    (vector credit amount amount))
    #:description description
    #:void-reason void-reason
    #:reconcile reconcile
@@ -245,6 +222,65 @@
    #:memo memo
    #:notes notes))
 
+;; creates multisplit transaction.
+;;
+;; input: DD/MM/YY - posting date of transaction
+;;
+;;        list-of-splits, a list of vectors, whose components are
+;;        (vector account value amount). The total of sum of values
+;;        must be zero, otherwise an imbalance split will be
+;;        created. It must contain at least 1 split. The transaction
+;;        currency is set as currency of the first split.
+;;
+;; returns: the transaction created, or #f
+(define* (env-create-multisplit-transaction
+          env DD MM YY list-of-splits
+          #:key            ; - the following are optional -
+          description      ; string: description (def = "ponies")
+          (pricedb? #t)    ; boolean: add pricedb entry?
+          void-reason      ; string: void-reason (def = not-voided)
+          reconcile        ; pair  : (cons reconciled reconciled-date)
+          num              ; string: num field   (def = null)
+          notes            ; string: notes       (def = null)
+          memo)            ; string: memo        (def = null)
+  (and (pair? list-of-splits)
+       (let* ((book (gnc-get-current-book))
+              (txn (xaccMallocTransaction book))
+              (first-split (vector-ref (car list-of-splits) 0)))
+         (xaccTransBeginEdit txn)
+         (xaccTransSetDescription txn (or description (env-string env "ponies")))
+         (xaccTransSetCurrency txn (xaccAccountGetCommodity first-split))
+         (xaccTransSetDate txn DD MM YY)
+         (for-each
+          (lambda (split)
+            (let ((acc (vector-ref split 0))
+                  (val (vector-ref split 1))
+                  (amt (vector-ref split 2))
+                  (newsplit (xaccMallocSplit book)))
+              (xaccSplitSetParent newsplit txn)
+              (xaccSplitSetAccount newsplit acc)
+              (xaccSplitSetValue newsplit val)
+              (xaccSplitSetAmount newsplit amt)
+              (if num (gnc-set-num-action txn newsplit num num))
+              (if memo (xaccSplitSetMemo newsplit memo))
+              (when reconcile
+                (xaccSplitSetReconcile newsplit (car reconcile))
+                (xaccSplitSetDateReconciledSecs newsplit (cdr reconcile)))
+              (if (and pricedb?
+                       (positive? amt)
+                       (not (gnc-commodity-equiv
+                             (xaccAccountGetCommodity first-split)
+                             (xaccAccountGetCommodity acc))))
+                  (gnc-pricedb-create (xaccAccountGetCommodity first-split)
+                                      (xaccAccountGetCommodity acc)
+                                      (gnc-dmy2time64 DD MM YY)
+                                      (/ val amt)))))
+          list-of-splits)
+         (if void-reason (xaccTransVoid txn void-reason))
+         (if notes (xaccTransSetNotes txn notes))
+         (xaccTransCommitEdit txn)
+         txn)))
+
 (define (env-create-root-account env type commodity)
   (env-create-account env type commodity (gnc-get-current-root-account)))
 

commit 82edec26fc22604f2ef62bae9917e2bf6d234e06
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Feb 7 19:52:49 2019 +0800

    [test-extras] (gnc:options->sxml) dumps better error
    
    The exception catcher gives a (k . args) pair which contain useful
    information about the exception. Show in test log output.

diff --git a/gnucash/report/report-system/test/test-extras.scm b/gnucash/report/report-system/test/test-extras.scm
index 41e15b825..2207e0ecb 100644
--- a/gnucash/report/report-system/test/test-extras.scm
+++ b/gnucash/report/report-system/test/test-extras.scm
@@ -83,8 +83,8 @@
                             #:trim-whitespace? #t
                             #:entities '((nbsp . "\xa0"))))
       (lambda (k . args)
-        (format #t "*** XML error: ~a ~a\n~a"
-                prefix test-title
+        (format #t "*** XML error: ~a ~a: ~a / ~a\n~a"
+                prefix test-title k args
                 (gnc:html-render-options-changed options #t))
         (throw k args)))))
 

commit 768132236ada1fa3afc3d9f18f329b18cb6afbd4
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Feb 20 21:05:52 2019 +0800

    [general-ledger] Void-Transactions had moved from Accounts to Filter
    
    TR void-transaction moved from Account tab to Filter tab.

diff --git a/gnucash/report/standard-reports/general-ledger.scm b/gnucash/report/standard-reports/general-ledger.scm
index 94a73d3cf..2e2231695 100644
--- a/gnucash/report/standard-reports/general-ledger.scm
+++ b/gnucash/report/standard-reports/general-ledger.scm
@@ -60,10 +60,8 @@
        (gnc:lookup-option options section name) value))
     
     ;; set options in the accounts tab...
-    (set-option!
-     gnc:pagename-accounts (N_ "Filter Type") 'none)
-    (set-option!
-     gnc:pagename-accounts (N_ "Void Transactions") 'non-void-only)
+    (set-option! gnc:pagename-accounts "Filter Type" 'none)
+    (set-option! "Filter" "Void Transactions" 'non-void-only)
     
     ;; set options in the display tab...
     (for-each

commit 971be33951be6eb7d8affec8356ca7370007aef9
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Feb 8 15:42:29 2019 +0800

    [html-fonts] compact (font-name-to-style-info)
    
    which was badly written. compact, and create tests.

diff --git a/gnucash/report/report-system/html-fonts.scm b/gnucash/report/report-system/html-fonts.scm
index d87ba1399..e9ea98f35 100644
--- a/gnucash/report/report-system/html-fonts.scm
+++ b/gnucash/report/report-system/html-fonts.scm
@@ -27,53 +27,36 @@
 
 (use-modules (gnucash gettext))
 
+(define (string-strip s1 s2)
+  (let ((idx (string-contains-ci s1 s2)))
+    (string-append
+     (string-take s1 idx)
+     (string-drop s1 (+ idx (string-length s2))))))
+
 ;; Converts a font name to css style information
 (define (font-name-to-style-info font-name)
-    (let*
-	  (
-	    (font-family "Arial")
-	    (font-size "20")
-		(font-style #f)
-		(font-style-idx 0)
-		(font-weight #f)
-		(font-weight-idx 0)
-		(result "")
-		(len (string-length font-name))
-		(idx 0)
-	  )
-	(set! idx (string-index-right font-name #\space))
-	(set! font-size (substring font-name (+ idx 1) len))
-	(set! font-name (string-take font-name idx))
-	(set! font-weight-idx (string-contains-ci font-name " bold"))
-	(if font-weight-idx
-	    (begin
-		    (set! font-weight "bold")
-			(set! font-name (string-append (string-take font-name font-weight-idx)
-			                               (string-drop font-name (+ font-weight-idx 5))))
-		))
-	(set! font-style-idx (string-contains-ci font-name " italic"))
-	(if font-style-idx
-	    (begin
-		    (set! font-style "italic")
-			(set! font-name (string-append (string-take font-name font-style-idx)
-			                               (string-drop font-name (+ font-style-idx 7))))
-		)
-		(begin
-			(set! font-style-idx (string-contains-ci font-name " oblique"))
-			(if font-style-idx
-				(begin
-					(set! font-style "oblique")
-					(set! font-name (string-append (string-take font-name font-style-idx)
-												   (string-drop font-name (+ font-style-idx 8))))
-		))))
-	(set! font-family font-name)
-	(set! result (string-append
-		"font-family: " font-family ", Sans-Serif; "
-		"font-size: " font-size "pt; "
-		(if font-style (string-append "font-style: " font-style "; ") "")
-		(if font-weight (string-append "font-weight: " font-weight "; ") "")))
-	result
-    ))
+  (let* ((font-style "")
+         (font-weight "")
+         (idx (string-index-right font-name #\space))
+         (font-size (substring font-name (1+ idx) (string-length font-name)))
+         (font-name (string-take font-name idx)))
+
+    (when (string-contains-ci font-name " bold")
+      (set! font-weight "font-weight: bold; ")
+      (set! font-name (string-strip font-name " bold")))
+
+    (cond
+     ((string-contains-ci font-name " italic")
+      (set! font-style "font-style: italic; ")
+      (set! font-name (string-strip font-name " italic")))
+
+     ((string-contains-ci font-name " oblique")
+      (set! font-style "font-style: oblique; ")
+      (set! font-name (string-strip font-name " oblique"))))
+
+    (string-append "font-family: " font-name ", Sans-Serif; "
+                   "font-size: " font-size "pt; "
+                   font-style font-weight)))
 
 ;; Registers font options
 (define (register-font-options options)
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
index 6aba16a3e..51e752e7e 100644
--- a/gnucash/report/report-system/test/CMakeLists.txt
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -18,6 +18,7 @@ set (scm_test_report_system_with_srfi64_SOURCES
   test-commodity-utils.scm
   test-report-utilities.scm
   test-html-utilities-srfi64.scm
+  test-html-fonts.scm
   test-report-html.scm
   test-report-system.scm
   )
diff --git a/gnucash/report/report-system/test/test-html-fonts.scm b/gnucash/report/report-system/test/test-html-fonts.scm
new file mode 100644
index 000000000..fecc058b4
--- /dev/null
+++ b/gnucash/report/report-system/test/test-html-fonts.scm
@@ -0,0 +1,36 @@
+(use-modules (srfi srfi-64))
+(use-modules (gnucash engine test srfi64-extras))
+(load "../html-fonts.scm")
+
+(setlocale LC_ALL "C")
+
+(define (run-test)
+  (test-runner-factory gnc:test-runner)
+  (test-begin "html-fonts")
+  (test-font-name-to-style-info)
+  (test-end "html-fonts"))
+
+(define (test-font-name-to-style-info)
+  (test-begin "font-name-to-style-info")
+
+  (test-equal "basic"
+    "font-family: Courier Regular, Sans-Serif; font-size: 20pt; "
+    (font-name-to-style-info "Courier Regular 20"))
+
+  (test-equal "basic size 50"
+    "font-family: Courier Regular, Sans-Serif; font-size: 50pt; "
+    (font-name-to-style-info "Courier Regular 50"))
+
+  (test-equal "basic size 50 bold"
+    "font-family: Courier, Sans-Serif; font-size: 50pt; font-weight: bold; "
+    (font-name-to-style-info "Courier bold 50"))
+
+  (test-equal "basic size 50 italic"
+    "font-family: Courier, Sans-Serif; font-size: 50pt; font-style: italic; "
+    (font-name-to-style-info "Courier italic 50"))
+
+  (test-equal "basic size 15 oblique"
+    "font-family: Courier, Sans-Serif; font-size: 15pt; font-style: oblique; "
+    (font-name-to-style-info "Courier oblique 15"))
+
+  (test-end "font-name-to-style-info"))

commit 4a2b5e96419b9e6b64f9350e5b5b8d208dcbe7b7
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Feb 10 18:53:53 2019 +0800

    [hooks.scm] deprecate hooks.scm
    
    this module has a single function which is used only once. inline it.

diff --git a/gnucash/report/report-gnome/report-gnome.scm b/gnucash/report/report-gnome/report-gnome.scm
index ade1d0f12..004db7d62 100644
--- a/gnucash/report/report-gnome/report-gnome.scm
+++ b/gnucash/report/report-gnome/report-gnome.scm
@@ -126,7 +126,7 @@
   (gnc-add-scm-extension business-menu)
 
   ;; run report-hook danglers
-  (gnc:hook-run-danglers HOOK-REPORT)
+  (gnc-hook-run HOOK-REPORT '())
 
   ;; push reports (new items added on top of menu)
   (gnc:add-report-template-menu-items)
diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
index 41c040c91..325ec507e 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/libgnucash/app-utils/app-utils.scm
@@ -265,7 +265,7 @@
 (export gnc:get-three-months-ahead)
 
 ;; hooks 
-(export gnc:hook-run-danglers)		;; from hooks.scm
+(export gnc:hook-run-danglers)	    	;; from hooks.scm- deprecated
 (re-export gnc-hook-add-scm-dangler)
 (re-export HOOK-REPORT)
 
diff --git a/libgnucash/app-utils/hooks.scm b/libgnucash/app-utils/hooks.scm
index 151dd2365..96ac43f37 100644
--- a/libgnucash/app-utils/hooks.scm
+++ b/libgnucash/app-utils/hooks.scm
@@ -16,6 +16,7 @@
 ;; Boston, MA  02110-1301,  USA       gnu at gnu.org
 
 (define (gnc:hook-run-danglers hook . args)
+  (issue-deprecation-warning "gnc:hook-run-danglers is now deprecated.")
   (if (null? args)
       (set! args '())
       (set! args (car args)))

commit f64586b873f4cbeaf276672bb8bb7a56f5c10cfc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Feb 14 20:55:06 2019 +0800

    [app-utils] remove config-var.scm
    
    unused since 1999?

diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
index eb6fd3d1d..e293ea476 100644
--- a/libgnucash/app-utils/CMakeLists.txt
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -175,7 +175,6 @@ set (app_utils_SCHEME_1
     hooks.scm
     business-options.scm
     c-interface.scm
-    config-var.scm
     date-utilities.scm
     migrate-prefs.scm
     options.scm
diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
index e462d6925..41c040c91 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/libgnucash/app-utils/app-utils.scm
@@ -157,18 +157,6 @@
                            (append (list category) key)
                            (list category key))))
 (export gnc:option-get-value)
-;; config-var.scm
-(export gnc:make-config-var)
-(export gnc:config-var-description-get)
-(export gnc:config-var-action-func-get)
-(export gnc:config-var-equality-func-get)
-(export gnc:config-var-modified?)
-(export gnc:config-var-modified?-set!)
-(export gnc:config-var-default-value-get)
-(export gnc:config-var-default-value-set!)
-(export gnc:config-var-value-get)
-(export gnc:config-var-value-set!)
-(export gnc:config-var-value-is-default?)
 
 ;; prefs.scm
 (export gnc:get-debit-string)
@@ -294,7 +282,6 @@
 (export gnc:*kvp-option-path*)
 
 (load-from-path "c-interface")
-(load-from-path "config-var")
 (load-from-path "options")
 (load-from-path "hooks")
 (load-from-path "prefs")
diff --git a/libgnucash/app-utils/config-var.scm b/libgnucash/app-utils/config-var.scm
deleted file mode 100644
index 4ee8e1b57..000000000
--- a/libgnucash/app-utils/config-var.scm
+++ /dev/null
@@ -1,74 +0,0 @@
-;; This program is free software; you can redistribute it and/or    
-;; modify it under the terms of the GNU General Public License as   
-;; published by the Free Software Foundation; either version 2 of   
-;; the License, or (at your option) any later version.              
-;;                                                                  
-;; This program is distributed in the hope that it will be useful,  
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of   
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
-;; GNU General Public License for more details.                     
-;;                                                                  
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, contact:
-;;
-;; Free Software Foundation           Voice:  +1-617-542-5942
-;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
-;; Boston, MA  02110-1301,  USA       gnu at gnu.org
-
-;;; config-var: You can create them, set values, find out if the value
-;;; is different from the default, and you can get a description.  You
-;;; can also specify an action function which will be called whenever
-;;; the value is changed.  The action function receives the special
-;;; var and the new value as arguments and should return either #f if
-;;; the modification should be rejected, or a list containing the
-;;; result otherwise.
-
-;;; Finally, a config var has two states, "officially" modified, and
-;;; unofficially modified.  You control what kind of modification
-;;; you're making with the second argument to
-;;; gnc:config-var-value-set!  The idea is that options specified on
-;;; the command line will set the value of these config vars, but that
-;;; setting is considered transient.  Other settings (like from the UI
-;;; preferences panel, or normal user code) should be considered
-;;; permanent, and if they leave the variable value different from the
-;;; default, should be saved to the auto configuration file.
-
-(define (gnc:make-config-var description
-                             set-action-func
-                             equality-func
-                             default)
-  (let ((var (vector description set-action-func
-                     equality-func #f default default)))
-    (gnc:config-var-value-set! var #f default)
-    var))
-
-(define (gnc:config-var-description-get var) (vector-ref var 0))
-
-(define (gnc:config-var-action-func-get var) (vector-ref var 1))
-
-(define (gnc:config-var-equality-func-get var) (vector-ref var 2))
-
-(define (gnc:config-var-modified? var) (vector-ref var 3))
-(define (gnc:config-var-modified?-set! var value) (vector-set! var 3 value))
-
-(define (gnc:config-var-default-value-get var) (vector-ref var 4))
-(define (gnc:config-var-default-value-set! var value)
-  (vector-set! var 4 value))
-
-(define (gnc:config-var-value-get var) (vector-ref var 5))
-(define (gnc:config-var-value-set! var is-config-mod? value)
-  (let ((set-action (gnc:config-var-action-func-get var))
-        (result (list value)))
-    (if set-action (set! result (set-action var value)))
-    (if result
-        (begin
-          (if is-config-mod? (gnc:config-var-modified?-set! var #t))
-          (vector-set! var 5 (car result))))))
-
-(define (gnc:config-var-value-is-default? var)
-  (if (not (gnc:config-var-modified? var))
-      #t
-      (let ((equal-values? (gnc:config-var-equality-func-get var)))
-        (equal-values? 
-         (gnc:config-var-default-value-get var)
-         (gnc:config-var-value-get var)))))



Summary of changes:
 gnucash/report/report-gnome/report-gnome.scm       |   2 +-
 gnucash/report/report-system/html-fonts.scm        |  73 +++++--------
 gnucash/report/report-system/test/CMakeLists.txt   |   1 +
 .../report-system/test/test-commodity-utils.scm    |   4 +-
 gnucash/report/report-system/test/test-extras.scm  |   4 +-
 .../report/report-system/test/test-html-fonts.scm  |  36 +++++++
 gnucash/report/standard-reports/general-ledger.scm |   6 +-
 .../standard-reports/test/test-transaction.scm     |  29 ++---
 libgnucash/app-utils/CMakeLists.txt                |   1 -
 libgnucash/app-utils/app-utils.scm                 |  15 +--
 libgnucash/app-utils/config-var.scm                |  74 -------------
 libgnucash/app-utils/hooks.scm                     |   1 +
 libgnucash/engine/test/test-extras.scm             | 120 +++++++++++++--------
 13 files changed, 159 insertions(+), 207 deletions(-)
 create mode 100644 gnucash/report/report-system/test/test-html-fonts.scm
 delete mode 100644 libgnucash/app-utils/config-var.scm



More information about the gnucash-changes mailing list