add version number (to enable sync with backend)

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4388 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2001-06-03 06:36:26 +00:00
parent 788d4ce173
commit b5700574d9
3 changed files with 20 additions and 0 deletions

View File

@ -39,6 +39,7 @@ struct _GNCPrice {
char *source;
char *type;
gnc_numeric value;
gint32 version; /* version number, for syncing with backend */
/* 'private' object management fields */
guint32 refcount; /* garbage collection reference count */

View File

@ -53,6 +53,7 @@ gnc_price_create()
p->editlevel = 0;
p->not_saved = FALSE;
p->do_free = FALSE;
p->version = 0;
xaccGUIDNew (&p->guid);
xaccStoreEntity(p, &p->guid, GNC_ID_PRICE);
gnc_engine_generate_event (&p->guid, GNC_EVENT_CREATE);
@ -110,6 +111,8 @@ gnc_price_clone(GNCPrice* p)
new_p = gnc_price_create();
if(!new_p) return NULL;
new_p->version = p->version;
gnc_price_begin_edit(new_p);
/* never ever clone guid's */
gnc_price_set_commodity(new_p, gnc_price_get_commodity(p));
@ -286,6 +289,13 @@ gnc_price_set_value(GNCPrice *p, gnc_numeric value)
gnc_price_commit_edit (p);
}
void
gnc_price_set_version(GNCPrice *p, gint32 vers)
{
if(!p) return;
p->version = vers;
}
/* ==================================================================== */
/* getters */
@ -354,6 +364,13 @@ gnc_price_get_currency(GNCPrice *p)
return p->currency;
}
gint32
gnc_price_get_version(GNCPrice *p)
{
if(!p) return 0;
return (p->version);
}
/* ==================================================================== */
/* setters */

View File

@ -154,6 +154,7 @@ void gnc_price_set_time(GNCPrice *p, Timespec t);
void gnc_price_set_source(GNCPrice *p, const char *source);
void gnc_price_set_type(GNCPrice *p, const char* type);
void gnc_price_set_value(GNCPrice *p, gnc_numeric value);
void gnc_price_set_version(GNCPrice *p, gint32 versn);
/***********/
/* getters */
@ -168,6 +169,7 @@ Timespec gnc_price_get_time(GNCPrice *p);
const char * gnc_price_get_source(GNCPrice *p);
const char * gnc_price_get_type(GNCPrice *p);
gnc_numeric gnc_price_get_value(GNCPrice *p);
gint32 gnc_price_get_version(GNCPrice *p);
/**********************************************************************
GNCPrice lists: