move transaction-counting-utility from book to transaction

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8532 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-06-10 04:30:54 +00:00
parent 071b1b7166
commit fc0189c3f5
2 changed files with 26 additions and 0 deletions

View File

@ -3037,6 +3037,24 @@ xaccSplitMakeStockSplit(Split *s)
}
/* ====================================================================== */
static gboolean
counter_thunk(Transaction *t, void *data)
{
(*((guint*)data))++;
return TRUE;
}
guint
gnc_book_count_transactions(GNCBook *book)
{
guint count = 0;
xaccGroupForEachTransaction(xaccGetAccountGroup(book),
counter_thunk, (void*)&count);
return count;
}
/********************************************************************\
\********************************************************************/

View File

@ -148,6 +148,14 @@ Transaction * xaccTransLookup (const GUID *guid, GNCBook *book);
transaction associated with the given id, or NULL
if there is no such transaction. */
Transaction * xaccTransLookupDirect (GUID guid, GNCBook *book);
/** \warning XXX FIXME
* gnc_book_count_transactions is a utility function,
* probably needs to be moved to a utility file somewhere.
*/
guint gnc_book_count_transactions(GNCBook *book);
/**@}*/