mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint'
This commit is contained in:
201
NEWS
201
NEWS
@@ -1,172 +1,51 @@
|
||||
Version history:
|
||||
------- -------
|
||||
3.9 - 29 March 2020
|
||||
The tenth release of the 3.x stable series.
|
||||
|
||||
Note for Online Banking users: When used with the latest releases of
|
||||
AQBanking and Gwenhywfar (provided in the MacOS and Microsoft Windows
|
||||
bundles) this release is fully stable for both FinTS and OFX Direct
|
||||
Connect.
|
||||
3.10 - 10 April 2020
|
||||
The eleventh release of the 3.x stable series.
|
||||
|
||||
This is a snap release to reverse the changes to the reconcile
|
||||
window's filtering reconciled transactions with a reconcile date after
|
||||
the current statement date when computing the starting balance. It
|
||||
seems that many users' books have accounts with reconcile dates in the
|
||||
future that were suddenly filtered out, creating an incorrect starting
|
||||
balance and making it impossible to reconcile the book.
|
||||
|
||||
The following bugs have been fixed:
|
||||
Bug 685102 - Scheduled Transactions don't always respect weekends for
|
||||
first occurrence
|
||||
Bug 794916 - Fails to find environment file at startup when installation
|
||||
prefix is '/opt
|
||||
Bug 796579 - Cannot go forward with empty duplicates screen
|
||||
Bug 796911 - Minimum window width to large.
|
||||
To fix this the text labels used have been enabled to ellipsize
|
||||
at the end
|
||||
Bug 796984 - Import Bills & Invoices: date of line item is not validated;
|
||||
can lead to unexpected results
|
||||
Bug 796985 - Import Bills & Invoices: option 'open not yet posted docs in
|
||||
tab' does not open tab if invoice could not be posted
|
||||
Bug 796986 - Import Bills & Invoices: in case of invalid posting date
|
||||
in import file, invoice is posted with unexpected date
|
||||
Bug 796987 - Import Bills & Invoices: fixing import items only works
|
||||
in special case
|
||||
Bug 797022 - Import Bills & Invoices: expense/income account is not
|
||||
validated - leads to one-sided posting if account is invalid
|
||||
Bug 797023 - Import Bills & Invoices: no user confirmation requested
|
||||
for update of invoices, if new invoice is created first
|
||||
Bug 797024 - Import Bills & Invoices: import matches csv data rows with
|
||||
too few separators, messing up the import data
|
||||
Bug 797025 - Import Bills & Invoices: the type of the post to account
|
||||
is not validated - enabling A/P and A/R postings on regular
|
||||
accounts
|
||||
Bug 797042 - OK button in OFX importer doesn't work if nothing is
|
||||
imported.
|
||||
Bug 797133 - CSV Import of multicurrency transaction export in multiline
|
||||
form
|
||||
Bug 797139 - test-report-utilities failure after 10-march in travis
|
||||
Bug 797419 - equity-statement unrealized-gain calculator uses
|
||||
weighted-average
|
||||
Bug 797481 - crash on close of unsaved tabs by pressing [X]
|
||||
Bug 797522 - Focus after reconcile jumps to a different account
|
||||
Bug 797536 - cmake errors out because it cannot find GncPkgConfig
|
||||
(cmake 3.5.2)
|
||||
Bug 797540 - Mapping of aqbanking accounts to gnucash accounts doesn't
|
||||
work
|
||||
Bug 797546 - Autocomplete not updated when account names changed
|
||||
Bug 797548 - multicolumn income statement: some closing entries are not
|
||||
ignored when within reporting period
|
||||
Bug 797549 - Reconcile window shows S_tatement Date rather than
|
||||
Statement Date.
|
||||
Bug 797550 - Crash when changing register tab position
|
||||
Bug 797551 - Budget totals line missing in 3.8
|
||||
Reinstate Income/Expense/Transfer/Total, but rename to:
|
||||
* Inflow from Income
|
||||
* Outflow to Expense
|
||||
* Outflow to Asset/Equity/Liability
|
||||
* Remaining to Budget
|
||||
Bug 797566 - Crash on use of context menu in importer
|
||||
Bug 797569 - Swedish account templates not accessible
|
||||
Bug 797570 - Unable to import vendors.
|
||||
In the import of Customer/Vendor or Bill/Invoice, the
|
||||
dialog that lists rows that were not imported shows a
|
||||
scrollable view of only four rows.
|
||||
Bug 797572 - Customer Report (beta): "Period Totals" includes total debit
|
||||
and credits outside the current period
|
||||
Change to formal accounting convention. Can swap to informal
|
||||
headers if set by global preference.
|
||||
Bug 797573 - Incorrect value of securities in the Asset Chart
|
||||
Bug 797576 - xaccAccountOrder shouldn't sort account codes as base-36
|
||||
Bug 797583 - gnc:book-add-quotes crashes when there are no quotes
|
||||
Bug 797584 - New-owner - bill amount field links to wrong account
|
||||
Bug 797588 - Gnucash segfaults when using mysql backend with empty
|
||||
password
|
||||
Bug 797591 - multiperiod b/s and PnL reports: add style sheet 'easy'
|
||||
Bug 797609 - Backtraces for eguile report errors strips wrong part of
|
||||
stack
|
||||
Bug 797613 - Due Invoices Reminder shows Job Name instead of Company
|
||||
Name
|
||||
Bug 797624 - At some point Vietnam Dong seemed to drop xu (decimals)
|
||||
Bug 797631 - Superfluous account selection dialog on first online
|
||||
retrieval
|
||||
The online id, which is needed to find a GnuCash account
|
||||
for a transaction or the balance retrieved from an online
|
||||
account, is already assigned to each matched GnuCash
|
||||
account within the Online Banking Setup tool. The online
|
||||
id is removed from the GnuCash account if it is no longer
|
||||
matched with an AqBanking account.
|
||||
Bug 797636 - Incorrect Online account matches cannot be deleted
|
||||
A push button with text "Delete selected matches" is added
|
||||
to the "Match Online accounts with GnuCash accounts" page
|
||||
of the "Online Banking Setup" tool. Additionally, the
|
||||
underlying tree view is set to multiple selection mode
|
||||
from single selection mode. Pushing the button will remove
|
||||
the matched GnuCash account from all selected AqBanking
|
||||
(Online) accounts.
|
||||
Bug 797638 - SIGSEGV editing transaction after closing Find Accounts
|
||||
dialog.
|
||||
Bug 797640 - The Reconciliation Window starting balance calculator
|
||||
needs to ignore splits after statement date
|
||||
Bug 797648 - Cannot reconcile both splits of a transaction with 2 splits
|
||||
for bank account subaccounts if only 1 is cleared
|
||||
Force all splits in a transaction for the account being
|
||||
reconciled and its children to have the same
|
||||
reconciliation status.
|
||||
Bug 797656 - Immediate crash when retrieving quotes
|
||||
Bug 620848 - Transfer Funds window - add Notes field
|
||||
Bug 797006 - Balance is misleading in open subaccounts when different
|
||||
currencies are involved
|
||||
Bug 797318 - Amounts ending in zero displayed as fractions
|
||||
Bug 797659 - Liabilities in budget report no longer calculate correctly
|
||||
candidate fix.
|
||||
Bug 797666 - libgnucash/engine/test/test-recurrence.c: In function
|
||||
'check_valid': 'result' may be used uninitialized
|
||||
Bug 797676 - Register displays amount in transaction currency...
|
||||
instead of register currency.
|
||||
|
||||
Other repairs or enhancements not marked as bugs:
|
||||
[report-utilities] fix gnc:account-accumulate-at-dates sorting &
|
||||
operator
|
||||
This commit performs 2 important fixes:
|
||||
1. The account splitlist walking assumes that the split->date always
|
||||
increases. This is now enforced by sorting the splitlist, *only* if
|
||||
a custom split->date is offered. By default the splits are sorted by
|
||||
posted_date, and if a custom split->date is used, will be
|
||||
stable-sorted to ensure the algorithm works.
|
||||
2. The handling of splits *ON* date boundaries is fixed. Previously if
|
||||
a split->date was equal to a date boundary, it would be considered
|
||||
part of the "after" date section. It is more intuitive that a date
|
||||
boundary includes all splits on and before the date.
|
||||
When selecting a file for OFX import, restrict the files listed to .OFX
|
||||
(or .QFX)
|
||||
Fix crash when changing account-separator.
|
||||
Change the default focus to search entry for 'Find Account'
|
||||
Fix rounding precision when importing prices from CSV
|
||||
[trep-engine] subtotals when cells have monetary only
|
||||
Instead of accumulating subtotals from any non-#f value, ensure value
|
||||
is a gnc-monetary before accumulating subtotals. This paves the way
|
||||
to allow non-monetary in RHS custom-calculated-cells.
|
||||
Travis - don't try to copy the removed after-failure file to the test
|
||||
container
|
||||
Travis - use ctest built-in feature to verbosely log test failures
|
||||
Fix tokenize_string()to prevent empty strings as Bayes account-matching
|
||||
tokens and remove duplicated tokens.
|
||||
Fix calculation of Bayes account-matching token info to find exactly
|
||||
matching tokens only.
|
||||
Clear online banking KVP from accounts no longer associated with an online
|
||||
one
|
||||
Account template improvements for Swiss-German KMU and Germany SKR04.
|
||||
Appdata file allows packagers to include distribution release information.
|
||||
Ensure that new budgets are saved instead of saving only the state
|
||||
information.
|
||||
Update US Income Tax information for 2019.
|
||||
Correct double-counting of accounts in some cases in US Income Tax
|
||||
Report.
|
||||
Housekeeping - reduce the number of PACKAGE and VERSION related cmake
|
||||
variables
|
||||
Restrict gnucash.pot comment collection to ones beginning with
|
||||
"Translators". At the recommendation of the Translation Project
|
||||
coordinator.
|
||||
[html-table][API] html-table can have multirow-col-headers
|
||||
* NEW API: gnc:html-table-multirow-col-headers and
|
||||
gnc:html-table-set-multirow-col-headers! gnc:html-table col-headers
|
||||
have been augmented to support list of <th> rows.
|
||||
* BACKWARD COMPATIBILITY is offered. Old use of single-row headers API
|
||||
gnc:html-table-col-headers and gnc:html-table-set-col-headers! should
|
||||
be unchanged; will get/set a single row of <th> elements.
|
||||
* NEW functions gnc:html-table-multirow-col-headers and
|
||||
gnc:html-table-set-multirow-col-headers! will get/set an arbitrary
|
||||
number of rows of <th> elements.
|
||||
* using old API gnc:html-table-col-headers on a table, whose multiple
|
||||
row headers have been set, will lead to a warning and return the first
|
||||
row only.
|
||||
[window-reconcile] when reconciling, warn on splits having a
|
||||
reconcile date > statement_date
|
||||
[window-reconcile] when inputing statement_date, warn if it's after today
|
||||
[find-transactions] add search for reconciled date
|
||||
Show transaction value, not amount, for registers with subaccounts.
|
||||
If the register has subaccounts in different currencies and a
|
||||
transaction has splits in more than one, the transaction will
|
||||
incorrectly appear to be unbalanced if we total amounts because the
|
||||
balancing logic works on split values.
|
||||
Revert "Bug 797659 - Liabilities in budget report no longer calculate
|
||||
correctly"
|
||||
Reverted for snap release. Not tested thoroughly yet.
|
||||
Add instance argument to Session constructor in python bindings.
|
||||
Enables a python console to connect to the running GnuCash's session.
|
||||
Make python console less noisy without --debug.
|
||||
Provide locals and globals of calling context to the python console's
|
||||
shell on shell init
|
||||
Make pycons/ishell.py compatible with Python 3 and current IPython
|
||||
[eguile-utilities] prevent crash in balsheet-eg.scm
|
||||
[eguile] escape-html -> gnc:html-string-sanitize
|
||||
[qif-to-gnc] Properly mark intra-QIF internal transfers.
|
||||
|
||||
Translations Updated: Croatian, German, Polish, Ukrainian.
|
||||
Translations Updated: Ukrainian.
|
||||
|
||||
3.8 - 29 December 2019
|
||||
The ninth release of the 3.x stable series.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
add_subdirectory(example_scripts)
|
||||
add_subdirectory(tests)
|
||||
|
||||
set(PYEXEC_FILES __init__.py function_class.py gnucash_business.py gnucash_core.py)
|
||||
set(PYEXEC_FILES __init__.py function_class.py gnucash_business.py gnucash_core.py app_utils.py)
|
||||
|
||||
set(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/time64.i)
|
||||
set(GNUCASH_CORE_C_INCLUDES
|
||||
|
||||
16
bindings/python/app_utils.py
Normal file
16
bindings/python/app_utils.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# app_utils.py -- High level python wrapper for app-utils
|
||||
#
|
||||
# @author Christoph Holtermann <mail@c-holtermann.net>
|
||||
## @file
|
||||
# @brief High level python wrapper for app-utils
|
||||
# @ingroup python_bindings
|
||||
|
||||
from gnucash import _sw_app_utils
|
||||
|
||||
def gnc_get_current_session():
|
||||
from gnucash import Session
|
||||
return Session(instance=_sw_app_utils.gnc_get_current_session())
|
||||
|
||||
# further functions in _sw_app_utils
|
||||
# _gnc_get_current_book is availabe through Session.get_book()
|
||||
# _gnc_get_current_root_account is available through Session.get_root_account()
|
||||
@@ -59,12 +59,15 @@ class ClassFromFunctions(object):
|
||||
self._module[self._new_instance] or using existing instance
|
||||
data. (specified with the keyword argument, instance)
|
||||
|
||||
if instance argument is None it will be ignored and the
|
||||
constructor will be called to get a new instance
|
||||
|
||||
Pass the arguments that should be passed on to
|
||||
self._module[self._new_instance] . Any arguments of that
|
||||
self._module[self._new_instance]. Any arguments of that
|
||||
are instances of ClassFromFunctions will be switched with the instance
|
||||
data. (by calling the .instance property)
|
||||
"""
|
||||
if INSTANCE_ARGUMENT in kargs:
|
||||
if INSTANCE_ARGUMENT in kargs and kargs[INSTANCE_ARGUMENT] is not None:
|
||||
self.__instance = kargs[INSTANCE_ARGUMENT]
|
||||
else:
|
||||
self.__instance = getattr(self._module, self._new_instance)(
|
||||
|
||||
@@ -75,7 +75,7 @@ class Session(GnuCashCoreClass):
|
||||
"""
|
||||
|
||||
def __init__(self, book_uri=None, ignore_lock=False, is_new=False,
|
||||
force_new= False):
|
||||
force_new=False, instance=None):
|
||||
"""A convenient constructor that allows you to specify a book URI,
|
||||
begin the session, and load the book.
|
||||
|
||||
@@ -95,13 +95,15 @@ class Session(GnuCashCoreClass):
|
||||
ignore_lock is passed to qof_session_begin's argument of the
|
||||
same name and is used to break an existing lock on a dataset.
|
||||
|
||||
instance argument can be passed if new Session is used as a
|
||||
wrapper for an existing session instance
|
||||
|
||||
|
||||
This function can raise a GnuCashBackendException. If it does,
|
||||
you don't need to cleanup and call end() and destroy(), that is handled
|
||||
for you, and the exception is raised.
|
||||
"""
|
||||
GnuCashCoreClass.__init__(self)
|
||||
GnuCashCoreClass.__init__(self, instance=instance)
|
||||
if book_uri is not None:
|
||||
try:
|
||||
self.begin(book_uri, ignore_lock, is_new, force_new)
|
||||
|
||||
@@ -5,7 +5,7 @@ if (WITH_PYTHON)
|
||||
# Because it hasn't been built yet
|
||||
set(test_core_dir ${CMAKE_BINARY_DIR}/common/test-core)
|
||||
endif()
|
||||
add_custom_target(test-python-bindings ALL DEPENDS unittest_support gnucash-core-c-build gnucash-core-c-py)
|
||||
add_custom_target(test-python-bindings ALL DEPENDS unittest_support gnucash-core-c-build gnucash-core-c-py sw_app_utils)
|
||||
add_dependencies(check test-python-bindings)
|
||||
add_test(python-bindings ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runTests.py.in)
|
||||
set_property(TEST python-bindings PROPERTY ENVIRONMENT
|
||||
@@ -21,6 +21,7 @@ set(test_python_bindings_DATA
|
||||
test_business.py
|
||||
test_commodity.py
|
||||
test_numeric.py
|
||||
test_session.py
|
||||
test_split.py
|
||||
test_transaction.py
|
||||
test_query.py)
|
||||
|
||||
@@ -5,6 +5,7 @@ import os
|
||||
|
||||
os.environ["GNC_UNINSTALLED"] = "1"
|
||||
|
||||
from test_session import TestSession
|
||||
from test_book import TestBook
|
||||
from test_account import TestAccount
|
||||
from test_split import TestSplit
|
||||
|
||||
@@ -5,12 +5,12 @@ from gnucash import Book, Account, Split, GncCommodity, GncNumeric, \
|
||||
|
||||
from test_book import BookSession
|
||||
|
||||
class AccountSession( BookSession ):
|
||||
class AccountSession(BookSession):
|
||||
def setUp(self):
|
||||
BookSession.setUp(self)
|
||||
self.account = Account(self.book)
|
||||
|
||||
class TestAccount( AccountSession ):
|
||||
class TestAccount(AccountSession):
|
||||
def test_name(self):
|
||||
NAME = "Money"
|
||||
self.assertEqual( '', self.account.GetName() )
|
||||
|
||||
@@ -2,14 +2,14 @@ from unittest import TestCase, main
|
||||
|
||||
from gnucash import Session
|
||||
|
||||
class BookSession( TestCase ):
|
||||
class BookSession(TestCase):
|
||||
def setUp(self):
|
||||
self.ses = Session()
|
||||
self.book = self.ses.get_book()
|
||||
self.table = self.book.get_table()
|
||||
self.currency = self.table.lookup('CURRENCY', 'EUR')
|
||||
|
||||
class TestBook( BookSession ):
|
||||
class TestBook(BookSession):
|
||||
def test_markclosed(self):
|
||||
self.ses.end()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from gnucash.gnucash_business import Vendor, Employee, Customer, Job, Invoice, E
|
||||
|
||||
from test_book import BookSession
|
||||
|
||||
class BusinessSession( BookSession ):
|
||||
class BusinessSession(BookSession):
|
||||
def setUp(self):
|
||||
BookSession.setUp(self)
|
||||
|
||||
@@ -43,7 +43,7 @@ class BusinessSession( BookSession ):
|
||||
self.invoice.PostToAccount(self.receivable,
|
||||
self.today, self.today, "", True, False)
|
||||
|
||||
class TestBusiness( BusinessSession ):
|
||||
class TestBusiness(BusinessSession):
|
||||
def test_equal(self):
|
||||
self.assertTrue( self.vendor.Equal( self.vendor.GetVendor() ) )
|
||||
self.assertTrue( self.customer.Equal( self.job.GetOwner() ) )
|
||||
|
||||
@@ -2,7 +2,7 @@ from unittest import TestCase, main
|
||||
|
||||
from gnucash import Session
|
||||
|
||||
class CommoditySession( TestCase ):
|
||||
class CommoditySession(TestCase):
|
||||
def setUp(self):
|
||||
self.ses = Session()
|
||||
self.book = self.ses.get_book()
|
||||
@@ -11,12 +11,12 @@ class CommoditySession( TestCase ):
|
||||
def tearDown(self):
|
||||
self.ses.end()
|
||||
|
||||
class TestCommodity( CommoditySession ):
|
||||
class TestCommodity(CommoditySession):
|
||||
def test_iso_currency(self):
|
||||
eur = self.table.lookup('CURRENCY', 'EUR')
|
||||
self.assertIsNotNone(eur)
|
||||
|
||||
class TestCommodityNamespace( CommoditySession ):
|
||||
class TestCommodityNamespace(CommoditySession):
|
||||
def test_namespaces(self):
|
||||
#print(self.table.__class__)
|
||||
namespace_names = self.table.get_namespaces()
|
||||
|
||||
@@ -3,7 +3,7 @@ from unittest import TestCase, main
|
||||
from gnucash import GncNumeric, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED, \
|
||||
GNC_HOW_RND_NEVER, GNC_HOW_RND_FLOOR, GNC_HOW_RND_CEIL
|
||||
|
||||
class TestGncNumeric( TestCase ):
|
||||
class TestGncNumeric(TestCase):
|
||||
def test_defaut(self):
|
||||
num = GncNumeric()
|
||||
self.assertEqual(str(num), "0/1")
|
||||
|
||||
34
bindings/python/tests/test_session.py
Normal file
34
bindings/python/tests/test_session.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# test cases for Session wrapper object
|
||||
#
|
||||
# test for get_book may belong in test_book but it makes sense here
|
||||
# to see if get_current_session works
|
||||
# test for app_utils on the other hand could go to a subfolder of
|
||||
# /libgnucash/app-utils
|
||||
#
|
||||
# @date 2020-04-03
|
||||
# @author Christoph Holtermann <mail@c-holtermann.net>
|
||||
|
||||
from unittest import TestCase, main
|
||||
|
||||
from gnucash import Session
|
||||
|
||||
class TestSession(TestCase):
|
||||
def test_create_empty_session(self):
|
||||
self.ses = Session()
|
||||
|
||||
def test_app_utils_get_current_session(self):
|
||||
from gnucash import _sw_app_utils
|
||||
self.ses_instance = _sw_app_utils.gnc_get_current_session()
|
||||
self.ses = Session(instance = self.ses_instance)
|
||||
self.assertIsInstance(obj = self.ses, cls = Session)
|
||||
|
||||
def test_get_book_from_current_session(self):
|
||||
from gnucash import _sw_app_utils
|
||||
from gnucash import Book
|
||||
self.ses_instance = _sw_app_utils.gnc_get_current_session()
|
||||
self.ses = Session(instance = self.ses_instance)
|
||||
self.book = self.ses.get_book()
|
||||
self.assertIsInstance(obj = self.book, cls = Book)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -5,7 +5,7 @@ from unittest_support import *
|
||||
|
||||
from test_book import BookSession
|
||||
|
||||
class SplitSession( BookSession ):
|
||||
class SplitSession(BookSession):
|
||||
def setUp(self):
|
||||
|
||||
BookSession.setUp(self)
|
||||
@@ -14,7 +14,7 @@ class SplitSession( BookSession ):
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
class TestSplit( SplitSession ):
|
||||
class TestSplit(SplitSession):
|
||||
def test_memo(self):
|
||||
MEMO = "cookie monster"
|
||||
self.assertEqual( '', self.split.GetMemo() )
|
||||
|
||||
@@ -5,7 +5,7 @@ from unittest_support import *
|
||||
|
||||
from test_book import BookSession
|
||||
|
||||
class TransactionSession( BookSession ):
|
||||
class TransactionSession(BookSession):
|
||||
def setUp(self):
|
||||
self.domain1 = "gnc.engine"
|
||||
self.domain2 = "gnc.engine.scrub"
|
||||
@@ -40,7 +40,7 @@ class TransactionSession( BookSession ):
|
||||
g_log_remove_handler(self.domain2, self.hdlr2)
|
||||
test_clear_error_list ()
|
||||
|
||||
class TestTransaction( TransactionSession ):
|
||||
class TestTransaction(TransactionSession):
|
||||
def test_equal(self):
|
||||
TRANS = self.trans
|
||||
self.assertTrue( TRANS.Equal(self.trans, True, False, False, False) )
|
||||
|
||||
@@ -72,13 +72,15 @@ macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_outp
|
||||
-python -py3
|
||||
-Wall -Werror
|
||||
${SWIG_ARGS}
|
||||
)
|
||||
)
|
||||
set (DEFAULT_SWIG_PYTHON_C_INCLUDES
|
||||
${GLIB2_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/common
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/app-utils
|
||||
)
|
||||
${GLIB2_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/common
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/app-utils
|
||||
${CMAKE_SOURCE_DIR}/bindings
|
||||
${CMAKE_SOURCE_DIR}/bindings/python
|
||||
)
|
||||
|
||||
set (PYTHON_SWIG_FLAGS ${DEFAULT_SWIG_PYTHON_FLAGS})
|
||||
foreach (dir ${DEFAULT_SWIG_PYTHON_C_INCLUDES} ${_include_dirs})
|
||||
@@ -87,8 +89,9 @@ macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_outp
|
||||
add_custom_command(OUTPUT ${outfile} ${py_outfile}
|
||||
COMMAND ${SWIG_EXECUTABLE} ${PYTHON_SWIG_FLAGS} -o ${outfile} ${_input}
|
||||
DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${ARGN}
|
||||
)
|
||||
add_custom_target(${_target} ALL DEPENDS ${outfile} ${py_outfile} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${_input} ${ARGN})
|
||||
)
|
||||
add_custom_target(${_target} ALL DEPENDS ${outfile} ${py_outfile}
|
||||
${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${_input} ${ARGN})
|
||||
endmacro()
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ function(run_dist_check PACKAGE_PREFIX EXT)
|
||||
-D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
|
||||
-D CMAKE_INSTALL_PREFIX=../${INSTALL_DIR}
|
||||
-D GTEST_ROOT=${GTEST_ROOT}
|
||||
-D WITH_PYTHON=YES
|
||||
../${PACKAGE_PREFIX}
|
||||
WORKING_DIRECTORY ${BUILD_DIR}
|
||||
ERROR_MSG "CMake configure command failed."
|
||||
|
||||
@@ -532,7 +532,7 @@ Dies ist der Grundplan gemäss offiziellem Plan.
|
||||
<act:parent type="new">c58b830157164df9aa197f9a0a0d3525</act:parent>
|
||||
</gnc:account>
|
||||
<gnc:account version="2.0.0">
|
||||
<act:name>Darlehnen</act:name>
|
||||
<act:name>Darlehen</act:name>
|
||||
<act:id type="new">6982fd93c9f34a76801c8e9dbae14d9b</act:id>
|
||||
<act:type>ASSET</act:type>
|
||||
<act:commodity>
|
||||
@@ -720,7 +720,7 @@ Dies ist der Grundplan gemäss offiziellem Plan.
|
||||
<act:parent type="new">d0e005ee0f924d68aa5c27de625c106b</act:parent>
|
||||
</gnc:account>
|
||||
<gnc:account version="2.0.0">
|
||||
<act:name>Wertberichtigungen Geschäftsliegenschafte</act:name>
|
||||
<act:name>Wertberichtigungen Geschäftsliegenschaften</act:name>
|
||||
<act:id type="new">1a70c4acc8a746aeba59021390ac3f89</act:id>
|
||||
<act:type>ASSET</act:type>
|
||||
<act:commodity>
|
||||
@@ -1918,7 +1918,7 @@ Dies ist der Grundplan gemäss offiziellem Plan.
|
||||
<act:parent type="new">ff17758ba51149a3a16c2e50f4dd12f3</act:parent>
|
||||
</gnc:account>
|
||||
<gnc:account version="2.0.0">
|
||||
<act:name>Betriebsfremder, ausserordentlicher, einmaliger oder perioden-fremder Aufwand und Ertrag</act:name>
|
||||
<act:name>Betriebsfremder, ausserordentlicher, einmaliger oder periodenfremder Aufwand und Ertrag</act:name>
|
||||
<act:id type="new">67be6ac625cc4b8f8ee6706b0434a335</act:id>
|
||||
<act:type>INCOME</act:type>
|
||||
<act:commodity>
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef gboolean (*AccountBoolCB) (Account*, gpointer);
|
||||
/** Create/fetch a quickfill of account names.
|
||||
*
|
||||
* The quickfill is created out of all of the subaccounts
|
||||
* the the account group, filtered by the 'skip_cb' callback.
|
||||
* in the account group, filtered by the 'skip_cb' callback.
|
||||
* If 'skip_cb' is not NULL, and if it returns TRUE when passed
|
||||
* a particular account, then that account won't be included in
|
||||
* the quickfill. The 'cb_data' is passed to the callback.
|
||||
|
||||
@@ -624,7 +624,7 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
|
||||
}
|
||||
}
|
||||
|
||||
/* Next insert insert "All non-currency" entry if requested */
|
||||
/* Next insert "All non-currency" entry if requested */
|
||||
if (mode == DIAG_COMM_NON_CURRENCY_SELECT || mode == DIAG_COMM_ALL)
|
||||
{
|
||||
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
|
||||
|
||||
@@ -2415,7 +2415,7 @@ gnc_options_dialog_destroy(GNCOptionWin * win)
|
||||
* You probably want to end with something like:
|
||||
* gtk_widget_show_all(*enclosing);
|
||||
*
|
||||
* If you can can detect state changes for your widget's value, you should also
|
||||
* If you can detect state changes for your widget's value, you should also
|
||||
* gnc_option_changed_widget_cb() upon changes.
|
||||
*
|
||||
* The widget you return from this function should be the widget in
|
||||
|
||||
@@ -591,7 +591,7 @@ gnc_preferences_build_page (gpointer data,
|
||||
gnc_prefs_build_widget_table(builder, dialog);
|
||||
|
||||
/* Connect the signals in this glade file. The dialog is passed in
|
||||
* so the the callback can find "interesting" widgets from other
|
||||
* so the callback can find "interesting" widgets from other
|
||||
* glade files if necessary (via the GPREFS_WIDGET_HASH hash table). */
|
||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dialog);
|
||||
|
||||
@@ -859,7 +859,7 @@ file_chooser_clear_cb (GtkButton *button, gpointer user_data)
|
||||
GtkWidget *fcb_new;
|
||||
gchar *boxname;
|
||||
|
||||
/* We need to distroy the GtkFileChooserButton and recreate as there
|
||||
/* We need to destroy the GtkFileChooserButton and recreate as there
|
||||
does not seem to be away of resetting the folder path to NONE */
|
||||
box = gtk_widget_get_parent (GTK_WIDGET(fcb));
|
||||
gtk_widget_destroy (GTK_WIDGET(fcb));
|
||||
|
||||
@@ -327,7 +327,7 @@ show_handler (const char *class_name, gint component_id,
|
||||
ENTER(" ");
|
||||
if (!rw_dialog)
|
||||
{
|
||||
LEAVE("no data strucure");
|
||||
LEAVE("no data structure");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ show_handler (const char *class_name, gint component_id,
|
||||
ENTER(" ");
|
||||
if (!totd_dialog)
|
||||
{
|
||||
LEAVE("no data strucure");
|
||||
LEAVE("no data structure");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ struct _xferDialog
|
||||
GtkWidget *date_entry;
|
||||
GtkWidget *num_entry;
|
||||
GtkWidget *description_entry;
|
||||
GtkWidget *notes_entry;
|
||||
GtkWidget *memo_entry;
|
||||
GtkWidget *conv_forward;
|
||||
GtkWidget *conv_reverse;
|
||||
@@ -1269,6 +1270,7 @@ gnc_xfer_dialog_is_exchange_dialog (XferDialog *xferData,
|
||||
gtk_widget_set_sensitive (xferData->date_entry, FALSE);
|
||||
gtk_widget_set_sensitive (xferData->num_entry, FALSE);
|
||||
gtk_widget_set_sensitive (xferData->description_entry, FALSE);
|
||||
gtk_widget_set_sensitive (xferData->notes_entry, FALSE);
|
||||
gtk_widget_set_sensitive (xferData->memo_entry, FALSE);
|
||||
|
||||
|
||||
@@ -1543,6 +1545,10 @@ create_transaction(XferDialog *xferData, time64 time,
|
||||
string = gtk_entry_get_text(GTK_ENTRY(xferData->num_entry));
|
||||
gnc_set_num_action (trans, from_split, string, NULL);
|
||||
|
||||
/* Set the transaction notes */
|
||||
string = gtk_entry_get_text(GTK_ENTRY(xferData->notes_entry));
|
||||
xaccTransSetNotes(trans, string);
|
||||
|
||||
/* Set the memo fields */
|
||||
string = gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry));
|
||||
xaccSplitSetMemo(from_split, string);
|
||||
@@ -1931,6 +1937,9 @@ gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData)
|
||||
entry = GTK_WIDGET(gtk_builder_get_object (builder, "description_entry"));
|
||||
xferData->description_entry = entry;
|
||||
|
||||
entry = GTK_WIDGET(gtk_builder_get_object (builder, "notes_entry"));
|
||||
xferData->notes_entry = entry;
|
||||
|
||||
entry = GTK_WIDGET(gtk_builder_get_object (builder, "memo_entry"));
|
||||
xferData->memo_entry = entry;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
|
||||
*
|
||||
* The "page_changed" signal is emitted when a new page is
|
||||
* selected in the notebook of a GncEmbeddedWindow. This can be
|
||||
* used to to adjust menu actions based upon which page is
|
||||
* used to adjust menu actions based upon which page is
|
||||
* currently displayed in a window.
|
||||
*/
|
||||
embedded_window_signals[PAGE_CHANGED] =
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
* will inform the user of the error.
|
||||
*
|
||||
* The gnc_file_quit() routine will close out and destroy the current session.
|
||||
* The user WILL NOT BE PROMPTED to confirm this action, or do do
|
||||
* The user WILL NOT BE PROMPTED to confirm this action, or do
|
||||
* any kind of saving beforehand.
|
||||
*
|
||||
* HISTORY:
|
||||
|
||||
@@ -127,7 +127,7 @@ gnc_gobject_tracking_remember (GObject *object, GObjectClass *klass)
|
||||
g_return_if_fail(G_IS_OBJECT(object));
|
||||
|
||||
/* Little dance here to handle startup conditions. During object
|
||||
* initialization the object type changes as each each parent class
|
||||
* initialization the object type changes as each parent class
|
||||
* is initialized. The class passed to the initialization function
|
||||
* is always the ultimate class of the object. */
|
||||
if (klass == NULL)
|
||||
|
||||
@@ -139,7 +139,7 @@ void gnc_keyring_set_password (const gchar *access_method,
|
||||
strlen(server), server, /* servername */
|
||||
strlen(access_method),
|
||||
access_method, /* securitydomain */
|
||||
strlen(user), user, /* acountname */
|
||||
strlen(user), user, /* accountname */
|
||||
strlen(service), service, /* path */
|
||||
port, /* port */
|
||||
kSecProtocolTypeAny, /* protocol */
|
||||
|
||||
@@ -2521,7 +2521,7 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
|
||||
*
|
||||
* The "page_changed" signal is emitted when a new page is
|
||||
* selected in the notebook of a GncMainWindow. This can be
|
||||
* used to to adjust menu actions based upon which page is
|
||||
* used to adjust menu actions based upon which page is
|
||||
* currently displayed in a window.
|
||||
*/
|
||||
main_window_signals[PAGE_CHANGED] =
|
||||
|
||||
@@ -426,7 +426,7 @@ GtkWidget *gnc_book_options_dialog_cb (gboolean modal, gchar *title,
|
||||
|
||||
/**
|
||||
* Processes selected options in the Book Options dialog: checks book_currency
|
||||
* and use_split_action_for_num to see if features kvp shuold be set. To be used
|
||||
* and use_split_action_for_num to see if features kvp should be set. To be used
|
||||
* where ever a new book situation requires book option selection (e.g., not
|
||||
* just in Book Options dialog opened from main window but also in new-file
|
||||
* assistant).
|
||||
|
||||
@@ -46,7 +46,7 @@ void gnc_extension_invoke_cb (SCM extension, SCM window);
|
||||
/** This function stores a menu item/callback for later insertion into
|
||||
* the application menus,
|
||||
*
|
||||
* @param extension A scheme object descrubing the menu to be
|
||||
* @param extension A scheme object describing the menu to be
|
||||
* inserted. Functions written in C should use the gnc-plugin code.
|
||||
*/
|
||||
void gnc_add_scm_extension(SCM extension);
|
||||
|
||||
@@ -423,7 +423,7 @@ void gnc_plugin_page_set_page_color (GncPluginPage *page, const char *color);
|
||||
|
||||
|
||||
/** Set up the page_changed callback for when the current page is changed.
|
||||
* This will store a pointer to the page focus funtion passed as a parameter
|
||||
* This will store a pointer to the page focus function passed as a parameter
|
||||
* so that it can be used in setting up the g_idle_add
|
||||
*
|
||||
* @param page The page the callback is setup for.
|
||||
|
||||
@@ -129,7 +129,7 @@ gnc_tree_model_account_update_color (gpointer gsettings, gchar *key, gpointer us
|
||||
model = user_data;
|
||||
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||
|
||||
// destroy/recreate the cached acount value hash to force update
|
||||
// destroy/recreate the cached account value hash to force update
|
||||
g_hash_table_destroy (priv->account_values_hash);
|
||||
priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, g_free);
|
||||
@@ -252,7 +252,7 @@ gnc_tree_model_account_dispose (GObject *object)
|
||||
if (priv->negative_color)
|
||||
g_free (priv->negative_color);
|
||||
|
||||
// destroy the cached acount values
|
||||
// destroy the cached account values
|
||||
g_hash_table_destroy (priv->account_values_hash);
|
||||
|
||||
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
|
||||
@@ -600,7 +600,7 @@ gnc_tree_model_account_clear_cache (GncTreeModelAccount *model)
|
||||
{
|
||||
GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||
|
||||
// destroy the cached acount values and recreate
|
||||
// destroy the cached account values and recreate
|
||||
g_hash_table_destroy (priv->account_values_hash);
|
||||
priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, g_free);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* GtkTreeViews allow the creation of columns in any order, not just
|
||||
* the order they appear in the underlying model. The most likely use
|
||||
* of this code will have the first view column mapped to this extra
|
||||
* boolean model column, and the column value diaplayed by a checkbox.
|
||||
* boolean model column, and the column value displayed by a checkbox.
|
||||
*/
|
||||
|
||||
#ifndef __GNC_TREE_MODEL_SELECTION_H
|
||||
|
||||
@@ -451,7 +451,7 @@ gnc_tree_model_split_reg_dispose (GObject *object)
|
||||
/* Create a new tree model */
|
||||
GncTreeModelSplitReg *
|
||||
gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
|
||||
gboolean use_double_line, gboolean is_template)
|
||||
gboolean use_double_line, gboolean is_template, gboolean mismatched_commodities)
|
||||
{
|
||||
GncTreeModelSplitReg *model;
|
||||
GncTreeModelSplitRegPrivate *priv;
|
||||
@@ -469,6 +469,7 @@ gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 s
|
||||
model->style = style;
|
||||
model->use_double_line = use_double_line;
|
||||
model->is_template = is_template;
|
||||
model->mismatched_commodities = mismatched_commodities;
|
||||
|
||||
model->sort_col = 1;
|
||||
model->sort_depth = 1;
|
||||
|
||||
@@ -144,6 +144,7 @@ typedef struct
|
||||
gboolean use_double_line; /**<FIXME ? As above, whether to use two lines per transaction */
|
||||
|
||||
gboolean is_template; /**< Are we using a template */
|
||||
gboolean mismatched_commodities; /**< Are there different commodities */
|
||||
|
||||
gint sort_depth; /**< This is the row the sort direction is based on. */
|
||||
gint sort_col; /**< This is the column the sort direction is based on. */
|
||||
@@ -201,7 +202,7 @@ GType gnc_tree_model_split_reg_get_type (void);
|
||||
/** Create new model and set options for register. */
|
||||
GncTreeModelSplitReg *
|
||||
gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
|
||||
gboolean use_double_line, gboolean is_template);
|
||||
gboolean use_double_line, gboolean is_template, gboolean mismatched_commodities);
|
||||
|
||||
/** Load the model from a slist and set default account for register. */
|
||||
void gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList * slist, Account *default_account);
|
||||
|
||||
@@ -1630,7 +1630,7 @@ gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view,
|
||||
}
|
||||
|
||||
/*
|
||||
* Selects all sub-accounts of an acccount.
|
||||
* Selects all sub-accounts of an account.
|
||||
*/
|
||||
void
|
||||
gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view,
|
||||
|
||||
@@ -410,7 +410,7 @@ Account * gnc_tree_view_account_get_selected_account (GncTreeViewAccount *view);
|
||||
|
||||
/** This function selects an account in the account tree view. All
|
||||
* other accounts will be unselected. In addition, this function
|
||||
* collapses the entitre tree and then expands only the path to the
|
||||
* collapses the entire tree and then expands only the path to the
|
||||
* selected account, making the item easy to find. In general, this
|
||||
* routine only need be called when initially putting up a window
|
||||
* containing an account tree view widget.
|
||||
@@ -443,7 +443,7 @@ GList * gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view);
|
||||
|
||||
/** This function selects a set of accounts in the account tree view.
|
||||
* All other accounts will be unselected. In addition, this function
|
||||
* collapses the entitre tree and then expands only the path to the
|
||||
* collapses the entire tree and then expands only the path to the
|
||||
* selected accounts, making them easy to find. In general, this
|
||||
* routine only need be called when initially putting up a window
|
||||
* containing an account tree view widget.
|
||||
|
||||
@@ -258,7 +258,7 @@ GncOwner * gnc_tree_view_owner_get_selected_owner (GncTreeViewOwner *view);
|
||||
|
||||
/** This function selects an owner in the owner tree view. All
|
||||
* other owners will be unselected. In addition, this function
|
||||
* collapses the entitre tree and then expands only the path to the
|
||||
* collapses the entire tree and then expands only the path to the
|
||||
* selected owner, making the item easy to find. In general, this
|
||||
* routine only need be called when initially putting up a window
|
||||
* containing an owner tree view widget.
|
||||
|
||||
@@ -177,7 +177,7 @@ GNCPrice * gnc_tree_view_price_get_selected_price (GncTreeViewPrice *view);
|
||||
|
||||
/** This function selects an price in the price tree view. All
|
||||
* other prices will be unselected. In addition, this function
|
||||
* collapses the entitre tree and then expands only the path to the
|
||||
* collapses the entire tree and then expands only the path to the
|
||||
* selected price, making the item easy to find. In general, this
|
||||
* routine only need be called when initially putting up a window
|
||||
* containing an price tree view widget.
|
||||
|
||||
@@ -592,7 +592,7 @@ gnc_tree_view_split_reg_pref_changed (gpointer prefs, gchar *pref, gpointer user
|
||||
|
||||
/* Define which columns are in which views */
|
||||
static ViewCol *
|
||||
gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
|
||||
gnc_tree_view_split_reg_get_column_list (GncTreeModelSplitReg *model)
|
||||
{
|
||||
DEBUG("Model-type is %d", model->type);
|
||||
|
||||
@@ -1024,7 +1024,7 @@ gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
|
||||
gnc_tree_view_set_sort_user_data (GNC_TREE_VIEW (view), s_model);
|
||||
|
||||
/* Set up the columns */
|
||||
gnc_tree_view_split_reg_set_cols (view, model, gnc_tree_view_split_reg_get_colummn_list (model));
|
||||
gnc_tree_view_split_reg_set_cols (view, model, gnc_tree_view_split_reg_get_column_list (model));
|
||||
|
||||
PINFO("#### Before View connected to Model ####");
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ GType gnc_tree_view_get_type (void);
|
||||
#define REAL_TITLE "real_title"
|
||||
|
||||
/* The name of this column to use when saving the view's state. It is
|
||||
* used internally to map this colum's properties to the saved state. */
|
||||
* used internally to map this column's properties to the saved state. */
|
||||
#define PREF_NAME "pref-name"
|
||||
|
||||
/* A column with this attribute set cannot be hidden from view. Valid
|
||||
|
||||
@@ -494,7 +494,7 @@ show_handler (const char *klass, gint component_id,
|
||||
ENTER(" ");
|
||||
if (!facc_dialog)
|
||||
{
|
||||
LEAVE("No data strucure");
|
||||
LEAVE("No data structure");
|
||||
return(FALSE);
|
||||
}
|
||||
gtk_window_present (GTK_WINDOW(facc_dialog->window));
|
||||
|
||||
@@ -126,6 +126,8 @@ gnc_ui_find_transactions_dialog_create(GtkWindow *parent, GNCLedgerDisplay * ori
|
||||
params = gnc_search_param_prepend (params, N_("Date Posted"), NULL,
|
||||
type, SPLIT_TRANS, TRANS_DATE_POSTED,
|
||||
NULL);
|
||||
params = gnc_search_param_prepend (params, N_("Reconciled Date"), NULL,
|
||||
type, SPLIT_DATE_RECONCILED, NULL);
|
||||
params = gnc_search_param_prepend (params, (num_action
|
||||
? N_("Number/Action")
|
||||
: N_("Action")), NULL,
|
||||
|
||||
@@ -1034,7 +1034,7 @@ show_handler (const char *klass, gint component_id,
|
||||
ENTER(" ");
|
||||
if (!imap_dialog)
|
||||
{
|
||||
LEAVE("No data strucure");
|
||||
LEAVE("No data structure");
|
||||
return(FALSE);
|
||||
}
|
||||
gtk_window_present (GTK_WINDOW(imap_dialog->dialog));
|
||||
|
||||
@@ -317,7 +317,7 @@ lv_select_row (GNCLotViewer *lv,
|
||||
}
|
||||
|
||||
/* ======================================================================== */
|
||||
/* Un-select a row the the lot list */
|
||||
/* Un-select a row of the lot list */
|
||||
|
||||
static void
|
||||
lv_unselect_row (GNCLotViewer *lv)
|
||||
|
||||
@@ -1084,7 +1084,7 @@ gnc_payment_leave_amount_cb (G_GNUC_UNUSED GtkWidget *widget,
|
||||
gnc_payment_window_check_payment (pw);
|
||||
}
|
||||
|
||||
/* Select the list of accoutns to show in the tree */
|
||||
/* Select the list of accounts to show in the tree */
|
||||
static void
|
||||
gnc_payment_set_account_types (GncTreeViewAccount *tree)
|
||||
{
|
||||
|
||||
@@ -800,7 +800,7 @@ show_handler (const char *klass, gint component_id,
|
||||
ENTER(" ");
|
||||
if (!pdb_dialog)
|
||||
{
|
||||
LEAVE("no data strucure");
|
||||
LEAVE("no data structure");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -559,6 +559,15 @@ typedef struct GncPluginPageRegister2Private
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static gpointer
|
||||
gnc_plug_page_register_check_commodity(Account *account, void* usr_data)
|
||||
{
|
||||
// Check that account's commodity matches the commodity in usr_data
|
||||
gnc_commodity* com0 = (gnc_commodity*) usr_data;
|
||||
gnc_commodity* com1 = xaccAccountGetCommodity(account);
|
||||
return gnc_commodity_equal(com1, com0) ? NULL : com1;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Implementation */
|
||||
/************************************************************/
|
||||
@@ -630,6 +639,8 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
|
||||
GNCLedgerDisplay2 *ledger;
|
||||
GncPluginPage *page;
|
||||
GncPluginPageRegister2Private *priv;
|
||||
gnc_commodity* com0;
|
||||
gnc_commodity* com1;
|
||||
|
||||
/*################## Added for Reg2 #################*/
|
||||
const GList *item;
|
||||
@@ -657,9 +668,10 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
|
||||
}
|
||||
}
|
||||
/*################## Added for Reg2 #################*/
|
||||
|
||||
com0 = gnc_account_get_currency_or_parent(account);
|
||||
com1 = gnc_account_foreach_descendant_until(account,gnc_plug_page_register_check_commodity,com0);
|
||||
if (subaccounts)
|
||||
ledger = gnc_ledger_display2_subaccounts (account);
|
||||
ledger = gnc_ledger_display2_subaccounts (account,com1!=NULL);
|
||||
else
|
||||
ledger = gnc_ledger_display2_simple (account);
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ gsr_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
|
||||
commodity = xaccAccountGetCommodity( leader );
|
||||
|
||||
/* no EURO converson, if account is already EURO or no EURO currency */
|
||||
/* no EURO conversion, if account is already EURO or no EURO currency */
|
||||
if (commodity != NULL)
|
||||
euro = (gnc_is_euro_currency( commodity ) &&
|
||||
(strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
|
||||
@@ -2619,27 +2619,38 @@ gnc_split_reg_determine_read_only( GNCSplitReg *gsr )
|
||||
{
|
||||
dialog_args *args;
|
||||
char *string = NULL;
|
||||
switch (gnc_split_reg_get_placeholder(gsr))
|
||||
reg = gnc_ledger_display_get_split_register( gsr->ledger );
|
||||
if(reg->mismatched_commodities)
|
||||
{
|
||||
case PLACEHOLDER_NONE:
|
||||
/* stay as false. */
|
||||
return;
|
||||
string = _("This account may not be edited because its"
|
||||
" subaccounts have mismatched commodities or currencies."
|
||||
"You need to open each account individually to "
|
||||
"edit transactions.");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gnc_split_reg_get_placeholder(gsr))
|
||||
{
|
||||
case PLACEHOLDER_NONE:
|
||||
/* stay as false. */
|
||||
return;
|
||||
|
||||
case PLACEHOLDER_THIS:
|
||||
string = _("This account may not be edited. If you want "
|
||||
"to edit transactions in this register, please "
|
||||
"open the account options and turn off the "
|
||||
"placeholder checkbox.");
|
||||
break;
|
||||
case PLACEHOLDER_THIS:
|
||||
string = _("This account may not be edited. If you want "
|
||||
"to edit transactions in this register, please "
|
||||
"open the account options and turn off the "
|
||||
"placeholder checkbox.");
|
||||
break;
|
||||
|
||||
default:
|
||||
string = _("One of the sub-accounts selected may not be "
|
||||
"edited. If you want to edit transactions in "
|
||||
"this register, please open the sub-account "
|
||||
"options and turn off the placeholder checkbox. "
|
||||
"You may also open an individual account instead "
|
||||
"of a set of accounts.");
|
||||
break;
|
||||
default:
|
||||
string = _("One of the sub-accounts selected may not be "
|
||||
"edited. If you want to edit transactions in "
|
||||
"this register, please open the sub-account "
|
||||
"options and turn off the placeholder checkbox. "
|
||||
"You may also open an individual account instead "
|
||||
"of a set of accounts.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
gsr->read_only = TRUE;
|
||||
/* Put up a warning dialog */
|
||||
|
||||
@@ -517,7 +517,7 @@ gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
|
||||
|
||||
commodity = xaccAccountGetCommodity( leader );
|
||||
|
||||
/* no EURO converson, if account is already EURO or no EURO currency */
|
||||
/* no EURO conversion, if account is already EURO or no EURO currency */
|
||||
if (commodity != NULL)
|
||||
euro = (gnc_is_euro_currency( commodity ) &&
|
||||
(strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
|
||||
|
||||
@@ -584,7 +584,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp
|
||||
other_account = xaccSplitGetAccount (other_split);
|
||||
if (other_split == split)
|
||||
continue;
|
||||
/* Check this 'other' account in in the same hierarchy */
|
||||
/* Check this 'other' account is in the same hierarchy */
|
||||
if (!g_list_find (child_accounts, other_account))
|
||||
continue;
|
||||
/* Search our sibling view for this split first. We search the
|
||||
|
||||
@@ -113,6 +113,8 @@ typedef struct _startRecnWindowData
|
||||
GtkWidget *startRecnWindow; /* the startRecnWindow dialog */
|
||||
GtkWidget *xfer_button; /* the dialog's interest transfer button */
|
||||
GtkWidget *date_value; /* the dialog's ending date field */
|
||||
GtkWidget *future_icon;
|
||||
GtkWidget *future_text;
|
||||
GNCAmountEdit *end_value; /* the dialog's ending balance amount edit */
|
||||
gnc_numeric original_value; /* the dialog's original ending balance */
|
||||
gboolean user_set_value; /* the user changed the ending value */
|
||||
@@ -280,8 +282,7 @@ recnRecalculateBalance (RecnWindow *recnData)
|
||||
|
||||
/* update the starting balance */
|
||||
include_children = xaccAccountGetReconcileChildrenStatus(account);
|
||||
starting = gnc_ui_account_get_reconciled_balance_as_of_date
|
||||
(account, recnData->statement_date, include_children);
|
||||
starting = gnc_ui_account_get_reconciled_balance(account, include_children);
|
||||
print_info = gnc_account_print_info (account, TRUE);
|
||||
|
||||
/*
|
||||
@@ -383,9 +384,57 @@ gnc_start_recn_date_changed (GtkWidget *widget, startRecnWindowData *data)
|
||||
gnc_numeric new_balance;
|
||||
time64 new_date;
|
||||
|
||||
gboolean show_warning = FALSE;
|
||||
gint days_after_today;
|
||||
static const time64 secs_per_day = 86400;
|
||||
static const time64 secs_per_hour = 3600;
|
||||
|
||||
new_date = gnc_date_edit_get_date_end (gde);
|
||||
|
||||
/* Add secs_per_hour to the difference to compensate for the short
|
||||
* day when transitioning from standard to daylight time.
|
||||
*/
|
||||
days_after_today = (gnc_time64_get_day_end (new_date) -
|
||||
gnc_time64_get_today_end () +
|
||||
secs_per_hour) / secs_per_day;
|
||||
|
||||
if (days_after_today > 0)
|
||||
{
|
||||
/* Translators: This is a ngettext(3) message, %d is the
|
||||
number of days in the future */
|
||||
gchar *str = g_strdup_printf
|
||||
(ngettext ("Statement Date is %d day after today.",
|
||||
"Statement Date is %d days after today.",
|
||||
days_after_today),
|
||||
days_after_today);
|
||||
|
||||
/* Translators: This is a ngettext(3) message, %d is the
|
||||
number of days in the future */
|
||||
gchar *tip_start = g_strdup_printf
|
||||
(ngettext ("The statement date you have chosen is %d day in the future.",
|
||||
"The statement date you have chosen is %d days in the future.",
|
||||
days_after_today),
|
||||
days_after_today);
|
||||
|
||||
gchar *tip_end = g_strdup (_("This may cause issues for future reconciliation \
|
||||
actions on this account. Please double-check this is the date you intended."));
|
||||
gchar *tip = g_strdup_printf ("%s %s", tip_start, tip_end);
|
||||
|
||||
show_warning = TRUE;
|
||||
|
||||
gtk_label_set_text (GTK_LABEL(data->future_text), str);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET(data->future_text), tip);
|
||||
g_free (str);
|
||||
g_free (tip_end);
|
||||
g_free (tip_start);
|
||||
g_free (tip);
|
||||
}
|
||||
gtk_widget_set_visible (GTK_WIDGET(data->future_icon), show_warning);
|
||||
gtk_widget_set_visible (GTK_WIDGET(data->future_text), show_warning);
|
||||
|
||||
if (data->user_set_value)
|
||||
return;
|
||||
new_date = gnc_date_edit_get_date_end (gde);
|
||||
|
||||
/* get the balance for the account as of the new date */
|
||||
new_balance = gnc_ui_account_get_balance_as_of_date (data->account, new_date,
|
||||
data->include_children);
|
||||
@@ -771,6 +820,10 @@ startRecnWindow(GtkWidget *parent, Account *account,
|
||||
data.end_value = GNC_AMOUNT_EDIT(end_value);
|
||||
data.original_value = *new_ending;
|
||||
data.user_set_value = FALSE;
|
||||
|
||||
data.future_icon = GTK_WIDGET(gtk_builder_get_object (builder, "future_icon"));
|
||||
data.future_text = GTK_WIDGET(gtk_builder_get_object (builder, "future_text"));
|
||||
|
||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "ending_value_box"));
|
||||
gtk_box_pack_start(GTK_BOX(box), end_value, TRUE, TRUE, 0);
|
||||
label = GTK_WIDGET(gtk_builder_get_object (builder, "end_label"));
|
||||
@@ -821,6 +874,9 @@ startRecnWindow(GtkWidget *parent, Account *account,
|
||||
|
||||
gtk_widget_show_all(dialog);
|
||||
|
||||
gtk_widget_hide (data.future_text);
|
||||
gtk_widget_hide (data.future_icon);
|
||||
|
||||
gtk_widget_grab_focus(gnc_amount_edit_gtk_entry
|
||||
(GNC_AMOUNT_EDIT (end_value)));
|
||||
}
|
||||
@@ -1788,6 +1844,43 @@ recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_endi
|
||||
g_signal_connect (recnData->window, "key_press_event",
|
||||
G_CALLBACK(recn_key_press_cb), recnData);
|
||||
|
||||
|
||||
/* if account has a reconciled split where reconciled_date is
|
||||
later than statement_date, emit a warning into statusbar */
|
||||
{
|
||||
GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
|
||||
guint context = gtk_statusbar_get_context_id (bar, "future_dates");
|
||||
GtkWidget *box = gtk_statusbar_get_message_area (bar);
|
||||
GtkWidget *image = gtk_image_new_from_icon_name
|
||||
("dialog-warning", GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
|
||||
for (GList *n = xaccAccountGetSplitList (account); n; n = n->next)
|
||||
{
|
||||
Split* split = n->data;
|
||||
time64 recn_date = xaccSplitGetDateReconciled (split);
|
||||
if ((xaccSplitGetReconcile (split) != YREC) ||
|
||||
(recn_date <= statement_date))
|
||||
continue;
|
||||
|
||||
PWARN ("split posting_date=%s, recn_date=%s",
|
||||
qof_print_date (xaccTransGetDate (xaccSplitGetParent (split))),
|
||||
qof_print_date (recn_date));
|
||||
|
||||
gtk_statusbar_push (bar, context, _("WARNING! Account contains \
|
||||
splits whose reconcile date is after statement date. Reconciliation may be \
|
||||
difficult."));
|
||||
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (bar), _("This account \
|
||||
has splits whose Reconciled Date is after this reconciliation statement date. \
|
||||
These splits may make reconciliation difficult. If this is the case, you may \
|
||||
use Find Transactions to find them, unreconcile, and re-reconcile."));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX(box), image, FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (GTK_BOX(box), image, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The main area */
|
||||
{
|
||||
GtkWidget *frame = gtk_frame_new(NULL);
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -229,6 +229,31 @@
|
||||
<property name="hexpand">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="label" translatable="yes">Notes</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="notes_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
|
||||
@@ -235,6 +235,43 @@
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="future_warning">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="future_icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="future_text">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Statement Date is after today</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
@@ -81,8 +81,8 @@ static char * un_escape(char *str);
|
||||
that matches each field of the import row and the user selected field
|
||||
separators (, or ;), optionally with the fields enclosed in quotes.
|
||||
|
||||
If the match is succesful, the fields of the import row are transferred to
|
||||
a row in the GtkListStore store. If the the match is not succesful, the
|
||||
If the match is successful, the fields of the import row are transferred to
|
||||
a row in the GtkListStore store. If the match is not successful, the
|
||||
row is ignored. Maintains information about number of rows imported,
|
||||
the number of rows ignored, and the actual ignored rows.
|
||||
|
||||
@@ -175,7 +175,7 @@ gnc_bi_import_read_file (const gchar * filename, const gchar * parser_regexp,
|
||||
line_utf8 = g_locale_to_utf8 (line, -1, NULL, NULL, NULL);
|
||||
|
||||
// parse the line
|
||||
match_info = NULL; // it seems, that in contrast to documentation, match_info is not alsways set -> g_match_info_free will segfault
|
||||
match_info = NULL; // it seems, that in contrast to documentation, match_info is not always set -> g_match_info_free will segfault
|
||||
if (g_regex_match (regexpat, line_utf8, 0, &match_info))
|
||||
{
|
||||
// match found
|
||||
|
||||
@@ -1807,7 +1807,7 @@ csv_tximp_acct_match_text_parse (std::string acct_name)
|
||||
void
|
||||
CsvImpTransAssist::acct_match_select(GtkTreeModel *model, GtkTreeIter* iter)
|
||||
{
|
||||
// Get the the stored string and account (if any)
|
||||
// Get the stored string and account (if any)
|
||||
gchar *text = nullptr;
|
||||
Account *account = nullptr;
|
||||
gtk_tree_model_get (model, iter, MAPPING_STRING, &text,
|
||||
|
||||
@@ -708,7 +708,7 @@ void GncPreSplit::create_split (Transaction* trans)
|
||||
if (taccount)
|
||||
{
|
||||
/* Note: the current importer assumes at most 2 splits. This means the second split amount
|
||||
* will be the negative of the the first split amount.
|
||||
* will be the negative of the first split amount.
|
||||
*/
|
||||
auto inv_price = m_price;
|
||||
if (m_price)
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
* match those of another one (the "parent"). Note this function is *not*
|
||||
* symmetrical. This instance can have empty properties and still be considered
|
||||
* part of the parent if the other properties match the parent's.
|
||||
* A fully empty instance will will equally be considered part of the parent.
|
||||
* A fully empty instance will equally be considered part of the parent.
|
||||
*
|
||||
* This function is intended to discover multi-split transaction lines in an import
|
||||
* file where the first line defines the transaction (with a first split) and subsequent
|
||||
|
||||
@@ -98,7 +98,7 @@ struct ErrorList;
|
||||
* the result of this step can be queried from tokenizer
|
||||
* - the user should now map the columns to types, which is stored in column_types
|
||||
* - last step is convert the mapped columns into a list of transactions
|
||||
* - this list will then be passed on the the generic importer for further processing */
|
||||
* - this list will then be passed on the generic importer for further processing */
|
||||
class GncTxImport
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -139,7 +139,7 @@ gnc_customer_import_read_file (const gchar *filename, const gchar *parser_regexp
|
||||
line_utf8 = g_locale_to_utf8 (line, -1, NULL, NULL, NULL);
|
||||
|
||||
// parse the line
|
||||
match_info = NULL; // it seems, that in contrast to documentation, match_info is not alsways set -> g_match_info_free will segfault
|
||||
match_info = NULL; // it seems, that in contrast to documentation, match_info is not always set -> g_match_info_free will segfault
|
||||
if (g_regex_match (regexpat, line_utf8, 0, &match_info))
|
||||
{
|
||||
// match found
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/** The gnc_file_log_replay() routine will pop up a standard file
|
||||
* selection dialogue asking the user to pick a log file to replay. If one
|
||||
* is selected the the .log file is opened and read. It's contents
|
||||
* is selected the .log file is opened and read. Its contents
|
||||
* are then silently merged in the current log file. */
|
||||
void gnc_file_log_replay (GtkWindow *parent);
|
||||
#endif
|
||||
|
||||
@@ -1045,7 +1045,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
|
||||
DEBUG("gnc_file_ofx_import(): Begin...\n");
|
||||
|
||||
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
|
||||
gtk_file_filter_set_name (filter, "ofx/qfx files (*.ofx,*.qfx)");
|
||||
gtk_file_filter_set_name (filter, _("Open/Quicken Financial Exchange file (*.ofx, *.qfx)"));
|
||||
gtk_file_filter_add_pattern (filter, "*.[oqOQ][fF][xX]");
|
||||
filters = g_list_prepend( filters, filter );
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/** The gnc_file_ofx_import() routine will pop up a standard file
|
||||
* selection dialogue asking the user to pick a OFX/QFX file. If one
|
||||
* is selected the the OFX file is opened and read. It's contents
|
||||
* is selected the OFX file is opened and read. Its contents
|
||||
* are merged into the existing session (if any). The current
|
||||
* session continues to remain open for editing. */
|
||||
void gnc_file_ofx_import (GtkWindow *parent);
|
||||
|
||||
@@ -1371,7 +1371,7 @@ gnc_ui_qif_import_cancel_cb (GtkAssistant *gtkassistant, gpointer user_data)
|
||||
if (!g_strcmp0 (pagename, "summary_page"))
|
||||
{
|
||||
/* Hitting the window close button on the summary page should not
|
||||
invoke a cancel action. The import has finised at that point. */
|
||||
invoke a cancel action. The import has finished at that point. */
|
||||
gnc_ui_qif_import_close_cb (gtkassistant, user_data);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -36,7 +36,7 @@ SCM gnc_ui_qif_import_assistant_get_mappings(QIFImportWindow * w);
|
||||
|
||||
/* The gnc_file_qif_import() routine will pop up a standard file
|
||||
* selection dialogue asking the user to pick a QIF file. If one
|
||||
* is selected then the QIF file is opened and read. It's contents
|
||||
* is selected then the QIF file is opened and read. Its contents
|
||||
* are merged into the existing session (if any). The current
|
||||
* session continues to remain open for editing. */
|
||||
void gnc_file_qif_import (void);
|
||||
|
||||
@@ -907,8 +907,8 @@
|
||||
(if (not (and far-acct-name near-acct-name))
|
||||
(if errorproc
|
||||
(errorproc "Transaction with no or only one associated account."))
|
||||
(if (and (not (qif-xtn:mark (car xtns))))
|
||||
(string=? (qif-xtn:from-acct (car xtns)) far-acct-name)
|
||||
(if (and (not (qif-xtn:mark (car xtns)))
|
||||
(string=? (qif-xtn:from-acct (car xtns)) far-acct-name))
|
||||
(begin
|
||||
(set! how
|
||||
(qif-import:xtn-has-matches? (car xtns) near-acct-name
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import sys
|
||||
import gnucash._sw_app_utils as _sw_app_utils
|
||||
from gnucash import *
|
||||
from gnucash._sw_core_utils import gnc_prefs_is_extra_enabled
|
||||
from gnucash._sw_core_utils import gnc_prefs_is_extra_enabled, gnc_prefs_is_debugging_enabled
|
||||
from gi import require_version
|
||||
require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
import os
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
noisy = gnc_prefs_is_extra_enabled()
|
||||
if noisy:
|
||||
if gnc_prefs_is_extra_enabled():
|
||||
print("woop", os.path.dirname(__file__))
|
||||
# Importing the console class causes SIGTTOU to be thrown if GnuCash is
|
||||
# started in the background. This causes a hang if it is not handled,
|
||||
@@ -21,7 +20,7 @@ import pycons.console as cons
|
||||
# Restore the SIGTTOU handler
|
||||
signal.signal(signal.SIGTTOU, old_sigttou)
|
||||
|
||||
if noisy:
|
||||
if gnc_prefs_is_extra_enabled() and gnc_prefs_is_debugging_enabled():
|
||||
print("Hello from python!")
|
||||
print("test", sys.modules.keys())
|
||||
print("test2", dir(_sw_app_utils))
|
||||
@@ -43,8 +42,9 @@ class Console (cons.Console):
|
||||
""" GTK python console """
|
||||
|
||||
def __init__(self, argv=[], shelltype='python', banner=[],
|
||||
filename=None, size=100):
|
||||
cons.Console.__init__(self, argv, shelltype, banner, filename, size)
|
||||
filename=None, size=100, user_local_ns=None, user_global_ns=None):
|
||||
cons.Console.__init__(self, argv, shelltype, banner, filename, size,
|
||||
user_local_ns=user_local_ns, user_global_ns=user_global_ns)
|
||||
self.buffer.create_tag('center',
|
||||
justification=Gtk.Justification.CENTER,
|
||||
font='Mono 4')
|
||||
@@ -101,12 +101,15 @@ if False:
|
||||
title = "gnucash "+shelltype+" shell"
|
||||
banner_style = 'title'
|
||||
banner = "Welcome to "+title+"!\n"
|
||||
console = Console(argv = [], shelltype = shelltype, banner = [[banner, banner_style]], size = 100)
|
||||
|
||||
window = Gtk.Window(type = Gtk.WindowType.TOPLEVEL)
|
||||
window.set_position(Gtk.WindowPosition.CENTER)
|
||||
window.set_default_size(800,600)
|
||||
window.set_border_width(0)
|
||||
|
||||
console = Console(argv = [], shelltype = shelltype, banner = [[banner, banner_style]],
|
||||
size = 100, user_local_ns=locals(), user_global_ns=globals())
|
||||
|
||||
window.connect('destroy-event', console.quit_event)
|
||||
window.connect('delete-event', console.quit_event)
|
||||
window.add (console)
|
||||
|
||||
@@ -126,7 +126,7 @@ class Console (Gtk.ScrolledWindow):
|
||||
""" GTK python console """
|
||||
|
||||
def __init__(self, argv=[], shelltype='python', banner=[],
|
||||
filename=None, size=100):
|
||||
filename=None, size=100, user_local_ns=None, user_global_ns=None):
|
||||
|
||||
""" Console interface building + initialization"""
|
||||
|
||||
@@ -184,12 +184,18 @@ class Console (Gtk.ScrolledWindow):
|
||||
self.history_init(filename, size)
|
||||
self.cout = io.StringIO()
|
||||
self.cout.truncate(0)
|
||||
|
||||
if not user_local_ns:
|
||||
user_local_ns = locals()
|
||||
if not user_global_ns:
|
||||
user_global_ns = globals()
|
||||
|
||||
if shelltype=='ipython':
|
||||
self.shell = ishell.Shell(argv,locals(),globals(),
|
||||
self.shell = ishell.Shell(argv,user_local_ns, user_global_ns,
|
||||
cout=self.cout, cerr=self.cout,
|
||||
input_func=self.raw_input)
|
||||
else:
|
||||
self.shell = shell.Shell(locals(),globals())
|
||||
self.shell = shell.Shell(user_local_ns,user_global_ns)
|
||||
self.interrupt = False
|
||||
self.input_mode = False
|
||||
self.input = None
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
from StringIO import StringIO
|
||||
from io import StringIO
|
||||
try:
|
||||
import IPython
|
||||
from IPython import ipapi
|
||||
except Exception,e:
|
||||
raise "Error importing IPython (%s)" % str(e)
|
||||
except Exception as e:
|
||||
raise Exception("Error importing IPython (%s)" % str(e))
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ class Shell
|
||||
@@ -54,11 +53,11 @@ class Shell:
|
||||
header='IPython system call: ',
|
||||
verbose=self.IP.rc.system_verbose)
|
||||
# Get a hold of the public IPython API object and use it
|
||||
self.ip = ipapi.get()
|
||||
self.ip = IPython.core.getipython.get_ipython()
|
||||
self.ip.magic('colors LightBG')
|
||||
sys.excepthook = excepthook
|
||||
self.iter_more = 0
|
||||
self.complete_sep = re.compile('[\s\{\}\[\]\(\)]')
|
||||
self.complete_sep = re.compile(r'[\s\{\}\[\]\(\)]')
|
||||
|
||||
|
||||
def namespace(self):
|
||||
|
||||
@@ -57,11 +57,11 @@ struct gnc_ledger_display
|
||||
{
|
||||
GncGUID leader;
|
||||
|
||||
Query *query;
|
||||
Query* query;
|
||||
|
||||
GNCLedgerDisplayType ld_type;
|
||||
|
||||
SplitRegister *reg;
|
||||
SplitRegister* reg;
|
||||
|
||||
gboolean loading;
|
||||
gboolean use_double_line_default;
|
||||
@@ -70,7 +70,7 @@ struct gnc_ledger_display
|
||||
GNCLedgerDisplayGetParent get_parent;
|
||||
|
||||
gpointer user_data;
|
||||
|
||||
|
||||
gint number_of_subaccounts;
|
||||
|
||||
gint component_id;
|
||||
@@ -82,34 +82,35 @@ static QofLogModule log_module = GNC_MOD_LEDGER;
|
||||
|
||||
|
||||
/** Declarations ****************************************************/
|
||||
static GNCLedgerDisplay *
|
||||
gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
static GNCLedgerDisplay*
|
||||
gnc_ledger_display_internal (Account* lead_account, Query* q,
|
||||
GNCLedgerDisplayType ld_type,
|
||||
SplitRegisterType reg_type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
static void gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld,
|
||||
GList *splits);
|
||||
static void gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld,
|
||||
GList* splits);
|
||||
|
||||
static void gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
gint limit,
|
||||
SplitRegisterType type);
|
||||
static void gnc_ledger_display_make_query (GNCLedgerDisplay* ld,
|
||||
gint limit,
|
||||
SplitRegisterType type);
|
||||
|
||||
/** Implementations *************************************************/
|
||||
|
||||
Account *
|
||||
gnc_ledger_display_leader (GNCLedgerDisplay *ld)
|
||||
Account*
|
||||
gnc_ledger_display_leader (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
|
||||
return xaccAccountLookup (&ld->leader, gnc_get_current_book ());
|
||||
return xaccAccountLookup (&ld->leader, gnc_get_current_book());
|
||||
}
|
||||
|
||||
GNCLedgerDisplayType
|
||||
gnc_ledger_display_type (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_type (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return -1;
|
||||
@@ -118,7 +119,7 @@ gnc_ledger_display_type (GNCLedgerDisplay *ld)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, gpointer user_data)
|
||||
gnc_ledger_display_set_user_data (GNCLedgerDisplay* ld, gpointer user_data)
|
||||
{
|
||||
if (!ld)
|
||||
return;
|
||||
@@ -127,7 +128,7 @@ gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, gpointer user_data)
|
||||
}
|
||||
|
||||
gpointer
|
||||
gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_get_user_data (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@@ -136,7 +137,7 @@ gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
gnc_ledger_display_set_handlers (GNCLedgerDisplay* ld,
|
||||
GNCLedgerDisplayDestroy destroy,
|
||||
GNCLedgerDisplayGetParent get_parent)
|
||||
{
|
||||
@@ -147,8 +148,8 @@ gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
ld->get_parent = get_parent;
|
||||
}
|
||||
|
||||
SplitRegister *
|
||||
gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld)
|
||||
SplitRegister*
|
||||
gnc_ledger_display_get_split_register (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@@ -156,8 +157,8 @@ gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld)
|
||||
return ld->reg;
|
||||
}
|
||||
|
||||
Query *
|
||||
gnc_ledger_display_get_query (GNCLedgerDisplay *ld)
|
||||
Query*
|
||||
gnc_ledger_display_get_query (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@@ -168,8 +169,8 @@ gnc_ledger_display_get_query (GNCLedgerDisplay *ld)
|
||||
static gboolean
|
||||
find_by_leader (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
Account *account = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
Account* account = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!account || !ld)
|
||||
return FALSE;
|
||||
@@ -180,8 +181,8 @@ find_by_leader (gpointer find_data, gpointer user_data)
|
||||
static gboolean
|
||||
find_by_query (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
Query *q = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
Query* q = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!q || !ld)
|
||||
return FALSE;
|
||||
@@ -192,8 +193,8 @@ find_by_query (gpointer find_data, gpointer user_data)
|
||||
static gboolean
|
||||
find_by_reg (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
SplitRegister *reg = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
SplitRegister* reg = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!reg || !ld)
|
||||
return FALSE;
|
||||
@@ -217,13 +218,13 @@ gnc_get_default_register_style (GNCAccountType type)
|
||||
}
|
||||
|
||||
static gpointer
|
||||
look_for_portfolio_cb (Account *account, gpointer data)
|
||||
look_for_portfolio_cb (Account* account, gpointer data)
|
||||
{
|
||||
return xaccAccountIsPriced(account) ? (gpointer) PORTFOLIO_LEDGER : NULL;
|
||||
return xaccAccountIsPriced (account) ? (gpointer) PORTFOLIO_LEDGER : NULL;
|
||||
}
|
||||
|
||||
static SplitRegisterType
|
||||
gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
gnc_get_reg_type (Account* leader, GNCLedgerDisplayType ld_type)
|
||||
{
|
||||
GNCAccountType account_type;
|
||||
SplitRegisterType reg_type;
|
||||
@@ -305,7 +306,8 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
gpointer ret;
|
||||
reg_type = GENERAL_JOURNAL;
|
||||
|
||||
ret = gnc_account_foreach_descendant_until(leader, look_for_portfolio_cb, NULL);
|
||||
ret = gnc_account_foreach_descendant_until (leader, look_for_portfolio_cb,
|
||||
NULL);
|
||||
if (ret) reg_type = PORTFOLIO_LEDGER;
|
||||
break;
|
||||
}
|
||||
@@ -338,22 +340,23 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
/* Returns a boolean of whether this display should be single or double lined
|
||||
* mode by default */
|
||||
gboolean
|
||||
gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld)
|
||||
gnc_ledger_display_default_double_line (GNCLedgerDisplay* gld)
|
||||
{
|
||||
return (gld->use_double_line_default ||
|
||||
gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_DOUBLE_LINE_MODE));
|
||||
gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_DOUBLE_LINE_MODE));
|
||||
}
|
||||
|
||||
/* Opens up a register window to display a single account */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_simple (Account *account)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_simple (Account* account)
|
||||
{
|
||||
SplitRegisterType reg_type;
|
||||
GNCAccountType acc_type = xaccAccountGetType (account);
|
||||
gboolean use_double_line;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("account=%p", account);
|
||||
ENTER ("account=%p", account);
|
||||
|
||||
switch (acc_type)
|
||||
{
|
||||
@@ -369,43 +372,44 @@ gnc_ledger_display_simple (Account *account)
|
||||
reg_type = gnc_get_reg_type (account, LD_SINGLE);
|
||||
|
||||
ld = gnc_ledger_display_internal (account, NULL, LD_SINGLE, reg_type,
|
||||
gnc_get_default_register_style(acc_type),
|
||||
use_double_line, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
gnc_get_default_register_style (acc_type),
|
||||
use_double_line, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
/* Opens up a register window to display an account, and all of its
|
||||
* children, in the same window */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_subaccounts (Account *account)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_subaccounts (Account* account,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
SplitRegisterType reg_type;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("account=%p", account);
|
||||
ENTER ("account=%p", account);
|
||||
|
||||
reg_type = gnc_get_reg_type (account, LD_SUBACCOUNT);
|
||||
|
||||
ld = gnc_ledger_display_internal (account, NULL, LD_SUBACCOUNT,
|
||||
reg_type, REG_STYLE_JOURNAL, FALSE,
|
||||
FALSE);
|
||||
LEAVE("%p", ld);
|
||||
FALSE, mismatched_commodities);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
/* Opens up a general journal window. */
|
||||
GNCLedgerDisplay *
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_gl (void)
|
||||
{
|
||||
Query *query;
|
||||
Query* query;
|
||||
time64 start;
|
||||
struct tm tm;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER(" ");
|
||||
ENTER (" ");
|
||||
|
||||
query = qof_query_create_for(GNC_ID_SPLIT);
|
||||
query = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
qof_query_set_book (query, gnc_get_current_book());
|
||||
|
||||
@@ -416,21 +420,21 @@ gnc_ledger_display_gl (void)
|
||||
* See Gnome Bug 86302.
|
||||
* -- jsled */
|
||||
{
|
||||
Account *tRoot;
|
||||
GList *al;
|
||||
Account* tRoot;
|
||||
GList* al;
|
||||
|
||||
tRoot = gnc_book_get_template_root( gnc_get_current_book() );
|
||||
al = gnc_account_get_descendants( tRoot );
|
||||
tRoot = gnc_book_get_template_root (gnc_get_current_book());
|
||||
al = gnc_account_get_descendants (tRoot);
|
||||
|
||||
if (g_list_length(al) != 0)
|
||||
xaccQueryAddAccountMatch( query, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND );
|
||||
if (g_list_length (al) != 0)
|
||||
xaccQueryAddAccountMatch (query, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND);
|
||||
|
||||
g_list_free (al);
|
||||
al = NULL;
|
||||
tRoot = NULL;
|
||||
}
|
||||
|
||||
gnc_tm_get_today_start(&tm);
|
||||
gnc_tm_get_today_start (&tm);
|
||||
tm.tm_mon--; /* Default the register to the last month's worth of transactions. */
|
||||
start = gnc_mktime (&tm);
|
||||
xaccQueryAddDateMatchTT (query,
|
||||
@@ -439,8 +443,8 @@ gnc_ledger_display_gl (void)
|
||||
QOF_QUERY_AND);
|
||||
|
||||
ld = gnc_ledger_display_internal (NULL, query, LD_GL, GENERAL_JOURNAL,
|
||||
REG_STYLE_JOURNAL, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
REG_STYLE_JOURNAL, FALSE, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
@@ -452,31 +456,31 @@ gnc_ledger_display_gl (void)
|
||||
* scheduled transaction. That's right. The stringified GncGUID of the SX is
|
||||
* the name of the SX'es template account.
|
||||
**/
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_template_gl (char *id)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_template_gl (char* id)
|
||||
{
|
||||
QofBook *book;
|
||||
Query *q;
|
||||
GNCLedgerDisplay *ld;
|
||||
SplitRegister *sr;
|
||||
Account *root, *acct;
|
||||
QofBook* book;
|
||||
Query* q;
|
||||
GNCLedgerDisplay* ld;
|
||||
SplitRegister* sr;
|
||||
Account* root, *acct;
|
||||
gboolean isTemplateModeTrue;
|
||||
|
||||
ENTER("id=%s", id ? id : "(null)");
|
||||
ENTER ("id=%s", id ? id : "(null)");
|
||||
|
||||
acct = NULL;
|
||||
isTemplateModeTrue = TRUE;
|
||||
|
||||
q = qof_query_create_for(GNC_ID_SPLIT);
|
||||
q = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
book = gnc_get_current_book ();
|
||||
book = gnc_get_current_book();
|
||||
qof_query_set_book (q, book);
|
||||
|
||||
if ( id != NULL )
|
||||
if (id != NULL)
|
||||
{
|
||||
root = gnc_book_get_template_root (book);
|
||||
acct = gnc_account_lookup_by_name(root, id);
|
||||
g_assert( acct );
|
||||
acct = gnc_account_lookup_by_name (root, id);
|
||||
g_assert (acct);
|
||||
xaccQueryAddSingleAccountMatch (q, acct, QOF_QUERY_AND);
|
||||
}
|
||||
|
||||
@@ -484,41 +488,42 @@ gnc_ledger_display_template_gl (char *id)
|
||||
SEARCH_LEDGER,
|
||||
REG_STYLE_JOURNAL,
|
||||
FALSE,
|
||||
isTemplateModeTrue);
|
||||
isTemplateModeTrue,
|
||||
FALSE);
|
||||
|
||||
sr = gnc_ledger_display_get_split_register (ld);
|
||||
if ( acct )
|
||||
if (acct)
|
||||
{
|
||||
gnc_split_register_set_template_account (sr, acct);
|
||||
}
|
||||
|
||||
LEAVE("%p", ld);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gnc_ledger_display_get_parent( GNCLedgerDisplay *ld )
|
||||
GtkWidget*
|
||||
gnc_ledger_display_get_parent (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if ( ld == NULL )
|
||||
if (ld == NULL)
|
||||
return NULL;
|
||||
|
||||
if ( ld->get_parent == NULL )
|
||||
if (ld->get_parent == NULL)
|
||||
return NULL;
|
||||
|
||||
return ld->get_parent( ld );
|
||||
return ld->get_parent (ld);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gnc_ledger_display_parent (void *user_data)
|
||||
static GtkWidget*
|
||||
gnc_ledger_display_parent (void* user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
return gnc_ledger_display_get_parent( ld );
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
return gnc_ledger_display_get_parent (ld);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
gnc_ledger_display_set_watches (GNCLedgerDisplay* ld, GList* splits)
|
||||
{
|
||||
GList *node;
|
||||
GList* node;
|
||||
|
||||
gnc_gui_component_clear_watches (ld->component_id);
|
||||
|
||||
@@ -529,8 +534,8 @@ gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
|
||||
for (node = splits; node; node = node->next)
|
||||
{
|
||||
Split *split = node->data;
|
||||
Transaction *trans = xaccSplitGetParent (split);
|
||||
Split* split = node->data;
|
||||
Transaction* trans = xaccSplitGetParent (split);
|
||||
|
||||
gnc_gui_component_watch_entity (ld->component_id,
|
||||
xaccTransGetGUID (trans),
|
||||
@@ -539,18 +544,18 @@ gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
refresh_handler (GHashTable* changes, gpointer user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
const EventInfo *info;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
const EventInfo* info;
|
||||
gboolean has_leader;
|
||||
GList *splits;
|
||||
GList* splits;
|
||||
|
||||
ENTER("changes=%p, user_data=%p", changes, user_data);
|
||||
ENTER ("changes=%p, user_data=%p", changes, user_data);
|
||||
|
||||
if (ld->loading)
|
||||
{
|
||||
LEAVE("already loading");
|
||||
LEAVE ("already loading");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -558,11 +563,11 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
|
||||
if (has_leader)
|
||||
{
|
||||
Account *leader = gnc_ledger_display_leader (ld);
|
||||
Account* leader = gnc_ledger_display_leader (ld);
|
||||
if (!leader)
|
||||
{
|
||||
gnc_close_gui_component (ld->component_id);
|
||||
LEAVE("no leader");
|
||||
LEAVE ("no leader");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -573,7 +578,7 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
if (info && (info->event_mask & QOF_EVENT_DESTROY))
|
||||
{
|
||||
gnc_close_gui_component (ld->component_id);
|
||||
LEAVE("destroy");
|
||||
LEAVE ("destroy");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -582,13 +587,13 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
* of subaccounts, if not recreate the query. */
|
||||
if (ld->ld_type == LD_SUBACCOUNT)
|
||||
{
|
||||
Account *leader = gnc_ledger_display_leader (ld);
|
||||
GList *accounts = gnc_account_get_descendants (leader);
|
||||
Account* leader = gnc_ledger_display_leader (ld);
|
||||
GList* accounts = gnc_account_get_descendants (leader);
|
||||
|
||||
if (g_list_length (accounts) != ld->number_of_subaccounts)
|
||||
gnc_ledger_display_make_query (ld,
|
||||
gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS),
|
||||
gnc_get_reg_type (leader, ld->ld_type));
|
||||
gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS),
|
||||
gnc_get_reg_type (leader, ld->ld_type));
|
||||
|
||||
g_list_free (accounts);
|
||||
}
|
||||
@@ -603,13 +608,13 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
gnc_ledger_display_set_watches (ld, splits);
|
||||
|
||||
gnc_ledger_display_refresh_internal (ld, splits);
|
||||
LEAVE(" ");
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
static void
|
||||
close_handler (gpointer user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!ld)
|
||||
return;
|
||||
@@ -630,12 +635,12 @@ close_handler (gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
gnc_ledger_display_make_query (GNCLedgerDisplay* ld,
|
||||
gint limit,
|
||||
SplitRegisterType type)
|
||||
{
|
||||
Account *leader;
|
||||
GList *accounts;
|
||||
Account* leader;
|
||||
GList* accounts;
|
||||
|
||||
if (!ld)
|
||||
return;
|
||||
@@ -655,7 +660,7 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
}
|
||||
|
||||
qof_query_destroy (ld->query);
|
||||
ld->query = qof_query_create_for(GNC_ID_SPLIT);
|
||||
ld->query = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
/* This is a bit of a hack. The number of splits should be
|
||||
* configurable, or maybe we should go back a time range instead
|
||||
@@ -668,8 +673,8 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
|
||||
leader = gnc_ledger_display_leader (ld);
|
||||
|
||||
/* if this is a subaccount ledger, record the number of
|
||||
* subaccounts so we can determine if the query needs
|
||||
/* if this is a subaccount ledger, record the number of
|
||||
* subaccounts so we can determine if the query needs
|
||||
* recreating on a refresh. */
|
||||
if (ld->ld_type == LD_SUBACCOUNT)
|
||||
{
|
||||
@@ -688,32 +693,33 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
}
|
||||
|
||||
/* Opens up a ledger window for an arbitrary query. */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_query (Query *query, SplitRegisterType type,
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_query (Query* query, SplitRegisterType type,
|
||||
SplitRegisterStyle style)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("query=%p", query);
|
||||
ENTER ("query=%p", query);
|
||||
|
||||
ld = gnc_ledger_display_internal (NULL, query, LD_GL, type, style,
|
||||
FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
FALSE, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
static GNCLedgerDisplay *
|
||||
gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
static GNCLedgerDisplay*
|
||||
gnc_ledger_display_internal (Account* lead_account, Query* q,
|
||||
GNCLedgerDisplayType ld_type,
|
||||
SplitRegisterType reg_type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template )
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
gint limit;
|
||||
const char *klass;
|
||||
GList *splits;
|
||||
const char* klass;
|
||||
GList* splits;
|
||||
|
||||
switch (ld_type)
|
||||
{
|
||||
@@ -791,7 +797,8 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
ld->get_parent = NULL;
|
||||
ld->user_data = NULL;
|
||||
|
||||
limit = gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS);
|
||||
limit = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_MAX_TRANS);
|
||||
|
||||
/* set up the query filter */
|
||||
if (q)
|
||||
@@ -800,16 +807,17 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
gnc_ledger_display_make_query (ld, limit, reg_type);
|
||||
|
||||
ld->component_id = gnc_register_gui_component (klass,
|
||||
refresh_handler,
|
||||
close_handler, ld);
|
||||
refresh_handler,
|
||||
close_handler, ld);
|
||||
|
||||
/******************************************************************\
|
||||
* The main register window itself *
|
||||
\******************************************************************/
|
||||
|
||||
ld->use_double_line_default = use_double_line;
|
||||
|
||||
ld->reg = gnc_split_register_new (reg_type, style, use_double_line,
|
||||
is_template);
|
||||
is_template, mismatched_commodities);
|
||||
|
||||
gnc_split_register_set_data (ld->reg, ld, gnc_ledger_display_parent);
|
||||
|
||||
@@ -823,7 +831,7 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, Query *q)
|
||||
gnc_ledger_display_set_query (GNCLedgerDisplay* ledger_display, Query* q)
|
||||
{
|
||||
if (!ledger_display || !q)
|
||||
return;
|
||||
@@ -834,8 +842,8 @@ gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, Query *q)
|
||||
ledger_display->query = qof_query_copy (q);
|
||||
}
|
||||
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_find_by_query (Query *q)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_find_by_query (Query* q)
|
||||
{
|
||||
if (!q)
|
||||
return NULL;
|
||||
@@ -848,7 +856,7 @@ gnc_ledger_display_find_by_query (Query *q)
|
||||
\********************************************************************/
|
||||
|
||||
static void
|
||||
gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld, GList *splits)
|
||||
gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld, GList* splits)
|
||||
{
|
||||
if (!ld || ld->loading)
|
||||
return;
|
||||
@@ -865,30 +873,30 @@ gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld, GList *splits)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_refresh (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_refresh (GNCLedgerDisplay* ld)
|
||||
{
|
||||
ENTER("ld=%p", ld);
|
||||
ENTER ("ld=%p", ld);
|
||||
|
||||
if (!ld)
|
||||
{
|
||||
LEAVE("no display");
|
||||
LEAVE ("no display");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ld->loading)
|
||||
{
|
||||
LEAVE("already loading");
|
||||
LEAVE ("already loading");
|
||||
return;
|
||||
}
|
||||
|
||||
gnc_ledger_display_refresh_internal (ld, qof_query_run (ld->query));
|
||||
LEAVE(" ");
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
gnc_ledger_display_refresh_by_split_register (SplitRegister* reg)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
if (!reg)
|
||||
return;
|
||||
@@ -918,7 +926,7 @@ gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
}
|
||||
|
||||
ld = gnc_find_first_gui_component (REGISTER_TEMPLATE_CM_CLASS,
|
||||
find_by_reg, reg );
|
||||
find_by_reg, reg);
|
||||
if (ld)
|
||||
{
|
||||
gnc_ledger_display_refresh (ld);
|
||||
@@ -926,7 +934,7 @@ gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_close (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_close (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return;
|
||||
|
||||
@@ -46,10 +46,10 @@
|
||||
* displaying the results of a Query. It also stores the Query. */
|
||||
typedef struct gnc_ledger_display GNCLedgerDisplay;
|
||||
|
||||
typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld);
|
||||
typedef GtkWidget *(*GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld);
|
||||
typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld,
|
||||
const char *help_str);
|
||||
typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay* ld);
|
||||
typedef GtkWidget* (*GNCLedgerDisplayGetParent) (GNCLedgerDisplay* ld);
|
||||
typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay* ld,
|
||||
const char* help_str);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -60,35 +60,36 @@ typedef enum
|
||||
|
||||
|
||||
/** returns the 'lead' account of a ledger display, or NULL if none. */
|
||||
Account * gnc_ledger_display_leader (GNCLedgerDisplay *ld);
|
||||
Account* gnc_ledger_display_leader (GNCLedgerDisplay* ld);
|
||||
|
||||
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld);
|
||||
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay* ld);
|
||||
|
||||
/** get and set the user data associated with the ledger */
|
||||
void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld,
|
||||
void gnc_ledger_display_set_user_data (GNCLedgerDisplay* ld,
|
||||
gpointer user_data);
|
||||
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld);
|
||||
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay* ld);
|
||||
|
||||
/** set the handlers used by the ledger display */
|
||||
void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
void gnc_ledger_display_set_handlers (GNCLedgerDisplay* ld,
|
||||
GNCLedgerDisplayDestroy destroy,
|
||||
GNCLedgerDisplayGetParent get_parent);
|
||||
|
||||
/** Returns the parent of a given ledger display */
|
||||
GtkWidget *gnc_ledger_display_get_parent( GNCLedgerDisplay *ld );
|
||||
GtkWidget* gnc_ledger_display_get_parent (GNCLedgerDisplay* ld);
|
||||
|
||||
/** return the split register associated with a ledger display */
|
||||
SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld);
|
||||
SplitRegister* gnc_ledger_display_get_split_register (GNCLedgerDisplay* ld);
|
||||
|
||||
/** opens up a register window to display a single account */
|
||||
GNCLedgerDisplay * gnc_ledger_display_simple (Account *account);
|
||||
GNCLedgerDisplay* gnc_ledger_display_simple (Account* account);
|
||||
|
||||
/** opens up a register window to display the parent account and all of
|
||||
* its children. */
|
||||
GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account);
|
||||
GNCLedgerDisplay* gnc_ledger_display_subaccounts (Account* account,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
/** opens up a general ledger window */
|
||||
GNCLedgerDisplay * gnc_ledger_display_gl (void);
|
||||
GNCLedgerDisplay* gnc_ledger_display_gl (void);
|
||||
|
||||
/**
|
||||
* Displays a template ledger.
|
||||
@@ -97,34 +98,34 @@ GNCLedgerDisplay * gnc_ledger_display_gl (void);
|
||||
* Really, requires a GList of scheduled transactions and kvp-frame
|
||||
* data.
|
||||
**/
|
||||
GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id);
|
||||
GNCLedgerDisplay* gnc_ledger_display_template_gl (char* id);
|
||||
|
||||
/** display a general ledger for an arbitrary query */
|
||||
GNCLedgerDisplay * gnc_ledger_display_query (Query *query,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style);
|
||||
GNCLedgerDisplay* gnc_ledger_display_query (Query* query,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style);
|
||||
|
||||
/** Set the query used for a register. */
|
||||
void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display,
|
||||
Query *q);
|
||||
void gnc_ledger_display_set_query (GNCLedgerDisplay* ledger_display,
|
||||
Query* q);
|
||||
|
||||
/** return the query associated with a ledger */
|
||||
Query * gnc_ledger_display_get_query (GNCLedgerDisplay *ld);
|
||||
Query* gnc_ledger_display_get_query (GNCLedgerDisplay* ld);
|
||||
|
||||
/** If the given ledger display still exists, return it. Otherwise,
|
||||
* return NULL */
|
||||
GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q);
|
||||
GNCLedgerDisplay* gnc_ledger_display_find_by_query (Query* q);
|
||||
|
||||
/** redisplay/redraw only the indicated window. Both routines do same
|
||||
* thing, they differ only by the argument they take. */
|
||||
void gnc_ledger_display_refresh (GNCLedgerDisplay * ledger_display);
|
||||
void gnc_ledger_display_refresh_by_split_register (SplitRegister *reg);
|
||||
void gnc_ledger_display_refresh (GNCLedgerDisplay* ledger_display);
|
||||
void gnc_ledger_display_refresh_by_split_register (SplitRegister* reg);
|
||||
|
||||
/** close the window */
|
||||
void gnc_ledger_display_close (GNCLedgerDisplay * ledger_display);
|
||||
void gnc_ledger_display_close (GNCLedgerDisplay* ledger_display);
|
||||
|
||||
/** Returns a boolean of whether this display should be single or double lined
|
||||
* mode by default */
|
||||
gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld);
|
||||
gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay* gld);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -93,7 +93,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
SplitRegisterType2 reg_type,
|
||||
SplitRegisterStyle2 style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
static void gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits);
|
||||
|
||||
@@ -373,7 +374,7 @@ gnc_ledger_display2_simple (Account *account)
|
||||
|
||||
ld = gnc_ledger_display2_internal (account, NULL, LD2_SINGLE, reg_type,
|
||||
gnc_get_default_register_style(acc_type),
|
||||
use_double_line, FALSE);
|
||||
use_double_line, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@@ -381,7 +382,7 @@ gnc_ledger_display2_simple (Account *account)
|
||||
/* Opens up a register window to display an account, and all of its
|
||||
* children, in the same window */
|
||||
GNCLedgerDisplay2 *
|
||||
gnc_ledger_display2_subaccounts (Account *account)
|
||||
gnc_ledger_display2_subaccounts (Account *account, gboolean mismatched_commodities)
|
||||
{
|
||||
SplitRegisterType2 reg_type;
|
||||
GNCLedgerDisplay2 *ld;
|
||||
@@ -392,7 +393,7 @@ gnc_ledger_display2_subaccounts (Account *account)
|
||||
|
||||
ld = gnc_ledger_display2_internal (account, NULL, LD2_SUBACCOUNT,
|
||||
reg_type, REG2_STYLE_JOURNAL, FALSE,
|
||||
FALSE);
|
||||
FALSE,mismatched_commodities);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@@ -442,7 +443,7 @@ gnc_ledger_display2_gl (void)
|
||||
QOF_QUERY_AND);
|
||||
|
||||
ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, GENERAL_JOURNAL2,
|
||||
REG2_STYLE_JOURNAL, FALSE, FALSE);
|
||||
REG2_STYLE_JOURNAL, FALSE, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@@ -487,7 +488,8 @@ gnc_ledger_display2_template_gl (char *id)
|
||||
SEARCH_LEDGER2,
|
||||
REG2_STYLE_JOURNAL,
|
||||
FALSE,
|
||||
isTemplateModeTrue);
|
||||
isTemplateModeTrue,
|
||||
FALSE);
|
||||
|
||||
|
||||
model = gnc_ledger_display2_get_split_model_register (ld);
|
||||
@@ -689,7 +691,7 @@ gnc_ledger_display2_query (Query *query, SplitRegisterType2 type,
|
||||
ENTER("query=%p", query);
|
||||
|
||||
ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, type, style,
|
||||
FALSE, FALSE);
|
||||
FALSE, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@@ -700,7 +702,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
SplitRegisterType2 reg_type,
|
||||
SplitRegisterStyle2 style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template )
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
GNCLedgerDisplay2 *ld;
|
||||
gint limit;
|
||||
@@ -806,7 +809,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
|
||||
ld->use_double_line_default = use_double_line;
|
||||
|
||||
ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template);
|
||||
// JEAN: add mismatched_commodities
|
||||
ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template, mismatched_commodities);
|
||||
|
||||
gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);
|
||||
gnc_tree_model_split_reg_set_display (ld->model, display_subaccounts, is_gl);
|
||||
|
||||
@@ -99,7 +99,7 @@ GNCLedgerDisplay2 * gnc_ledger_display2_simple (Account *account);
|
||||
|
||||
/** opens up a register window to display the parent account and all of
|
||||
* its children. */
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account);
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account, gboolean mismatched_commodities);
|
||||
|
||||
/** opens up a general ledger window */
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
|
||||
|
||||
@@ -35,15 +35,15 @@ static QofLogModule log_module = GNC_MOD_REGISTER;
|
||||
|
||||
|
||||
static void
|
||||
gnc_register_add_cell (TableLayout *layout,
|
||||
const char *cell_name,
|
||||
const char *cell_type_name,
|
||||
const char *sample_text,
|
||||
gnc_register_add_cell (TableLayout* layout,
|
||||
const char* cell_name,
|
||||
const char* cell_type_name,
|
||||
const char* sample_text,
|
||||
CellAlignment alignment,
|
||||
gboolean expandable,
|
||||
gboolean span)
|
||||
{
|
||||
BasicCell *cell;
|
||||
BasicCell* cell;
|
||||
|
||||
g_return_if_fail (layout != NULL);
|
||||
g_return_if_fail (cell_type_name != NULL);
|
||||
@@ -61,13 +61,13 @@ gnc_register_add_cell (TableLayout *layout,
|
||||
}
|
||||
|
||||
static void
|
||||
copy_cursor_row (TableLayout *layout, CellBlock *to, CellBlock *from, int row)
|
||||
copy_cursor_row (TableLayout* layout, CellBlock* to, CellBlock* from, int row)
|
||||
{
|
||||
int col;
|
||||
|
||||
for (col = 0; col < from->num_cols; col++)
|
||||
{
|
||||
BasicCell *cell;
|
||||
BasicCell* cell;
|
||||
|
||||
cell = gnc_cellblock_get_cell (from, row, col);
|
||||
if (!cell || !cell->cell_name)
|
||||
@@ -78,10 +78,10 @@ copy_cursor_row (TableLayout *layout, CellBlock *to, CellBlock *from, int row)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
gnc_split_register_set_cells (SplitRegister* reg, TableLayout* layout)
|
||||
{
|
||||
CellBlock *curs;
|
||||
CellBlock *curs_last;
|
||||
CellBlock* curs;
|
||||
CellBlock* curs_last;
|
||||
|
||||
switch (reg->type)
|
||||
{
|
||||
@@ -291,8 +291,16 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 5);
|
||||
gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 6);
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
if (!reg->mismatched_commodities)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't display the balance if there are mismatched commodities
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
}
|
||||
}
|
||||
|
||||
curs_last = curs;
|
||||
@@ -328,8 +336,16 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
else
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
if (!reg->mismatched_commodities)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't display the balance if there are mismatched commodities
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
}
|
||||
}
|
||||
|
||||
curs_last = curs;
|
||||
@@ -549,10 +565,10 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
TableLayout *layout)
|
||||
gnc_split_register_layout_add_cursors (SplitRegister* reg,
|
||||
TableLayout* layout)
|
||||
{
|
||||
CellBlock *cursor;
|
||||
CellBlock* cursor;
|
||||
int num_cols;
|
||||
|
||||
switch (reg->type)
|
||||
@@ -577,7 +593,7 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
case INCOME_LEDGER:
|
||||
case GENERAL_JOURNAL:
|
||||
case SEARCH_LEDGER:
|
||||
if (reg->is_template)
|
||||
if (reg->is_template || reg->mismatched_commodities)
|
||||
num_cols = 8;
|
||||
else
|
||||
num_cols = 9;
|
||||
@@ -593,7 +609,7 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
break;
|
||||
|
||||
default:
|
||||
PERR("Bad register type");
|
||||
PERR ("Bad register type");
|
||||
g_assert (FALSE);
|
||||
return;
|
||||
}
|
||||
@@ -628,8 +644,8 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
TableLayout *layout)
|
||||
gnc_split_register_layout_add_cells (SplitRegister* reg,
|
||||
TableLayout* layout)
|
||||
{
|
||||
gnc_register_add_cell (layout,
|
||||
DATE_CELL,
|
||||
@@ -637,7 +653,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
/* Translators: The 'sample:' items are
|
||||
strings which are not displayed, but only
|
||||
used to estimate widths. */
|
||||
C_("sample", "22/02/2000"),
|
||||
C_ ("sample", "22/02/2000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -645,7 +661,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DDUE_CELL,
|
||||
DATE_CELL_TYPE_NAME,
|
||||
C_("sample", "22/02/2000"),
|
||||
C_ ("sample", "22/02/2000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -656,7 +672,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
/* Translators: The 'sample' items are
|
||||
strings which are not displayed, but only
|
||||
used to estimate widths. */
|
||||
C_("sample", "99999"),
|
||||
C_ ("sample", "99999"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -664,7 +680,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TNUM_CELL,
|
||||
BASIC_CELL_TYPE_NAME,
|
||||
C_("sample", "99999"),
|
||||
C_ ("sample", "99999"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -672,7 +688,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DESC_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Description of a transaction"),
|
||||
C_ ("sample", "Description of a transaction"),
|
||||
CELL_ALIGN_LEFT,
|
||||
TRUE,
|
||||
FALSE);
|
||||
@@ -688,7 +704,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
RECN_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Reconciled'", "R"),
|
||||
C_ ("Column header for 'Reconciled'", "R"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -696,7 +712,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
ASSOC_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Associate'", "A"),
|
||||
C_ ("Column header for 'Associate'", "A"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -704,7 +720,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
BALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -712,7 +728,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
XFRM_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
_("Transfer"),
|
||||
_ ("Transfer"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -720,7 +736,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
MXFRM_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
C_("sample", "Expenses:Automobile:Gasoline"),
|
||||
C_ ("sample", "Expenses:Automobile:Gasoline"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -728,7 +744,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
ACTN_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
C_("sample", "Expenses:Automobile:Gasoline"),
|
||||
C_ ("sample", "Expenses:Automobile:Gasoline"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -736,7 +752,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
MEMO_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Memo field sample text string"),
|
||||
C_ ("sample", "Memo field sample text string"),
|
||||
CELL_ALIGN_LEFT,
|
||||
TRUE,
|
||||
FALSE);
|
||||
@@ -744,7 +760,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DEBT_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -752,7 +768,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
CRED_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -760,7 +776,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
SHRS_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -770,7 +786,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
PRIC_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -778,7 +794,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TDEBT_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -786,7 +802,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TCRED_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -794,7 +810,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TSHRS_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -802,7 +818,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TBALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -810,7 +826,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TYPE_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Type'", "T"),
|
||||
C_ ("Column header for 'Type'", "T"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -818,7 +834,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
NOTES_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Notes field sample text string"),
|
||||
C_ ("sample", "Notes field sample text string"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
TRUE);
|
||||
@@ -826,7 +842,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
VNOTES_CELL,
|
||||
BASIC_CELL_TYPE_NAME,
|
||||
C_("sample", "No Particular Reason"),
|
||||
C_ ("sample", "No Particular Reason"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
TRUE);
|
||||
@@ -834,7 +850,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
FCRED_CELL,
|
||||
FORMULA_CELL_TYPE_NAME,
|
||||
C_("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
C_ ("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -842,7 +858,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
FDEBT_CELL,
|
||||
FORMULA_CELL_TYPE_NAME,
|
||||
C_("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
C_ ("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@@ -850,19 +866,19 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
RBALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
}
|
||||
|
||||
TableLayout *
|
||||
gnc_split_register_layout_new (SplitRegister *reg)
|
||||
TableLayout*
|
||||
gnc_split_register_layout_new (SplitRegister* reg)
|
||||
{
|
||||
TableLayout *layout;
|
||||
TableLayout* layout;
|
||||
|
||||
layout = gnc_table_layout_new ();
|
||||
layout = gnc_table_layout_new();
|
||||
|
||||
gnc_split_register_layout_add_cells (reg, layout);
|
||||
gnc_split_register_layout_add_cursors (reg, layout);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -240,7 +240,7 @@ typedef struct sr_info SRInfo;
|
||||
/** @brief The type, style and table for the register. */
|
||||
struct split_register
|
||||
{
|
||||
Table * table; /**< The table itself that implements the underlying GUI. */
|
||||
Table* table; /**< The table itself that implements the underlying GUI. */
|
||||
|
||||
SplitRegisterType type;
|
||||
SplitRegisterStyle style;
|
||||
@@ -254,14 +254,17 @@ struct split_register
|
||||
|
||||
gboolean is_template;
|
||||
gboolean do_auto_complete; /**< whether to use auto-completion */
|
||||
gboolean mismatched_commodities; /**< indicates the register includes transactions in
|
||||
mismatched commodities */
|
||||
|
||||
SplitList *unrecn_splits; /**< list of splits to unreconcile after transaction edit */
|
||||
SplitList*
|
||||
unrecn_splits; /**< list of splits to unreconcile after transaction edit */
|
||||
|
||||
SRInfo * sr_info; /**< private data; outsiders should not access this */
|
||||
SRInfo* sr_info; /**< private data; outsiders should not access this */
|
||||
};
|
||||
|
||||
/** Callback function type */
|
||||
typedef GtkWidget *(*SRGetParentCallback) (gpointer user_data);
|
||||
typedef GtkWidget* (*SRGetParentCallback) (gpointer user_data);
|
||||
|
||||
|
||||
/* Prototypes ******************************************************/
|
||||
@@ -279,16 +282,17 @@ typedef GtkWidget *(*SRGetParentCallback) (gpointer user_data);
|
||||
*
|
||||
* @return a newly created ::SplitRegister
|
||||
*/
|
||||
SplitRegister * gnc_split_register_new (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
SplitRegister* gnc_split_register_new (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
/** Destroys a split register.
|
||||
*
|
||||
* @param reg a ::SplitRegister
|
||||
*/
|
||||
void gnc_split_register_destroy (SplitRegister *reg);
|
||||
void gnc_split_register_destroy (SplitRegister* reg);
|
||||
|
||||
/** Sets a split register's type, style or line use.
|
||||
*
|
||||
@@ -301,7 +305,7 @@ void gnc_split_register_destroy (SplitRegister *reg);
|
||||
* @param use_double_line @c TRUE to show two lines for transactions,
|
||||
* @c FALSE for one
|
||||
*/
|
||||
void gnc_split_register_config (SplitRegister *reg,
|
||||
void gnc_split_register_config (SplitRegister* reg,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line);
|
||||
@@ -312,8 +316,8 @@ void gnc_split_register_config (SplitRegister *reg,
|
||||
*
|
||||
* @param do_auto_complete @c TRUE to use auto-completion, @c FALSE otherwise
|
||||
*/
|
||||
void gnc_split_register_set_auto_complete(SplitRegister *reg,
|
||||
gboolean do_auto_complete);
|
||||
void gnc_split_register_set_auto_complete (SplitRegister* reg,
|
||||
gboolean do_auto_complete);
|
||||
|
||||
/** Sets whether a register window is "read only".
|
||||
*
|
||||
@@ -321,7 +325,7 @@ void gnc_split_register_set_auto_complete(SplitRegister *reg,
|
||||
*
|
||||
* @param read_only @c TRUE to use "read only" mode, @c FALSE otherwise
|
||||
*/
|
||||
void gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only);
|
||||
void gnc_split_register_set_read_only (SplitRegister* reg, gboolean read_only);
|
||||
|
||||
|
||||
/** Set the template account for use in a template register.
|
||||
@@ -330,11 +334,11 @@ void gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only);
|
||||
*
|
||||
* @param template_account the account to use for the template
|
||||
*/
|
||||
void gnc_split_register_set_template_account (SplitRegister *reg,
|
||||
Account *template_account);
|
||||
void gnc_split_register_set_template_account (SplitRegister* reg,
|
||||
Account* template_account);
|
||||
|
||||
/** Sets the user data and callback hooks for the register. */
|
||||
void gnc_split_register_set_data (SplitRegister *reg, gpointer user_data,
|
||||
void gnc_split_register_set_data (SplitRegister* reg, gpointer user_data,
|
||||
SRGetParentCallback get_parent);
|
||||
|
||||
/** Returns the class of a register's current cursor.
|
||||
@@ -343,7 +347,7 @@ void gnc_split_register_set_data (SplitRegister *reg, gpointer user_data,
|
||||
*
|
||||
* @return the ::CursorClass of the current cursor
|
||||
*/
|
||||
CursorClass gnc_split_register_get_current_cursor_class (SplitRegister *reg);
|
||||
CursorClass gnc_split_register_get_current_cursor_class (SplitRegister* reg);
|
||||
|
||||
/** Returns the class of the cursor at the given virtual cell location.
|
||||
*
|
||||
@@ -354,7 +358,7 @@ CursorClass gnc_split_register_get_current_cursor_class (SplitRegister *reg);
|
||||
* @return the ::CursorClass of the cursor at @a vcell_loc
|
||||
*/
|
||||
CursorClass gnc_split_register_get_cursor_class
|
||||
(SplitRegister *reg,
|
||||
(SplitRegister* reg,
|
||||
VirtualCellLocation vcell_loc);
|
||||
|
||||
/** Gets the transaction at the current cursor location, which may be on
|
||||
@@ -364,7 +368,7 @@ CursorClass gnc_split_register_get_cursor_class
|
||||
*
|
||||
* @return the ::Transaction at the cursor location, or @c NULL
|
||||
*/
|
||||
Transaction * gnc_split_register_get_current_trans (SplitRegister *reg);
|
||||
Transaction* gnc_split_register_get_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Gets the anchoring split of the transaction at the current cursor location,
|
||||
* which may be on the transaction itself or on any of its splits.
|
||||
@@ -376,9 +380,9 @@ Transaction * gnc_split_register_get_current_trans (SplitRegister *reg);
|
||||
*
|
||||
* @return the anchoring ::Split of the transaction
|
||||
*/
|
||||
Split *
|
||||
gnc_split_register_get_current_trans_split (SplitRegister *reg,
|
||||
VirtualCellLocation *vcell_loc);
|
||||
Split*
|
||||
gnc_split_register_get_current_trans_split (SplitRegister* reg,
|
||||
VirtualCellLocation* vcell_loc);
|
||||
|
||||
/** Returns the split at which the cursor is currently located.
|
||||
*
|
||||
@@ -387,7 +391,7 @@ gnc_split_register_get_current_trans_split (SplitRegister *reg,
|
||||
* @return the ::Split at the cursor location, or the anchoring split
|
||||
* if the cursor is currently on a transaction
|
||||
*/
|
||||
Split * gnc_split_register_get_current_split (SplitRegister *reg);
|
||||
Split* gnc_split_register_get_current_split (SplitRegister* reg);
|
||||
|
||||
/** Gets the blank split for a register.
|
||||
*
|
||||
@@ -396,7 +400,7 @@ Split * gnc_split_register_get_current_split (SplitRegister *reg);
|
||||
* @return the ::Split used as the blank split, or @c NULL if
|
||||
* there currently isn't one
|
||||
*/
|
||||
Split * gnc_split_register_get_blank_split (SplitRegister *reg);
|
||||
Split* gnc_split_register_get_blank_split (SplitRegister* reg);
|
||||
|
||||
/** Searches the split register for a given split.
|
||||
* The search begins from the bottom row and works backwards. The location
|
||||
@@ -413,8 +417,8 @@ Split * gnc_split_register_get_blank_split (SplitRegister *reg);
|
||||
* at @a vcell_loc, @c FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
|
||||
VirtualCellLocation *vcell_loc);
|
||||
gnc_split_register_get_split_virt_loc (SplitRegister* reg, Split* split,
|
||||
VirtualCellLocation* vcell_loc);
|
||||
|
||||
/** Searches the split register for the given split and determines the
|
||||
* location of either its credit (if non-zero) or debit cell.
|
||||
@@ -429,58 +433,59 @@ gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
|
||||
* at @a virt_loc, @c FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_get_split_amount_virt_loc (SplitRegister *reg, Split *split,
|
||||
VirtualLocation *virt_loc);
|
||||
gnc_split_register_get_split_amount_virt_loc (SplitRegister* reg, Split* split,
|
||||
VirtualLocation* virt_loc);
|
||||
|
||||
/** Duplicates either the current transaction or the current split
|
||||
* depending on the register mode and cursor position. Returns the
|
||||
* split just created, or the 'main' split of the transaction just
|
||||
* created, or NULL if nothing happened. */
|
||||
Split * gnc_split_register_duplicate_current (SplitRegister *reg);
|
||||
Split* gnc_split_register_duplicate_current (SplitRegister* reg);
|
||||
|
||||
/** Makes a copy of the current entity, either a split or a
|
||||
* transaction, so that it can be pasted later. */
|
||||
void gnc_split_register_copy_current (SplitRegister *reg);
|
||||
void gnc_split_register_copy_current (SplitRegister* reg);
|
||||
|
||||
/** Equivalent to copying the current entity and the deleting it with
|
||||
* the appropriate delete method. */
|
||||
void gnc_split_register_cut_current (SplitRegister *reg);
|
||||
void gnc_split_register_cut_current (SplitRegister* reg);
|
||||
|
||||
/** Pastes a previous copied entity onto the current entity, but only
|
||||
* if the copied and current entity have the same type. */
|
||||
void gnc_split_register_paste_current (SplitRegister *reg);
|
||||
void gnc_split_register_paste_current (SplitRegister* reg);
|
||||
|
||||
/** Deletes the split associated with the current cursor, if both are
|
||||
* non-NULL. Deleting the blank split just clears cursor values. */
|
||||
void gnc_split_register_delete_current_split (SplitRegister *reg);
|
||||
void gnc_split_register_delete_current_split (SplitRegister* reg);
|
||||
|
||||
/** Deletes the transaction associated with the current cursor, if both
|
||||
* are non-NULL. */
|
||||
void gnc_split_register_delete_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_delete_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Voids the transaction associated with the current cursor, if
|
||||
* non-NULL. */
|
||||
void gnc_split_register_void_current_trans (SplitRegister *reg,
|
||||
const char *reason);
|
||||
void gnc_split_register_void_current_trans (SplitRegister* reg,
|
||||
const char* reason);
|
||||
|
||||
/** Unvoids the transaction associated with the current cursor, if
|
||||
* non-NULL. */
|
||||
void gnc_split_register_unvoid_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_unvoid_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Deletes the non-transaction splits associated with the current
|
||||
* cursor, if both are non-NULL. */
|
||||
void gnc_split_register_empty_current_trans_except_split (SplitRegister *reg, Split *split);
|
||||
void gnc_split_register_empty_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_empty_current_trans_except_split (SplitRegister* reg,
|
||||
Split* split);
|
||||
void gnc_split_register_empty_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Cancels any changes made to the current cursor, reloads the cursor
|
||||
* from the engine, reloads the table from the cursor, and updates
|
||||
* the GUI. The change flags are cleared. */
|
||||
void gnc_split_register_cancel_cursor_split_changes (SplitRegister *reg);
|
||||
void gnc_split_register_cancel_cursor_split_changes (SplitRegister* reg);
|
||||
|
||||
/** Cancels any changes made to the current pending transaction,
|
||||
* reloads the table from the engine, and updates the GUI. The
|
||||
* change flags are cleared. */
|
||||
void gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg);
|
||||
void gnc_split_register_cancel_cursor_trans_changes (SplitRegister* reg);
|
||||
|
||||
/** Populates the rows of a register.
|
||||
*
|
||||
@@ -499,8 +504,8 @@ void gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg);
|
||||
*
|
||||
* @param default_account an account to provide defaults for the blank split
|
||||
*/
|
||||
void gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
Account *default_account);
|
||||
void gnc_split_register_load (SplitRegister* reg, GList* slist,
|
||||
Account* default_account);
|
||||
|
||||
/** Copy the contents of the current cursor to a split. The split and
|
||||
* transaction that are updated are the ones associated with the
|
||||
@@ -509,56 +514,57 @@ void gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
* blank transaction, and the do_commit flag is set, a refresh will
|
||||
* result in a new blank transaction. The method returns TRUE if
|
||||
* something was changed. */
|
||||
gboolean gnc_split_register_save (SplitRegister *reg, gboolean do_commit);
|
||||
gboolean gnc_split_register_save (SplitRegister* reg, gboolean do_commit);
|
||||
|
||||
/** Causes a redraw of the register window associated with reg. */
|
||||
void gnc_split_register_redraw (SplitRegister *reg);
|
||||
void gnc_split_register_redraw (SplitRegister* reg);
|
||||
|
||||
/** Returns TRUE if the register has changed cells. */
|
||||
gboolean gnc_split_register_changed (SplitRegister *reg);
|
||||
gboolean gnc_split_register_changed (SplitRegister* reg);
|
||||
|
||||
/** If TRUE, visually indicate the demarcation between splits with post
|
||||
* dates prior to the present, and after. This will only make sense if
|
||||
* the splits are ordered primarily by post date. */
|
||||
void gnc_split_register_show_present_divider (SplitRegister *reg,
|
||||
gboolean show_present);
|
||||
void gnc_split_register_show_present_divider (SplitRegister* reg,
|
||||
gboolean show_present);
|
||||
|
||||
/** Expand the current transaction if it is collapsed. */
|
||||
void gnc_split_register_expand_current_trans (SplitRegister *reg,
|
||||
gboolean expand);
|
||||
void gnc_split_register_expand_current_trans (SplitRegister* reg,
|
||||
gboolean expand);
|
||||
|
||||
/** Mark the current transaction as collapsed, and do callbacks. */
|
||||
void gnc_split_register_collapse_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_collapse_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Return TRUE if current trans is expanded and style is REG_STYLE_LEDGER. */
|
||||
gboolean gnc_split_register_current_trans_expanded (SplitRegister *reg);
|
||||
gboolean gnc_split_register_current_trans_expanded (SplitRegister* reg);
|
||||
|
||||
/** Return the debit string used in the register. */
|
||||
const char * gnc_split_register_get_debit_string (SplitRegister *reg);
|
||||
const char* gnc_split_register_get_debit_string (SplitRegister* reg);
|
||||
|
||||
/** Return the credit string used in the register. */
|
||||
const char * gnc_split_register_get_credit_string (SplitRegister *reg);
|
||||
const char* gnc_split_register_get_credit_string (SplitRegister* reg);
|
||||
|
||||
/** Return TRUE if split is the blank_split. */
|
||||
gboolean gnc_split_register_is_blank_split (SplitRegister *reg, Split *split);
|
||||
gboolean gnc_split_register_is_blank_split (SplitRegister* reg, Split* split);
|
||||
|
||||
/** Change the blank_split reference from pointing to split to another
|
||||
* split of the transaction. This is used when deleting a split after an
|
||||
* autocomplete as the blank_split reference will be pointing to one of
|
||||
* the splits so it does not cancel the whole transaction */
|
||||
void gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split);
|
||||
void gnc_split_register_change_blank_split_ref (SplitRegister* reg,
|
||||
Split* split);
|
||||
|
||||
/** Pop up the exchange-rate dialog, maybe, for the current split.
|
||||
* If force_dialog is TRUE, the forces the dialog to to be called.
|
||||
* If force_dialog is TRUE, the forces the dialog to be called.
|
||||
* If the dialog does not complete successfully, then return TRUE.
|
||||
* Return FALSE in all other cases (meaning "move on")
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog);
|
||||
gnc_split_register_handle_exchange (SplitRegister* reg, gboolean force_dialog);
|
||||
|
||||
/* returns TRUE if begin_edit was aborted */
|
||||
gboolean
|
||||
gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans);
|
||||
gnc_split_register_begin_edit_or_warn (SRInfo* info, Transaction* trans);
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
@@ -566,10 +572,10 @@ gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans);
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
/** Private function -- outsiders must not use this */
|
||||
gboolean gnc_split_register_full_refresh_ok (SplitRegister *reg);
|
||||
gboolean gnc_split_register_full_refresh_ok (SplitRegister* reg);
|
||||
|
||||
/** Private function -- outsiders must not use this */
|
||||
void gnc_copy_trans_onto_trans (Transaction *from, Transaction *to,
|
||||
void gnc_copy_trans_onto_trans (Transaction* from, Transaction* to,
|
||||
gboolean use_cut_semantics,
|
||||
gboolean do_commit);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* numcell.c -- number handling cell incl. accelarator key support *
|
||||
* numcell.c -- number handling cell incl. accelerator key support *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* numcell.h -- number handling cell incl. accelarator key support *
|
||||
* numcell.h -- number handling cell incl. accelerator key support *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
||||
@@ -1022,7 +1022,7 @@ gnc_table_virtual_loc_valid(Table *table,
|
||||
return FALSE;
|
||||
|
||||
/* verify that offsets are valid. This may occur if the app that is
|
||||
* using the table has a paritally initialized cursor. (probably due
|
||||
* using the table has a partially initialized cursor. (probably due
|
||||
* to a programming error, but maybe they meant to do this). */
|
||||
if ((0 > virt_loc.phys_row_offset) || (0 > virt_loc.phys_col_offset))
|
||||
return FALSE;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
(string-append "<span class=\"foreign\">" item "</span>"))
|
||||
|
||||
;; Convert any x into something printable as HTML
|
||||
(define-public (dump x) (escape-html (object->string x)))
|
||||
(define-public (dump x) (gnc:html-string-sanitize (object->string x)))
|
||||
; ddump does the display as well -- for use in eguile reports
|
||||
; where anything 'display'ed becomes part of the report
|
||||
(define-public (ddump x) (display (dump x)))
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
(define-public safe-cadr
|
||||
(match-lambda
|
||||
((_ x . _) x)
|
||||
((_ x . y) x)
|
||||
(_ '())))
|
||||
|
||||
; deprecated - use find-stylesheet or find-template instead
|
||||
|
||||
@@ -803,7 +803,7 @@ also show overall period profit & loss."))
|
||||
|
||||
;; this function will convert the monetary found at col-idx
|
||||
;; into report-currency if the latter exists. The price
|
||||
;; applicable the the col-idx column is used. If the monetary
|
||||
;; applicable to the col-idx column is used. If the monetary
|
||||
;; cannot be converted (eg. missing price) then it is not converted.
|
||||
(convert-curr-fn
|
||||
(lambda (monetary col-idx)
|
||||
|
||||
@@ -48,6 +48,7 @@ SCM scm_init_sw_app_utils_module (void);
|
||||
/* avoid no previous prototype warning/error */
|
||||
PyObject* SWIG_init (void);
|
||||
%}
|
||||
%import <gnucash_core.i>
|
||||
#endif
|
||||
|
||||
%import "base-typemaps.i"
|
||||
|
||||
@@ -1549,7 +1549,9 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
||||
*buf = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Value may now be decimal, for example if the factional part is zero
|
||||
value_is_decimal = gnc_numeric_to_decimal(&val, NULL);
|
||||
/* print the integer part without separators */
|
||||
sprintf(temp_buf, "%" G_GINT64_FORMAT, whole.num);
|
||||
num_whole_digits = strlen (temp_buf);
|
||||
|
||||
@@ -469,23 +469,26 @@ gnc_gbr_find_prefix (const gchar *default_prefix)
|
||||
static gchar*
|
||||
find_component_directory (const gchar *default_dir, const gchar* compiled_dir)
|
||||
{
|
||||
gchar *prefix = NULL, *dir = NULL, *subdir = NULL;
|
||||
gchar *prefix = NULL, *dir = NULL;
|
||||
gchar *subdir = gnc_file_path_relative_part(PREFIX, compiled_dir);
|
||||
|
||||
prefix = gnc_gbr_find_prefix (NULL);
|
||||
if (prefix == NULL)
|
||||
return g_strdup (default_dir ? default_dir : compiled_dir);
|
||||
else if (!g_strcmp0 (prefix, PREFIX))
|
||||
return g_strdup (compiled_dir);
|
||||
|
||||
subdir = gnc_file_path_relative_part(PREFIX, compiled_dir);
|
||||
if (g_strcmp0 (compiled_dir, subdir) == 0)
|
||||
if (!g_getenv("GNC_UNINSTALLED"))
|
||||
{
|
||||
/* compiled_dir isn't a subdir of PREFIX. This isn't relocatable so
|
||||
* return compiled_dir.
|
||||
*/
|
||||
g_free (subdir);
|
||||
g_free (prefix);
|
||||
return g_strdup (compiled_dir);
|
||||
if (!g_strcmp0 (prefix, PREFIX))
|
||||
return g_strdup (compiled_dir);
|
||||
|
||||
if (g_strcmp0 (compiled_dir, subdir) == 0)
|
||||
{
|
||||
/* compiled_dir isn't a subdir of PREFIX. This isn't relocatable so
|
||||
* return compiled_dir.
|
||||
*/
|
||||
g_free (subdir);
|
||||
g_free (prefix);
|
||||
return g_strdup (compiled_dir);
|
||||
}
|
||||
}
|
||||
dir = g_build_filename (prefix, subdir, NULL);
|
||||
g_free (subdir);
|
||||
|
||||
@@ -1073,6 +1073,7 @@ gnc_numeric_to_decimal(gnc_numeric *a, guint8 *max_decimal_places)
|
||||
{
|
||||
int max_places = max_decimal_places == NULL ? max_leg_digits :
|
||||
*max_decimal_places;
|
||||
if (a->num == 0) return TRUE;
|
||||
try
|
||||
{
|
||||
GncNumeric an (*a);
|
||||
|
||||
@@ -34,7 +34,6 @@ static gboolean check_valid(GDate *next, GDate *ref, GDate *start,
|
||||
guint16 mult, PeriodType pt, WeekendAdjust wadj)
|
||||
{
|
||||
gboolean valid;
|
||||
GDate adj_date;
|
||||
gint startToNext;
|
||||
gboolean ret_val = TRUE;
|
||||
|
||||
@@ -65,10 +64,10 @@ static gboolean check_valid(GDate *next, GDate *ref, GDate *start,
|
||||
ret_val &= do_test(g_date_is_last_of_month(next), "end of month phase wrong");
|
||||
else
|
||||
{
|
||||
gboolean result;
|
||||
gboolean result = TRUE;
|
||||
if(!g_date_is_last_of_month(next))
|
||||
{
|
||||
adj_date = *next;
|
||||
GDate adj_date = *next;
|
||||
if(wadj == WEEKEND_ADJ_BACK)
|
||||
{
|
||||
// If adjusting back, one of the next two days to be end of month
|
||||
@@ -133,7 +132,7 @@ static gboolean check_valid(GDate *next, GDate *ref, GDate *start,
|
||||
day_next = g_date_get_day(next);
|
||||
if (day_start < 28)
|
||||
{
|
||||
gboolean result;
|
||||
gboolean result = TRUE;
|
||||
week_day = g_date_get_weekday (next);
|
||||
switch (wadj) {
|
||||
case WEEKEND_ADJ_NONE:
|
||||
|
||||
Reference in New Issue
Block a user