diff --git a/src/MultiLedger.c b/src/MultiLedger.c index 42a4d7fbce..7c46ecd79a 100644 --- a/src/MultiLedger.c +++ b/src/MultiLedger.c @@ -25,9 +25,10 @@ #include "Account.h" #include "Group.h" +#include "LedgerUtils.h" #include "MultiLedger.h" +#include "Query.h" #include "SplitLedger.h" -#include "LedgerUtils.h" #include "Transaction.h" #include "util.h" @@ -329,14 +330,20 @@ xaccLedgerDisplayGeneral (Account *lead_acc, Account **acclist, int ledger_type) regData->displayed_accounts = accListCopy (acclist); regData->type = ledger_type; + /* set up the query filter */ + regData->query = xaccMallocQuery(); + xaccQuerySetAccounts (regData->query, regData->displayed_accounts); + xaccQueryAddAccount (regData->query, regData->leader); + + /* add this register to the list of registers */ fullList = ledgerListAdd (fullList, regData); /******************************************************************\ * The main register window itself * \******************************************************************/ - /* MallocBasicRegister will malloc & initialize the - * register but doesn't do the gui init */ + /* MallocBasicRegister will malloc & initialize the register, + * but will not do the gui init */ regData->ledger = xaccMallocSplitRegister (ledger_type); regData->dirty = 1; @@ -365,7 +372,7 @@ xaccLedgerDisplayRefresh (xaccLedgerDisplay *regData) * new splits and get them into the system. */ xaccSRLoadRegister (regData->ledger, - xaccAccountGetSplitList (regData->leader), + xaccQueryGetSplits (regData->query), regData->leader); @@ -610,6 +617,8 @@ xaccLedgerDisplayClose (xaccLedgerDisplay *regData) ledgerListRemove (fullList, regData); + xaccFreeQuery (regData->query); + free(regData); } diff --git a/src/MultiLedger.h b/src/MultiLedger.h index ffe52c1b89..e124d7e2aa 100644 --- a/src/MultiLedger.h +++ b/src/MultiLedger.h @@ -27,6 +27,7 @@ #include "config.h" #include "Account.h" +#include "Query.h" #include "splitreg.h" #include "SplitLedger.h" #include "Transaction.h" @@ -41,6 +42,7 @@ struct _xaccLedgerDisplay { Account *leader; /* leading. "master" account */ Account **displayed_accounts; /* The list of accounts shown here */ short numAcc; /* number of accounts in list */ + Query *query; /* query engine & filter for displaying */ short type; /* register display type, usually equal to * * account type, but not always. */