mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
remove template group from the book
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8533 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
fc0189c3f5
commit
cb9ea67de7
@ -32,6 +32,7 @@
|
|||||||
#include "SX-ttinfo.h"
|
#include "SX-ttinfo.h"
|
||||||
#include "SchedXactionP.h"
|
#include "SchedXactionP.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
|
#include "gnc-book.h"
|
||||||
#include "gnc-book-p.h"
|
#include "gnc-book-p.h"
|
||||||
#include "gnc-date.h"
|
#include "gnc-date.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
@ -789,3 +790,27 @@ gnc_sx_get_defer_instances( SchedXaction *sx )
|
|||||||
{
|
{
|
||||||
return sx->deferredList;
|
return sx->deferredList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define GNC_TEMPLATE_GROUP "gnc_template_group"
|
||||||
|
AccountGroup *
|
||||||
|
gnc_book_get_template_group( GNCBook *book )
|
||||||
|
{
|
||||||
|
if (!book) return NULL;
|
||||||
|
return gnc_book_get_data (book, GNC_TEMPLATE_GROUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
|
||||||
|
{
|
||||||
|
if (!book) return;
|
||||||
|
|
||||||
|
if (templateGroup && templateGroup->book != book)
|
||||||
|
{
|
||||||
|
PERR ("cannot mix and match books freely!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gnc_book_set_data (book, GNC_TEMPLATE_GROUP, templateGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -34,9 +34,10 @@
|
|||||||
|
|
||||||
#include "GNCId.h"
|
#include "GNCId.h"
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "date.h"
|
#include "gnc-date.h"
|
||||||
#include "kvp_frame.h"
|
#include "gnc-book.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #defines for kvp_frame strings
|
* #defines for kvp_frame strings
|
||||||
@ -252,6 +253,11 @@ void gnc_sx_remove_defer_instance( SchedXaction *sx, void *deferStateData );
|
|||||||
**/
|
**/
|
||||||
GList *gnc_sx_get_defer_instances( SchedXaction *sx );
|
GList *gnc_sx_get_defer_instances( SchedXaction *sx );
|
||||||
|
|
||||||
|
|
||||||
|
/** Returns the template group from the book.
|
||||||
|
**/
|
||||||
|
AccountGroup * gnc_book_get_template_group (GNCBook *book);
|
||||||
|
|
||||||
#endif /* XACC_SCHEDXACTION_H */
|
#endif /* XACC_SCHEDXACTION_H */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -94,4 +94,8 @@ typedef struct _temporalStateData {
|
|||||||
gint num_inst;
|
gint num_inst;
|
||||||
} temporalStateData;
|
} temporalStateData;
|
||||||
|
|
||||||
|
|
||||||
|
/* Associate the given template group with a book */
|
||||||
|
void gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,30 +83,6 @@ gnc_book_set_schedxactions( GNCBook *book, GList *newList )
|
|||||||
book->sx_notsaved = TRUE;
|
book->sx_notsaved = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================================================================== */
|
|
||||||
|
|
||||||
#define GNC_TEMPLATE_GROUP "gnc_template_group"
|
|
||||||
AccountGroup *
|
|
||||||
gnc_book_get_template_group( GNCBook *book )
|
|
||||||
{
|
|
||||||
if (!book) return NULL;
|
|
||||||
return gnc_book_get_data (book, GNC_TEMPLATE_GROUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gnc_book_set_template_group (GNCBook *book, AccountGroup *templateGroup)
|
|
||||||
{
|
|
||||||
if (!book) return;
|
|
||||||
|
|
||||||
if (templateGroup && templateGroup->book != book)
|
|
||||||
{
|
|
||||||
PERR ("cannot mix and match books freely!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gnc_book_set_data (book, GNC_TEMPLATE_GROUP, templateGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ====================================================================== */
|
/* ====================================================================== */
|
||||||
/* dirty flag stuff */
|
/* dirty flag stuff */
|
||||||
|
|
||||||
@ -168,24 +144,6 @@ gnc_book_mark_saved(GNCBook *book)
|
|||||||
|
|
||||||
/* ====================================================================== */
|
/* ====================================================================== */
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ====================================================================== */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_book_populate (GNCBook *book)
|
gnc_book_populate (GNCBook *book)
|
||||||
{
|
{
|
||||||
|
@ -58,9 +58,6 @@ kvp_frame * gnc_book_get_slots (GNCBook *book);
|
|||||||
/** \return A GList of the scheduled transactions in the book. */
|
/** \return A GList of the scheduled transactions in the book. */
|
||||||
GList * gnc_book_get_schedxactions( GNCBook *book );
|
GList * gnc_book_get_schedxactions( GNCBook *book );
|
||||||
|
|
||||||
/** \return The template AccountGroup of the book. */
|
|
||||||
AccountGroup * gnc_book_get_template_group( GNCBook *book );
|
|
||||||
|
|
||||||
/** The gnc_book_set_data() allows
|
/** The gnc_book_set_data() allows
|
||||||
* arbitrary pointers to structs to be stored in GNCBook.
|
* arbitrary pointers to structs to be stored in GNCBook.
|
||||||
* This is the "prefered" method for extending GNCBook to hold
|
* This is the "prefered" method for extending GNCBook to hold
|
||||||
|
Loading…
Reference in New Issue
Block a user