mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
remove more GUI stuff from the accounts structure
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@477 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -75,8 +75,6 @@ mallocAccount( void )
|
||||
acc->regData = NULL;
|
||||
acc->regLedger = NULL;
|
||||
acc->ledgerList = NULL;
|
||||
acc->recnData = NULL;
|
||||
acc->adjBData = NULL;
|
||||
|
||||
return acc;
|
||||
}
|
||||
@@ -156,8 +154,6 @@ freeAccount( Account *acc )
|
||||
acc->expand = 0;
|
||||
acc->regData = NULL;
|
||||
acc->regLedger = NULL;
|
||||
acc->recnData = NULL;
|
||||
acc->adjBData = NULL;
|
||||
|
||||
if (acc->ledgerList) _free (acc->ledgerList);
|
||||
acc->ledgerList = NULL;
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "util.h"
|
||||
#include "xtutil.h"
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
typedef struct _AdjBWindow
|
||||
@@ -53,29 +52,20 @@ typedef struct _AdjBWindow
|
||||
Widget date; /* Text field, the date for the balance */
|
||||
} AdjBWindow;
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
static AdjBWindow **adjBList = NULL;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
static void adjBOkCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||
static void adjBClose( Widget mw, XtPointer cd, XtPointer cb );
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccDestroyAdjBWindow (AdjBWindow *adjBData)
|
||||
{
|
||||
if (!adjBData) return;
|
||||
XtDestroyWidget (adjBData->dialog);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* adjBWindow *
|
||||
* opens up the window to adjust the balance *
|
||||
* *
|
||||
* Args: parent - the parent of this window *
|
||||
* account - the account to adjust *
|
||||
* Return: recnData - the instance of this AdjBWindow *
|
||||
* Return: adjBData - the instance of this AdjBWindow *
|
||||
\********************************************************************/
|
||||
AdjBWindow *
|
||||
adjBWindow( Widget parent, Account *acc )
|
||||
@@ -85,11 +75,10 @@ adjBWindow( Widget parent, Account *acc )
|
||||
AdjBWindow *adjBData;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
FETCH_FROM_LIST (AdjBWindow, adjBList, acc, acc, adjBData);
|
||||
|
||||
setBusyCursor( parent );
|
||||
|
||||
adjBData = (AdjBWindow *)_malloc(sizeof(AdjBWindow));
|
||||
adjBData->acc = acc;
|
||||
|
||||
/* Create the dialog box... */
|
||||
sprintf( buf, "%s: %s", acc->accountName, ADJ_BALN_STR);
|
||||
|
||||
@@ -246,6 +235,19 @@ adjBWindow( Widget parent, Account *acc )
|
||||
return adjBData;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccDestroyAdjBWindow (Account *acc)
|
||||
{
|
||||
AdjBWindow *adjBData;
|
||||
|
||||
REMOVE_FROM_LIST (AdjBWindow, adjBList, acc, acc, adjBData);
|
||||
XtDestroyWidget (adjBData->dialog);
|
||||
free (adjBData);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* adjBClose *
|
||||
* frees memory allocated for an adjBWindow, and other cleanup *
|
||||
@@ -262,8 +264,8 @@ adjBClose( Widget mw, XtPointer cd, XtPointer cb )
|
||||
AdjBWindow *adjBData = (AdjBWindow *)cd;
|
||||
Account *acc = adjBData->acc;
|
||||
|
||||
_free(adjBData);
|
||||
acc->adjBData = NULL;
|
||||
REMOVE_FROM_LIST (AdjBWindow, adjBList, acc, acc, adjBData);
|
||||
free(adjBData);
|
||||
|
||||
DEBUG("closed AdjBWindow");
|
||||
}
|
||||
@@ -320,8 +322,9 @@ adjBOkCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
|
||||
/* Refresh the account register window */
|
||||
regRefresh(acc->regData);
|
||||
|
||||
/* Refresh the account reconcile window */
|
||||
recnRefresh(acc->recnData);
|
||||
recnRefresh (acc);
|
||||
|
||||
refreshMainWindow();
|
||||
}
|
||||
|
||||
@@ -47,11 +47,10 @@ xaccAccountWindowDestroy (Account *acc)
|
||||
|
||||
xaccDestroyRegWindow (acc->regData);
|
||||
xaccDestroyRegWindow (acc->regLedger);
|
||||
xaccDestroyRecnWindow (acc->recnData);
|
||||
xaccDestroyAdjBWindow (acc->adjBData);
|
||||
xaccDestroyRecnWindow (acc);
|
||||
xaccDestroyAdjBWindow (acc);
|
||||
xaccDestroyEditAccWindow (acc);
|
||||
xaccDestroyEditNotesWindow (acc);
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
@@ -1021,22 +1021,6 @@ fileMenubarCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
case FMB_QUIT:
|
||||
DEBUG("FMB_QUIT\n");
|
||||
{
|
||||
Account *acc;
|
||||
int i=0;
|
||||
while( (acc=getAccount (grp,i++)) != NULL )
|
||||
{
|
||||
if( acc->regData != NULL )
|
||||
{
|
||||
/* ??? -- hack alert -- should free */
|
||||
acc->regData = NULL;
|
||||
}
|
||||
if( acc->recnData != NULL )
|
||||
{
|
||||
/* ??? -- hack alert -- should free */
|
||||
acc->recnData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( !(grp->saved) )
|
||||
{
|
||||
if( verifyBox(toplevel, FMB_SAVE_MSG) )
|
||||
|
||||
@@ -58,27 +58,19 @@ typedef struct _RecnWindow
|
||||
} RecnWindow;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
void recnRecalculateBalance( RecnWindow *recnData );
|
||||
static void recnRecalculateBalance( RecnWindow *recnData );
|
||||
|
||||
void recnClose( Widget mw, XtPointer cd, XtPointer cb );
|
||||
void recnOkCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||
void recnCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||
static void recnClose( Widget mw, XtPointer cd, XtPointer cb );
|
||||
static void recnOkCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||
static void recnCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
extern XtAppContext app;
|
||||
|
||||
static RecnWindow **recnList = NULL;
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccDestroyRecnWindow (RecnWindow *recnData)
|
||||
{
|
||||
if (!recnData) return;
|
||||
XtDestroyWidget (recnData->dialog);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* recnRefresh *
|
||||
* refreshes the transactions in the reconcile window *
|
||||
@@ -87,14 +79,14 @@ xaccDestroyRecnWindow (RecnWindow *recnData)
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
recnRefresh( RecnWindow *recnData )
|
||||
{
|
||||
if( recnData != NULL )
|
||||
{
|
||||
recnRefresh (Account *acc)
|
||||
{
|
||||
int i,nrows;
|
||||
char buf[BUFSIZE];
|
||||
Split *split;
|
||||
Account *acc = recnData->acc;
|
||||
RecnWindow *recnData;
|
||||
|
||||
FIND_IN_LIST (RecnWindow, recnList, acc, acc, recnData);
|
||||
|
||||
/* NOTE: an improvement of the current design would be to use the
|
||||
* user-data in the rows to detect where transactions need
|
||||
@@ -157,7 +149,6 @@ recnRefresh( RecnWindow *recnData )
|
||||
}
|
||||
|
||||
recnRecalculateBalance(recnData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +159,7 @@ recnRefresh( RecnWindow *recnData )
|
||||
* Args: recnData -- the reconcile window to refresh *
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
recnRecalculateBalance( RecnWindow *recnData )
|
||||
{
|
||||
Split * split;
|
||||
@@ -236,10 +227,10 @@ recnRecalculateBalance( RecnWindow *recnData )
|
||||
/********************************************************************\
|
||||
* startRecnWindow: gets the ending balance for reconcile window *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
startRecnOkCB( Widget wm, XtPointer cd, XtPointer cb )
|
||||
{ *(int *)cd = 1; }
|
||||
void
|
||||
static void
|
||||
startRecnCancelCB( Widget wm, XtPointer cd, XtPointer cb )
|
||||
{ *(int *)cd = 0; }
|
||||
|
||||
@@ -757,7 +748,8 @@ recnWindow( Widget parent, Account *acc )
|
||||
XtManageChild(recnData->dialog);
|
||||
|
||||
/* now that the matices are set up, fill 'em in with transactions: */
|
||||
recnRefresh(recnData);
|
||||
recnRefresh (acc);
|
||||
|
||||
/* and then refresh the total/difference balance fields: */
|
||||
recnRecalculateBalance(recnData);
|
||||
|
||||
@@ -766,6 +758,19 @@ recnWindow( Widget parent, Account *acc )
|
||||
return recnData;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccDestroyRecnWindow (Account *acc)
|
||||
{
|
||||
RecnWindow *recnData;
|
||||
|
||||
REMOVE_FROM_LIST (RecnWindow, recnList, acc, acc, recnData);
|
||||
XtDestroyWidget (recnData->dialog);
|
||||
free (recnData);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* recnClose *
|
||||
* frees memory allocated for an recnWindow, and other cleanup *
|
||||
@@ -776,14 +781,14 @@ recnWindow( Widget parent, Account *acc )
|
||||
* cb - *
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
recnClose( Widget mw, XtPointer cd, XtPointer cb )
|
||||
{
|
||||
RecnWindow *recnData = (RecnWindow *)cd;
|
||||
Account *acc = recnData->acc;
|
||||
|
||||
_free(recnData);
|
||||
acc->recnData = NULL;
|
||||
REMOVE_FROM_LIST (RecnWindow, recnList, acc, acc, recnData);
|
||||
free(recnData);
|
||||
|
||||
DEBUG("closed RecnWindow");
|
||||
}
|
||||
@@ -798,7 +803,7 @@ recnClose( Widget mw, XtPointer cd, XtPointer cb )
|
||||
* Return: none *
|
||||
* Global: data *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
recnOkCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
{
|
||||
int nrows,i;
|
||||
@@ -848,7 +853,7 @@ recnOkCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
* cb - *
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
recnCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
{
|
||||
RecnWindow *recnData = (RecnWindow *)cd;
|
||||
|
||||
@@ -609,8 +609,7 @@ startAdjBCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
if (1 != regData->numAcc) return;
|
||||
|
||||
acc = regData->blackacc[0];
|
||||
if( acc->adjBData == NULL )
|
||||
acc->adjBData = adjBWindow( toplevel, acc );
|
||||
adjBWindow( toplevel, acc );
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -635,8 +634,7 @@ startRecnCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
if (1 != regData->numAcc) return;
|
||||
|
||||
acc = regData->blackacc[0];
|
||||
if( acc->recnData == NULL )
|
||||
acc->recnData = recnWindow( toplevel, acc );
|
||||
recnWindow( toplevel, acc );
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
|
||||
@@ -485,7 +485,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
/* Refresh the "from" account register window */
|
||||
regRefresh(acc->regData);
|
||||
/* Refresh the "from" account reconcile window */
|
||||
recnRefresh(acc->recnData);
|
||||
recnRefresh(acc);
|
||||
|
||||
/* insert transaction into to acount */
|
||||
xaccInsertSplit (((Account *) (trans->credit_split.acc)), &(trans->credit_split));
|
||||
@@ -493,7 +493,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
/* Refresh the "to" account register window */
|
||||
regRefresh(acc->regData);
|
||||
/* Refresh the "to" account reconcile window */
|
||||
recnRefresh(acc->recnData);
|
||||
recnRefresh(acc);
|
||||
|
||||
refreshMainWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user