mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
remove the commodities from the commodity table
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8524 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
4251a2bdf6
commit
9b9fef58ce
@ -66,24 +66,6 @@ static short module = MOD_ENGINE;
|
|||||||
|
|
||||||
/* ====================================================================== */
|
/* ====================================================================== */
|
||||||
|
|
||||||
#define GNC_COMMODITY_TABLE "gnc_commodity_table"
|
|
||||||
gnc_commodity_table *
|
|
||||||
gnc_book_get_commodity_table(GNCBook *book)
|
|
||||||
{
|
|
||||||
if (!book) return NULL;
|
|
||||||
printf ("duude get commodity table\n");
|
|
||||||
return gnc_book_get_data (book, GNC_COMMODITY_TABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gnc_book_set_commodity_table(GNCBook *book, gnc_commodity_table *ct)
|
|
||||||
{
|
|
||||||
if (!book) return;
|
|
||||||
gnc_book_set_data (book, GNC_COMMODITY_TABLE, ct);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ====================================================================== */
|
|
||||||
|
|
||||||
#define GNC_TOP_GROUP "gnc_top_group"
|
#define GNC_TOP_GROUP "gnc_top_group"
|
||||||
AccountGroup *
|
AccountGroup *
|
||||||
gnc_book_get_group (GNCBook *book)
|
gnc_book_get_group (GNCBook *book)
|
||||||
@ -229,7 +211,7 @@ gnc_book_populate (GNCBook *book)
|
|||||||
{
|
{
|
||||||
PWARN("unable to initialize book's commodity_table");
|
PWARN("unable to initialize book's commodity_table");
|
||||||
}
|
}
|
||||||
gnc_book_set_commodity_table (book, ct);
|
gnc_commodity_table_set_table (book, ct);
|
||||||
|
|
||||||
gnc_book_set_group (book, xaccMallocAccountGroup(book));
|
gnc_book_set_group (book, xaccMallocAccountGroup(book));
|
||||||
|
|
||||||
@ -246,7 +228,6 @@ gnc_book_depopulate (GNCBook *book)
|
|||||||
{
|
{
|
||||||
AccountGroup *grp;
|
AccountGroup *grp;
|
||||||
gnc_commodity_table *ct;
|
gnc_commodity_table *ct;
|
||||||
GNCPriceDB *db;
|
|
||||||
|
|
||||||
/* unhook the top-level group */
|
/* unhook the top-level group */
|
||||||
grp = gnc_book_get_group (book);
|
grp = gnc_book_get_group (book);
|
||||||
@ -255,13 +236,11 @@ gnc_book_depopulate (GNCBook *book)
|
|||||||
gnc_book_set_group (book, NULL);
|
gnc_book_set_group (book, NULL);
|
||||||
|
|
||||||
/* unhook the prices */
|
/* unhook the prices */
|
||||||
db = gnc_book_get_pricedb (book);
|
|
||||||
gnc_pricedb_destroy (db);
|
|
||||||
gnc_pricedb_set_db (book, NULL);
|
gnc_pricedb_set_db (book, NULL);
|
||||||
|
|
||||||
ct = gnc_book_get_commodity_table (book);
|
ct = gnc_commodity_table_get_table (book);
|
||||||
gnc_commodity_table_destroy (ct);
|
gnc_commodity_table_destroy (ct);
|
||||||
gnc_book_set_commodity_table (book, NULL);
|
gnc_commodity_table_set_table (book, NULL);
|
||||||
|
|
||||||
/* FIXME: destroy SX data members here, too */
|
/* FIXME: destroy SX data members here, too */
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,6 @@ kvp_frame * gnc_book_get_slots (GNCBook *book);
|
|||||||
/** \return The top-level group in the book.*/
|
/** \return The top-level group in the book.*/
|
||||||
AccountGroup * gnc_book_get_group (GNCBook *book);
|
AccountGroup * gnc_book_get_group (GNCBook *book);
|
||||||
|
|
||||||
/** \return The commodity table of the book. */
|
|
||||||
gnc_commodity_table * gnc_book_get_commodity_table(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 );
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc-commodity.c -- api for tradable commodities (incl. currency) *
|
* gnc-commodity.c -- api for tradable commodities (incl. currency) *
|
||||||
* Copyright (C) 2000 Bill Gribble *
|
* Copyright (C) 2000 Bill Gribble *
|
||||||
* Copyright (C) 2001 Linas Vepstas *
|
* Copyright (C) 2001 Linas Vepstas <linas@linas.org> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
@ -31,6 +31,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "gnc-book.h"
|
||||||
#include "gnc-commodity.h"
|
#include "gnc-commodity.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "guid.h"
|
#include "guid.h"
|
||||||
@ -510,6 +511,26 @@ gnc_commodity_table_new(void)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* book anchor functons
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
#define GNC_COMMODITY_TABLE "gnc_commodity_table"
|
||||||
|
gnc_commodity_table *
|
||||||
|
gnc_commodity_table_get_table(GNCBook *book)
|
||||||
|
{
|
||||||
|
if (!book) return NULL;
|
||||||
|
printf ("duude get commodity table\n");
|
||||||
|
return gnc_book_get_data (book, GNC_COMMODITY_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_commodity_table_set_table(GNCBook *book, gnc_commodity_table *ct)
|
||||||
|
{
|
||||||
|
if (!book) return;
|
||||||
|
gnc_book_set_data (book, GNC_COMMODITY_TABLE, ct);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc_commodity_get_size
|
* gnc_commodity_get_size
|
||||||
* get the size of the commodity table
|
* get the size of the commodity table
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc-commodity.h -- API for tradable commodities (incl. currency) *
|
* gnc-commodity.h -- API for tradable commodities (incl. currency) *
|
||||||
* Copyright (C) 2000 Bill Gribble *
|
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
@ -41,6 +40,7 @@
|
|||||||
#define GNC_COMMODITY_H
|
#define GNC_COMMODITY_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "gnc-book.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
|
||||||
/** The commodity namespace definitions are used to tag a commodity by
|
/** The commodity namespace definitions are used to tag a commodity by
|
||||||
@ -408,17 +408,35 @@ gboolean gnc_commodity_is_iso(const gnc_commodity * cm);
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== */
|
||||||
/** @name Commodity Table Creation */
|
/** @name Commodity Table Creation */
|
||||||
/** @{ */
|
/** @{ */
|
||||||
|
|
||||||
/* gnc_commodity_table functions : operate on a database of commodity
|
/* gnc_commodity_table functions : operate on a database of commodity
|
||||||
* info */
|
* info */
|
||||||
|
|
||||||
|
/** You proably shouldn't be using gnc_commodity_table_new() directly,
|
||||||
|
* its for internal use only. You should probably be using
|
||||||
|
* gnc_commodity_table_get_table()
|
||||||
|
*/
|
||||||
gnc_commodity_table * gnc_commodity_table_new(void);
|
gnc_commodity_table * gnc_commodity_table_new(void);
|
||||||
void gnc_commodity_table_destroy(gnc_commodity_table * table);
|
void gnc_commodity_table_destroy(gnc_commodity_table * table);
|
||||||
|
|
||||||
|
/** Returns the commodity table assoicated with a book.
|
||||||
|
*/
|
||||||
|
gnc_commodity_table * gnc_commodity_table_get_table(GNCBook *book);
|
||||||
|
|
||||||
|
/** You should probably not be using gnc_commodity_table_set_table()
|
||||||
|
* directly. Its for internal use only.
|
||||||
|
*/
|
||||||
|
void gnc_commodity_table_set_table(GNCBook *book, gnc_commodity_table *ct);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
/* XXX backwards compat function; remove me someday */
|
||||||
|
#define gnc_book_get_commodity_table gnc_commodity_table_get_table
|
||||||
|
|
||||||
|
|
||||||
/** @name Commodity Table Comparison */
|
/** @name Commodity Table Comparison */
|
||||||
/** @{ */
|
/** @{ */
|
||||||
|
Loading…
Reference in New Issue
Block a user