Use (ice-9 match) for easier matching for the variable
'path'. Explanation; consider the snippet
(cond
((null? path) ...A...)
((and (pair? (car path)) (number (caar path))) ...B...)
(else ...C...))
This snippet is a shorthand for nested if-then-else clauses, testing
'path' successfully to determine whether to evaluate A, B or C. Some
code will also use components of 'path' eg B uses (caar path).
Using Alex Shinn's match.scm library allows more concise matching and
assignment at the same time. The syntax is (match EXPR (CLAUSE BODY ...))
(define (try path)
(match path
(() (display "null"))
((((? number? idx)) . tail) (display "B") (display idx) (newline) (display tail))
((head . tail) (display "C") (display head) (newline) (display tail))))
A: the first match is easy -- if path is '() then evaluate the first
body.
(try '())
--> "null"
C: the third match is easy -- if path is a pair, then assign 'head' to
pair's car, 'tail' to the pair's cdr, and evaluate the body which has
access to head and tail. Note the head is a string, and the tail is a
list containing a single string.
(try '("this" "that"))
--> Cthis
(that)
B: the second match is more difficult -- let's consider the
broken-down clause: a pair, (HEAD . tail); where HEAD is a
single-element list (ELT), and ELT is a match conditional satisfying
number? and is also assigns the variable idx (? number? idx).
Example:
(try '((2) "two"))
--> B2
(two)
This means the match is successful when 'path' is a pair, the pair's
car is a single-element list, and the list's sole element is a
number. The latter is bound to the variable 'idx' which is accessible
in the body. The variable 'tail' contains the path's cdr which
contains a single string.
Note: later in same commit we also use the identifier _ to denote
elements which *must* be matched, but are *not* bound to any variable.
e.g. the clause (((? out-of-bound?)) . _) means that path is a pair,
whose car is a single-element list, and the element satisfies the
predicate out-of-bound?. We don't need to use the (cdr path) therefore
we use _ as a placeholder.
Instead of retrieving the preference 'use red for negative numbers'
every time the budget cells are updated/refreshed which could be many
times retrieve it on create and store it in GncBudgetView and set up a
preference call back to track the value.
To make it easier to change the hidden property on multiple accounts,
a new column can be added to the CoA to toggle the account hidden
property. This only makes sense if the 'View->Filter By...' other tab
has been accessed to enable showing of hidden accounts first.
This fixes an error message 'page_changed is invalid for instance of
type GncEmbeddedWindow' when you double click on the selected schedule
in the sx editor.
The reports page uses a g_idle_add against the plugin_page to load the
report once the container for the report is realized. With the changes
to the page focus functions, the use of g_idle_remove_by_data removed
this idle function so no report. Change the page focus functions to
record the id used and then use this id to remove the page focus idle
function.
If you create a new budget and do not change any thing when closing the
budget or quitting with new budget open the state information for that
budget is saved but the budget is not. To fix this make a change to the
new budget description to force the save of the new budget.
This is down to the amount of information that is displayed on the
register status bar which can also be influenced by the type of
register being displayed. To fix this the text labels used have been
enabled to ellipsize at the end and also the displayed information has
been added to a tooltip. So for example the minimum app size was
957x736 and after the changes it can be 610x475.
This commit moves the setting up of the page changed signal callback to
when the plugin page is inserted and also records the id used. This is
used to disconnect this callback when the page is moved to a different
window and also when the page is destroyed.
* invoice->payment LINK or PAYMENT txns are handled identically. Merge.
* reorder definitions in document handler.
* rename variable 'invoice' to 'document'; invoice was clashing with
outer variable. This fixes a credit-note negation bug.
- gettext minimum required version on master becomes 0.19.6
- simplify gettext detection code and appdata/desktop file creation
based on this new minimum
- fix merge conflict for new test-new-owner-report
- update deprecated scheme modules for test-new-owner-report
- attempt to merge in translations before merging in version data
- add the intermediate file (with translations) to the dist tarball
- dist builds no longer have to run the translation merge, but can instead
use the included intermediate file. This accomodates distros with
older gettext versions.
- only abort configuration if gettext is older than 0.18.1 (required for string extraction from scheme files)
- otherwise always continue but disable a few other build steps depending on the gettext version
- use feature variables to more clearly convey what is enabled or disabled
Tests some basic business transactions
* 1 invoice for $6.75
* 1 invoice for $11.50
2 partial payments $1.50 and $2.00
* 1 credit-note for $3.00
* 1 invoice for $28
1 credit note for $27
1 payment linking both including $1 bank transfer