diff --git a/src/Data.c b/src/Data.c index f6bf10e5bd..5bdcb18c9c 100644 --- a/src/Data.c +++ b/src/Data.c @@ -206,6 +206,8 @@ xaccGetAccountRoot (Account * acc) AccountGroup * grp; AccountGroup * root = NULL; + if (!acc) return NULL; + /* find the root of the account group structure */ grp = (AccountGroup *) acc->parent; while (grp) { @@ -481,27 +483,6 @@ xaccRecomputeGroupBalance (AccountGroup *grp) } } -/********************************************************************\ -\********************************************************************/ -AccountGroup * -xaccGetRootGroupOfAcct (Account *acc) -{ - AccountGroup *grp; - - if (!acc) return NULL; - - /* recursively walk up the tree of parents */ - grp = acc->parent; - if (!grp) return NULL; - acc = grp->parent; - while (acc) { - grp = acc->parent; - acc = grp->parent; - } - - return grp; -} - /********************************************************************\ \********************************************************************/ diff --git a/src/FileIO.c b/src/FileIO.c index 9d0aa9a7af..d4381ba2bb 100644 --- a/src/FileIO.c +++ b/src/FileIO.c @@ -78,6 +78,7 @@ \********************************************************************/ #include +#include #include #include "config.h" diff --git a/src/MainWindow.c b/src/MainWindow.c index d7a6084c7b..377e5fc053 100644 --- a/src/MainWindow.c +++ b/src/MainWindow.c @@ -119,6 +119,8 @@ xaccMainArrow (Widget acctrix, Account *acc ) FETCH_FROM_LIST (MainArrow, arrowList, acc, account, arrowData); + arrowData->expand = 0; + /* adjust arrow size for font size */ height = XbaeMatrixGetRowPixelHeight (acctrix); arrowData->arrowb = XtVaCreateManagedWidget ("accarrow", diff --git a/src/QIFIO.c b/src/QIFIO.c index 01de555840..7ef43ccb63 100644 --- a/src/QIFIO.c +++ b/src/QIFIO.c @@ -511,7 +511,7 @@ xaccGetXferQIFAccount (Account *acc, char *qifline) if(tmp) *tmp = 0x0; /* see if the account exists */ - rootgrp = xaccGetRootGroupOfAcct (acc); + rootgrp = xaccGetAccountRoot (acc); xfer_acc = xaccGetAccountFromName (rootgrp, qifline); /* if not, create it */ @@ -552,7 +552,7 @@ xaccGetSecurityQIFAccount (Account *acc, char *qifline) if(tmp) *tmp = 0x0; /* see if the account exists */ - rootgrp = xaccGetRootGroupOfAcct (acc); + rootgrp = xaccGetAccountRoot (acc); xfer_acc = xaccGetAccountFromName (rootgrp, qifline); /* if not, create it */ diff --git a/src/RegWindow.c b/src/RegWindow.c index ef878745d3..bcf7ccb768 100644 --- a/src/RegWindow.c +++ b/src/RegWindow.c @@ -176,6 +176,8 @@ ledgerIsMember (RegWindow *reg, Account * acc) if (acc == reg->leader) return 1; + if (! (reg->blackacc)) return 0; + n = 0; while (reg->blackacc[n]) { if (acc == reg->blackacc[n]) return 1; @@ -495,8 +497,12 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger regData->reg = reg; /* complete GUI initialization */ - /* hack alert ------- wrong list of accounts */ - xaccLoadXferCell (regData->ledger->xfrmCell, regData->blackacc[0]->parent); + { + AccountGroup *grp; + grp = xaccGetAccountRoot (regData->leader); + if (!grp) grp = xaccGetAccountRoot (regData->blackacc[0]); + xaccLoadXferCell (regData->ledger->xfrmCell, grp); + } XtManageChild (reg); XtManageChild (frame); @@ -626,8 +632,8 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger /******************************************************************/ XtManageChild(pane); - /* hack alert -- this is wrong */ - regRefresh (regData->blackacc[0]); + /* hack alert -- if no leader, should be refreshing from list */ + regRefresh (regData->leader); XtPopup( regData->dialog, XtGrabNone ); @@ -645,6 +651,8 @@ void regRefresh (Account *acc) RegWindow *regData; int n; + if (!acc) return; + xaccRecomputeBalance (acc); /* find all registers whch contain this account */