mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/engine/gw-engine-spec.scm: g-wrap event types enum
* src/engine/gnc-session.c: set book backend to NULL before destroying old book in gnc_session_load * src/engine/Transaction.c: do checks & events when setting slots for transactions and splits. * src/engine/GNCId.h: add a const typedef for GNCIdType git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6393 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e9bc21cf28
commit
bf0bc57a5a
@ -47,6 +47,7 @@
|
|||||||
* identifier. */
|
* identifier. */
|
||||||
|
|
||||||
typedef char * GNCIdType;
|
typedef char * GNCIdType;
|
||||||
|
typedef const char * GNCIdTypeConst;
|
||||||
|
|
||||||
#define GNC_ID_NONE NULL
|
#define GNC_ID_NONE NULL
|
||||||
#define GNC_ID_NULL "null"
|
#define GNC_ID_NULL "null"
|
||||||
|
@ -367,30 +367,6 @@ xaccSplitEqual(const Split *sa, const Split *sb,
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
* xaccSplitGetSlots
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
kvp_frame *
|
|
||||||
xaccSplitGetSlots(Split * s) {
|
|
||||||
if(!s) return NULL;
|
|
||||||
return(s->kvp_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccSplitSetSlots_nc(Split *s, kvp_frame *frm)
|
|
||||||
{
|
|
||||||
g_return_if_fail(s);
|
|
||||||
g_return_if_fail(frm);
|
|
||||||
|
|
||||||
if(s->kvp_data)
|
|
||||||
{
|
|
||||||
kvp_frame_delete(s->kvp_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
s->kvp_data = frm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* Account funcs
|
* Account funcs
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
@ -437,7 +413,8 @@ xaccSplitSetGUID (Split *split, const GUID *guid)
|
|||||||
check_open (split->parent);
|
check_open (split->parent);
|
||||||
xaccRemoveEntity(split->book->entity_table, &split->guid);
|
xaccRemoveEntity(split->book->entity_table, &split->guid);
|
||||||
split->guid = *guid;
|
split->guid = *guid;
|
||||||
xaccStoreEntity(split->book->entity_table, split, &split->guid, GNC_ID_SPLIT);
|
xaccStoreEntity(split->book->entity_table, split,
|
||||||
|
&split->guid, GNC_ID_SPLIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -569,6 +546,34 @@ get_commodity_denom(Split * s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* xaccSplitGetSlots
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
kvp_frame *
|
||||||
|
xaccSplitGetSlots (Split * s)
|
||||||
|
{
|
||||||
|
if(!s) return NULL;
|
||||||
|
return(s->kvp_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccSplitSetSlots_nc(Split *s, kvp_frame *frm)
|
||||||
|
{
|
||||||
|
g_return_if_fail(s);
|
||||||
|
g_return_if_fail(frm);
|
||||||
|
check_open (s->parent);
|
||||||
|
|
||||||
|
if (s->kvp_data && (s->kvp_data != frm))
|
||||||
|
{
|
||||||
|
kvp_frame_delete(s->kvp_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
s->kvp_data = frm;
|
||||||
|
|
||||||
|
gen_event (s);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
@ -1040,23 +1045,27 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
kvp_frame *
|
kvp_frame *
|
||||||
xaccTransGetSlots(Transaction *t) {
|
xaccTransGetSlots (Transaction *t)
|
||||||
|
{
|
||||||
if(!t) return NULL;
|
if(!t) return NULL;
|
||||||
return(t->kvp_data);
|
return(t->kvp_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccTransSetSlots_nc(Transaction *t, kvp_frame *frm)
|
xaccTransSetSlots_nc (Transaction *t, kvp_frame *frm)
|
||||||
{
|
{
|
||||||
g_return_if_fail(t);
|
g_return_if_fail(t);
|
||||||
g_return_if_fail(frm);
|
g_return_if_fail(frm);
|
||||||
|
check_open (t);
|
||||||
|
|
||||||
if(t->kvp_data)
|
if (t->kvp_data && (t->kvp_data != frm))
|
||||||
{
|
{
|
||||||
kvp_frame_delete(t->kvp_data);
|
kvp_frame_delete(t->kvp_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
t->kvp_data = frm;
|
t->kvp_data = frm;
|
||||||
|
|
||||||
|
gen_event_trans (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
@ -361,6 +361,7 @@ gnc_session_load (GNCSession *session)
|
|||||||
|
|
||||||
xaccLogDisable();
|
xaccLogDisable();
|
||||||
|
|
||||||
|
gnc_book_set_backend (session->book, NULL);
|
||||||
gnc_book_destroy (session->book);
|
gnc_book_destroy (session->book);
|
||||||
session->book = gnc_book_new ();
|
session->book = gnc_book_new ();
|
||||||
|
|
||||||
|
@ -375,6 +375,7 @@
|
|||||||
"#include <gnc-book.h>\n"
|
"#include <gnc-book.h>\n"
|
||||||
"#include <gnc-session.h>\n"
|
"#include <gnc-session.h>\n"
|
||||||
"#include <gnc-engine-util.h>\n"
|
"#include <gnc-engine-util.h>\n"
|
||||||
|
"#include <gnc-event.h>\n"
|
||||||
"#include <date.h>\n"
|
"#include <date.h>\n"
|
||||||
"#include <engine-helpers.h>\n"
|
"#include <engine-helpers.h>\n"
|
||||||
"#include <gnc-engine.h>\n"
|
"#include <gnc-engine.h>\n"
|
||||||
@ -387,7 +388,16 @@
|
|||||||
(if client-only?
|
(if client-only?
|
||||||
'()
|
'()
|
||||||
(gw:inline-scheme '(use-modules (gnucash engine))))))
|
(gw:inline-scheme '(use-modules (gnucash engine))))))
|
||||||
|
|
||||||
|
(let ((wt (gw:wrap-enumeration mod '<gnc:event-type>
|
||||||
|
"GNCEngineEventType"
|
||||||
|
"const GNCEngineEventType")))
|
||||||
|
(gw:enum-add-value! wt "GNC_EVENT_NONE" 'gnc-event-none)
|
||||||
|
(gw:enum-add-value! wt "GNC_EVENT_CREATE" 'gnc-event-create)
|
||||||
|
(gw:enum-add-value! wt "GNC_EVENT_MODIFY" 'gnc-event-modify)
|
||||||
|
(gw:enum-add-value! wt "GNC_EVENT_DESTROY" 'gnc-event-destroy)
|
||||||
|
(gw:enum-add-value! wt "GNC_EVENT_ALL" 'gnc-event-all))
|
||||||
|
|
||||||
(gw:wrap-non-native-type mod '<gnc:Account*> "Account*" "const Account*")
|
(gw:wrap-non-native-type mod '<gnc:Account*> "Account*" "const Account*")
|
||||||
(gw:wrap-non-native-type mod '<gnc:Account**> "Account**" "const Account**")
|
(gw:wrap-non-native-type mod '<gnc:Account**> "Account**" "const Account**")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user