This was due to some leftovers of the fix for bug 734168. That fix initially
went too far but for some reason the reversal of these parts never got
committed.
Change some plain string literals to std::string constants, which helps
avoiding typos and also saves some string constructors/destructors
in the KVP lookup. Nevertheless the functions in Account.cpp do not
contribute that much to the overall UI speed, but whatever.
The underlying problem was that the vendor object remained in infant state
That confused the backend code so it used an sql INSERT statement instead
of an UPDATE statement to write back the changes. As the object already
existed in the db this would fail.
The fix is to ensure the object doesn't remain in infant state during
sql loading. See the bug report for a more detailed explanation.
As a follow on to last commit, if a large datafile is subject to a
reconciled date filter, the initial QofQuery date matcher would be
skipped, causing a large number of splits sent for custom
sorting prior to filtering.
It will always be more efficient that filtering is applied
first. Therefore custom sorting should be applied after filtering.
This commit modifies the date filter for reconciliation report,
ensuring only splits whose reconciled dates match report options.
If a split is not yet reconciled, include it anyway.
In a large datafile with a narrow reconciled date range, the
datefilter is likely to be the filter with highest frequency of #f
therefore it should be prioritised in the combined filter.
I chose to add another optional keyword instead of reusing the
existing #:custom-split-filter, because we need to detect when to
override the QofQuery date filter.
The function qof_book_use_split_action_for_num_field gets called quite a
lot in each register display refresh (due to sorting all splits from
Split.x's xaccSplitOrder function), but it always used to use a KVP
lookup, which is rather expensive compared to accessing a gboolean member
variable.
To get rid of this cost, I had to remove the KVP lookup in this
simple-looking function. The pattern is this: A gboolean cache variable is
introduced, along with an isvalid flag. The lookup makes the expensive
KVP lookup once, then caches the value. The GObject property mechanism
offers a callback for when the setter was called, which is used to mark
the cached value as invalid. A parallel setter method (here:
qof_book_set_option) also just marks the cache as invalid. This covers
all setters, and the getters will use the cached value except for their
first invocation.
The NUM_FIELD_SOURCE feature was introduced in 2012 by the very large
commit 7cdd7372 and apparently its costs never were a problem
until the KVP lookup became more costly due to the std::vector
construction and destruction.
This got disabled in commit 54019608ee in the gtk3 refactoring by accident.
While we now no longer save the negative coordinates for hidden windows,
there are still other situations in which this could happen, like switching
from a dual monitor to a single monitor setup (common with laptops).
By default the account column is the expand column but if it is manually
changed this is reset to the last column. If Gnucash is maximised in
this state, the totals column then has a lot of white space so this
change reapplies the expand setting to the account column so it has the
extra space.
This replaces the 'account_name' key in the same state. Keys should only be used
data that's actually parsed when reading the state. Using a key for account_name here
can create the false impression this data can be modified. A comment makes it much more
clear the name is only informational while keeping the convenience.
One for the reconcile cell which displays the reconciled date when
reconciled or the void reason if voided. Also for the association cell
to display the uri.
Turns out that the on-the-fly conversion from const char* (the KVP_OPTION_PATH
constants) to std::string with their immediate deletion afterwards is
a quite costly operation. Avoiding this is surprisingly easy: Just keep
local std::string objects at hand, and they don't have to be created
and deleted anymore.
The more optimized solution might be to turn the std::vector<std::string>
into a std::vector<GQuark>, but this commit at least improves the picture for now.
Fixes the crash and also pauses after loading if there are load errors.
The load "protection" catches exceptions other than bad-date so that it's
real protection.
Check for unbalanced transactions (i.e. with only one account) and don't
try to match if there is; report the error in the error log space in the
assistant.
Don't proceed to finding duplicates if the new account tree hasn't been
created, there aren't any.