And in Windows only with the value from the environment if there is one.
Calling it with "" in Windows ignores the environment and sets it to the
system settings.
So that it's clear in the UI that clicking on the box won't do anything.
The case that triggered this is the Get-online-quotes item in the
Securities Editor tree view.
Gnucash shows comma.
This was introduced by 8f88b7f2b. It turns out that Windows
implementation of setlocale works only if the POSIX locale environment
variables (i.e. LC_FOO or LANG) are set, otherwise it returns NULL. We
were unknowingly relying on Guile to retrieve the Windows environment
for us and that would do the wrong thing if the user had set the locale
in the environment file, so 8f88b7f2b restored it... unfortunately to
the C locale.
This commit changes the set_win32_thread_locale function to work in
both directions, setting both locales from the environment variables
if any are set and calling setlocale with the result of
GetUserDefaultLocaleName if not.
Ensure that all includes of swig-runtime.h are *followed* by
including guile-mappings.h so that the defines masking
scm_to_utf8_string and scm_from_utf8_string are undone.
Remove lots of ignores that were only relevant for our former autotools/intltool based build system.
Note if people still have very old working directories, some of these files may suddenly appear
as untracked files after pulling in this commit. A good time to clean them up...
When you have multiple loggers enabled, the log file indentations are
partly based on logger name length and so you can have false
indentations which can cause confusion. This change gets the maximum
name logger length and uses this for all with a minimum default length
of 12 characters.
Currently if you add a price and a price already exists for that
commodity/currency/day combination it will silently replace that price.
The same is also true for editing a prices if you decide to change the
date. To overcome this add a gnc-warning which allows the response to
be saved temporary or permanently.
Caused by the introduction of caching used in gnc_pricedb_nth_price,
when prices were deleted, the cached list was never updated and so the
tree model could reference a deleted price and hence crash. This also
affected adding prices as the new prices would not show due to the
cache not being updated. To fix this a function was added to reset the
cache when prices are updated from the model.
After a commodity is updated or added, another row will be selected so
add function to select a given commodity and call this after the
changes so the selection can be maintained. For removal the selection
is cleared so it is consistent.
Change the Securities dialogue from a GtkDialog to GtkWindow. This
removes the need for setting the transient parent which allows the
dialogue to be placed behind the main application.
This reverts commit aa53c23239, reversing
changes made to 3c946a8449, because
aa53c23 was based on master and so undid other changes made to maint
since the last merge-to-master.
copied function created by Mark Weaver, core guile dev and augmented
to selectively replace substring indices
This is a much more efficient function than the previous
gnc:substring-replace which will constantly split lists using
substring, and create new strings using string-append.
It also does tail call optimization properly, unlike the previous
functions.
https://lists.gnu.org/archive/html/guile-devel/2013-09/msg00029.html -
original
"Here's an implementation that does this benchmark about 80 times
faster on my machine: (20 milliseconds vs 1.69 seconds)
--8<---------------cut here---------------start------------->8---
(define* (string-replace-substring s substr replacement
#:optional
(start 0)
(end (string-length s)))
(let ((substr-length (string-length substr)))
(if (zero? substr-length)
(error "string-replace-substring: empty substr")
(let loop ((start start)
(pieces (list (substring s 0 start))))
(let ((idx (string-contains s substr start end)))
(if idx
(loop (+ idx substr-length)
(cons* replacement
(substring s start idx)
pieces))
(string-concatenate-reverse (cons (substring s start)
pieces))))))))
--8<---------------cut here---------------end--------------->8---
The reason this is so much faster is because it avoids needless
generation of intermediate strings."
Add tests for libgnucash/scm/utilities.scm functions
- tests for list<->vec
- tests for gnc:substring-replace
- tests for gnc:substring-replace-from-to
The latter confirms that the comment before the function definition
is *incorrect* - it describes that substring-replace-from-to will
start from the 2nd substring for the first substitution, and
performs 2 substitutions. However the comment illustrates only 1
substitution. The test suite performs the test according to code
behaviour, rather than the comment. This issue is moot in practice
because the end-after is always called with negative in the code
base.
original comment:
;; gnc:substring-replace-from-to
;; same as gnc:substring-replace extended by:
;; start: from which occurrence onwards the replacement shall start
;; end-after: max. number times the replacement should executed
;;
;; Example: (gnc:substring-replace-from-to "foobarfoobarfoobar" "bar" "xyz" 2 2)
;; returns "foobarfooxyzfoobar".
When exporting transactions to CSV not all were showing up in the CSV
file. This was due to the start and end dates not being set to the
'start of day' and 'end of day' respectively. Also if you had specified
a range and subsequently used the 'Show All' button the dates used
would still be the ones used for the range.