mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-05-11 Dave Peticolas <dave@krondo.com>
* src/engine/Account.c (xaccCloneAccountSimple): use xaccAccountSetCurrency -- it does more than just set the pointer! * src/gnome/new-user-funs.c (clone_account): don't use engine private functions. * src/engine/io-example-account.c (add_account_local): fix up currency & security for new example accounts * src/engine/io-utils.c: add emacs mode comment to cancel XML comment git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4167 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,5 +1,17 @@
|
||||
2001-05-11 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/Account.c (xaccCloneAccountSimple): use
|
||||
xaccAccountSetCurrency -- it does more than just set the pointer!
|
||||
|
||||
* src/gnome/new-user-funs.c (clone_account): don't use engine
|
||||
private functions.
|
||||
|
||||
* src/engine/io-example-account.c (add_account_local): fix up
|
||||
currency & security for new example accounts
|
||||
|
||||
* src/engine/io-utils.c: add emacs mode comment to cancel
|
||||
XML comment
|
||||
|
||||
* src/gnome/new-user-callbacks.c: fix compiler warning
|
||||
|
||||
* src/engine/gnc-book.c (gnc_book_set_group): fix bug
|
||||
|
||||
@@ -151,7 +151,7 @@ xaccCloneAccountSimple(const Account *from)
|
||||
|
||||
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
||||
|
||||
ret->currency = from->currency;
|
||||
xaccAccountSetCurrency (ret, from->currency);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -22,24 +22,27 @@
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include "sixtp.h"
|
||||
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-xml.h"
|
||||
#include "io-example-account.h"
|
||||
#include "io-gncxml-gen.h"
|
||||
#include "io-utils.h"
|
||||
#include "sixtp-dom-generators.h"
|
||||
#include "sixtp-dom-parsers.h"
|
||||
#include "sixtp-parsers.h"
|
||||
#include "io-gncxml-gen.h"
|
||||
#include "gnc-xml.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "TransLog.h"
|
||||
@@ -103,9 +106,43 @@ gnc_destroy_example_account(GncExampleAccount *gea)
|
||||
g_free(gea);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_up_account_commodity(
|
||||
gnc_commodity_table *tbl, Account *act,
|
||||
gnc_commodity * (*getter) (Account *account),
|
||||
void (*setter) (Account *account, gnc_commodity *comm))
|
||||
{
|
||||
gnc_commodity *gcom;
|
||||
gnc_commodity *com = getter(act);
|
||||
|
||||
if(!com)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gcom = gnc_commodity_table_lookup(tbl, gnc_commodity_get_namespace(com),
|
||||
gnc_commodity_get_mnemonic(com));
|
||||
if(!gcom)
|
||||
{
|
||||
g_warning("unable to find global commodity for %s adding new",
|
||||
gnc_commodity_get_unique_name(com));
|
||||
gnc_commodity_table_insert(tbl, com);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_commodity_destroy(com);
|
||||
setter(act, gcom);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_account_local(GncExampleAccount *gea, Account *act)
|
||||
{
|
||||
clear_up_account_commodity(gnc_engine_commodities(), act,
|
||||
xaccAccountGetCurrency, xaccAccountSetCurrency);
|
||||
clear_up_account_commodity(gnc_engine_commodities(), act,
|
||||
xaccAccountGetSecurity, xaccAccountSetSecurity);
|
||||
|
||||
if(!xaccAccountGetParent(act))
|
||||
{
|
||||
xaccGroupInsertAccount(gea->group, act);
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
#include "gnc-xml-helper.h"
|
||||
#include "io-utils.h"
|
||||
|
||||
/*
|
||||
<!-- Local variables: -->
|
||||
<!-- mode: C -->
|
||||
<!-- End: -->
|
||||
*/
|
||||
|
||||
static const gchar *emacs_trailer =
|
||||
"<!-- Local variables: -->\n"
|
||||
"<!-- mode: xml -->\n"
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "Group.h"
|
||||
#include "io-example-account.h"
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
|
||||
#include <guile/gh.h>
|
||||
|
||||
@@ -51,7 +50,8 @@ clone_account(const Account* from, gnc_commodity *com)
|
||||
Account *ret;
|
||||
|
||||
ret = xaccCloneAccountSimple(from);
|
||||
ret->currency = com;
|
||||
|
||||
xaccAccountSetCurrency (ret, com);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user