mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
move some bogus kvp utility to its own file
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6066 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
c989125281
commit
a8f0f08c68
@ -39,6 +39,7 @@
|
|||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "gnc-event-p.h"
|
#include "gnc-event-p.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
|
#include "kvp-util-p.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
@ -52,7 +53,6 @@ static short module = MOD_ENGINE;
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
static void xaccAccountBringUpToDate (Account *);
|
static void xaccAccountBringUpToDate (Account *);
|
||||||
static void gemini (kvp_frame *, const GUID *, const GUID *, time_t);
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
@ -184,8 +184,8 @@ xaccCloneAccount (const Account *from, GNCBook *book)
|
|||||||
xaccAccountSetCommodity (ret, from->commodity);
|
xaccAccountSetCommodity (ret, from->commodity);
|
||||||
|
|
||||||
/* make a note of where the copy came from */
|
/* make a note of where the copy came from */
|
||||||
gemini (ret->kvp_data, &from->guid, &from->book->guid, now);
|
gnc_kvp_gemini (ret->kvp_data, &from->guid, &from->book->guid, now);
|
||||||
gemini (from->kvp_data, &ret->guid, &book->guid, now);
|
gnc_kvp_gemini (from->kvp_data, &ret->guid, &book->guid, now);
|
||||||
|
|
||||||
gnc_engine_generate_event (&ret->guid, GNC_EVENT_CREATE);
|
gnc_engine_generate_event (&ret->guid, GNC_EVENT_CREATE);
|
||||||
|
|
||||||
@ -194,61 +194,6 @@ xaccCloneAccount (const Account *from, GNCBook *book)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
|
||||||
\********************************************************************/
|
|
||||||
/* mark the guid and date of the copy, using kvp. The info will be
|
|
||||||
* places in /gemini/ncopies, /gemini/<n>/acct_guid, /gemini/<n>/book_guid,
|
|
||||||
* /gemini/<n>/date, where <n> = ncopies-1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
gemini (kvp_frame *kvp_root, const GUID *acct_guid,
|
|
||||||
const GUID *book_guid, time_t secs)
|
|
||||||
{
|
|
||||||
char buff[80];
|
|
||||||
kvp_frame *cwd, *pwd;
|
|
||||||
kvp_value *v_ncopies, *vvv;
|
|
||||||
gint64 ncopies = 0;
|
|
||||||
Timespec ts;
|
|
||||||
|
|
||||||
/* cwd == 'current working directory' */
|
|
||||||
pwd = kvp_frame_get_frame (kvp_root, "gemini");
|
|
||||||
if (!pwd)
|
|
||||||
{
|
|
||||||
pwd = kvp_frame_new();
|
|
||||||
kvp_frame_set_slot_nc (kvp_root,
|
|
||||||
"gemini", kvp_value_new_frame(pwd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find, increment, store number of copies */
|
|
||||||
v_ncopies = kvp_frame_get_slot (pwd, "ncopies");
|
|
||||||
if (v_ncopies)
|
|
||||||
{
|
|
||||||
ncopies = kvp_value_get_gint64 (v_ncopies);
|
|
||||||
}
|
|
||||||
|
|
||||||
ncopies ++;
|
|
||||||
v_ncopies = kvp_value_new_gint64 (ncopies);
|
|
||||||
kvp_frame_set_slot_nc (pwd, "ncopies", v_ncopies);
|
|
||||||
|
|
||||||
/* OK, now create subdirectory and put the actual data */
|
|
||||||
--ncopies;
|
|
||||||
sprintf (buff, "%lld", ncopies);
|
|
||||||
cwd = kvp_frame_new();
|
|
||||||
kvp_frame_set_slot_nc(pwd, buff, kvp_value_new_frame(cwd));
|
|
||||||
|
|
||||||
vvv = kvp_value_new_guid (acct_guid);
|
|
||||||
kvp_frame_set_slot_nc (cwd, "acct_guid", vvv);
|
|
||||||
|
|
||||||
vvv = kvp_value_new_guid (book_guid);
|
|
||||||
kvp_frame_set_slot_nc (cwd, "book_guid", vvv);
|
|
||||||
|
|
||||||
ts.tv_sec = secs;
|
|
||||||
ts.tv_nsec = 0;
|
|
||||||
vvv = kvp_value_new_timespec (ts);
|
|
||||||
kvp_frame_set_slot_nc (cwd, "date", vvv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================ */
|
/* ================================================================ */
|
||||||
|
|
||||||
Account *
|
Account *
|
||||||
|
@ -12,6 +12,7 @@ libgncmod_engine_la_SOURCES = \
|
|||||||
FreqSpec.c \
|
FreqSpec.c \
|
||||||
GNCId.c \
|
GNCId.c \
|
||||||
Group.c \
|
Group.c \
|
||||||
|
Period.c \
|
||||||
Query.c \
|
Query.c \
|
||||||
SchedXaction.c \
|
SchedXaction.c \
|
||||||
SX-ttinfo.c \
|
SX-ttinfo.c \
|
||||||
@ -31,6 +32,7 @@ libgncmod_engine_la_SOURCES = \
|
|||||||
gncmod-engine.c \
|
gncmod-engine.c \
|
||||||
guid.c \
|
guid.c \
|
||||||
kvp_frame.c \
|
kvp_frame.c \
|
||||||
|
kvp-util.c \
|
||||||
md5.c \
|
md5.c \
|
||||||
messages.c
|
messages.c
|
||||||
|
|
||||||
@ -78,6 +80,7 @@ noinst_HEADERS = \
|
|||||||
gnc-event-p.h \
|
gnc-event-p.h \
|
||||||
gnc-pricedb-p.h \
|
gnc-pricedb-p.h \
|
||||||
gnc-session-p.h \
|
gnc-session-p.h \
|
||||||
|
kvp-util-p.h \
|
||||||
md5.h
|
md5.h
|
||||||
|
|
||||||
libgncmod_engine_la_LDFLAGS = -module
|
libgncmod_engine_la_LDFLAGS = -module
|
||||||
|
Loading…
Reference in New Issue
Block a user