mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-24 23:27:39 -05:00
Work around compile to get first milestone: Use GType as type system and Get Qof and engine depends on GObject
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev@15726 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
0b121228ca
commit
eef551a119
92 files changed
+1305
-1111
No files matched your search
@@ -4868,8 +4868,8 @@ r13313 | chris | 2006-02-19 21:58:29 -0500 (Sun, 19 Feb 2006) | 1 line
|
||||
* qof/qof.h : Create reference group in doxygen and
|
||||
export qofreference.h into the API.
|
||||
* qof/qof/qofsession.c : Set QOF_TYPE_COLLECT as registered
|
||||
type and move qof_entity_get_reference_from to new file.
|
||||
* qof/qof/qofsession.h : Move qof_entity_get_reference_from
|
||||
type and move qof_instanceget_reference_from to new file.
|
||||
* qof/qof/qofsession.h : Move qof_instanceget_reference_from
|
||||
to new file: qofreference.c|h.
|
||||
* qof/qofreference.c : New file to handle reference related
|
||||
code.
|
||||
|
||||
+1
-1
@@ -4988,7 +4988,7 @@ r12228 | chris | 2005-12-31 17:28:42 -0500 (Sat, 31 Dec 2005) | 2 lines
|
||||
QOF objects, whether or not any specific object exists in the book.
|
||||
* src/engine/qofbackend.h: Adding a further QSF error code for
|
||||
when a GUID string has been mangled and fails to convert to a GUID.
|
||||
* src/engine/qofsession.c: Adding qof_entity_copy routines to
|
||||
* src/engine/qofsession.c: Adding qof_instancecopy routines to
|
||||
copy single, lists or collections of entities between session books.
|
||||
Note: Each function creates a partial QofBook! Only certain backends
|
||||
{QSF} can handle partial books! Use for data export.
|
||||
|
||||
@@ -81,7 +81,7 @@ in the QSF QofBackend to contain the reference data so that when the book is
|
||||
written out, the reference can be included. When the file is imported back in, a
|
||||
little extra code then rebuilds those references during the merge.
|
||||
|
||||
Copying entites from an existing QofBook using the qof_entity_copy routines will
|
||||
Copying entites from an existing QofBook using the qof_instancecopy routines will
|
||||
automatically create the reference table. If your QOF objects use references to other
|
||||
entities, books that are created manually also need to create a reference table.
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ gboolean qof_book_insert_element (QofBook *book, QofInstance *inst);
|
||||
|
||||
QofInstance* qof_book_get_element (QofBook *book, GType type, GUID *guid);
|
||||
|
||||
|
||||
#define qof_book_get_guid(b) qof_instance_get_guid(QOF_INSTANCE(b))
|
||||
|
||||
#endif /* QOF_BOOK_H */
|
||||
/** @} */
|
||||
|
||||
@@ -325,7 +325,7 @@ The next mergeEnt may be a much better match for that targetEnt and the target_t
|
||||
is designed to solve the issues that result from this conflict. The previous match
|
||||
must be re-assigned because if two mergeEnt's are matched with only one targetEnt,
|
||||
data loss \b WILL follow. Equally, the current mergeEnt must replace the previous
|
||||
one as it is a better match. qof_entity_rating holds the details required to identify
|
||||
one as it is a better match. qof_instancerating holds the details required to identify
|
||||
the correct mergeEnt to be re-assigned and these mergeEnt entities are therefore
|
||||
orphaned - to be re-matched later.
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ of one object type as references of another entity.
|
||||
Entities can be
|
||||
freely added and merged across these secondary collections, they
|
||||
will not be removed from the original collection as they would
|
||||
by using ::qof_entity_insert_entity or ::qof_entity_remove_entity.
|
||||
by using ::qof_instanceinsert_entity or ::qof_instanceremove_entity.
|
||||
|
||||
*/
|
||||
gboolean qof_collection_add_element (QofCollection *coll, QofInstance *inst);
|
||||
@@ -190,7 +190,7 @@ gboolean qof_collection_remove_element (QofCollection *coll, QofInstance *inst);
|
||||
QOF_TYPE_COLLECT uses a secondary collection, independent of
|
||||
those in the book. Entities will not be removed from the
|
||||
original collection as when using ::qof_instance_insert_entity
|
||||
or ::qof_entity_remove_entity.
|
||||
or ::qof_instanceremove_entity.
|
||||
|
||||
*/
|
||||
gboolean
|
||||
|
||||
@@ -103,7 +103,8 @@ enum _QofInstanceSignalType {
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BOOK
|
||||
PROP_BOOK,
|
||||
PROP_GUID
|
||||
};
|
||||
|
||||
struct _QofInstanceSignal {
|
||||
@@ -153,7 +154,10 @@ qof_instance_class_init(QofInstanceClass *klass)
|
||||
g_param_spec_object ("book", NULL, _("Book"), QOF_TYPE_BOOK,
|
||||
(G_PARAM_READABLE | G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY)));
|
||||
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GUID,
|
||||
g_param_spec_object ("guid", NULL, _("GUID"), QOF_TYPE_GUID,
|
||||
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
|
||||
/* Create signals here:*/
|
||||
|
||||
qof_instance_signals[COMMITED] =
|
||||
@@ -253,6 +257,9 @@ qof_instance_get_property (GObject *object,
|
||||
case PROP_BOOK:
|
||||
g_value_set_object (value, obj->priv->book);
|
||||
break;
|
||||
case PROP_GUID:
|
||||
g_value_set_boxed (value, obj->priv->guid);
|
||||
break;
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
@@ -472,6 +479,18 @@ qof_instance_mark_free(QofInstance *inst)
|
||||
inst->priv->do_free = TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
qof_instance_get_do_free (QofInstance *inst)
|
||||
{
|
||||
return inst->priv->do_free;
|
||||
}
|
||||
|
||||
void
|
||||
qof_instance_set_do_free (QofInstance *inst, gboolean val)
|
||||
{
|
||||
inst->priv->do_free = val;
|
||||
}
|
||||
|
||||
/* ========================================================== */
|
||||
/* setters */
|
||||
|
||||
|
||||
@@ -133,13 +133,17 @@ gboolean qof_instance_do_free(const QofInstance *inst);
|
||||
|
||||
void qof_instance_mark_free(QofInstance *inst);
|
||||
|
||||
gboolean qof_instance_get_do_free (QofInstance *inst);
|
||||
|
||||
void qof_instance_set_do_free (QofInstance *inst, gboolean val);
|
||||
|
||||
QofInstance* qof_instance_create (GType type, QofBook *book);
|
||||
|
||||
gboolean qof_instance_destroy (QofInstance *inst, GError **error);
|
||||
|
||||
void qof_instance_release (QofInstance *instance);
|
||||
|
||||
#define qof_entity_release(obj) qof_instance_release (QOF_INSTANCE (obj))
|
||||
#define qof_instancerelease(obj) qof_instance_release (QOF_INSTANCE (obj))
|
||||
|
||||
/** Pair things up. This routine inserts a kvp value into each instance
|
||||
* containing the guid of the other. In this way, if one has one of the
|
||||
|
||||
@@ -334,7 +334,7 @@ struct foreach_data {
|
||||
|
||||
static void foreach_backend (gpointer key, gpointer be_item, gpointer arg)
|
||||
{
|
||||
GType data_type = GPOINTER_TO_INT(key);
|
||||
const gchar *data_type = (const gchar*) key;
|
||||
struct foreach_data *cb_data = arg;
|
||||
|
||||
g_return_if_fail (key && be_item && arg);
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
typedef struct _QofObject QofObject;
|
||||
typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
|
||||
typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
|
||||
typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
|
||||
typedef void (*QofForeachBackendTypeCB) (const gchar *type,
|
||||
gpointer backend_data,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void qof_query_shutdown (void);
|
||||
/** \name Low-Level API Functions */
|
||||
// @{
|
||||
|
||||
GSList * qof_query_build_param_list (char const *param, ...);
|
||||
GSList * qof_query_build_param_list (const gchar *param, ...);
|
||||
|
||||
/** Create a new query.
|
||||
* Before running the query, a 'search-for' type must be set
|
||||
|
||||
+29
-29
@@ -306,7 +306,7 @@ qof_session_get_url (QofSession *session)
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
typedef struct qof_entity_copy_data {
|
||||
typedef struct qof_instancecopy_data {
|
||||
QofInstance *from;
|
||||
QofInstance *to;
|
||||
QofParam *param;
|
||||
@@ -342,7 +342,7 @@ qof_session_update_reference_list(QofSession *session, QofInstanceReference *ref
|
||||
}
|
||||
|
||||
static void
|
||||
qof_entity_param_cb(QofParam *param, gpointer data)
|
||||
qof_instanceparam_cb(QofParam *param, gpointer data)
|
||||
{
|
||||
QofInstanceCopyData *qecd;
|
||||
|
||||
@@ -387,7 +387,7 @@ col_ref_cb (QofInstance* ref_ent, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
qof_entity_foreach_copy(gpointer data, gpointer user_data)
|
||||
qof_instanceforeach_copy(gpointer data, gpointer user_data)
|
||||
{
|
||||
QofInstance *importEnt, *targetEnt/*, *referenceEnt*/;
|
||||
QofInstanceCopyData *context;
|
||||
@@ -526,7 +526,7 @@ qof_entity_foreach_copy(gpointer data, gpointer user_data)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
qof_entity_guid_match(QofSession *new_session, QofInstance *original)
|
||||
qof_instanceguid_match(QofSession *new_session, QofInstance *original)
|
||||
{
|
||||
QofInstance *copy;
|
||||
const GUID *g;
|
||||
@@ -547,7 +547,7 @@ qof_entity_guid_match(QofSession *new_session, QofInstance *original)
|
||||
}
|
||||
|
||||
static void
|
||||
qof_entity_list_foreach(gpointer data, gpointer user_data)
|
||||
qof_instancelist_foreach(gpointer data, gpointer user_data)
|
||||
{
|
||||
QofInstanceCopyData *qecd;
|
||||
QofInstance *original;
|
||||
@@ -559,7 +559,7 @@ qof_entity_list_foreach(gpointer data, gpointer user_data)
|
||||
original = (QofInstance*)data;
|
||||
g_return_if_fail(user_data != NULL);
|
||||
qecd = (QofInstanceCopyData*)user_data;
|
||||
if(qof_entity_guid_match(qecd->new_session, original)) { return; }
|
||||
if(qof_instanceguid_match(qecd->new_session, original)) { return; }
|
||||
qecd->from = original;
|
||||
if(!qof_object_compliance(G_OBJECT_TYPE (G_OBJECT (original)), FALSE))
|
||||
{
|
||||
@@ -581,14 +581,14 @@ qof_entity_list_foreach(gpointer data, gpointer user_data)
|
||||
g_slist_free(qecd->param_list);
|
||||
qecd->param_list = NULL;
|
||||
}
|
||||
qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_entity_param_cb, qecd);
|
||||
qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_instanceparam_cb, qecd);
|
||||
qof_begin_edit(inst);
|
||||
g_slist_foreach(qecd->param_list, qof_entity_foreach_copy, qecd);
|
||||
g_slist_foreach(qecd->param_list, qof_instanceforeach_copy, qecd);
|
||||
qof_commit_edit(inst);
|
||||
}
|
||||
|
||||
static void
|
||||
qof_entity_coll_foreach(QofInstance *original, gpointer user_data)
|
||||
qof_instancecoll_foreach(QofInstance *original, gpointer user_data)
|
||||
{
|
||||
QofInstanceCopyData *qecd;
|
||||
const GUID *g;
|
||||
@@ -607,7 +607,7 @@ qof_entity_coll_foreach(QofInstance *original, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
qof_entity_coll_copy(QofInstance *original, gpointer user_data)
|
||||
qof_instancecoll_copy(QofInstance *original, gpointer user_data)
|
||||
{
|
||||
QofInstanceCopyData *qecd;
|
||||
QofBook *book;
|
||||
@@ -624,19 +624,19 @@ qof_entity_coll_copy(QofInstance *original, gpointer user_data)
|
||||
g = qof_instance_get_guid(original);
|
||||
qof_instance_set_guid(qecd->to, g);
|
||||
qof_begin_edit(inst);
|
||||
g_slist_foreach(qecd->param_list, qof_entity_foreach_copy, qecd);
|
||||
g_slist_foreach(qecd->param_list, qof_instanceforeach_copy, qecd);
|
||||
qof_commit_edit(inst);
|
||||
}
|
||||
|
||||
gboolean
|
||||
qof_entity_copy_to_session(QofSession* new_session, QofInstance* original)
|
||||
qof_instancecopy_to_session(QofSession* new_session, QofInstance* original)
|
||||
{
|
||||
QofInstanceCopyData qecd;
|
||||
QofInstance *inst;
|
||||
QofBook *book;
|
||||
|
||||
if(!new_session || !original) { return FALSE; }
|
||||
if(qof_entity_guid_match(new_session, original)) { return FALSE; }
|
||||
if(qof_instanceguid_match(new_session, original)) { return FALSE; }
|
||||
if(!qof_object_compliance(G_OBJECT_TYPE (G_OBJECT (original)), TRUE)) { return FALSE; }
|
||||
qof_event_suspend();
|
||||
qecd.param_list = NULL;
|
||||
@@ -648,16 +648,16 @@ qof_entity_copy_to_session(QofSession* new_session, QofInstance* original)
|
||||
qecd.from = original;
|
||||
qof_instance_set_guid(qecd.to, qof_instance_get_guid(original));
|
||||
qof_begin_edit(inst);
|
||||
qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_entity_param_cb, &qecd);
|
||||
qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_instanceparam_cb, &qecd);
|
||||
qof_commit_edit(inst);
|
||||
if(g_slist_length(qecd.param_list) == 0) { return FALSE; }
|
||||
g_slist_foreach(qecd.param_list, qof_entity_foreach_copy, &qecd);
|
||||
g_slist_foreach(qecd.param_list, qof_instanceforeach_copy, &qecd);
|
||||
g_slist_free(qecd.param_list);
|
||||
qof_event_resume();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list)
|
||||
gboolean qof_instancecopy_list(QofSession *new_session, GList *entity_list)
|
||||
{
|
||||
QofInstanceCopyData *qecd;
|
||||
|
||||
@@ -668,7 +668,7 @@ gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list)
|
||||
qecd->param_list = NULL;
|
||||
qecd->new_session = new_session;
|
||||
qof_book_set_partial(qof_session_get_book(new_session));
|
||||
g_list_foreach(entity_list, qof_entity_list_foreach, qecd);
|
||||
g_list_foreach(entity_list, qof_instancelist_foreach, qecd);
|
||||
qof_event_resume();
|
||||
if(qecd->error)
|
||||
{
|
||||
@@ -680,7 +680,7 @@ gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list)
|
||||
}
|
||||
|
||||
gboolean
|
||||
qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll)
|
||||
qof_instancecopy_coll(QofSession *new_session, QofCollection *entity_coll)
|
||||
{
|
||||
QofInstanceCopyData qecd;
|
||||
|
||||
@@ -690,10 +690,10 @@ qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll)
|
||||
qecd.param_list = NULL;
|
||||
qecd.new_session = new_session;
|
||||
qof_book_set_partial(qof_session_get_book(qecd.new_session));
|
||||
qof_collection_foreach(entity_coll, qof_entity_coll_foreach, &qecd);
|
||||
qof_collection_foreach(entity_coll, qof_instancecoll_foreach, &qecd);
|
||||
qof_class_param_foreach(qof_collection_get_g_type(entity_coll),
|
||||
qof_entity_param_cb, &qecd);
|
||||
qof_collection_foreach(entity_coll, qof_entity_coll_copy, &qecd);
|
||||
qof_instanceparam_cb, &qecd);
|
||||
qof_collection_foreach(entity_coll, qof_instancecoll_copy, &qecd);
|
||||
if(qecd.param_list != NULL) { g_slist_free(qecd.param_list); }
|
||||
qof_event_resume();
|
||||
return TRUE;
|
||||
@@ -715,7 +715,7 @@ recurse_collection_cb (QofInstance *ent, gpointer user_data)
|
||||
if(user_data == NULL) { return; }
|
||||
store = (struct recurse_s*)user_data;
|
||||
if(!ent || !store) { return; }
|
||||
store->success = qof_entity_copy_to_session(store->session, ent);
|
||||
store->success = qof_instancecopy_to_session(store->session, ent);
|
||||
if(store->success) {
|
||||
store->ent_list = g_list_append(store->ent_list, ent);
|
||||
}
|
||||
@@ -760,7 +760,7 @@ recurse_ent_cb(QofInstance *ent, gpointer user_data)
|
||||
ref_ent = (QofInstance*)ref_param->param_getfcn(ent, ref_param);
|
||||
if((ref_ent)&&(G_OBJECT_TYPE (G_OBJECT (ref_ent))))
|
||||
{
|
||||
store->success = qof_entity_copy_to_session(session, ref_ent);
|
||||
store->success = qof_instancecopy_to_session(session, ref_ent);
|
||||
if(store->success) { ent_list = g_list_append(ent_list, ref_ent); }
|
||||
}
|
||||
}
|
||||
@@ -777,7 +777,7 @@ recurse_ent_cb(QofInstance *ent, gpointer user_data)
|
||||
ref_ent = ref_param->param_getfcn(child_ent, ref_param);
|
||||
if(ref_ent != NULL)
|
||||
{
|
||||
success = qof_entity_copy_to_session(session, ref_ent);
|
||||
success = qof_instancecopy_to_session(session, ref_ent);
|
||||
if(success) { child_list = g_list_append(child_list, ref_ent); }
|
||||
}
|
||||
}
|
||||
@@ -795,14 +795,14 @@ recurse_ent_cb(QofInstance *ent, gpointer user_data)
|
||||
child_ent = ref_param->param_getfcn(ref_ent, ref_param);
|
||||
if(child_ent != NULL)
|
||||
{
|
||||
qof_entity_copy_to_session(session, child_ent);
|
||||
qof_instancecopy_to_session(session, child_ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll)
|
||||
qof_instancecopy_coll_r(QofSession *new_session, QofCollection *coll)
|
||||
{
|
||||
struct recurse_s store;
|
||||
gboolean success;
|
||||
@@ -813,12 +813,12 @@ qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll)
|
||||
store.success = success;
|
||||
store.ent_list = NULL;
|
||||
store.ref_list = qof_class_get_referenceList(qof_collection_get_g_type(coll));
|
||||
success = qof_entity_copy_coll(new_session, coll);
|
||||
success = qof_instancecopy_coll(new_session, coll);
|
||||
if(success){ qof_collection_foreach(coll, recurse_ent_cb, &store); }
|
||||
return success;
|
||||
}
|
||||
|
||||
gboolean qof_entity_copy_one_r(QofSession *new_session, QofInstance *ent)
|
||||
gboolean qof_instancecopy_one_r(QofSession *new_session, QofInstance *ent)
|
||||
{
|
||||
struct recurse_s store;
|
||||
QofCollection *coll;
|
||||
@@ -829,7 +829,7 @@ gboolean qof_entity_copy_one_r(QofSession *new_session, QofInstance *ent)
|
||||
success = TRUE;
|
||||
store.success = success;
|
||||
store.ref_list = qof_class_get_referenceList(G_OBJECT_TYPE (G_OBJECT (ent)));
|
||||
success = qof_entity_copy_to_session(new_session, ent);
|
||||
success = qof_instancecopy_to_session(new_session, ent);
|
||||
if(success == TRUE) {
|
||||
coll = qof_book_get_collection(qof_session_get_book(new_session), G_OBJECT_TYPE (G_OBJECT (ent)));
|
||||
if(coll) { qof_collection_foreach(coll, recurse_ent_cb, &store); }
|
||||
|
||||
@@ -292,7 +292,7 @@ the GUID of the source entity.
|
||||
with the same GUID already, otherwise TRUE.
|
||||
*/
|
||||
|
||||
gboolean qof_entity_copy_to_session(QofSession* new_session, QofInstance* original);
|
||||
gboolean qof_instancecopy_to_session(QofSession* new_session, QofInstance* original);
|
||||
|
||||
/** @brief Copy a GList of entities to another session
|
||||
|
||||
@@ -312,7 +312,7 @@ unique, the list can be copied.
|
||||
with the same GUID. Otherwise TRUE.
|
||||
|
||||
*/
|
||||
gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list);
|
||||
gboolean qof_instancecopy_list(QofSession *new_session, GList *entity_list);
|
||||
|
||||
/** @brief Copy a QofCollection of entities.
|
||||
|
||||
@@ -327,12 +327,12 @@ no support for handling collisions - instead, use \ref BookMerge
|
||||
with the same GUID. Otherwise TRUE.
|
||||
*/
|
||||
|
||||
gboolean qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll);
|
||||
gboolean qof_instancecopy_coll(QofSession *new_session, QofCollection *entity_coll);
|
||||
|
||||
/** \brief Recursively copy a collection of entities to a session.
|
||||
|
||||
\note This function creates a <b>partial QofBook</b>. See
|
||||
::qof_entity_copy_to_session for more information.
|
||||
::qof_instancecopy_to_session for more information.
|
||||
|
||||
The QofBook in the new_session must \b not contain any entities
|
||||
with the same GUID as any entities to be copied - there is
|
||||
@@ -358,7 +358,7 @@ one of the references fails to copy.
|
||||
|
||||
*/
|
||||
gboolean
|
||||
qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll);
|
||||
qof_instancecopy_coll_r(QofSession *new_session, QofCollection *coll);
|
||||
|
||||
/** \brief Recursively copy a single entity to a new session.
|
||||
|
||||
@@ -369,7 +369,7 @@ copied.
|
||||
|
||||
This is a deep copy - all parameters of all referenced entities are copied. If
|
||||
the top level entity has no references, this is identical to
|
||||
::qof_entity_copy_to_session.
|
||||
::qof_instancecopy_to_session.
|
||||
|
||||
@param ent A single entity that may or may not have references.
|
||||
|
||||
@@ -380,7 +380,7 @@ the top level entity has no references, this is identical to
|
||||
one of the references fails to copy.
|
||||
*/
|
||||
gboolean
|
||||
qof_entity_copy_one_r(QofSession *new_session, QofInstance *ent);
|
||||
qof_instancecopy_one_r(QofSession *new_session, QofInstance *ent);
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
@@ -633,10 +633,10 @@ qof_sql_insertCB(const QofParam *param, const gchar *insert_string, QofSqlQuery
|
||||
/* reference_type = xmlGetProp(node, QSF_OBJECT_TYPE);
|
||||
if(0 == safe_strcmp(QOF_PARAM_GUID, reference_type))
|
||||
{
|
||||
qof_entity_set_guid(qsf_ent, cm_guid);
|
||||
qof_instance_set_guid(qsf_ent, cm_guid);
|
||||
}
|
||||
else {
|
||||
reference = qof_entity_get_reference_from(qsf_ent, cm_param);
|
||||
reference = qof_instanceget_reference_from(qsf_ent, cm_param);
|
||||
if(reference) {
|
||||
params->referenceList = g_list_append(params->referenceList, reference);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ search loop, aka a 'join', which is not currently supported in the
|
||||
underlying QofQuery code.
|
||||
|
||||
However, by repeating queries and adding the entities to a new session using
|
||||
::qof_entity_copy_list, a series of queries can be added to a single
|
||||
::qof_instancecopy_list, a series of queries can be added to a single
|
||||
book. e.g. You can insert multiple entities and save out as a QSF XML
|
||||
file or use multiple SELECT queries to build a precise list - this
|
||||
can be used to replicate most of the functionality of a SQL join.
|
||||
|
||||
@@ -230,7 +230,7 @@ add_event (ComponentEventInfo *cei, const GUID *entity,
|
||||
}
|
||||
|
||||
static void
|
||||
add_event_type (ComponentEventInfo *cei, GNCIdTypeConst entity_type,
|
||||
add_event_type (ComponentEventInfo *cei, QofIdTypeConst entity_type,
|
||||
QofEventId event_mask, gboolean or_in)
|
||||
{
|
||||
QofEventId *mask;
|
||||
@@ -239,11 +239,11 @@ add_event_type (ComponentEventInfo *cei, GNCIdTypeConst entity_type,
|
||||
g_return_if_fail (cei->event_masks);
|
||||
g_return_if_fail (entity_type);
|
||||
|
||||
mask = g_hash_table_lookup (cei->event_masks, entity_type);
|
||||
mask = g_hash_table_lookup (cei->event_masks, GINT_TO_POINTER (entity_type));
|
||||
if (!mask)
|
||||
{
|
||||
mask = g_new0 (QofEventId, 1);
|
||||
g_hash_table_insert (cei->event_masks, entity_type, mask);
|
||||
g_hash_table_insert (cei->event_masks, GINT_TO_POINTER (entity_type), mask);
|
||||
}
|
||||
|
||||
if (or_in)
|
||||
@@ -265,7 +265,7 @@ gnc_cm_event_handler (QofEntity *entity,
|
||||
#endif
|
||||
add_event (&changes, guid, event_type, TRUE);
|
||||
|
||||
if (QOF_CHECK_TYPE(entity, GNC_ID_SPLIT))
|
||||
if (G_OBJECT_TYPE (entity ) == GNC_ID_SPLIT)
|
||||
{
|
||||
/* split events are never generated by the engine, but might
|
||||
* be generated by a backend (viz. the postgres backend.)
|
||||
@@ -476,7 +476,7 @@ gnc_gui_component_watch_entity_direct (gint component_id,
|
||||
|
||||
void
|
||||
gnc_gui_component_watch_entity_type (gint component_id,
|
||||
GNCIdTypeConst entity_type,
|
||||
QofIdTypeConst entity_type,
|
||||
QofEventId event_mask)
|
||||
{
|
||||
ComponentInfo *ci;
|
||||
@@ -606,11 +606,11 @@ static void
|
||||
match_type_helper (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
ComponentEventInfo *cei = user_data;
|
||||
GNCIdType id_type = key;
|
||||
QofIdType id_type = GPOINTER_TO_INT (key);
|
||||
QofEventId * et = value;
|
||||
QofEventId * et_2;
|
||||
|
||||
et_2 = g_hash_table_lookup (cei->event_masks, id_type);
|
||||
et_2 = g_hash_table_lookup (cei->event_masks, GINT_TO_POINTER (id_type));
|
||||
if (!et_2)
|
||||
return;
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ void gnc_gui_component_watch_entity_direct (gint component_id,
|
||||
* setting the mask to 0 turns off watching for the entity type
|
||||
*/
|
||||
void gnc_gui_component_watch_entity_type (gint component_id,
|
||||
GNCIdTypeConst entity_type,
|
||||
QofIdTypeConst entity_type,
|
||||
QofEventId event_mask);
|
||||
|
||||
/* gnc_gui_get_entity_events
|
||||
|
||||
@@ -595,15 +595,15 @@ _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer u
|
||||
// (gnc_collection_get_schedxaction_list(book), GNC_EVENT_ITEM_REMOVED)
|
||||
// (GNC_IS_SX(ent), QOF_EVENT_MODIFIED)
|
||||
// } */
|
||||
if (!(GNC_IS_SX(ent) || GNC_IS_SXES(ent)))
|
||||
if (!(GNC_IS_SCHEDULE_ACTION (ent) || GNC_IS_SCHEDULE_ACTIONS (ent)))
|
||||
return;
|
||||
|
||||
if (GNC_IS_SX(ent))
|
||||
if (GNC_IS_SCHEDULE_ACTION(ent))
|
||||
{
|
||||
SchedXaction *sx;
|
||||
gboolean sx_is_in_model = FALSE;
|
||||
|
||||
sx = GNC_SX(ent);
|
||||
sx = GNC_SCHEDULE_ACTION(ent);
|
||||
// only send `updated` if it's actually in the model
|
||||
sx_is_in_model = (g_list_find_custom(instances->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx) != NULL);
|
||||
if (sx_is_in_model && event_type & QOF_EVENT_MODIFY)
|
||||
@@ -612,10 +612,10 @@ _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer u
|
||||
}
|
||||
/* else { unsupported event type; ignore } */
|
||||
}
|
||||
else if (GNC_IS_SXES(ent))
|
||||
else if (GNC_SCHEDULE_ACTIONS (ent))
|
||||
{
|
||||
SchedXactions *sxes = GNC_SXES(ent);
|
||||
SchedXaction *sx = GNC_SX(evt_data);
|
||||
SchedXactions *sxes = GNC_SCHEDULE_ACTIONS (ent);
|
||||
SchedXaction *sx = GNC_SCHEDULE_ACTION (evt_data);
|
||||
|
||||
sxes = NULL;
|
||||
if (event_type & GNC_EVENT_ITEM_REMOVED)
|
||||
|
||||
@@ -2803,9 +2803,9 @@ gnc_register_kvp_option_generator(QofIdType id_type, SCM generator)
|
||||
{
|
||||
GList *list;
|
||||
init_table();
|
||||
list = g_hash_table_lookup(kvp_registry, id_type);
|
||||
list = g_hash_table_lookup(kvp_registry, GINT_TO_POINTER (id_type));
|
||||
list = g_list_prepend(list, generator);
|
||||
g_hash_table_insert(kvp_registry, (gpointer) id_type, list);
|
||||
g_hash_table_insert(kvp_registry, GINT_TO_POINTER (id_type), list);
|
||||
scm_gc_protect_object(generator);
|
||||
}
|
||||
|
||||
@@ -2819,7 +2819,7 @@ gnc_make_kvp_options(QofIdType id_type)
|
||||
SCM options = SCM_UNDEFINED;
|
||||
|
||||
init_table();
|
||||
list = g_hash_table_lookup(kvp_registry, id_type);
|
||||
list = g_hash_table_lookup(kvp_registry, GINT_TO_POINTER (id_type));
|
||||
gnc_new_options = scm_c_eval_string("gnc:new-options");
|
||||
options = scm_call_0(gnc_new_options);
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ write_out (QofMap *qm, QofInstance *inst)
|
||||
{
|
||||
if (!inst) return;
|
||||
|
||||
GUID *guid = &QOF_ENTITY(inst)->guid;
|
||||
GUID *guid = &QOF_INSTANCE(inst)->guid;
|
||||
|
||||
dui_connection_lock(qm->db_conn, qm->table_name);
|
||||
/* Use a temp book when loading from the database */
|
||||
@@ -376,7 +376,7 @@ write_out (QofMap *qm, QofInstance *inst)
|
||||
|
||||
/* See if we got something back from the DB */
|
||||
QofCollection *col;
|
||||
col = qof_book_get_collection (qm->tmp_book, QOF_ENTITY(inst)->e_type);
|
||||
col = qof_book_get_collection (qm->tmp_book, QOF_INSTANCE(inst)->e_type);
|
||||
QofEntity * db_ent = qof_collection_lookup_entity (col, guid);
|
||||
QofInstance *db_inst = QOF_INSTANCE(db_ent);
|
||||
|
||||
|
||||
@@ -804,7 +804,7 @@ file_begin_edit (QofBackend *be, QofInstance *inst, GError **error)
|
||||
QofBook *book = gp;
|
||||
const char * filepath;
|
||||
|
||||
QofIdTypeConst typ = QOF_ENTITY(inst)->e_type;
|
||||
QofIdTypeConst typ = QOF_INSTANCE(inst)->e_type;
|
||||
if (strcmp (GNC_ID_PERIOD, typ)) return;
|
||||
filepath = build_period_filepath(fbe, book);
|
||||
PINFO (" ====================== book=%p filepath=%s\n", book, filepath);
|
||||
|
||||
@@ -181,7 +181,7 @@ book_id_handler(xmlNodePtr node, gpointer book_pdata)
|
||||
GUID *guid;
|
||||
|
||||
guid = dom_tree_to_guid(node);
|
||||
qof_entity_set_guid(QOF_ENTITY(book), guid);
|
||||
qof_instance_set_guid(QOF_INSTANCE(book), guid);
|
||||
g_free(guid);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -111,7 +111,7 @@ budget_id_handler (xmlNodePtr node, gpointer bgt)
|
||||
|
||||
guid = dom_tree_to_guid(node);
|
||||
g_return_val_if_fail(guid, FALSE);
|
||||
qof_entity_set_guid(QOF_ENTITY(bgt), guid);
|
||||
qof_instance_set_guid(QOF_INSTANCE(bgt), guid);
|
||||
g_free(guid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ gnc_freqSpec_dom_tree_create( FreqSpec *fs )
|
||||
ret = xmlNewNode( NULL, BAD_CAST "gnc:freqspec" );
|
||||
xmlSetProp( ret, BAD_CAST "version", BAD_CAST freqspec_version_string );
|
||||
|
||||
xmlAddChild( ret, guid_to_dom_tree( "fs:id", &fs->entity.guid ) );
|
||||
xmlAddChild( ret, guid_to_dom_tree( "fs:id", qof_instance_get_guid (QOF_INSTANCE (fs))));
|
||||
|
||||
xmlSub = text_to_dom_tree( "fs:ui_type",
|
||||
uiFreqTypeStrs[ xaccFreqSpecGetUIType(fs) ].str );
|
||||
@@ -527,7 +527,7 @@ fs_guid_handler( xmlNodePtr node, gpointer data)
|
||||
fsParseData *fspd = data;
|
||||
GUID *guid;
|
||||
guid = dom_tree_to_guid( node );
|
||||
fspd->fs->entity.guid = *guid;
|
||||
qof_instance_set_guid (QOF_INSTANCE (fspd), guid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1377,8 +1377,9 @@ account_restore_after_child_handler(gpointer data_for_children,
|
||||
if(strcmp(child_result->tag, "slots") == 0) {
|
||||
kvp_frame *f = (kvp_frame *) child_result->data;
|
||||
g_return_val_if_fail(f, FALSE);
|
||||
if(a->inst.kvp_data) kvp_frame_delete(a->inst.kvp_data);
|
||||
a->inst.kvp_data = f;
|
||||
if(qof_instance_get_kvp_data (QOF_INSTANCE (a)))
|
||||
qof_instance_delete_kvp_data (QOF_INSTANCE (a));
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE (a), f);
|
||||
child_result->should_cleanup = FALSE;
|
||||
}
|
||||
else if(strcmp(child_result->tag, "currency") == 0) {
|
||||
@@ -3112,8 +3113,9 @@ txn_restore_split_after_child_handler(gpointer data_for_children,
|
||||
if(strcmp(child_result->tag, "slots") == 0) {
|
||||
kvp_frame *f = (kvp_frame *) child_result->data;
|
||||
g_return_val_if_fail(f, FALSE);
|
||||
if(s->inst.kvp_data) kvp_frame_delete(s->inst.kvp_data);
|
||||
s->inst.kvp_data = f;
|
||||
if(qof_instance_get_kvp_data (QOF_INSTANCE (s)))
|
||||
qof_instance_delete_kvp_data (QOF_INSTANCE (s));
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE (s), f);
|
||||
child_result->should_cleanup = FALSE;
|
||||
}
|
||||
else if(strcmp(child_result->tag, "quantity") == 0) {
|
||||
|
||||
@@ -305,12 +305,12 @@ add_pricedb_local(sixtp_gdv2 *data, GNCPriceDB *db)
|
||||
}
|
||||
|
||||
static void
|
||||
do_counter_cb (const char *type, gpointer data_p, gpointer be_data_p)
|
||||
do_counter_cb (const gchar *type, gpointer data_p, gpointer be_data_p)
|
||||
{
|
||||
GncXmlDataType_t *data = data_p;
|
||||
struct file_backend *be_data = be_data_p;
|
||||
|
||||
g_return_if_fail (type && data && be_data);
|
||||
g_return_if_fail (type != G_TYPE_INVALID && data && be_data);
|
||||
g_return_if_fail (data->version == GNC_FILE_BACKEND_VERS);
|
||||
|
||||
if (be_data->ok == TRUE)
|
||||
|
||||
@@ -139,7 +139,7 @@ get_one_book_cb (PGBackend *be, PGresult *result, int j, gpointer data)
|
||||
guid = nullguid; /* just in case the read fails ... */
|
||||
string_to_guid (DB_GET_VAL("bookGuid",j), &guid);
|
||||
|
||||
qof_entity_set_guid ((QofEntity*)book, &guid);
|
||||
qof_instance_set_guid ((QofInstance*)book, &guid);
|
||||
|
||||
if((DB_GET_VAL("book_open",j))[0] == 'n')
|
||||
{
|
||||
@@ -208,14 +208,14 @@ get_book_cb (PGBackend *be, PGresult *result, int j, gpointer data)
|
||||
for (node=blist; node; node=node->next)
|
||||
{
|
||||
book = node->data;
|
||||
if (guid_equal (qof_entity_get_guid((QofEntity*)book), &guid)) break;
|
||||
if (guid_equal (qof_instance_get_guid(QOF_INSTANCE (book)), &guid)) break;
|
||||
book = NULL;
|
||||
}
|
||||
|
||||
if (!book)
|
||||
{
|
||||
book = qof_book_new();
|
||||
qof_entity_set_guid ((QofEntity*)book, &guid);
|
||||
qof_instance_set_guid ((QofInstance*)book, &guid);
|
||||
}
|
||||
|
||||
if((DB_GET_VAL("book_open",j))[0] == 'n')
|
||||
|
||||
@@ -358,7 +358,7 @@ int finishQuery(PGBackend *be);
|
||||
for (node=be->blist; node; node=node->next) \
|
||||
{ \
|
||||
book = node->data; \
|
||||
if (guid_equal (qof_entity_get_guid((QofEntity*)book), &book_guid)) break; \
|
||||
if (guid_equal (qof_instance_get_guid(QOF_INSTANCE (book)), &book_guid)) break; \
|
||||
book = NULL; \
|
||||
} \
|
||||
if (!book) return data; \
|
||||
|
||||
@@ -13,7 +13,7 @@ define(`account', `gncAccount, Account, Account, a,
|
||||
commodity, , char *, gnc_commodity_get_unique_name(xaccAccountGetCommodity(ptr)),
|
||||
version, , int32, xaccAccountGetVersion(ptr),
|
||||
iguid, , int32, ptr->idata,
|
||||
bookGUID, , GUID *, qof_entity_get_guid((QofEntity*)xaccAccountGetBook(ptr)),
|
||||
bookGUID, , GUID *, qof_instance_get_guid(QOF_INSTANCE (xaccAccountGetBook(ptr))),
|
||||
parentGUID, , GUID *, xaccAccountGetGUID(xaccAccountGetParentAccount(ptr)),
|
||||
accountGUID, KEY, GUID *, xaccAccountGetGUID(ptr),
|
||||
')
|
||||
@@ -362,7 +362,7 @@ define(`compare_version',
|
||||
|
||||
p = be->buff; *p = 0;
|
||||
p = stpcpy (p, "SELECT version FROM tablename($@) WHERE key_fieldname($@) = ''`");
|
||||
p = guid_to_string_buff (qof_entity_get_guid(QOF_ENTITY(ptr)), p);
|
||||
p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p);
|
||||
p = stpcpy (p, "''`;");
|
||||
SEND_QUERY (be,be->buff, -1);
|
||||
sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));
|
||||
@@ -392,7 +392,7 @@ define(`is_deleted',
|
||||
|
||||
p = be->buff; *p = 0;
|
||||
p = stpcpy (p, "SELECT version FROM tablename($@)" "Trail WHERE key_fieldname($@) = ''`");
|
||||
p = guid_to_string_buff (qof_entity_get_guid(QOF_ENTITY(ptr)), p);
|
||||
p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p);
|
||||
p = stpcpy (p, "''` AND change = ''`d''`;");
|
||||
SEND_QUERY (be,be->buff, -1);
|
||||
sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));
|
||||
|
||||
@@ -267,7 +267,7 @@ gncAddressFree (GncAddress *addr)
|
||||
{
|
||||
if (!addr) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (addr), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (addr), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (addr->priv->name);
|
||||
CACHE_REMOVE (addr->priv->addr1);
|
||||
|
||||
@@ -64,7 +64,7 @@ GncBillTerm * gncCloneBillTerm (GncBillTerm *from, QofBook *);
|
||||
*/
|
||||
GncBillTerm * gncBillTermObtainTwin (GncBillTerm *from, QofBook *book);
|
||||
|
||||
#define gncBillTermSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncBillTermSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
|
||||
#endif /* GNC_BILLTERMP_H_ */
|
||||
@@ -240,16 +240,16 @@ GncCustomer *gncCustomerCreate (QofBook *book)
|
||||
cust->priv->id = CACHE_INSERT ("");
|
||||
cust->priv->name = CACHE_INSERT ("");
|
||||
cust->priv->notes = CACHE_INSERT ("");
|
||||
cust->priv->addr = gncAddressCreate (book, QOF_ENTITY (cust));
|
||||
cust->priv->addr = gncAddressCreate (book, QOF_INSTANCE (cust));
|
||||
cust->priv->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
|
||||
cust->priv->active = TRUE;
|
||||
cust->priv->jobs = NULL;
|
||||
|
||||
cust->priv->discount = gnc_numeric_zero();
|
||||
cust->priv->credit = gnc_numeric_zero();
|
||||
cust->priv->shipaddr = gncAddressCreate (book, QOF_ENTITY (cust));
|
||||
cust->priv->shipaddr = gncAddressCreate (book, QOF_INSTANCE (cust));
|
||||
|
||||
qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return cust;
|
||||
}
|
||||
@@ -275,8 +275,8 @@ gncCloneCustomer (GncCustomer *from, QofBook *book)
|
||||
cust->priv->active = from->active;
|
||||
cust->priv->taxtable_override = from->taxtable_override;
|
||||
|
||||
cust->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (cust), book);
|
||||
cust->priv->shipaddr = gncCloneAddress (from->shipaddr, QOF_ENTITY (cust), book);
|
||||
cust->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (cust), book);
|
||||
cust->priv->shipaddr = gncCloneAddress (from->shipaddr, QOF_INSTANCE (cust), book);
|
||||
|
||||
/* Find the matching currency in the new book, assumes
|
||||
* currency has already been copied into new book. */
|
||||
@@ -293,7 +293,7 @@ gncCloneCustomer (GncCustomer *from, QofBook *book)
|
||||
cust->priv->jobs = g_list_prepend(cust->priv->jobs, job);
|
||||
}
|
||||
|
||||
qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return cust;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ static void gncCustomerFree (GncCustomer *cust)
|
||||
{
|
||||
if (!cust) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (cust->priv->id);
|
||||
CACHE_REMOVE (cust->priv->name);
|
||||
@@ -483,7 +483,7 @@ void gncCustomerAddJob (GncCustomer *cust, GncJob *job)
|
||||
cust->priv->jobs = g_list_insert_sorted (cust->priv->jobs, job,
|
||||
(GCompareFunc)gncJobCompare);
|
||||
|
||||
qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
void gncCustomerRemoveJob (GncCustomer *cust, GncJob *job)
|
||||
@@ -500,7 +500,7 @@ void gncCustomerRemoveJob (GncCustomer *cust, GncJob *job)
|
||||
cust->priv->jobs = g_list_remove_link (cust->priv->jobs, node);
|
||||
g_list_free_1 (node);
|
||||
}
|
||||
qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
void gncCustomerBeginEdit (GncCustomer *cust)
|
||||
|
||||
@@ -53,6 +53,6 @@ GncCustomer * gncCloneCustomer (GncCustomer *from, QofBook *book);
|
||||
*/
|
||||
GncCustomer * gncCustomerObtainTwin (GncCustomer *from, QofBook *book);
|
||||
|
||||
#define gncCustomerSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncCustomerSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
#endif /* GNC_CUSTOMERP_H_ */
|
||||
@@ -183,7 +183,7 @@ G_INLINE_FUNC void mark_employee (GncEmployee *employee);
|
||||
void mark_employee (GncEmployee *employee)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_INSTANCE (employee));
|
||||
qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -204,12 +204,12 @@ GncEmployee *gncEmployeeCreate (QofBook *book)
|
||||
employee->priv->username = CACHE_INSERT ("");
|
||||
employee->priv->language = CACHE_INSERT ("");
|
||||
employee->priv->acl = CACHE_INSERT ("");
|
||||
employee->priv->addr = gncAddressCreate (book, QOF_ENTITY (employee));
|
||||
employee->priv->addr = gncAddressCreate (book, QOF_INSTANCE (employee));
|
||||
employee->priv->workday = gnc_numeric_zero();
|
||||
employee->priv->rate = gnc_numeric_zero();
|
||||
employee->priv->active = TRUE;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return employee;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ static void gncEmployeeFree (GncEmployee *employee)
|
||||
{
|
||||
if (!employee) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (employee->priv->id);
|
||||
CACHE_REMOVE (employee->priv->username);
|
||||
@@ -250,7 +250,7 @@ gncCloneEmployee (GncEmployee *from, QofBook *book)
|
||||
employee->priv->username = CACHE_INSERT (from->username);
|
||||
employee->priv->language = CACHE_INSERT (from->language);
|
||||
employee->priv->acl = CACHE_INSERT (from->acl);
|
||||
employee->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (employee), book);
|
||||
employee->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (employee), book);
|
||||
employee->priv->workday = from->workday;
|
||||
employee->priv->rate = from->rate;
|
||||
employee->priv->active = from->active;
|
||||
@@ -258,7 +258,7 @@ gncCloneEmployee (GncEmployee *from, QofBook *book)
|
||||
employee->priv->ccard_acc =
|
||||
GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->ccard_acc), book));
|
||||
|
||||
qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return employee;
|
||||
}
|
||||
|
||||
@@ -127,9 +127,9 @@ gboolean gncEmployeeIsDirty (GncEmployee *employee);
|
||||
#define EMPLOYEE_CC "credit_card_account"
|
||||
|
||||
/** deprecated routines */
|
||||
#define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_ENTITY(E))
|
||||
#define gncEmployeeGetGUID(E) qof_instance_get_guid(QOF_INSTANCE(E))
|
||||
#define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
|
||||
#define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_ENTITY(E))) : *(guid_null()))
|
||||
#define gncEmployeeRetGUID(E) (E ? *(qof_instance_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
|
||||
#define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
|
||||
|
||||
#endif /* GNC_EMPLOYEE_H_ */
|
||||
|
||||
@@ -57,6 +57,6 @@ GncEmployee * gncCloneEmployee (GncEmployee *from, QofBook *);
|
||||
*/
|
||||
GncEmployee * gncEmployeeObtainTwin (GncEmployee *from, QofBook *book);
|
||||
|
||||
#define gncEmployeeSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncEmployeeSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
#endif /* GNC_EMPLOYEEP_H_ */
|
||||
@@ -59,6 +59,6 @@ GncEntry * gncCloneEntry (GncEntry *from, QofBook *);
|
||||
*/
|
||||
GncEntry * gncEntryObtainTwin (GncEntry *from, QofBook *book);
|
||||
|
||||
#define gncEntrySetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncEntrySetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
#endif /* GNC_ENTRYP_H_ */
|
||||
@@ -207,7 +207,7 @@ static void
|
||||
mark_invoice (GncInvoice *invoice)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_INSTANCE (invoice));
|
||||
qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
QofBook * gncInvoiceGetBook(GncInvoice *x)
|
||||
@@ -236,7 +236,7 @@ GncInvoice *gncInvoiceCreate (QofBook *book)
|
||||
|
||||
invoice->priv->to_charge_amount = gnc_numeric_zero();
|
||||
|
||||
qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return invoice;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static void gncInvoiceFree (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (invoice->priv->id);
|
||||
CACHE_REMOVE (invoice->priv->notes);
|
||||
@@ -317,7 +317,7 @@ XXX not done */
|
||||
GNCLot * posted_lot;
|
||||
#endif
|
||||
|
||||
qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
@@ -63,5 +63,5 @@ GncInvoice * gncCloneInvoice (GncInvoice *from, QofBook *);
|
||||
* different ways.
|
||||
*/
|
||||
GncInvoice * gncInvoiceObtainTwin (GncInvoice *from, QofBook *book);
|
||||
#define gncInvoiceSetGUID(I,G) qof_entity_set_guid(QOF_ENTITY(I),(G))
|
||||
#define gncInvoiceSetGUID(I,G) qof_instance_set_guid(QOF_INSTANCE(I),(G))
|
||||
#endif /* GNC_INVOICEP_H_ */
|
||||
@@ -173,7 +173,7 @@ G_INLINE_FUNC void mark_job (GncJob *job);
|
||||
void mark_job (GncJob *job)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_INSTANCE (job));
|
||||
qof_event_gen (QOF_ENTITY (job), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
@@ -196,7 +196,7 @@ GncJob *gncJobCreate (QofBook *book)
|
||||
job->priv->active = TRUE;
|
||||
|
||||
/* GncOwner not initialized */
|
||||
qof_event_gen (QOF_ENTITY (job), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return job;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ gncCloneJob (GncJob *from, QofBook *book)
|
||||
|
||||
job->priv->owner = gncCloneOwner(&from->owner, book);
|
||||
|
||||
qof_event_gen (QOF_ENTITY (job), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return job;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ static void gncJobFree (GncJob *job)
|
||||
{
|
||||
if (!job) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (job), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (job->priv->id);
|
||||
CACHE_REMOVE (job->priv->name);
|
||||
|
||||
@@ -53,6 +53,6 @@ GncJob * gncCloneJob (GncJob *from, QofBook *book);
|
||||
*/
|
||||
GncJob * gncJobObtainTwin (GncJob *from, QofBook *book);
|
||||
|
||||
#define gncJobSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncJobSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
#endif /* GNC_JOBP_H_ */
|
||||
@@ -187,7 +187,7 @@ G_INLINE_FUNC void mark_order (GncOrder *order);
|
||||
void mark_order (GncOrder *order)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_INSTANCE (order));
|
||||
qof_event_gen (QOF_ENTITY (order), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* =============================================================== */
|
||||
@@ -210,7 +210,7 @@ GncOrder *gncOrderCreate (QofBook *book)
|
||||
|
||||
order->priv->active = TRUE;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (order), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return order;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ static void gncOrderFree (GncOrder *order)
|
||||
{
|
||||
if (!order) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (order), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
g_list_free (order->priv->entries);
|
||||
CACHE_REMOVE (order->priv->id);
|
||||
@@ -270,7 +270,7 @@ gncCloneOrder (GncOrder *from, QofBook *book)
|
||||
order->priv->entries = g_list_prepend (order->priv->entries, entry);
|
||||
}
|
||||
|
||||
qof_event_gen (QOF_ENTITY (order), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,6 @@ GncOrder * gncCloneOrder (GncOrder *from, QofBook *);
|
||||
*/
|
||||
GncOrder * gncOrderObtainTwin (GncOrder *from, QofBook *book);
|
||||
|
||||
#define gncOrderSetGUID(O,G) qof_entity_set_guid(QOF_ENTITY(O),(G))
|
||||
#define gncOrderSetGUID(O,G) qof_instance_set_guid(QOF_INSTANCE(O),(G))
|
||||
|
||||
#endif /* GNC_ORDERP_H_ */
|
||||
@@ -63,6 +63,6 @@ GncTaxTable * gncCloneTaxTable (GncTaxTable *from, QofBook *book);
|
||||
*/
|
||||
GncTaxTable * gncTaxTableObtainTwin (GncTaxTable *from, QofBook *book);
|
||||
|
||||
#define gncTaxTableSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
|
||||
#define gncTaxTableSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
|
||||
|
||||
#endif /* GNC_TAXTABLEP_H_ */
|
||||
@@ -186,8 +186,8 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
|
||||
G_INLINE_FUNC void mark_vendor (GncVendor *vendor);
|
||||
void mark_vendor (GncVendor *vendor)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_ENTITY (vendor));
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (vendor));
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -200,17 +200,17 @@ GncVendor *gncVendorCreate (QofBook *book)
|
||||
if (!book) return NULL;
|
||||
|
||||
vendor = g_new0 (GncVendor, 1);
|
||||
qof_instance_init (QOF_ENTITY (vendor), _GNC_MOD_NAME, book);
|
||||
qof_instance_init (QOF_INSTANCE (vendor), _GNC_MOD_NAME, book);
|
||||
|
||||
vendor->priv->id = CACHE_INSERT ("");
|
||||
vendor->priv->name = CACHE_INSERT ("");
|
||||
vendor->priv->notes = CACHE_INSERT ("");
|
||||
vendor->priv->addr = gncAddressCreate (book, QOF_ENTITY (vendor));
|
||||
vendor->priv->addr = gncAddressCreate (book, QOF_INSTANCE (vendor));
|
||||
vendor->priv->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
|
||||
vendor->priv->active = TRUE;
|
||||
vendor->priv->jobs = NULL;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return vendor;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ static void gncVendorFree (GncVendor *vendor)
|
||||
{
|
||||
if (!vendor) return;
|
||||
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE (vendor->priv->id);
|
||||
CACHE_REMOVE (vendor->priv->name);
|
||||
@@ -239,7 +239,7 @@ static void gncVendorFree (GncVendor *vendor)
|
||||
if (vendor->priv->taxtable)
|
||||
gncTaxTableDecRef (vendor->priv->taxtable);
|
||||
|
||||
qof_instance_release (QOF_ENTITY (vendor));
|
||||
qof_instance_release (QOF_INSTANCE (vendor));
|
||||
|
||||
}
|
||||
|
||||
@@ -254,13 +254,13 @@ gncCloneVendor (GncVendor *from, QofBook *book)
|
||||
vendor = GNC_VENDOR ( g_object_new (GNC_TYPE_VENDOR, NULL));
|
||||
vendor->priv = g_new0 (GncVendorPrivate, 1);
|
||||
|
||||
qof_instance_init (QOF_ENTITY (vendor), _GNC_MOD_NAME, book);
|
||||
qof_instance_gemini (QOF_ENTITY (vendor), &from->inst);
|
||||
qof_instance_init (QOF_INSTANCE (vendor), _GNC_MOD_NAME, book);
|
||||
qof_instance_gemini (QOF_INSTANCE (vendor), &from->inst);
|
||||
|
||||
vendor->priv->id = CACHE_INSERT (from->id);
|
||||
vendor->priv->name = CACHE_INSERT (from->name);
|
||||
vendor->priv->notes = CACHE_INSERT (from->notes);
|
||||
vendor->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (vendor), book);
|
||||
vendor->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (vendor), book);
|
||||
vendor->priv->taxincluded = from->taxincluded;
|
||||
vendor->priv->taxtable_override = from->taxtable_override;
|
||||
vendor->priv->active = from->active;
|
||||
@@ -281,7 +281,7 @@ gncCloneVendor (GncVendor *from, QofBook *book)
|
||||
vendor->priv->jobs = g_list_prepend(vendor->priv->jobs, job);
|
||||
}
|
||||
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return vendor;
|
||||
}
|
||||
@@ -516,7 +516,7 @@ void gncVendorAddJob (GncVendor *vendor, GncJob *job)
|
||||
vendor->priv->jobs = g_list_insert_sorted (vendor->priv->jobs, job,
|
||||
(GCompareFunc)gncJobCompare);
|
||||
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
void gncVendorRemoveJob (GncVendor *vendor, GncJob *job)
|
||||
@@ -534,12 +534,12 @@ void gncVendorRemoveJob (GncVendor *vendor, GncJob *job)
|
||||
g_list_free_1 (node);
|
||||
}
|
||||
|
||||
qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
void gncVendorBeginEdit (GncVendor *vendor)
|
||||
{
|
||||
QOF_BEGIN_EDIT (QOF_ENTITY (vendor));
|
||||
QOF_BEGIN_EDIT (QOF_INSTANCE (vendor));
|
||||
}
|
||||
|
||||
static void gncVendorOnError (QofInstance *vendor, QofBackendError errcode)
|
||||
@@ -562,7 +562,7 @@ static void vendor_free (QofInstance *inst)
|
||||
void gncVendorCommitEdit (GncVendor *vendor)
|
||||
{
|
||||
if (!qof_commit_edit (QOF_INSTANCE(vendor))) return;
|
||||
qof_commit_edit_part2 (QOF_ENTITY (vendor), gncVendorOnError,
|
||||
qof_commit_edit_part2 (QOF_INSTANCE (vendor), gncVendorOnError,
|
||||
gncVendorOnDone, vendor_free);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ GncVendor * gncCloneVendor (GncVendor *from, QofBook *);
|
||||
* different ways.
|
||||
*/
|
||||
GncVendor * gncVendorObtainTwin (GncVendor *from, QofBook *book);
|
||||
#define gncVendorSetGUID(V,G) qof_entity_set_guid(QOF_ENTITY(V),(G))
|
||||
#define gncVendorSetGUID(V,G) qof_instance_set_guid(QOF_INSTANCE(V),(G))
|
||||
|
||||
|
||||
#endif /* GNC_VENDORP_H_ */
|
||||
@@ -727,10 +727,10 @@ gnc_plugin_business_cmd_export_invoice (GtkAction *action, GncMainWindowActionDa
|
||||
{
|
||||
qof_session_begin(chart_session, filename, TRUE, TRUE);
|
||||
coll = qof_book_get_collection(book, GNC_ID_INVOICE);
|
||||
success = qof_entity_copy_coll_r(chart_session, coll);
|
||||
success = qof_instancecopy_coll_r(chart_session, coll);
|
||||
/* Need to get the GList of GncEntry's - KVP */
|
||||
coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
|
||||
success = qof_entity_copy_coll_r(chart_session, coll);
|
||||
success = qof_instancecopy_coll_r(chart_session, coll);
|
||||
if(success)
|
||||
{
|
||||
qof_session_save(chart_session, NULL);
|
||||
@@ -762,7 +762,7 @@ gnc_plugin_business_cmd_export_customer (GtkAction *action, GncMainWindowActionD
|
||||
{
|
||||
qof_session_begin(chart_session, filename, TRUE, TRUE);
|
||||
coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
|
||||
success = qof_entity_copy_coll_r(chart_session, coll);
|
||||
success = qof_instancecopy_coll_r(chart_session, coll);
|
||||
if(success)
|
||||
{
|
||||
qof_session_save(chart_session, NULL);
|
||||
@@ -794,7 +794,7 @@ gnc_plugin_business_cmd_export_vendor (GtkAction *action, GncMainWindowActionDat
|
||||
{
|
||||
qof_session_begin(chart_session, filename, TRUE, TRUE);
|
||||
coll = qof_book_get_collection(book, GNC_ID_VENDOR);
|
||||
success = qof_entity_copy_coll_r(chart_session, coll);
|
||||
success = qof_instancecopy_coll_r(chart_session, coll);
|
||||
if(success)
|
||||
{
|
||||
qof_session_save(chart_session, NULL);
|
||||
@@ -826,7 +826,7 @@ gnc_plugin_business_cmd_export_employee (GtkAction *action, GncMainWindowActionD
|
||||
{
|
||||
qof_session_begin(chart_session, filename, TRUE, TRUE);
|
||||
coll = qof_book_get_collection(book, GNC_ID_EMPLOYEE);
|
||||
success = qof_entity_copy_coll_r(chart_session, coll);
|
||||
success = qof_instancecopy_coll_r(chart_session, coll);
|
||||
if(success)
|
||||
{
|
||||
qof_session_save(chart_session, NULL);
|
||||
|
||||
+71
-3
@@ -486,15 +486,83 @@ xaccCloneAccountSimple (const GncAccount *from, QofBook *book)
|
||||
AccountGroup*
|
||||
gnc_account_get_children (GncAccount* acc)
|
||||
{
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), NULL);
|
||||
return acc->priv->children;
|
||||
}
|
||||
|
||||
AccountGroup*
|
||||
void
|
||||
gnc_account_set_children (GncAccount* acc, AccountGroup *grp)
|
||||
{
|
||||
g_return_if_fail (GNC_IS_ACCOUNT (acc));
|
||||
acc->priv->children = grp;
|
||||
}
|
||||
|
||||
AccountGroup*
|
||||
gnc_account_get_parent (GncAccount* acc)
|
||||
{
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), NULL);
|
||||
return acc->priv->parent;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_account_set_parent (GncAccount* acc, AccountGroup *grp)
|
||||
{
|
||||
g_return_if_fail (GNC_IS_ACCOUNT (acc));
|
||||
acc->priv->parent = grp;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_account_set_sort_dirty (GncAccount *acc, gboolean val)
|
||||
{
|
||||
g_return_if_fail (GNC_IS_ACCOUNT (acc));
|
||||
acc->priv->sort_dirty = val;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_account_get_sort_dirty (GncAccount *acc)
|
||||
{
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
|
||||
return acc->priv->sort_dirty;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_account_set_balance_dirty (GncAccount *acc, gboolean val)
|
||||
{
|
||||
g_return_if_fail (GNC_IS_ACCOUNT (acc));
|
||||
acc->priv->balance_dirty = val;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_account_get_balance_dirty (GncAccount *acc)
|
||||
{
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
|
||||
return acc->priv->balance_dirty;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_account_set_policy (GncAccount *acc, GNCPolicy *policy)
|
||||
{
|
||||
acc->priv->policy = policy;
|
||||
}
|
||||
|
||||
GNCPolicy*
|
||||
gnc_account_get_policy (GncAccount *acc)
|
||||
{
|
||||
return acc->priv->policy;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_account_set_commodity (GncAccount *acc, gnc_commodity *commodity)
|
||||
{
|
||||
acc->priv->commodity = commodity;
|
||||
}
|
||||
gnc_commodity*
|
||||
gnc_account_get_commodity (GncAccount *acc)
|
||||
{
|
||||
return acc->priv->commodity;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* transactional routines
|
||||
\********************************************************************/
|
||||
@@ -1660,7 +1728,7 @@ xaccAccountConvertBalanceToCurrency(const GncAccount *acc, /* for book */
|
||||
gnc_commodity_equiv (balance_currency, new_currency))
|
||||
return balance;
|
||||
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (acc));
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot ((GncAccount*)acc));
|
||||
pdb = gnc_pricedb_get_db (book);
|
||||
|
||||
balance = gnc_pricedb_convert_balance_latest_price(
|
||||
@@ -1688,7 +1756,7 @@ xaccAccountConvertBalanceToCurrencyAsOfDate(const GncAccount *acc, /* for book *
|
||||
gnc_commodity_equiv (balance_currency, new_currency))
|
||||
return balance;
|
||||
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (acc));
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot ((GncAccount*)acc));
|
||||
pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
ts.tv_sec = date;
|
||||
|
||||
+17
-3
@@ -47,6 +47,7 @@
|
||||
#define XACC_ACCOUNT_H
|
||||
#include "qof.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "policy.h"
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
@@ -217,13 +218,13 @@ void gnc_set_account_separator (const gchar *separator);
|
||||
|
||||
/** @deprecated */
|
||||
#define xaccAccountGetBook(X) qof_instance_get_book(QOF_INSTANCE(X))
|
||||
#define xaccAccountGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define xaccAccountReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
|
||||
#define xaccAccountGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
#define xaccAccountReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
|
||||
|
||||
/** The xaccAccountLookup() subroutine will return the
|
||||
* account associated with the given id, or NULL
|
||||
* if there is no such account. */
|
||||
#define xaccAccountLookup (guid, book) qof_book_get_object (book, GNC_TYPE_ACCOUNT, guid)
|
||||
#define xaccAccountLookup(guid, book) GNC_ACCOUNT (qof_book_get_element (book, GNC_TYPE_ACCOUNT, guid))
|
||||
#define xaccAccountLookupDirect(g,b) xaccAccountLookup(&(g),b)
|
||||
|
||||
/** @} */
|
||||
@@ -842,6 +843,19 @@ void gnc_account_set_children (GncAccount* acc, AccountGroup *grp);
|
||||
AccountGroup* gnc_account_get_parent (GncAccount* acc);
|
||||
void gnc_account_set_parent (GncAccount* acc, AccountGroup *grp);
|
||||
|
||||
void gnc_account_set_sort_dirty (GncAccount *acc, gboolean val);
|
||||
gboolean gnc_account_get_sort_dirty (GncAccount *acc);
|
||||
|
||||
|
||||
void gnc_account_set_balance_dirty (GncAccount *acc, gboolean val);
|
||||
gboolean gnc_account_get_balance_dirty (GncAccount *acc);
|
||||
|
||||
void gnc_account_set_policy (GncAccount *acc, GNCPolicy *policy);
|
||||
GNCPolicy* gnc_account_get_policy (GncAccount *acc);
|
||||
|
||||
void gnc_account_set_commodity (GncAccount *acc, gnc_commodity *commodity);
|
||||
gnc_commodity* gnc_account_get_commodity (GncAccount *acc);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
@@ -346,8 +346,8 @@ xaccFreqSpecFree( FreqSpec *fs )
|
||||
qof_event_gen( QOF_INSTANCE (fs), QOF_EVENT_DESTROY , NULL);
|
||||
xaccFreqSpecCleanUp( fs );
|
||||
|
||||
qof_entity_release (fs);
|
||||
// g_free( fs ); the qof_entity_realise function call g_object_unref
|
||||
qof_instancerelease (fs);
|
||||
// g_free( fs ); the qof_instancerealise function call g_object_unref
|
||||
}
|
||||
|
||||
FreqType
|
||||
|
||||
+15
-10
@@ -1,29 +1,34 @@
|
||||
|
||||
#include "qof.h"
|
||||
#include <glib.h>
|
||||
|
||||
#ifndef GNC_ID_H
|
||||
#define GNC_ID_H
|
||||
|
||||
/* Equivalent function prototype:
|
||||
* void xaccGUIDNew (GUID *guid, QofBook *book)
|
||||
*/
|
||||
#define xaccGUIDNew(guid,book) \
|
||||
qof_entity_guid_new (qof_book_get_entity_table (book), (guid))
|
||||
qof_instanceguid_new (qof_book_get_entity_table (book), (guid))
|
||||
|
||||
|
||||
#define xaccGUIDNULL guid_null
|
||||
#define xaccGUIDMalloc guid_malloc
|
||||
#define xaccGUIDFree guid_free
|
||||
|
||||
#define GNCIdTypeConst QofIdTypeConst
|
||||
#define GNCIdType QofIdType
|
||||
typedef gchar* GNCIdTypeConst;
|
||||
typedef gchar* GNCIdType;
|
||||
#define GNCEntityTable QofEntityTable
|
||||
#define xaccGUIDTypeEntityTable qof_guid_type
|
||||
|
||||
#define xaccEntityTableNew qof_entity_new
|
||||
#define xaccEntityTableDestroy qof_entity_destroy
|
||||
#define xaccGUIDNewEntityTable qof_entity_guid_new
|
||||
#define xaccLookupEntity qof_entity_lookup
|
||||
#define xaccStoreEntity qof_entity_store
|
||||
#define xaccRemoveEntity qof_entity_remove
|
||||
#define xaccForeachEntity qof_entity_foreach
|
||||
#define xaccEntityTableNew qof_instancenew
|
||||
#define xaccEntityTableDestroy qof_instancedestroy
|
||||
#define xaccGUIDNewEntityTable qof_instanceguid_new
|
||||
#define xaccLookupEntity qof_instancelookup
|
||||
#define xaccStoreEntity qof_instancestore
|
||||
#define xaccRemoveEntity qof_instanceremove
|
||||
#define xaccForeachEntity qof_instanceforeach
|
||||
|
||||
#define foreachObjectCB QofEntityForeachCB
|
||||
|
||||
#endif
|
||||
+55
-55
@@ -366,7 +366,7 @@ xaccGroupMarkDoFree (AccountGroup *grp)
|
||||
for (node = grp->accounts; node; node = node->next)
|
||||
{
|
||||
Account *account = node->data;
|
||||
qof_instace_do_free ((const QofInstance*) QOF_INSTANCE (account));
|
||||
qof_instance_do_free ((const QofInstance*) QOF_INSTANCE (account));
|
||||
xaccGroupMarkDoFree (gnc_account_get_children (account));
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@ xaccFreeAccountGroup (AccountGroup *grp)
|
||||
|
||||
grp->parent = NULL;
|
||||
|
||||
qof_instance_release ();
|
||||
qof_instance_release (QOF_INSTANCE (grp));
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -629,7 +629,7 @@ xaccGroupGetRoot (const AccountGroup * grp)
|
||||
parent_acc = grp->parent;
|
||||
|
||||
if (parent_acc)
|
||||
grp = parent_acc->parent;
|
||||
grp = gnc_account_get_parent (parent_acc);
|
||||
else
|
||||
grp = NULL;
|
||||
}
|
||||
@@ -638,9 +638,9 @@ xaccGroupGetRoot (const AccountGroup * grp)
|
||||
}
|
||||
|
||||
AccountGroup *
|
||||
xaccAccountGetRoot (const Account * acc)
|
||||
xaccAccountGetRoot (GncAccount * acc)
|
||||
{
|
||||
return acc ? xaccGroupGetRoot (acc->parent) : NULL;
|
||||
return acc ? xaccGroupGetRoot (gnc_account_get_parent (acc)) : NULL;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -794,7 +794,7 @@ xaccGetPeerAccountFromName (const Account *acc, const char * name)
|
||||
if (!name) return NULL;
|
||||
|
||||
/* first, find the root of the account group structure */
|
||||
root = xaccAccountGetRoot (acc);
|
||||
root = xaccAccountGetRoot ((GncAccount*)acc);
|
||||
|
||||
/* now search all accounts hanging off the root */
|
||||
peer_acc = xaccGetAccountFromName (root, name);
|
||||
@@ -816,7 +816,7 @@ xaccGetPeerAccountFromFullName (const Account *acc, const char * name)
|
||||
if (!name) return NULL;
|
||||
|
||||
/* first, find the root of the account group structure */
|
||||
root = xaccAccountGetRoot (acc);
|
||||
root = xaccAccountGetRoot ((GncAccount*)acc);
|
||||
|
||||
/* now search all acounts hanging off the root */
|
||||
peer_acc = xaccGetAccountFromFullName (root, name);
|
||||
@@ -835,19 +835,19 @@ xaccAccountRemoveGroup (Account *acc)
|
||||
/* if this group has no parent, it must be the topgroup */
|
||||
if (!acc) return;
|
||||
|
||||
grp = acc->children;
|
||||
grp = gnc_account_get_children (acc);
|
||||
|
||||
if (grp) grp->parent = NULL;
|
||||
acc->children = NULL;
|
||||
gnc_account_set_children (acc, NULL);
|
||||
|
||||
/* make sure that the parent of the group is marked
|
||||
* as having been modified. */
|
||||
grp = acc->parent;
|
||||
grp = gnc_account_get_parent (acc);
|
||||
if (!grp) return;
|
||||
|
||||
grp->saved = 0;
|
||||
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -864,7 +864,7 @@ xaccGroupRemoveAccount (AccountGroup *grp, Account *acc)
|
||||
* are not yet parented. */
|
||||
if (!grp) return;
|
||||
|
||||
if (acc->parent != grp)
|
||||
if (gnc_account_get_parent (acc) != grp)
|
||||
{
|
||||
PERR ("account not in group");
|
||||
return;
|
||||
@@ -877,10 +877,10 @@ xaccGroupRemoveAccount (AccountGroup *grp, Account *acc)
|
||||
grp->accounts = g_list_remove (grp->accounts, acc);
|
||||
|
||||
/* Now send the event. */
|
||||
qof_event_gen(&acc->inst.entity, QOF_EVENT_REMOVE, &ed);
|
||||
qof_event_gen(QOF_INSTANCE (acc), QOF_EVENT_REMOVE, &ed);
|
||||
|
||||
/* clear the account's group pointer after REMOVE event generation. */
|
||||
acc->parent = NULL;
|
||||
gnc_account_set_parent (acc, NULL);
|
||||
|
||||
grp->saved = 0;
|
||||
|
||||
@@ -892,30 +892,30 @@ xaccGroupRemoveAccount (AccountGroup *grp, Account *acc)
|
||||
xaccFreeAccountGroup (grp);
|
||||
}
|
||||
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccAccountInsertSubAccount (Account *adult, Account *child)
|
||||
xaccAccountInsertSubAccount (GncAccount *adult, GncAccount *child)
|
||||
{
|
||||
if (!adult) return;
|
||||
|
||||
/* if a container for the children doesn't yet exist, add it */
|
||||
if (adult->children == NULL)
|
||||
adult->children = xaccMallocAccountGroup (adult->inst.book);
|
||||
if (gnc_account_get_children (adult) == NULL)
|
||||
gnc_account_set_children(adult, xaccMallocAccountGroup (qof_instance_get_book (QOF_INSTANCE (adult))));
|
||||
|
||||
/* set back-pointer to parent */
|
||||
adult->children->parent = adult;
|
||||
(gnc_account_get_children (adult))->parent = adult;
|
||||
|
||||
/* allow side-effect of creating a child-less account group */
|
||||
if (!child) return;
|
||||
|
||||
xaccGroupInsertAccount (adult->children, child);
|
||||
xaccGroupInsertAccount (gnc_account_get_children (adult), child);
|
||||
|
||||
qof_event_gen (&adult->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (adult), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -932,16 +932,16 @@ xaccGroupInsertAccount (AccountGroup *grp, Account *acc)
|
||||
* first. Basically, we can't have accounts being in two places at
|
||||
* once. If old and new parents are the same, reinsertion causes
|
||||
* the sort order to be checked. */
|
||||
if (acc->parent != grp)
|
||||
if (gnc_account_get_parent (acc) != grp)
|
||||
{
|
||||
xaccAccountBeginEdit (acc);
|
||||
|
||||
if (acc->parent)
|
||||
if (gnc_account_get_parent (acc))
|
||||
{
|
||||
xaccGroupRemoveAccount (acc->parent, acc);
|
||||
xaccGroupRemoveAccount (gnc_account_get_parent (acc), acc);
|
||||
|
||||
/* switch over between books, if needed */
|
||||
if (qof_instance_get_book (QOF_INSTANCE (grp)) != acc->inst.book)
|
||||
if (qof_instance_get_book (QOF_INSTANCE (grp)) != qof_instance_get_book (QOF_INSTANCE (acc)))
|
||||
{
|
||||
QofCollection *col;
|
||||
// xxxxxxxxxxxxxxxxxxxxxxx
|
||||
@@ -958,28 +958,28 @@ xaccGroupInsertAccount (AccountGroup *grp, Account *acc)
|
||||
*/
|
||||
PWARN ("reparenting accounts across books is not correctly supported\n");
|
||||
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_DESTROY, NULL);
|
||||
col = qof_book_get_collection (qof_instance_get_book (QOF_INSTANCE (grp)), GNC_ID_ACCOUNT);
|
||||
qof_collection_insert_entity (col, &acc->inst.entity);
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (acc));
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_CREATE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* set back-pointer to the account's parent */
|
||||
acc->parent = grp;
|
||||
gnc_account_set_parent (acc, grp);
|
||||
|
||||
grp->accounts = g_list_append (grp->accounts, acc);
|
||||
|
||||
/* Gather event data */
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_ADD, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_ADD, NULL);
|
||||
|
||||
qof_instance_set_dirty(&acc->inst);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (acc), TRUE);
|
||||
xaccAccountCommitEdit (acc);
|
||||
}
|
||||
|
||||
grp->saved = 0;
|
||||
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
@@ -1022,7 +1022,7 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
|
||||
int i;
|
||||
GList *node;
|
||||
if (!to || !from) return;
|
||||
if (!from->accounts || !to->book) return;
|
||||
if (!from->accounts || !qof_instance_get_book (QOF_INSTANCE (to))) return;
|
||||
|
||||
ENTER (" ");
|
||||
xaccAccountGroupBeginEdit(to);
|
||||
@@ -1033,23 +1033,23 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
|
||||
|
||||
/* This will copy the basic data and the KVP. It will
|
||||
* not copy any splits/transactions. It will gemini. */
|
||||
to_acc = xaccCloneAccount (from_acc, to->book);
|
||||
to_acc = xaccCloneAccount (from_acc, qof_instance_get_book (QOF_INSTANCE (to)));
|
||||
|
||||
xaccAccountBeginEdit (to_acc);
|
||||
to->accounts = g_list_append (to->accounts, to_acc);
|
||||
|
||||
to_acc->parent = to;
|
||||
qof_instance_set_dirty(&to_acc->inst);
|
||||
gnc_account_set_parent (to_acc, to);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (to_acc), TRUE);
|
||||
|
||||
/* Copy child accounts too. */
|
||||
if (from_acc->children)
|
||||
if (gnc_account_get_children (from_acc))
|
||||
{
|
||||
to_acc->children = xaccMallocAccountGroup (to->book);
|
||||
to_acc->children->parent = to_acc;
|
||||
xaccGroupCopyGroup (to_acc->children, from_acc->children);
|
||||
gnc_account_set_children (to_acc, xaccMallocAccountGroup (qof_instance_get_book (QOF_INSTANCE (to))));
|
||||
(gnc_account_get_children (to_acc))->parent = to_acc;
|
||||
xaccGroupCopyGroup (gnc_account_get_children (to_acc), gnc_account_get_children (from_acc));
|
||||
}
|
||||
xaccAccountCommitEdit (to_acc);
|
||||
qof_event_gen (&to_acc->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (to_acc), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
/* make sure that we have a symmetric, uniform number of
|
||||
* begin-edits, so that subsequent GroupCommitEdit's
|
||||
@@ -1057,7 +1057,7 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
|
||||
for (i=0; i<to->editlevel; i++)
|
||||
{
|
||||
xaccAccountBeginEdit (to_acc);
|
||||
xaccAccountGroupBeginEdit (to_acc->children);
|
||||
xaccAccountGroupBeginEdit (gnc_account_get_children (to_acc));
|
||||
}
|
||||
}
|
||||
xaccAccountGroupCommitEdit(from);
|
||||
@@ -1099,25 +1099,25 @@ xaccGroupMergeAccounts (AccountGroup *grp)
|
||||
AccountGroup *ga, *gb;
|
||||
|
||||
/* consolidate children */
|
||||
ga = (AccountGroup *) acc_a->children;
|
||||
gb = (AccountGroup *) acc_b->children;
|
||||
ga = (AccountGroup *) gnc_account_get_children (acc_a);
|
||||
gb = (AccountGroup *) gnc_account_get_children (acc_b);
|
||||
|
||||
if (gb)
|
||||
{
|
||||
if (!ga)
|
||||
{
|
||||
acc_a->children = gb;
|
||||
gnc_account_set_children (acc_a, gb);
|
||||
gb->parent = acc_a;
|
||||
acc_b->children = NULL;
|
||||
gnc_account_set_children (acc_b, NULL);
|
||||
|
||||
qof_event_gen (&acc_a->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc_a), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc_b), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
xaccGroupConcatGroup (ga, gb);
|
||||
acc_b->children = NULL;
|
||||
qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
gnc_account_set_children (acc_b, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc_b), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1125,8 +1125,8 @@ xaccGroupMergeAccounts (AccountGroup *grp)
|
||||
xaccGroupMergeAccounts (ga);
|
||||
|
||||
/* consolidate transactions */
|
||||
while (acc_b->splits)
|
||||
xaccSplitSetAccount (acc_b->splits->data, acc_a);
|
||||
while (xaccAccountGetSplitList(acc_b))
|
||||
xaccSplitSetAccount ((xaccAccountGetSplitList (acc_b))->data, acc_a);
|
||||
|
||||
/* move back one before removal */
|
||||
node_b = node_b->prev;
|
||||
@@ -1216,7 +1216,7 @@ void
|
||||
xaccAccountBeginStagedTransactionTraversals (const Account *account)
|
||||
{
|
||||
if (account)
|
||||
xaccSplitsBeginStagedTransactionTraversals (account->splits);
|
||||
xaccSplitsBeginStagedTransactionTraversals (xaccAccountGetSplitList(account));
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1256,7 +1256,7 @@ xaccGroupBeginStagedTransactionTraversals (AccountGroup *grp)
|
||||
/* recursively do sub-accounts */
|
||||
xaccGroupBeginStagedTransactionTraversals (gnc_account_get_children (account));
|
||||
|
||||
for (lp = account->splits; lp; lp = lp->next)
|
||||
for (lp = xaccAccountGetSplitList(account); lp; lp = lp->next)
|
||||
{
|
||||
Split *s = lp->data;
|
||||
Transaction *trans = s->parent;
|
||||
@@ -1275,7 +1275,7 @@ xaccAccountStagedTransactionTraversal (const Account *acc,
|
||||
GList *lp;
|
||||
if (!acc) return 0;
|
||||
|
||||
for(lp = acc->splits; lp; lp = lp->next)
|
||||
for(lp = xaccAccountGetSplitList(acc); lp; lp = lp->next)
|
||||
{
|
||||
Split *s = (Split *) lp->data;
|
||||
Transaction *trans = s->parent;
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ void xaccGroupInsertAccount (AccountGroup *grp, Account *acc);
|
||||
/** The xaccAccountInsertSubAccount() does the same, except that
|
||||
* the parent is specified as an account.
|
||||
*/
|
||||
void xaccAccountInsertSubAccount (Account *parent, Account *child);
|
||||
void xaccAccountInsertSubAccount (GncAccount *parent, GncAccount *child);
|
||||
/** @} */
|
||||
|
||||
/** @name Counting the Size and Depth of the Account Tree
|
||||
@@ -227,7 +227,7 @@ AccountGroup * xaccGroupGetRoot (const AccountGroup *grp);
|
||||
/** The xaccGetAccountRoot() subroutine will find the topmost
|
||||
* (root) group to which this account belongs.
|
||||
*/
|
||||
AccountGroup * xaccAccountGetRoot (const Account *account);
|
||||
AccountGroup * xaccAccountGetRoot (GncAccount *account);
|
||||
|
||||
/** The xaccGroupGetParentAccount() subroutine returns the parent
|
||||
* account of the group, or NULL.
|
||||
|
||||
+34
-35
@@ -73,7 +73,7 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
||||
if (!trans || !book) return;
|
||||
|
||||
/* If this is the same book, its a no-op. */
|
||||
if (trans->inst.book == book) return;
|
||||
if (qof_instance_get_book (QOF_INSTANCE (trans)) == book) return;
|
||||
|
||||
ENTER ("trans=%p %s", trans, trans->description);
|
||||
newtrans = xaccDupeTransaction (trans);
|
||||
@@ -90,8 +90,8 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
||||
|
||||
/* Fiddle the transaction into place in the new book */
|
||||
col = qof_book_get_collection (book, GNC_ID_TRANS);
|
||||
qof_collection_insert_entity (col, &newtrans->inst.entity);
|
||||
newtrans->inst.book = book;
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (newtrans));
|
||||
qof_instance_set_book (QOF_INSTANCE (newtrans), book);
|
||||
|
||||
col = qof_book_get_collection (book, GNC_ID_SPLIT);
|
||||
xaccTransBeginEdit (newtrans);
|
||||
@@ -101,8 +101,7 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
||||
Split *s = node->data;
|
||||
|
||||
/* move the split into the new book ... */
|
||||
s->inst.book = book;
|
||||
qof_collection_insert_entity(col, &s->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (s), book);
|
||||
|
||||
/* find the twin account, and re-parent to that. */
|
||||
twin = xaccAccountLookupTwin (s->acc, book);
|
||||
@@ -113,13 +112,13 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
||||
else
|
||||
{
|
||||
xaccAccountInsertSplit (twin, s);
|
||||
twin->balance_dirty = TRUE;
|
||||
twin->sort_dirty = TRUE;
|
||||
gnc_account_set_balance_dirty (twin, TRUE);
|
||||
gnc_account_set_sort_dirty (twin, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
xaccTransCommitEdit (newtrans);
|
||||
qof_event_gen (&newtrans->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (newtrans), QOF_EVENT_CREATE, NULL);
|
||||
LEAVE ("trans=%p %s", trans, trans->description);
|
||||
}
|
||||
|
||||
@@ -137,11 +136,11 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
||||
if (!trans || !book) return;
|
||||
|
||||
/* If this is the same book, its a no-op. */
|
||||
if (trans->inst.book == book) return;
|
||||
if (qof_instance_get_book (QOF_INSTANCE (trans)) == book) return;
|
||||
|
||||
/* If the old and new book don't share backends, then clobber-copy;
|
||||
* i.e. destroy it in one backend, create it in another. */
|
||||
if (qof_book_get_backend(book) != qof_book_get_backend(trans->inst.book))
|
||||
if (qof_book_get_backend(book) != qof_book_get_backend(qof_instance_get_book (QOF_INSTANCE (trans))))
|
||||
{
|
||||
gnc_book_insert_trans_clobber (book, trans);
|
||||
return;
|
||||
@@ -152,8 +151,8 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
||||
xaccTransBeginEdit (trans);
|
||||
|
||||
col = qof_book_get_collection (book, GNC_ID_TRANS);
|
||||
trans->inst.book = book;
|
||||
qof_collection_insert_entity (col, &trans->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (trans), book);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (trans)); // This operation isn't needed becouse set_book does this
|
||||
|
||||
col = qof_book_get_collection (book, GNC_ID_SPLIT);
|
||||
for (node = trans->splits; node; node = node->next)
|
||||
@@ -162,10 +161,10 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
||||
Split *s = node->data;
|
||||
|
||||
/* Move the splits over (only if they haven't already been moved). */
|
||||
if (s->inst.book != book)
|
||||
if (qof_instance_get_book (QOF_INSTANCE (s)) != book)
|
||||
{
|
||||
s->inst.book = book;
|
||||
qof_collection_insert_entity (col, &s->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (s), book);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (s));
|
||||
}
|
||||
|
||||
/* Find the twin account, and re-parent to that. */
|
||||
@@ -180,14 +179,14 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
||||
if (s->acc != twin)
|
||||
{
|
||||
xaccAccountInsertSplit (twin, s);
|
||||
twin->balance_dirty = TRUE;
|
||||
twin->sort_dirty = TRUE;
|
||||
gnc_account_set_balance_dirty (twin, TRUE);
|
||||
gnc_account_set_sort_dirty (twin, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xaccTransCommitEdit (trans);
|
||||
qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (trans), QOF_EVENT_MODIFY, NULL);
|
||||
LEAVE ("trans=%p %s", trans, trans->description);
|
||||
}
|
||||
|
||||
@@ -228,18 +227,18 @@ gnc_book_insert_lot (QofBook *book, GNCLot *lot)
|
||||
ENTER ("lot=%p", lot);
|
||||
|
||||
col = qof_book_get_collection (book, GNC_ID_LOT);
|
||||
lot->inst.book = book;
|
||||
qof_collection_insert_entity (col, &lot->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (lot), book);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (lot)); // don't need it
|
||||
|
||||
/* Move the splits over (only if they haven't already been moved). */
|
||||
col = qof_book_get_collection (book, GNC_ID_SPLIT);
|
||||
for (snode = lot->splits; snode; snode=snode->next)
|
||||
{
|
||||
Split *s = snode->data;
|
||||
if (s->inst.book != book)
|
||||
if (qof_instance_get_book (QOF_INSTANCE (s)) != book)
|
||||
{
|
||||
s->inst.book = book;
|
||||
qof_collection_insert_entity (col, &s->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (s), book);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (s));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,11 +263,11 @@ gnc_book_insert_price (QofBook *book, GNCPrice *pr)
|
||||
if (!pr || !book) return;
|
||||
|
||||
/* If this is the same book, its a no-op. */
|
||||
if (pr->inst.book == book) return;
|
||||
if (qof_instance_get_book (QOF_INSTANCE (pr)) == book) return;
|
||||
|
||||
/* If the old and new book don't share backends, then clobber-copy;
|
||||
* i.e. destroy it in one backend, create it in another. */
|
||||
if (qof_book_get_backend(book) != qof_book_get_backend(pr->inst.book))
|
||||
if (qof_book_get_backend(book) != qof_book_get_backend(qof_instance_get_book (QOF_INSTANCE (pr))))
|
||||
{
|
||||
gnc_book_insert_price_clobber (book, pr);
|
||||
return;
|
||||
@@ -280,8 +279,8 @@ gnc_book_insert_price (QofBook *book, GNCPrice *pr)
|
||||
gnc_price_begin_edit (pr);
|
||||
|
||||
col = qof_book_get_collection (book, GNC_ID_PRICE);
|
||||
pr->inst.book = book;
|
||||
qof_collection_insert_entity (col, &pr->inst.entity);
|
||||
qof_instance_set_book (QOF_INSTANCE (pr), book);
|
||||
qof_collection_insert_entity (col, QOF_INSTANCE (pr)); // don't need it
|
||||
|
||||
gnc_pricedb_remove_price (pr->db, pr);
|
||||
gnc_pricedb_add_price (gnc_pricedb_get_db (book), pr);
|
||||
@@ -444,9 +443,9 @@ clear_markers (AccountGroup *grp)
|
||||
GList *lp;
|
||||
|
||||
/* recursively do sub-accounts */
|
||||
clear_markers (account->children);
|
||||
clear_markers (gnc_account_get_children (account));
|
||||
|
||||
for (lp = account->splits; lp; lp = lp->next)
|
||||
for (lp = xaccAccountGetSplitList(account); lp; lp = lp->next)
|
||||
{
|
||||
Split *s = lp->data;
|
||||
Transaction *trans = s->parent;
|
||||
@@ -541,7 +540,7 @@ gnc_book_partition_txn (QofBook *dest_book, QofBook *src_book, QofQuery *query)
|
||||
* and it is not needed for the current usage. */
|
||||
kvp_frame_delete (qof_book_get_slots(dest_book));
|
||||
book_inst = (QofInstance*)dest_book;
|
||||
book_inst->kvp_data = kvp_frame_copy (qof_book_get_slots(src_book));
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE (book_inst), qof_book_get_slots(src_book));
|
||||
|
||||
/* Next, copy the commodity tables */
|
||||
src_tbl = gnc_commodity_table_get_table (src_book);
|
||||
@@ -589,7 +588,7 @@ gnc_book_partition_txn (QofBook *dest_book, QofBook *src_book, QofQuery *query)
|
||||
/* Make note of the sibling books */
|
||||
now = time(0);
|
||||
gnc_kvp_bag_add (qof_book_get_slots(src_book), "gemini", now,
|
||||
"book_guid", qof_book_get_guid(dest_book),
|
||||
"book_guid", qof_instance_get_guid(QOF_INSTANCE (dest_book)),
|
||||
NULL);
|
||||
gnc_kvp_bag_add (qof_book_get_slots(dest_book), "gemini", now,
|
||||
"book_guid", qof_book_get_guid(src_book),
|
||||
@@ -684,9 +683,9 @@ add_closing_balances (AccountGroup *closed_grp,
|
||||
xaccAccountBeginEdit (twin);
|
||||
cwd = xaccAccountGetSlots (twin);
|
||||
kvp_frame_set_guid (cwd, "/book/prev-acct", xaccAccountGetGUID (candidate));
|
||||
kvp_frame_set_guid (cwd, "/book/prev-book", qof_book_get_guid(closed_book));
|
||||
kvp_frame_set_guid (cwd, "/book/prev-book", qof_instance_get_guid(QOF_INSTANCE (closed_book)));
|
||||
|
||||
xaccAccountSetSlots_nc (twin, twin->inst.kvp_data);
|
||||
xaccAccountSetSlots_nc (twin, qof_instance_get_kvp_data (QOF_INSTANCE (twin)));
|
||||
|
||||
/* -------------------------------- */
|
||||
/* Add KVP to closed account, indicating where
|
||||
@@ -696,7 +695,7 @@ add_closing_balances (AccountGroup *closed_grp,
|
||||
kvp_frame_set_guid (cwd, "/book/next-book", qof_book_get_guid(open_book));
|
||||
kvp_frame_set_guid (cwd, "/book/next-acct", xaccAccountGetGUID (twin));
|
||||
|
||||
xaccAccountSetSlots_nc (candidate, candidate->inst.kvp_data);
|
||||
xaccAccountSetSlots_nc (candidate, qof_instance_get_kvp_data (QOF_INSTANCE (candidate)));
|
||||
|
||||
/* -------------------------------- */
|
||||
/* We need to carry a balance on any account that is not
|
||||
@@ -778,7 +777,7 @@ add_closing_balances (AccountGroup *closed_grp,
|
||||
if (childs)
|
||||
{
|
||||
PINFO ("add closing baln to subaccts of %s",
|
||||
candidate->description);
|
||||
xaccAccountGetDescription((const GncAccount*) candidate));
|
||||
add_closing_balances (childs, open_book, closed_book,
|
||||
equity_account,
|
||||
post_date, date_entered, desc);
|
||||
|
||||
+9
-9
@@ -521,14 +521,14 @@ xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||
if (!q || !guid || !id_type)
|
||||
return;
|
||||
|
||||
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
|
||||
param_list = qof_query_build_param_list (QOF_PARAM_GUID, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
|
||||
if (id_type == GNC_ID_SPLIT)
|
||||
param_list = qof_query_build_param_list (g_type_name (QOF_PARAM_GUID), NULL);
|
||||
else if (id_type == GNC_ID_TRANS)
|
||||
param_list = qof_query_build_param_list (SPLIT_TRANS, QOF_PARAM_GUID, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
|
||||
else if (id_type == GNC_ID_ACCOUNT)
|
||||
param_list = qof_query_build_param_list (SPLIT_ACCOUNT, QOF_PARAM_GUID, NULL);
|
||||
else
|
||||
PERR ("Invalid match type: %s", id_type);
|
||||
PERR ("Invalid match type: %s", g_type_name (id_type));
|
||||
|
||||
qof_query_add_guid_match (q, param_list, guid, op);
|
||||
}
|
||||
@@ -548,14 +548,14 @@ xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value,
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
|
||||
if (id_type == GNC_ID_SPLIT)
|
||||
param_list = qof_query_build_param_list (SPLIT_KVP, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
|
||||
else if (id_type == GNC_ID_TRANS)
|
||||
param_list = qof_query_build_param_list (SPLIT_TRANS, TRANS_KVP, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
|
||||
else if (id_type == GNC_ID_ACCOUNT)
|
||||
param_list = qof_query_build_param_list (SPLIT_ACCOUNT, ACCOUNT_KVP, NULL);
|
||||
else
|
||||
PERR ("Invalid match type: %s", id_type);
|
||||
PERR ("Invalid match type: %s", g_type_name (id_type));
|
||||
|
||||
qof_query_add_term (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
+11
-4
@@ -53,6 +53,8 @@ static QofLogModule log_module = GNC_MOD_SX;
|
||||
static void gnc_schedule_actions_class_init(GncScheduleActionsClass *klass);
|
||||
static void gnc_schedule_actions_init(GncScheduleActions *sp);
|
||||
static void gnc_schedule_actions_finalize(GObject *object);
|
||||
static void gnc_schedule_actions_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_schedule_actions_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncScheduleActionsPrivate
|
||||
{
|
||||
@@ -64,6 +66,7 @@ typedef enum _GncScheduleActionsSignalType GncScheduleActionsSignalType;
|
||||
|
||||
enum _GncScheduleActionsSignalType {
|
||||
/* Signals */
|
||||
FIRS_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -81,7 +84,7 @@ static guint gnc_schedule_actions_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_schedule_actions_get_type()
|
||||
gnc_schedule_actions_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -98,7 +101,7 @@ gnc_schedule_actions_get_type()
|
||||
(GInstanceInitFunc)gnc_schedule_actions_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static(QOF_TYPE_ENTITY,
|
||||
type = g_type_register_static(QOF_TYPE_INSTANCE,
|
||||
"GncScheduleActions", &our_info, 0);
|
||||
}
|
||||
|
||||
@@ -153,7 +156,7 @@ gnc_schedule_actions_set_property (GObject *object,
|
||||
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +224,7 @@ gnc_book_set_template_group (QofBook *book, AccountGroup *templateGroup)
|
||||
QofCollection *col;
|
||||
if (!book) return;
|
||||
|
||||
if (templateGroup && templateGroup->book != book)
|
||||
if (templateGroup && qof_instance_get_book (QOF_INSTANCE (templateGroup)) != book)
|
||||
{
|
||||
PERR ("cannot mix and match books freely!");
|
||||
return;
|
||||
@@ -369,6 +372,8 @@ book_sxlist_notsaved(const QofCollection *col)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
BROKEN CODE
|
||||
static QofObject sxes_object_def =
|
||||
{
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -399,6 +404,7 @@ static QofObject sxtt_object_def =
|
||||
version_cmp: NULL,
|
||||
};
|
||||
|
||||
|
||||
gboolean
|
||||
gnc_sxtt_register (void)
|
||||
{
|
||||
@@ -408,6 +414,7 @@ gnc_sxtt_register (void)
|
||||
return FALSE;
|
||||
return qof_object_register(&sxtt_object_def);
|
||||
}
|
||||
*/
|
||||
|
||||
GList*
|
||||
gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
typedef struct _GncScheduleActionsClass GncScheduleActionsClass;
|
||||
typedef struct _GncScheduleActionsPrivate GncScheduleActionsPrivate;
|
||||
typedef struct _GncScheduleActions GncScheduleActions;
|
||||
typedef struct GncScheduleActions SchedXactions ; /* Backward compatibility*/
|
||||
typedef GncScheduleActions SchedXactions ; /* Backward compatibility*/
|
||||
|
||||
struct _GncScheduleActions {
|
||||
QofInstance inst;
|
||||
@@ -71,7 +71,7 @@ struct _GncScheduleActionsClass {
|
||||
/* Add Signal Functions Here */
|
||||
};
|
||||
|
||||
GType gnc_schedule_actions_get_type ();
|
||||
GType gnc_schedule_actions_get_type (void);
|
||||
|
||||
|
||||
#define GNC_IS_SXES(obj) GNC_IS_SCHEDULE_ACTIONS(o)
|
||||
|
||||
+32
-25
@@ -48,6 +48,8 @@ static QofLogModule log_module = GNC_MOD_SX;
|
||||
static void gnc_schedule_action_class_init(GncScheduleActionClass *klass);
|
||||
static void gnc_schedule_action_init(GncScheduleAction *sp);
|
||||
static void gnc_schedule_action_finalize(GObject *object);
|
||||
static void gnc_schedule_action_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_schedule_action_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncScheduleActionPrivate {
|
||||
/* Private Members */
|
||||
@@ -56,8 +58,10 @@ struct _GncScheduleActionPrivate {
|
||||
typedef struct _GncScheduleActionSignal GncScheduleActionSignal;
|
||||
typedef enum _GncScheduleActionSignalType GncScheduleActionSignalType;
|
||||
|
||||
|
||||
enum _GncScheduleActionSignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -75,7 +79,7 @@ static guint gnc_schedule_action_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_schedule_action_get_type()
|
||||
gnc_schedule_action_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -142,7 +146,7 @@ gnc_schedule_action_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -175,8 +179,6 @@ xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
|
||||
{
|
||||
AccountGroup *ag;
|
||||
|
||||
qof_instance_init (&sx->inst, GNC_ID_SCHEDXACTION, book);
|
||||
|
||||
sx->freq = xaccFreqSpecMalloc(book);
|
||||
|
||||
g_date_clear( &sx->last_date, 1 );
|
||||
@@ -195,7 +197,7 @@ xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
|
||||
sx->template_acct = xaccMallocAccount(book);
|
||||
/* THREAD-UNSAFE */
|
||||
xaccAccountSetName( sx->template_acct,
|
||||
guid_to_string( QOF_INSTANCE (sx).entity.guid ));
|
||||
guid_to_string( qof_instance_get_guid (QOF_INSTANCE (sx)) ));
|
||||
xaccAccountSetCommodity
|
||||
(sx->template_acct,
|
||||
gnc_commodity_new( book,
|
||||
@@ -209,15 +211,15 @@ xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
|
||||
SchedXaction*
|
||||
xaccSchedXactionMalloc(QofBook *book)
|
||||
{
|
||||
SchedXaction *sx;
|
||||
GncScheduleAction *sx;
|
||||
|
||||
g_return_val_if_fail (book, NULL);
|
||||
|
||||
sx = g_object_new (GNC_SCHEDULE_ACTION, NULL );
|
||||
xaccSchedXactionInit( sx, book );
|
||||
qof_event_gen( QOF_ENTITY (sx), QOF_EVENT_CREATE , NULL);
|
||||
sx = GNC_SCHEDULE_ACTION (g_object_new (GNC_TYPE_SCHEDULE_ACTION, "book", book, NULL ));
|
||||
xaccSchedXactionInit( (SchedXaction*) sx, book );
|
||||
qof_event_gen( QOF_INSTANCE (sx), QOF_EVENT_CREATE , NULL);
|
||||
|
||||
return sx;
|
||||
return (SchedXaction*) sx;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -269,7 +271,7 @@ xaccSchedXactionFree( SchedXaction *sx )
|
||||
if ( sx == NULL ) return;
|
||||
|
||||
xaccFreqSpecFree( sx->freq );
|
||||
qof_event_gen( QOF_ENTITY (sx), QOF_EVENT_DESTROY , NULL);
|
||||
qof_event_gen( QOF_INSTANCE (sx), QOF_EVENT_DESTROY , NULL);
|
||||
|
||||
if ( sx->name )
|
||||
g_free( sx->name );
|
||||
@@ -345,7 +347,7 @@ xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs )
|
||||
gnc_sx_begin_edit(sx);
|
||||
xaccFreqSpecFree( sx->freq );
|
||||
sx->freq = fs;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -365,7 +367,7 @@ xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName )
|
||||
sx->name = NULL;
|
||||
}
|
||||
sx->name = g_strdup( newName );
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -380,7 +382,7 @@ xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->start_date = *newStart;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -412,7 +414,7 @@ xaccSchedXactionSetEndDate( SchedXaction *sx, GDate *newEnd )
|
||||
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->end_date = *newEnd;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -427,7 +429,7 @@ xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->last_date = *newLastOccur;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -448,7 +450,7 @@ xaccSchedXactionSetNumOccur( SchedXaction *sx, gint newNum )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = sx->num_occurances_total = newNum;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -471,7 +473,7 @@ xaccSchedXactionSetRemOccur( SchedXaction *sx,
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = numRemain;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
}
|
||||
@@ -482,7 +484,7 @@ xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot )
|
||||
{
|
||||
if (!sx) return NULL;
|
||||
|
||||
return kvp_frame_get_slot(sx->inst.kvp_data, slot);
|
||||
return kvp_frame_get_slot(qof_instance_get_kvp_data (QOF_INSTANCE (sx)), slot);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -493,8 +495,8 @@ xaccSchedXactionSetSlot( SchedXaction *sx,
|
||||
if (!sx) return;
|
||||
|
||||
gnc_sx_begin_edit(sx);
|
||||
kvp_frame_set_slot( sx->inst.kvp_data, slot, value );
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
kvp_frame_set_slot( qof_instance_get_kvp_data (QOF_INSTANCE (sx)), slot, value );
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -519,7 +521,7 @@ xaccSchedXactionSetAutoCreate( SchedXaction *sx,
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->autoCreateOption = newAutoCreate;
|
||||
sx->autoCreateNotify = newNotify;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
return;
|
||||
}
|
||||
@@ -535,7 +537,7 @@ xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->advanceCreateDays = createDays;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -550,7 +552,7 @@ xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->advanceRemindDays = reminderDays;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -835,7 +837,7 @@ gnc_sx_revert_to_temporal_state( SchedXaction *sx, void *stateData )
|
||||
sx->last_date = tsd->last_date;
|
||||
sx->num_occurances_remain = tsd->num_occur_rem;
|
||||
sx->instance_num = tsd->num_inst;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
@@ -906,6 +908,10 @@ gnc_sx_get_defer_instances( SchedXaction *sx )
|
||||
return sx->deferredList;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
BROKEN CODE
|
||||
|
||||
static QofObject SXDesc =
|
||||
{
|
||||
interface_version : QOF_OBJECT_VERSION,
|
||||
@@ -944,3 +950,4 @@ SXRegister(void)
|
||||
qof_class_register(GNC_SX_ID, NULL, params);
|
||||
return qof_object_register(&SXDesc);
|
||||
}
|
||||
*/
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
typedef struct _GncScheduleActionClass GncScheduleActionClass;
|
||||
typedef struct _GncScheduleAction GncScheduleAction;
|
||||
typedef struct GncScheduleAction ShedXaction; /* Dummy type for backward compatilibity */
|
||||
typedef GncScheduleAction SchedXaction; /* Dummy type for backward compatilibity */
|
||||
|
||||
struct _GncScheduleActionClass {
|
||||
QofInstanceClass parent_class;
|
||||
@@ -63,14 +63,10 @@ struct _GncScheduleActionClass {
|
||||
/* Add Signal Functions Here */
|
||||
};
|
||||
|
||||
GType gnc_schedule_action_get_type ();
|
||||
GType gnc_schedule_action_get_type (void);
|
||||
|
||||
/********************************************/
|
||||
|
||||
/**
|
||||
* The SchedXaction data.
|
||||
*/
|
||||
typedef struct gncp_SchedXaction SchedXaction;
|
||||
|
||||
/**
|
||||
* Creates and initializes a scheduled transaction.
|
||||
@@ -246,7 +242,7 @@ gboolean SXRegister (void);
|
||||
/** \deprecated */
|
||||
#define xaccSchedXactionIsDirty(X) qof_instance_is_dirty (QOF_INSTANCE(X))
|
||||
/** \deprecated */
|
||||
#define xaccSchedXactionGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define xaccSchedXactionGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
/** \deprecated */
|
||||
#define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))
|
||||
|
||||
|
||||
@@ -87,6 +87,6 @@ typedef struct _temporalStateData {
|
||||
gint num_inst;
|
||||
} temporalStateData;
|
||||
|
||||
#define xaccSchedXactionSetGUID(X,G) qof_entity_set_guid(QOF_ENTITY(X),(G))
|
||||
#define xaccSchedXactionSetGUID(X,G) qof_instance_set_guid(QOF_INSTANCE(X),(G))
|
||||
|
||||
#endif /* XACC_SCHEDXACTION_P_H */
|
||||
+19
-18
@@ -250,12 +250,12 @@ xaccSplitScrub (Split *split)
|
||||
/* If the account doesn't have a commodity,
|
||||
* we should attempt to fix that first.
|
||||
*/
|
||||
if (!account->commodity)
|
||||
if (!xaccAccountGetCommodity((const GncAccount*)account))
|
||||
{
|
||||
xaccAccountScrubCommodity (account);
|
||||
}
|
||||
if (!account->commodity ||
|
||||
!gnc_commodity_equiv (account->commodity, currency))
|
||||
if (!xaccAccountGetCommodity((const GncAccount*)account) ||
|
||||
!gnc_commodity_equiv (xaccAccountGetCommodity((const GncAccount*)account), currency))
|
||||
{
|
||||
LEAVE ("(split=%p) inequiv currency", split);
|
||||
return;
|
||||
@@ -439,7 +439,7 @@ xaccTransScrubImbalance (Transaction *trans, AccountGroup *root,
|
||||
/* Put split into account before setting split value */
|
||||
if (!balance_split)
|
||||
{
|
||||
balance_split = xaccMallocSplit (trans->inst.book);
|
||||
balance_split = xaccMallocSplit (qof_instance_get_book (QOF_INSTANCE (trans)));
|
||||
|
||||
xaccTransBeginEdit (trans);
|
||||
xaccSplitSetParent(balance_split, trans);
|
||||
@@ -616,7 +616,7 @@ xaccTransScrubCurrency (Transaction *trans)
|
||||
currency = xaccTransGetCurrency (trans);
|
||||
if (currency) return;
|
||||
|
||||
currency = xaccTransFindOldCommonCurrency (trans, trans->inst.book);
|
||||
currency = xaccTransFindOldCommonCurrency (trans, qof_instance_get_book (QOF_INSTANCE (trans)));
|
||||
if (currency)
|
||||
{
|
||||
xaccTransBeginEdit (trans);
|
||||
@@ -647,7 +647,8 @@ xaccTransScrubCurrency (Transaction *trans)
|
||||
else
|
||||
{
|
||||
PWARN (" split=\"%s\" account=\"%s\" commodity=\"%s\"",
|
||||
split->memo, split->acc->accountName, gnc_commodity_get_mnemonic (split->acc->commodity));
|
||||
split->memo, xaccAccountGetName((const GncAccount*) split->acc),
|
||||
gnc_commodity_get_mnemonic (xaccAccountGetCommodity ((const GncAccount*) split->acc)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -731,7 +732,7 @@ xaccAccountScrubCommodity (Account *account)
|
||||
return;
|
||||
}
|
||||
|
||||
PERR ("Account \"%s\" does not have a commodity!", account->accountName);
|
||||
PERR ("Account \"%s\" does not have a commodity!", xaccAccountGetName ((const GncAccount*) account));
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
@@ -741,10 +742,10 @@ xaccAccountDeleteOldData (Account *account)
|
||||
{
|
||||
if (!account) return;
|
||||
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency", NULL);
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security", NULL);
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency-scu", NULL);
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security-scu", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-currency", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-security", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-currency-scu", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-security-scu", NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -853,21 +854,21 @@ xaccAccountScrubKvp (Account *account)
|
||||
|
||||
if (!account) return;
|
||||
|
||||
str = kvp_frame_get_string(account->inst.kvp_data, "notes");
|
||||
str = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "notes");
|
||||
if (str) {
|
||||
str2 = g_strstrip(g_strdup(str));
|
||||
if (strlen(str2) == 0)
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "notes", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "notes", NULL);
|
||||
g_free(str2);
|
||||
}
|
||||
|
||||
str = kvp_frame_get_string(account->inst.kvp_data, "placeholder");
|
||||
str = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "placeholder");
|
||||
if (str && strcmp(str, "false") == 0)
|
||||
kvp_frame_set_slot_nc (account->inst.kvp_data, "placeholder", NULL);
|
||||
kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "placeholder", NULL);
|
||||
|
||||
frame = kvp_frame_get_frame(account->inst.kvp_data, "hbci");
|
||||
frame = kvp_frame_get_frame(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "hbci");
|
||||
if (frame && kvp_frame_is_empty(frame)) {
|
||||
kvp_frame_set_frame_nc(account->inst.kvp_data, "hbci", NULL);
|
||||
kvp_frame_set_frame_nc(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "hbci", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,7 +899,7 @@ xaccScrubUtilityGetOrMakeAccount (AccountGroup *root, gnc_commodity * currency,
|
||||
if (acc == NULL)
|
||||
{
|
||||
/* Guess not. We'll have to build one. */
|
||||
acc = xaccMallocAccount (root->book);
|
||||
acc = xaccMallocAccount (qof_instance_get_book (QOF_INSTANCE (root)));
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountSetName (acc, accname);
|
||||
xaccAccountSetCommodity (acc, currency);
|
||||
|
||||
+18
-18
@@ -63,11 +63,11 @@ xaccAccountAssignLots (Account *acc)
|
||||
|
||||
if (!acc) return;
|
||||
|
||||
ENTER ("acc=%s", acc->accountName);
|
||||
ENTER ("acc=%s", xaccAccountGetName(acc));
|
||||
xaccAccountBeginEdit (acc);
|
||||
|
||||
restart_loop:
|
||||
for (node=acc->splits; node; node=node->next)
|
||||
for (node=xaccAccountGetSplitList (acc); node; node=node->next)
|
||||
{
|
||||
Split * split = node->data;
|
||||
|
||||
@@ -81,7 +81,7 @@ restart_loop:
|
||||
if (xaccSplitAssign (split)) goto restart_loop;
|
||||
}
|
||||
xaccAccountCommitEdit (acc);
|
||||
LEAVE ("acc=%s", acc->accountName);
|
||||
LEAVE ("acc=%s", xaccAccountGetName (acc));
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -102,9 +102,9 @@ xaccLotFill (GNCLot *lot)
|
||||
|
||||
if (!lot) return;
|
||||
acc = lot->account;
|
||||
pcy = acc->policy;
|
||||
pcy = gnc_account_get_policy (acc);
|
||||
|
||||
ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
|
||||
ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName (acc));
|
||||
|
||||
/* If balance already zero, we have nothing to do. */
|
||||
if (gnc_lot_is_closed (lot)) return;
|
||||
@@ -142,7 +142,7 @@ xaccLotFill (GNCLot *lot)
|
||||
if (!split) break;
|
||||
}
|
||||
xaccAccountCommitEdit (acc);
|
||||
LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
|
||||
LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName (acc));
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -232,7 +232,7 @@ is_subsplit (Split *split)
|
||||
g_return_val_if_fail (split->parent, FALSE);
|
||||
|
||||
/* If there are no sub-splits, then there's nothing to do. */
|
||||
kval = kvp_frame_get_slot (split->inst.kvp_data, "lot-split");
|
||||
kval = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split");
|
||||
if (!kval) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
@@ -320,27 +320,27 @@ remove_guids (Split *sa, Split *sb)
|
||||
KvpFrame *ksub;
|
||||
|
||||
/* Find and remove the matching guid's */
|
||||
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sa->inst.kvp_data, "lot-split",
|
||||
"peer_guid", &sb->inst.entity.guid);
|
||||
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split",
|
||||
"peer_guid", qof_instance_get_guid (QOF_INSTANCE (sb)));
|
||||
if (ksub)
|
||||
{
|
||||
gnc_kvp_bag_remove_frame (sa->inst.kvp_data, "lot-split", ksub);
|
||||
gnc_kvp_bag_remove_frame (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split", ksub);
|
||||
kvp_frame_delete (ksub);
|
||||
}
|
||||
|
||||
/* Now do it in the other direction */
|
||||
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sb->inst.kvp_data, "lot-split",
|
||||
"peer_guid", &sa->inst.entity.guid);
|
||||
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split",
|
||||
"peer_guid", qof_instance_get_guid (QOF_INSTANCE (sa)));
|
||||
if (ksub)
|
||||
{
|
||||
gnc_kvp_bag_remove_frame (sb->inst.kvp_data, "lot-split", ksub);
|
||||
gnc_kvp_bag_remove_frame (qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split", ksub);
|
||||
kvp_frame_delete (ksub);
|
||||
}
|
||||
|
||||
/* Finally, merge b's lot-splits, if any, into a's */
|
||||
/* This is an important step, if it got busted into many pieces. */
|
||||
gnc_kvp_bag_merge (sa->inst.kvp_data, "lot-split",
|
||||
sb->inst.kvp_data, "lot-split");
|
||||
gnc_kvp_bag_merge (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split",
|
||||
qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split");
|
||||
}
|
||||
|
||||
/* The merge_splits() routine causes the amount & value of sb
|
||||
@@ -413,7 +413,7 @@ restart:
|
||||
Split *s = node->data;
|
||||
if (xaccSplitGetLot (s) != lot) continue;
|
||||
if (s == split) continue;
|
||||
if (s->inst.do_free) continue;
|
||||
if (qof_instance_do_free (QOF_INSTANCE (s))) continue;
|
||||
|
||||
/* OK, this split is in the same lot (and thus same account)
|
||||
* as the indicated split. Make sure it is really a subsplit
|
||||
@@ -423,8 +423,8 @@ restart:
|
||||
* example. Only worry about adjacent sub-splits. By
|
||||
* repeatedly merging adjacent subsplits, we'll get the non-
|
||||
* adjacent ones too. */
|
||||
if (gnc_kvp_bag_find_by_guid (split->inst.kvp_data, "lot-split",
|
||||
"peer_guid", &s->inst.entity.guid) == NULL)
|
||||
if (gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split",
|
||||
"peer_guid", qof_instance_get_guid (QOF_INSTANCE (s))) == NULL)
|
||||
continue;
|
||||
|
||||
merge_splits (split, s);
|
||||
|
||||
+6
-6
@@ -70,7 +70,7 @@ gains_possible (GNCLot *lot)
|
||||
if (!node) return FALSE;
|
||||
split = node->data;
|
||||
|
||||
comeq = gnc_commodity_equiv (acc->commodity, split->parent->common_currency);
|
||||
comeq = gnc_commodity_equiv (xaccAccountGetCommodity (acc), split->parent->common_currency);
|
||||
return (FALSE == comeq);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ xaccScrubLot (GNCLot *lot)
|
||||
ENTER ("(lot=%p) %s", lot, gnc_lot_get_title(lot));
|
||||
|
||||
acc = gnc_lot_get_account (lot);
|
||||
pcy = acc->policy;
|
||||
pcy = gnc_account_get_policy (acc);
|
||||
xaccAccountBeginEdit(acc);
|
||||
xaccScrubMergeLotSubSplits (lot);
|
||||
|
||||
@@ -161,17 +161,17 @@ xaccAccountScrubLots (Account *acc)
|
||||
if (!acc) return;
|
||||
if (FALSE == xaccAccountHasTrades (acc)) return;
|
||||
|
||||
ENTER ("(acc=%s)", acc->accountName);
|
||||
ENTER ("(acc=%s)", xaccAccountGetName (acc));
|
||||
xaccAccountBeginEdit(acc);
|
||||
xaccAccountAssignLots (acc);
|
||||
|
||||
for (node = acc->lots; node; node=node->next)
|
||||
for (node = xaccAccountGetLotList (acc); node; node=node->next)
|
||||
{
|
||||
GNCLot *lot = node->data;
|
||||
xaccScrubLot (lot);
|
||||
}
|
||||
xaccAccountCommitEdit(acc);
|
||||
LEAVE ("(acc=%s)", acc->accountName);
|
||||
LEAVE ("(acc=%s)", xaccAccountGetName (acc));
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -196,7 +196,7 @@ xaccAccountTreeScrubLots (Account *acc)
|
||||
{
|
||||
if (!acc) return;
|
||||
|
||||
xaccGroupScrubLots (acc->children);
|
||||
xaccGroupScrubLots (gnc_account_get_children (acc));
|
||||
xaccAccountScrubLots (acc);
|
||||
}
|
||||
|
||||
|
||||
+95
-84
@@ -53,6 +53,8 @@
|
||||
static void gnc_split_class_init(GncSplitClass *klass);
|
||||
static void gnc_split_init(GncSplit *sp);
|
||||
static void gnc_split_finalize(GObject *object);
|
||||
static void gnc_split_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_split_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncSplitPrivate {
|
||||
/* Private Members */
|
||||
@@ -63,6 +65,7 @@ typedef enum _GncSplitSignalType GncSplitSignalType;
|
||||
|
||||
enum _GncSplitSignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -80,7 +83,7 @@ static guint gnc_split_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_split_get_type()
|
||||
gnc_split_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -147,7 +150,7 @@ gnc_split_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -211,8 +214,6 @@ xaccInitSplit(Split * split, QofBook *book)
|
||||
|
||||
split->gains = GAINS_STATUS_UNKNOWN;
|
||||
split->gains_split = NULL;
|
||||
|
||||
qof_instance_init(QOF_INSTANCE (split), GNC_ID_SPLIT, book);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -237,9 +238,9 @@ xaccSplitReinit(Split * split)
|
||||
split->cleared_balance = gnc_numeric_zero();
|
||||
split->reconciled_balance = gnc_numeric_zero();
|
||||
|
||||
if (split->inst.kvp_data)
|
||||
kvp_frame_delete(split->inst.kvp_data);
|
||||
split->inst.kvp_data = kvp_frame_new();
|
||||
if (qof_instance_get_kvp_data (QOF_INSTANCE (split)))
|
||||
qof_instance_delete_kvp_data (QOF_INSTANCE (split));
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE (split), kvp_frame_new());
|
||||
split->idata = 0;
|
||||
|
||||
split->gains = GAINS_STATUS_UNKNOWN;
|
||||
@@ -279,10 +280,8 @@ xaccDupeSplit (const Split *s)
|
||||
* splits as something official. If we ever use this split, we'll
|
||||
* have to fix this up.
|
||||
*/
|
||||
split->inst.entity.e_type = NULL;
|
||||
split->inst.entity.collection = NULL;
|
||||
split->inst.entity.guid = s->inst.entity.guid;
|
||||
split->inst.book = s->inst.book;
|
||||
qof_instance_set_guid (QOF_INSTANCE (split), qof_instance_get_guid (QOF_INSTANCE (s)));
|
||||
qof_instance_set_book (QOF_INSTANCE (split), qof_instance_get_book (QOF_INSTANCE (s)));
|
||||
|
||||
split->parent = s->parent;
|
||||
split->acc = s->acc;
|
||||
@@ -292,7 +291,7 @@ xaccDupeSplit (const Split *s)
|
||||
split->memo = CACHE_INSERT(s->memo);
|
||||
split->action = CACHE_INSERT(s->action);
|
||||
|
||||
split->inst.kvp_data = kvp_frame_copy (s->inst.kvp_data);
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE (split), qof_instance_get_kvp_data (QOF_INSTANCE (s)));
|
||||
|
||||
split->reconciled = s->reconciled;
|
||||
split->date_reconciled = s->date_reconciled;
|
||||
@@ -329,9 +328,8 @@ xaccSplitClone (const Split *s)
|
||||
split->gains = GAINS_STATUS_UNKNOWN;
|
||||
split->gains_split = NULL;
|
||||
|
||||
qof_instance_init(QOF_INSTANCE (split), GNC_ID_SPLIT, s->inst.book);
|
||||
kvp_frame_delete(split->inst.kvp_data);
|
||||
split->inst.kvp_data = kvp_frame_copy(s->inst.kvp_data);
|
||||
qof_instance_delete_kvp_data (QOF_INSTANCE (split));
|
||||
qof_instance_set_kvp_data (QOF_INSTANCE(split), qof_instance_get_kvp_data (QOF_INSTANCE (s)));
|
||||
|
||||
xaccAccountInsertSplit(s->acc, split);
|
||||
if (s->lot) {
|
||||
@@ -404,9 +402,9 @@ xaccFreeSplit (Split *split)
|
||||
|
||||
static void mark_acc(Account *acc)
|
||||
{
|
||||
if (acc && !acc->inst.do_free) {
|
||||
acc->balance_dirty = TRUE;
|
||||
acc->sort_dirty = TRUE;
|
||||
if (acc && !qof_instance_get_do_free (QOF_INSTANCE (acc))) {
|
||||
gnc_account_set_balance_dirty (acc, TRUE);
|
||||
gnc_account_set_sort_dirty (acc, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +458,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
|
||||
if (sa == sb) return TRUE;
|
||||
|
||||
if (check_guids) {
|
||||
if (!guid_equal(&(sa->inst.entity.guid), &(sb->inst.entity.guid)))
|
||||
if (!guid_equal(qof_instance_get_guid (QOF_INSTANCE (sa)), qof_instance_get_guid (QOF_INSTANCE (sb))))
|
||||
{
|
||||
PWARN ("GUIDs differ");
|
||||
return FALSE;
|
||||
@@ -481,13 +479,13 @@ xaccSplitEqual(const Split *sa, const Split *sb,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (kvp_frame_compare(sa->inst.kvp_data, sb->inst.kvp_data) != 0)
|
||||
if (kvp_frame_compare(qof_instance_get_kvp_data (QOF_INSTANCE (sa)), qof_instance_get_kvp_data (QOF_INSTANCE (sb))) != 0)
|
||||
{
|
||||
char *frame_a;
|
||||
char *frame_b;
|
||||
|
||||
frame_a = kvp_frame_to_string (sa->inst.kvp_data);
|
||||
frame_b = kvp_frame_to_string (sb->inst.kvp_data);
|
||||
frame_a = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (sa)));
|
||||
frame_b = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (sb)));
|
||||
|
||||
PWARN ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b);
|
||||
|
||||
@@ -600,14 +598,14 @@ xaccSplitSetAccount (Split *s, Account *acc)
|
||||
Transaction *trans;
|
||||
|
||||
g_return_if_fail(s && acc);
|
||||
g_return_if_fail(acc->inst.book == s->inst.book);
|
||||
g_return_if_fail(qof_instance_get_book (QOF_INSTANCE (acc)) == qof_instance_get_book (QOF_INSTANCE (s)));
|
||||
|
||||
trans = s->parent;
|
||||
if (trans)
|
||||
xaccTransBeginEdit(trans);
|
||||
|
||||
s->acc = acc;
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
|
||||
if (trans)
|
||||
xaccTransCommitEdit(trans);
|
||||
@@ -618,6 +616,7 @@ void
|
||||
xaccSplitCommitEdit(Split *s)
|
||||
{
|
||||
Account *acc, *orig_acc;
|
||||
SplitList *l;
|
||||
|
||||
g_return_if_fail(s);
|
||||
if (!qof_instance_is_dirty(QOF_INSTANCE(s)))
|
||||
@@ -627,32 +626,35 @@ xaccSplitCommitEdit(Split *s)
|
||||
acc = s->acc;
|
||||
/* Remove from lot (but only if it hasn't been moved to
|
||||
new lot already) */
|
||||
if (s->lot && (s->lot->account != acc || s->inst.do_free))
|
||||
if (s->lot && (s->lot->account != acc || qof_instance_get_do_free (QOF_INSTANCE (s))))
|
||||
gnc_lot_remove_split (s->lot, s);
|
||||
|
||||
/* Possibly remove the split from the original account... */
|
||||
if (orig_acc && (orig_acc != acc || s->inst.do_free)) {
|
||||
GList *node = g_list_find (orig_acc->splits, s);
|
||||
if (orig_acc && (orig_acc != acc || qof_instance_get_do_free (QOF_INSTANCE (s)))) {
|
||||
GList *node = g_list_find (xaccAccountGetSplitList (orig_acc), s);
|
||||
if (node) {
|
||||
orig_acc->splits = g_list_delete_link (orig_acc->splits, node);
|
||||
l = xaccAccountGetSplitList (orig_acc);
|
||||
l = g_list_delete_link (xaccAccountGetSplitList (orig_acc), node);
|
||||
//FIXME: find better event type
|
||||
qof_event_gen (&orig_acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (orig_acc), QOF_EVENT_MODIFY, NULL);
|
||||
// And send the account-based event, too
|
||||
qof_event_gen(&orig_acc->inst.entity, GNC_EVENT_ITEM_REMOVED, s);
|
||||
qof_event_gen(QOF_INSTANCE (orig_acc), GNC_EVENT_ITEM_REMOVED, s);
|
||||
} else PERR("Account lost track of moved or deleted split.");
|
||||
orig_acc->balance_dirty = TRUE;
|
||||
gnc_account_set_balance_dirty (orig_acc, TRUE);
|
||||
xaccAccountRecomputeBalance(orig_acc);
|
||||
}
|
||||
|
||||
/* ... and insert it into the new account if needed */
|
||||
if (orig_acc != s->acc && !s->inst.do_free) {
|
||||
if (!g_list_find(acc->splits, s)) {
|
||||
if (acc->inst.editlevel == 0) {
|
||||
acc->splits = g_list_insert_sorted(
|
||||
acc->splits, s, (GCompareFunc)xaccSplitDateOrder);
|
||||
if (orig_acc != s->acc && !qof_instance_get_do_free (QOF_INSTANCE (s))) {
|
||||
if (!g_list_find(xaccAccountGetSplitList (acc), s)) {
|
||||
if (qof_instance_get_edit_level (QOF_INSTANCE (acc)) == 0) {
|
||||
l = xaccAccountGetSplitList (acc);
|
||||
l = g_list_insert_sorted(
|
||||
xaccAccountGetSplitList (acc), s, (GCompareFunc)xaccSplitDateOrder);
|
||||
} else {
|
||||
acc->splits = g_list_prepend(acc->splits, s);
|
||||
acc->sort_dirty = TRUE;
|
||||
l = xaccAccountGetSplitList (acc);
|
||||
l = g_list_prepend(xaccAccountGetSplitList(acc), s);
|
||||
gnc_account_set_sort_dirty (acc, TRUE);
|
||||
}
|
||||
|
||||
/* If the split's lot belonged to some other account, we
|
||||
@@ -661,24 +663,24 @@ xaccSplitCommitEdit(Split *s)
|
||||
xaccAccountInsertLot (acc, s->lot);
|
||||
|
||||
//FIXME: find better event
|
||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
|
||||
|
||||
/* Also send an event based on the account */
|
||||
qof_event_gen(&acc->inst.entity, GNC_EVENT_ITEM_ADDED, s);
|
||||
qof_event_gen(QOF_INSTANCE (acc), GNC_EVENT_ITEM_ADDED, s);
|
||||
} else PERR("Account grabbed split prematurely.");
|
||||
acc->balance_dirty = TRUE;
|
||||
gnc_account_set_balance_dirty(acc, TRUE);
|
||||
xaccSplitSetAmount(s, xaccSplitGetAmount(s));
|
||||
}
|
||||
|
||||
if (s->parent != s->orig_parent) {
|
||||
//FIXME: find better event
|
||||
if (s->orig_parent)
|
||||
qof_event_gen(&s->orig_parent->inst.entity, QOF_EVENT_MODIFY,
|
||||
qof_event_gen(QOF_INSTANCE (s->orig_parent), QOF_EVENT_MODIFY,
|
||||
NULL);
|
||||
}
|
||||
if (s->lot) {
|
||||
/* A change of value/amnt affects gains display, etc. */
|
||||
qof_event_gen (&s->lot->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (s->lot), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* Important: we save off the original parent transaction and account
|
||||
@@ -689,11 +691,11 @@ xaccSplitCommitEdit(Split *s)
|
||||
qof_instance_mark_clean (QOF_INSTANCE(s));
|
||||
|
||||
/* This is because Splits don't call qof_commit_edit(). */
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s->parent));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s->parent), TRUE);
|
||||
|
||||
mark_acc(acc);
|
||||
xaccAccountRecomputeBalance(acc);
|
||||
if (s->inst.do_free)
|
||||
if (qof_instance_do_free (QOF_INSTANCE (s)))
|
||||
xaccFreeSplit(s);
|
||||
}
|
||||
|
||||
@@ -709,12 +711,12 @@ xaccSplitRollbackEdit(Split *s)
|
||||
s->acc = s->orig_acc;
|
||||
|
||||
/* Undestroy if needed */
|
||||
if (s->inst.do_free && s->parent) {
|
||||
if (qof_instance_do_free (QOF_INSTANCE (s)) && s->parent) {
|
||||
GncEventData ed;
|
||||
s->inst.do_free = FALSE;
|
||||
qof_instance_set_do_free (QOF_INSTANCE (s), FALSE);
|
||||
ed.node = s;
|
||||
ed.idx = -1; /* unused */
|
||||
qof_event_gen(&s->parent->inst.entity, GNC_EVENT_ITEM_ADDED, &ed);
|
||||
qof_event_gen(QOF_INSTANCE (s), GNC_EVENT_ITEM_ADDED, &ed);
|
||||
}
|
||||
|
||||
/* But for the parent trans, we want the intermediate events, so
|
||||
@@ -731,7 +733,7 @@ xaccSplitLookup (const GUID *guid, QofBook *book)
|
||||
QofCollection *col;
|
||||
if (!guid || !book) return NULL;
|
||||
col = qof_book_get_collection (book, GNC_ID_SPLIT);
|
||||
return (Split *) qof_collection_lookup_entity (col, guid);
|
||||
return (Split *) qof_collection_lookup_element (col, guid);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -760,16 +762,16 @@ xaccSplitDetermineGainStatus (Split *split)
|
||||
return;
|
||||
}
|
||||
|
||||
val = kvp_frame_get_slot (split->inst.kvp_data, "gains-source");
|
||||
val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-source");
|
||||
if (!val)
|
||||
{
|
||||
// CHECKME: We leave split->gains_split alone. Is that correct?
|
||||
split->gains = GAINS_STATUS_A_VDIRTY | GAINS_STATUS_DATE_DIRTY;
|
||||
} else {
|
||||
QofCollection *col;
|
||||
col = qof_book_get_collection (split->inst.book, GNC_ID_SPLIT);
|
||||
col = qof_book_get_collection (qof_instance_get_book (QOF_INSTANCE (split)), GNC_ID_SPLIT);
|
||||
split->gains = GAINS_STATUS_GAINS;
|
||||
other = (Split *) qof_collection_lookup_entity (col,
|
||||
other = (Split *) qof_collection_lookup_element (col,
|
||||
kvp_value_get_guid (val));
|
||||
split->gains_split = other;
|
||||
}
|
||||
@@ -849,7 +851,7 @@ DxaccSplitSetSharePriceAndAmount (Split *s, double price, double amt)
|
||||
|
||||
SET_GAINS_A_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
|
||||
}
|
||||
@@ -868,7 +870,7 @@ xaccSplitSetSharePriceAndAmount (Split *s, gnc_numeric price, gnc_numeric amt)
|
||||
|
||||
SET_GAINS_A_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
}
|
||||
|
||||
@@ -894,7 +896,7 @@ xaccSplitSetSharePrice (Split *s, gnc_numeric price)
|
||||
|
||||
SET_GAINS_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
}
|
||||
|
||||
@@ -927,7 +929,7 @@ DxaccSplitSetShareAmount (Split *s, double damt)
|
||||
|
||||
SET_GAINS_A_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
}
|
||||
|
||||
@@ -962,7 +964,7 @@ xaccSplitSetAmount (Split *s, gnc_numeric amt)
|
||||
|
||||
SET_GAINS_ADIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
LEAVE("");
|
||||
}
|
||||
@@ -996,7 +998,7 @@ xaccSplitSetValue (Split *s, gnc_numeric amt)
|
||||
|
||||
SET_GAINS_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
LEAVE ("");
|
||||
}
|
||||
@@ -1069,7 +1071,7 @@ xaccSplitSetBaseValue (Split *s, gnc_numeric value,
|
||||
|
||||
SET_GAINS_A_VDIRTY(s);
|
||||
mark_split (s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
}
|
||||
|
||||
@@ -1233,15 +1235,15 @@ xaccSplitDestroy (Split *split)
|
||||
|
||||
acc = split->acc;
|
||||
trans = split->parent;
|
||||
if (acc && !acc->inst.do_free && xaccTransGetReadOnly (trans))
|
||||
if (acc && !qof_instance_get_do_free (QOF_INSTANCE (acc)) && xaccTransGetReadOnly (trans))
|
||||
return FALSE;
|
||||
|
||||
xaccTransBeginEdit(trans);
|
||||
ed.node = split;
|
||||
ed.idx = xaccTransGetSplitIndex(trans, split);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
split->inst.do_free = TRUE;
|
||||
qof_event_gen(&trans->inst.entity, GNC_EVENT_ITEM_REMOVED, &ed);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
qof_instance_set_do_free (QOF_INSTANCE (split), TRUE);
|
||||
qof_event_gen(QOF_INSTANCE (trans), GNC_EVENT_ITEM_REMOVED, &ed);
|
||||
xaccTransCommitEdit(trans);
|
||||
|
||||
return TRUE;
|
||||
@@ -1296,7 +1298,7 @@ xaccSplitDateOrder (const Split *sa, const Split *sb)
|
||||
DATE_CMP(sa,sb,date_reconciled);
|
||||
|
||||
/* else, sort on guid - keeps sort stable. */
|
||||
retval = guid_compare(&(sa->inst.entity.guid), &(sb->inst.entity.guid));
|
||||
retval = guid_compare(qof_instance_get_guid (QOF_INSTANCE (sa)), qof_instance_get_guid (QOF_INSTANCE(sb)));
|
||||
if (retval) return retval;
|
||||
|
||||
return 0;
|
||||
@@ -1473,7 +1475,7 @@ xaccSplitSetMemo (Split *split, const char *memo)
|
||||
xaccTransBeginEdit (split->parent);
|
||||
|
||||
CACHE_REPLACE(split->memo, memo);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
xaccTransCommitEdit(split->parent);
|
||||
|
||||
}
|
||||
@@ -1492,7 +1494,7 @@ xaccSplitSetAction (Split *split, const char *actn)
|
||||
xaccTransBeginEdit (split->parent);
|
||||
|
||||
CACHE_REPLACE(split->action, actn);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
xaccTransCommitEdit(split->parent);
|
||||
|
||||
}
|
||||
@@ -1532,7 +1534,7 @@ xaccSplitSetReconcile (Split *split, char recn)
|
||||
case VREC:
|
||||
split->reconciled = recn;
|
||||
mark_split (split);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
xaccAccountRecomputeBalance (split->acc);
|
||||
break;
|
||||
default:
|
||||
@@ -1550,7 +1552,7 @@ xaccSplitSetDateReconciledSecs (Split *split, time_t secs)
|
||||
|
||||
split->date_reconciled.tv_sec = secs;
|
||||
split->date_reconciled.tv_nsec = 0;
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
xaccTransCommitEdit(split->parent);
|
||||
|
||||
}
|
||||
@@ -1562,7 +1564,7 @@ xaccSplitSetDateReconciledTS (Split *split, Timespec *ts)
|
||||
xaccTransBeginEdit (split->parent);
|
||||
|
||||
split->date_reconciled = *ts;
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
|
||||
xaccTransCommitEdit(split->parent);
|
||||
|
||||
}
|
||||
@@ -1611,12 +1613,12 @@ xaccSplitSetParent(Split *s, Transaction *t)
|
||||
ed.node = s;
|
||||
if (old_trans) {
|
||||
ed.idx = xaccTransGetSplitIndex(old_trans, s);
|
||||
qof_event_gen(&old_trans->inst.entity, GNC_EVENT_ITEM_REMOVED, &ed);
|
||||
qof_event_gen(QOF_INSTANCE (old_trans), GNC_EVENT_ITEM_REMOVED, &ed);
|
||||
}
|
||||
s->parent = t;
|
||||
|
||||
xaccTransCommitEdit(old_trans);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
|
||||
if (t) {
|
||||
/* Convert split to new transaction's commodity denominator */
|
||||
@@ -1627,7 +1629,7 @@ xaccSplitSetParent(Split *s, Transaction *t)
|
||||
t->splits = g_list_append(t->splits, s);
|
||||
|
||||
ed.idx = -1; /* unused */
|
||||
qof_event_gen(&t->inst.entity, GNC_EVENT_ITEM_ADDED, &ed);
|
||||
qof_event_gen(QOF_INSTANCE (t), GNC_EVENT_ITEM_ADDED, &ed);
|
||||
}
|
||||
xaccTransCommitEdit(t);
|
||||
}
|
||||
@@ -1725,7 +1727,7 @@ xaccSplitGetType(const Split *s)
|
||||
const char *split_type;
|
||||
|
||||
if (!s) return NULL;
|
||||
split_type = kvp_frame_get_string(s->inst.kvp_data, "split-type");
|
||||
split_type = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (s)), "split-type");
|
||||
return split_type ? split_type : "normal";
|
||||
}
|
||||
|
||||
@@ -1737,10 +1739,10 @@ xaccSplitMakeStockSplit(Split *s)
|
||||
xaccTransBeginEdit (s->parent);
|
||||
|
||||
s->value = gnc_numeric_zero();
|
||||
kvp_frame_set_str(s->inst.kvp_data, "split-type", "stock-split");
|
||||
kvp_frame_set_str(qof_instance_get_kvp_data (QOF_INSTANCE (s)), "split-type", "stock-split");
|
||||
SET_GAINS_VDIRTY(s);
|
||||
mark_split(s);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
|
||||
xaccTransCommitEdit(s->parent);
|
||||
}
|
||||
|
||||
@@ -1783,13 +1785,13 @@ xaccSplitGetOtherSplit (const Split *split)
|
||||
|
||||
num_splits = xaccTransCountSplits(trans);
|
||||
count = num_splits;
|
||||
sva = kvp_frame_get_slot (split->inst.kvp_data, "lot-split");
|
||||
sva = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split");
|
||||
if (!sva && (2 != count)) return NULL;
|
||||
|
||||
for (i = 0; i < num_splits; i++) {
|
||||
Split *s = xaccTransGetSplit(trans, i);
|
||||
if (s == split) { --count; continue; }
|
||||
if (kvp_frame_get_slot (s->inst.kvp_data, "lot-split"))
|
||||
if (kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (s)), "lot-split"))
|
||||
{ --count; continue; }
|
||||
other = s;
|
||||
}
|
||||
@@ -1809,21 +1811,21 @@ gnc_numeric
|
||||
xaccSplitVoidFormerAmount(const Split *split)
|
||||
{
|
||||
g_return_val_if_fail(split, gnc_numeric_zero());
|
||||
return kvp_frame_get_numeric(split->inst.kvp_data, void_former_amt_str);
|
||||
return kvp_frame_get_numeric(qof_instance_get_kvp_data (QOF_INSTANCE (split)), void_former_amt_str);
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccSplitVoidFormerValue(const Split *split)
|
||||
{
|
||||
g_return_val_if_fail(split, gnc_numeric_zero());
|
||||
return kvp_frame_get_numeric(split->inst.kvp_data, void_former_val_str);
|
||||
return kvp_frame_get_numeric(qof_instance_get_kvp_data (QOF_INSTANCE (split)), void_former_val_str);
|
||||
}
|
||||
|
||||
void
|
||||
xaccSplitVoid(Split *split)
|
||||
{
|
||||
gnc_numeric zero = gnc_numeric_zero();
|
||||
KvpFrame *frame = split->inst.kvp_data;
|
||||
KvpFrame *frame = qof_instance_get_kvp_data (QOF_INSTANCE (split));
|
||||
|
||||
kvp_frame_set_gnc_numeric(frame, void_former_amt_str,
|
||||
xaccSplitGetAmount(split));
|
||||
@@ -1839,7 +1841,7 @@ xaccSplitVoid(Split *split)
|
||||
void
|
||||
xaccSplitUnvoid(Split *split)
|
||||
{
|
||||
KvpFrame *frame = split->inst.kvp_data;
|
||||
KvpFrame *frame = qof_instance_get_kvp_data (QOF_INSTANCE (split));
|
||||
|
||||
xaccSplitSetAmount (split, xaccSplitVoidFormerAmount(split));
|
||||
xaccSplitSetValue (split, xaccSplitVoidFormerValue(split));
|
||||
@@ -1853,6 +1855,9 @@ xaccSplitUnvoid(Split *split)
|
||||
/* QofObject function implementation */
|
||||
|
||||
/* Hook into the QofObject registry */
|
||||
/*
|
||||
|
||||
BROKEN CODE
|
||||
|
||||
static QofObject split_object_def = {
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -1867,6 +1872,7 @@ static QofObject split_object_def = {
|
||||
printable: (const char* (*)(gpointer)) xaccSplitGetMemo,
|
||||
version_cmp: (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
*/
|
||||
|
||||
static gpointer
|
||||
split_account_guid_getter (gpointer obj, const QofParam *p)
|
||||
@@ -1910,6 +1916,7 @@ qofSplitSetAccount(Split *s, QofEntity *ent)
|
||||
xaccSplitSetAccount(s, acc);
|
||||
}
|
||||
|
||||
/*
|
||||
gboolean xaccSplitRegister (void)
|
||||
{
|
||||
static const QofParam params[] = {
|
||||
@@ -1917,12 +1924,13 @@ gboolean xaccSplitRegister (void)
|
||||
(QofAccessFunc)xaccSplitRetDateReconciledTS,
|
||||
(QofSetterFunc)xaccSplitSetDateReconciledTS },
|
||||
|
||||
/* d-* are deprecated query params, should not be used in new
|
||||
d-* are deprecated query params, should not be used in new
|
||||
* queries, should be removed from old queries. */
|
||||
/*
|
||||
{ "d-share-amount", QOF_TYPE_DOUBLE,
|
||||
(QofAccessFunc)DxaccSplitGetShareAmount, NULL },
|
||||
{ "d-share-int64", QOF_TYPE_INT64,
|
||||
(QofAccessFunc)qof_entity_get_guid, NULL },
|
||||
(QofAccessFunc)qof_instance_get_guid, NULL },
|
||||
{ SPLIT_BALANCE, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitGetBalance, NULL },
|
||||
{ SPLIT_CLEARED_BALANCE, QOF_TYPE_NUMERIC,
|
||||
@@ -1955,15 +1963,17 @@ gboolean xaccSplitRegister (void)
|
||||
{ SPLIT_ACCOUNT, GNC_ID_ACCOUNT,
|
||||
(QofAccessFunc)xaccSplitGetAccount, (QofSetterFunc)qofSplitSetAccount },
|
||||
{ SPLIT_ACCOUNT_GUID, QOF_TYPE_GUID, split_account_guid_getter, NULL },
|
||||
*/
|
||||
/* these are no-ops to register the parameter names (for sorting) but
|
||||
they return an allocated object which getters cannot do. */
|
||||
/*
|
||||
{ SPLIT_ACCT_FULLNAME, SPLIT_ACCT_FULLNAME, no_op, NULL },
|
||||
{ SPLIT_CORR_ACCT_NAME, SPLIT_CORR_ACCT_NAME, no_op, NULL },
|
||||
{ SPLIT_CORR_ACCT_CODE, SPLIT_CORR_ACCT_CODE, no_op, NULL },
|
||||
{ SPLIT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccSplitGetSlots, NULL },
|
||||
{ QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccSplitGetBook, NULL },
|
||||
{ QOF_PARAM_GUID, QOF_TYPE_GUID,
|
||||
(QofAccessFunc)qof_entity_get_guid, NULL },
|
||||
(QofAccessFunc)qof_instance_get_guid, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
@@ -1978,6 +1988,7 @@ gboolean xaccSplitRegister (void)
|
||||
|
||||
return qof_object_register (&split_object_def);
|
||||
}
|
||||
*/
|
||||
|
||||
/************************ END OF ************************************\
|
||||
\************************* FILE *************************************/
|
||||
+2
-2
@@ -485,9 +485,9 @@ gnc_numeric xaccSplitVoidFormerValue(const Split *split);
|
||||
/** @} */
|
||||
|
||||
/** \deprecated */
|
||||
#define xaccSplitGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define xaccSplitGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
/** \deprecated */
|
||||
#define xaccSplitReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
|
||||
#define xaccSplitReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
|
||||
|
||||
#endif /* XACC_SPLIT_H */
|
||||
/** @} */
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ struct _GncSplit
|
||||
/* Set the split's GUID. This should only be done when reading
|
||||
* a split from a datafile, or some other external source. Never
|
||||
* call this on an existing split! */
|
||||
#define xaccSplitSetGUID(s,g) qof_entity_set_guid(QOF_ENTITY(s),g)
|
||||
#define xaccSplitSetGUID(s,g) qof_instance_set_guid(QOF_INSTANCE(s),g)
|
||||
|
||||
/* The xaccFreeSplit() method simply frees all memory associated
|
||||
* with the split. It does not verify that the split isn't
|
||||
|
||||
+223
-207
File diff suppressed because it is too large.
Load diff
+86
-86
@@ -19,7 +19,7 @@
|
||||
\********************************************************************/
|
||||
/** @addtogroup Engine
|
||||
@{ */
|
||||
/** @addtogroup Transaction Financial Transactions
|
||||
/** @addtogroup GncTransaction Financial Transactions
|
||||
A good overview of transactions, splits and GncAccounts can be
|
||||
found in the texinfo documentation, together with an overview of
|
||||
how to use this API.
|
||||
@@ -28,12 +28,12 @@ Splits, or "Ledger Entries" are the fundamental
|
||||
GncAccounting units. Each Split consists of an amount (number of dollar
|
||||
bills, number of shares, etc.), the value of that amount expressed in
|
||||
a (possibly) different currency than the amount, a Memo, a pointer to
|
||||
the parent Transaction, a pointer to the debited GncAccount, a reconciled
|
||||
the parent GncTransaction, a pointer to the debited GncAccount, a reconciled
|
||||
flag and timestamp, an "Action" field, and a key-value frame which can
|
||||
store arbitrary data.
|
||||
|
||||
Transactions embody the notion of "double entry" GncAccounting.
|
||||
A Transaction consists of a date, a description, an ID number,
|
||||
A GncTransaction consists of a date, a description, an ID number,
|
||||
a list of one or more Splits, and a key-value frame. The transaction
|
||||
also specifies the currency with which all of the splits will be valued.
|
||||
When double-entry rules are enforced, the sum total value of the splits
|
||||
@@ -47,14 +47,14 @@ The engine does not enforce double-entry GncAccounting, but provides an API
|
||||
to enable user-code to find unbalanced transactions and 'repair' them so
|
||||
that they are in balance.
|
||||
|
||||
Note the sum of the values of Splits in a Transaction is always computed
|
||||
Note the sum of the values of Splits in a GncTransaction is always computed
|
||||
with respect to a currency; thus splits can be balanced even when they
|
||||
are in different currencies, as long as they share a common currency.
|
||||
This feature allows currency-trading GncAccounts to be established.
|
||||
|
||||
Every Split must point to its parent Transaction, and that Transaction
|
||||
must in turn include that Split in the Transaction's list of Splits. A
|
||||
Split can belong to at most one Transaction. These relationships are
|
||||
Every Split must point to its parent GncTransaction, and that GncTransaction
|
||||
must in turn include that Split in the GncTransaction's list of Splits. A
|
||||
Split can belong to at most one GncTransaction. These relationships are
|
||||
enforced by the engine. The engine user cannnot accidentally destroy
|
||||
this relationship as long as they stick to using the API and never
|
||||
access internal structures directly.
|
||||
@@ -77,7 +77,7 @@ convention, the value of an GncAccount is equal to the value of all of its
|
||||
Splits plus the value of all of its sub-GncAccounts.
|
||||
|
||||
@{ */
|
||||
/** @file Transaction.h
|
||||
/** @file GncTransaction.h
|
||||
@brief API for Transactions and Splits (journal entries)
|
||||
@author Copyright (C) 1997 Robin D. Clark
|
||||
@author Copyright (C) 1997-2001 Linas Vepstas <linas@linas.org>
|
||||
@@ -94,25 +94,25 @@ Splits plus the value of all of its sub-GncAccounts.
|
||||
#include "Account.h"
|
||||
|
||||
|
||||
/** @name Transaction Type field values
|
||||
/** @name GncTransaction Type field values
|
||||
@{
|
||||
*/
|
||||
#define TXN_TYPE_NONE '\0' /**< No transaction type */
|
||||
#define TXN_TYPE_INVOICE 'I' /**< Transaction is an invoice */
|
||||
#define TXN_TYPE_PAYMENT 'P' /**< Transaction is a payment */
|
||||
#define TXN_TYPE_INVOICE 'I' /**< GncTransaction is an invoice */
|
||||
#define TXN_TYPE_PAYMENT 'P' /**< GncTransaction is a payment */
|
||||
/** @} */
|
||||
|
||||
/* --------------------------------------------------------------- */
|
||||
/* Transactions */
|
||||
|
||||
/** @name Transaction creation and editing
|
||||
/** @name GncTransaction creation and editing
|
||||
@{
|
||||
*/
|
||||
/**
|
||||
The xaccMallocTransaction() will malloc memory and initialize it.
|
||||
Once created, it is usually unsafe to merely "free" this memory;
|
||||
the xaccTransDestroy() method should be called. */
|
||||
Transaction * xaccMallocTransaction (QofBook *book);
|
||||
GncTransaction * xaccMallocTransaction (QofBook *book);
|
||||
|
||||
/**
|
||||
The xaccTransDestroy() method will remove all
|
||||
@@ -122,13 +122,13 @@ Transaction * xaccMallocTransaction (QofBook *book);
|
||||
memory will be freed, or by xaccTransRollbackEdit(), in which
|
||||
case nothing at all is freed, and everything is put back into
|
||||
original order. */
|
||||
void xaccTransDestroy (Transaction *trans);
|
||||
void xaccTransDestroy (GncTransaction *trans);
|
||||
|
||||
/**
|
||||
The xaccTransClone() method will create a complete copy of an
|
||||
existing transaction.
|
||||
*/
|
||||
Transaction * xaccTransClone (const Transaction *t);
|
||||
GncTransaction * xaccTransClone (const GncTransaction *t);
|
||||
|
||||
/** Equality.
|
||||
*
|
||||
@@ -153,8 +153,8 @@ Transaction * xaccTransClone (const Transaction *t);
|
||||
* up splits by GUID, and is required for checking duplicated
|
||||
* transactions because all the splits have new GUIDs.
|
||||
*/
|
||||
gboolean xaccTransEqual(const Transaction *ta,
|
||||
const Transaction *tb,
|
||||
gboolean xaccTransEqual(const GncTransaction *ta,
|
||||
const GncTransaction *tb,
|
||||
gboolean check_guids,
|
||||
gboolean check_splits,
|
||||
gboolean check_balances,
|
||||
@@ -163,21 +163,21 @@ gboolean xaccTransEqual(const Transaction *ta,
|
||||
/** The xaccTransBeginEdit() method must be called before any changes
|
||||
are made to a transaction or any of its component splits. If
|
||||
this is not done, errors will result. */
|
||||
void xaccTransBeginEdit (Transaction *trans);
|
||||
void xaccTransBeginEdit (GncTransaction *trans);
|
||||
|
||||
/** The xaccTransCommitEdit() method indicates that the changes to the
|
||||
transaction and its splits are complete and should be made
|
||||
permanent. Note this routine may result in the deletion of the
|
||||
transaction, if the transaction is "empty" (has no splits), or
|
||||
of xaccTransDestroy() was called on the transaction. */
|
||||
void xaccTransCommitEdit (Transaction *trans);
|
||||
void xaccTransCommitEdit (GncTransaction *trans);
|
||||
|
||||
/** The xaccTransRollbackEdit() routine rejects all edits made, and
|
||||
sets the transaction back to where it was before the editing
|
||||
started. This includes restoring any deleted splits, removing
|
||||
any added splits, and undoing the effects of xaccTransDestroy,
|
||||
as well as restoring share quantities, memos, descriptions, etc. */
|
||||
void xaccTransRollbackEdit (Transaction *trans);
|
||||
void xaccTransRollbackEdit (GncTransaction *trans);
|
||||
|
||||
/** The xaccTransIsOpen() method returns TRUE if the transaction
|
||||
is open for editing. Otherwise, it returns false.
|
||||
@@ -185,15 +185,15 @@ void xaccTransRollbackEdit (Transaction *trans);
|
||||
hard to imagine legitamate uses (but it is used by
|
||||
the import/export code for reasons I can't understand.)
|
||||
*/
|
||||
gboolean xaccTransIsOpen (const Transaction *trans);
|
||||
gboolean xaccTransIsOpen (const GncTransaction *trans);
|
||||
|
||||
/** The xaccTransLookup() subroutine will return the
|
||||
transaction associated with the given id, or NULL
|
||||
if there is no such transaction. */
|
||||
Transaction * xaccTransLookup (const GUID *guid, QofBook *book);
|
||||
GncTransaction * xaccTransLookup (const GUID *guid, QofBook *book);
|
||||
#define xaccTransLookupDirect(g,b) xaccTransLookup(&(g),b)
|
||||
|
||||
Split * xaccTransFindSplitByAccount(const Transaction *trans,
|
||||
Split * xaccTransFindSplitByAccount(const GncTransaction *trans,
|
||||
const GncAccount *acc);
|
||||
|
||||
/** The xaccTransScrubGains() routine performs a number of cleanup
|
||||
@@ -203,7 +203,7 @@ Split * xaccTransFindSplitByAccount(const Transaction *trans,
|
||||
* assignments of all the splits are good, and that the lots
|
||||
* balance appropriately.
|
||||
*/
|
||||
void xaccTransScrubGains (Transaction *trans, GncAccount *gain_acc);
|
||||
void xaccTransScrubGains (GncTransaction *trans, GncAccount *gain_acc);
|
||||
|
||||
|
||||
/** \warning XXX FIXME
|
||||
@@ -215,42 +215,42 @@ guint gnc_book_count_transactions(QofBook *book);
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @name Transaction general getters/setters
|
||||
/** @name GncTransaction general getters/setters
|
||||
@{
|
||||
*/
|
||||
|
||||
/** Sorts the splits in a transaction, putting the debits first,
|
||||
* followed by the credits.
|
||||
*/
|
||||
void xaccTransSortSplits (Transaction *trans);
|
||||
void xaccTransSortSplits (GncTransaction *trans);
|
||||
|
||||
/** Set the Transaction Type
|
||||
/** Set the GncTransaction Type
|
||||
*
|
||||
* See #TXN_TYPE_NONE, #TXN_TYPE_INVOICE and #TXN_TYPE_PAYMENT */
|
||||
void xaccTransSetTxnType (Transaction *trans, char type);
|
||||
/** Returns the Transaction Type
|
||||
void xaccTransSetTxnType (GncTransaction *trans, char type);
|
||||
/** Returns the GncTransaction Type
|
||||
*
|
||||
* See #TXN_TYPE_NONE, #TXN_TYPE_INVOICE and #TXN_TYPE_PAYMENT */
|
||||
char xaccTransGetTxnType (const Transaction *trans);
|
||||
char xaccTransGetTxnType (const GncTransaction *trans);
|
||||
|
||||
|
||||
/** Sets the transaction Number (or ID) field*/
|
||||
void xaccTransSetNum (Transaction *trans, const char *num);
|
||||
void xaccTransSetNum (GncTransaction *trans, const char *num);
|
||||
/** Sets the transaction Description */
|
||||
void xaccTransSetDescription (Transaction *trans, const char *desc);
|
||||
void xaccTransSetDescription (GncTransaction *trans, const char *desc);
|
||||
/** Sets the transaction Notes
|
||||
*
|
||||
The Notes field is only visible in the register in double-line mode */
|
||||
void xaccTransSetNotes (Transaction *trans, const char *notes);
|
||||
void xaccTransSetNotes (GncTransaction *trans, const char *notes);
|
||||
|
||||
/** Gets the transaction Number (or ID) field*/
|
||||
const char * xaccTransGetNum (const Transaction *trans);
|
||||
const char * xaccTransGetNum (const GncTransaction *trans);
|
||||
/** Gets the transaction Description */
|
||||
const char * xaccTransGetDescription (const Transaction *trans);
|
||||
const char * xaccTransGetDescription (const GncTransaction *trans);
|
||||
/** Gets the transaction Notes
|
||||
*
|
||||
The Notes field is only visible in the register in double-line mode */
|
||||
const char * xaccTransGetNotes (const Transaction *trans);
|
||||
const char * xaccTransGetNotes (const GncTransaction *trans);
|
||||
|
||||
|
||||
/** Add a split to the transaction
|
||||
@@ -269,38 +269,38 @@ const char * xaccTransGetNotes (const Transaction *trans);
|
||||
(number_of__splits-1). An invalid value of i will cause NULL to
|
||||
be returned. A convenient way of cycling through all splits is
|
||||
to start at zero, and keep incrementing until a null value is returned. */
|
||||
Split * xaccTransGetSplit (const Transaction *trans, int i);
|
||||
Split * xaccTransGetSplit (const GncTransaction *trans, int i);
|
||||
|
||||
/** Inverse of xaccTransGetSplit() */
|
||||
int xaccTransGetSplitIndex(const Transaction *trans, const Split *split);
|
||||
int xaccTransGetSplitIndex(const GncTransaction *trans, const Split *split);
|
||||
|
||||
/** The xaccTransGetSplitList() method returns a GList of the splits
|
||||
in a transaction.
|
||||
@return The list of splits. This list must NOT be modified. Do *NOT* free
|
||||
this list when you are done with it. */
|
||||
SplitList * xaccTransGetSplitList (const Transaction *trans);
|
||||
gboolean xaccTransStillHasSplit(const Transaction *trans, const Split *s);
|
||||
SplitList * xaccTransGetSplitList (const GncTransaction *trans);
|
||||
gboolean xaccTransStillHasSplit(const GncTransaction *trans, const Split *s);
|
||||
|
||||
|
||||
/** Set the transaction to be ReadOnly */
|
||||
void xaccTransSetReadOnly (Transaction *trans, const char *reason);
|
||||
void xaccTransClearReadOnly (Transaction *trans);
|
||||
void xaccTransSetReadOnly (GncTransaction *trans, const char *reason);
|
||||
void xaccTransClearReadOnly (GncTransaction *trans);
|
||||
/** FIXME: document me */
|
||||
const char * xaccTransGetReadOnly (const Transaction *trans);
|
||||
const char * xaccTransGetReadOnly (const GncTransaction *trans);
|
||||
|
||||
/** Returns the number of splits in this transaction. */
|
||||
int xaccTransCountSplits (const Transaction *trans);
|
||||
int xaccTransCountSplits (const GncTransaction *trans);
|
||||
|
||||
/** FIXME: document me */
|
||||
gboolean xaccTransHasReconciledSplits (const Transaction *trans);
|
||||
gboolean xaccTransHasReconciledSplits (const GncTransaction *trans);
|
||||
/** FIXME: document me */
|
||||
gboolean xaccTransHasReconciledSplitsByGncAccount (const Transaction *trans,
|
||||
gboolean xaccTransHasReconciledSplitsByAccount (const GncTransaction *trans,
|
||||
const GncAccount *GncAccount);
|
||||
|
||||
/** FIXME: document me */
|
||||
gboolean xaccTransHasSplitsInState (const Transaction *trans, const char state);
|
||||
gboolean xaccTransHasSplitsInState (const GncTransaction *trans, const char state);
|
||||
/** FIXME: document me */
|
||||
gboolean xaccTransHasSplitsInStateByGncAccount (const Transaction *trans,
|
||||
gboolean xaccTransHasSplitsInStateByAccount (const GncTransaction *trans,
|
||||
const char state,
|
||||
const GncAccount *GncAccount);
|
||||
|
||||
@@ -312,10 +312,10 @@ gboolean xaccTransHasSplitsInStateByGncAccount (const Transaction *trans,
|
||||
* The total value of the transaction must be zero when all splits
|
||||
* are valued in this currency.
|
||||
* @note What happens if the Currency isn't set? Ans: bad things. */
|
||||
gnc_commodity * xaccTransGetCurrency (const Transaction *trans);
|
||||
gnc_commodity * xaccTransGetCurrency (const GncTransaction *trans);
|
||||
|
||||
/** Set the commodity of this transaction. */
|
||||
void xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr);
|
||||
void xaccTransSetCurrency (GncTransaction *trans, gnc_commodity *curr);
|
||||
|
||||
/** The xaccTransGetImbalance() method returns the total value of the
|
||||
* transaction. In a pure double-entry system, this imbalance
|
||||
@@ -325,19 +325,19 @@ void xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr);
|
||||
* out how much things are off by. The value returned is denominated
|
||||
* in the currency that is returned by the xaccTransFindCommonCurrency()
|
||||
* method. */
|
||||
gnc_numeric xaccTransGetImbalance (const Transaction * trans);
|
||||
gnc_numeric xaccTransGetImbalance (const GncTransaction * trans);
|
||||
|
||||
/** The xaccTransGetGncAccountValue() method returns the total value applied
|
||||
* to a particular GncAccount. In some cases there may be multiple Splits
|
||||
* in a single Transaction applied to one GncAccount (in particular when
|
||||
* in a single GncTransaction applied to one GncAccount (in particular when
|
||||
* trying to balance Lots) -- this function is just a convienience to
|
||||
* view everything at once.
|
||||
*/
|
||||
gnc_numeric xaccTransGetGncAccountValue (const Transaction *trans,
|
||||
gnc_numeric xaccTransGetAccountValue (const GncTransaction *trans,
|
||||
const GncAccount *GncAccount);
|
||||
|
||||
/** Same as xaccTransGetGncAccountValue, but uses the GncAccount's commodity. */
|
||||
gnc_numeric xaccTransGetGncAccountAmount (const Transaction *trans,
|
||||
gnc_numeric xaccTransGetAccountAmount (const GncTransaction *trans,
|
||||
const GncAccount *GncAccount);
|
||||
|
||||
/* Compute the conversion rate for the transaction to this GncAccount.
|
||||
@@ -347,11 +347,11 @@ gnc_numeric xaccTransGetGncAccountAmount (const Transaction *trans,
|
||||
*
|
||||
* If 'acc' is NULL, return unity.
|
||||
*/
|
||||
gnc_numeric xaccTransGetGncAccountConvRate(Transaction *txn, GncAccount *acc);
|
||||
gnc_numeric xaccTransGetAccountConvRate(GncTransaction *txn, GncAccount *acc);
|
||||
|
||||
/** Get the GncAccount balance for the specified GncAccount after the last
|
||||
split in the specified transaction. */
|
||||
gnc_numeric xaccTransGetGncAccountBalance (const Transaction *trans,
|
||||
gnc_numeric xaccTransGetAccountBalance (const GncTransaction *trans,
|
||||
const GncAccount *GncAccount);
|
||||
|
||||
/**
|
||||
@@ -370,12 +370,12 @@ gnc_numeric xaccTransGetGncAccountBalance (const Transaction *trans,
|
||||
* Finally, it returns zero if all of the above match.
|
||||
* Note that it does *NOT* compare its member splits.
|
||||
*/
|
||||
int xaccTransOrder (const Transaction *ta, const Transaction *tb);
|
||||
int xaccTransOrder (const GncTransaction *ta, const GncTransaction *tb);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @name Transaction date setters/getters
|
||||
/** @name GncTransaction date setters/getters
|
||||
@{
|
||||
*/
|
||||
|
||||
@@ -388,7 +388,7 @@ int xaccTransOrder (const Transaction *ta, const Transaction *tb);
|
||||
called, the date order of each of the component splits will be
|
||||
checked, and will be restored in ascending date order.)
|
||||
*/
|
||||
void xaccTransSetDate (Transaction *trans,
|
||||
void xaccTransSetDate (GncTransaction *trans,
|
||||
int day, int mon, int year);
|
||||
|
||||
/** The xaccTransSetDatePostedSecs() method will modify the <i>posted</i>
|
||||
@@ -396,51 +396,51 @@ void xaccTransSetDate (Transaction *trans,
|
||||
posted date is the date when this transaction was posted at the
|
||||
bank. */
|
||||
#define xaccTransSetDateSecs xaccTransSetDatePostedSecs
|
||||
void xaccTransSetDatePostedSecs (Transaction *trans, time_t time);
|
||||
void xaccTransSetDatePostedSecs (GncTransaction *trans, time_t time);
|
||||
|
||||
/** The xaccTransSetDatePostedTS() method does the same thing as
|
||||
xaccTransSetDatePostedSecs(), but takes a struct timespec64. */
|
||||
void xaccTransSetDatePostedTS (Transaction *trans,
|
||||
void xaccTransSetDatePostedTS (GncTransaction *trans,
|
||||
const Timespec *ts);
|
||||
|
||||
/** Modify the date of when the transaction was entered. The entered
|
||||
* date is the date when the register entry was made. */
|
||||
void xaccTransSetDateEnteredSecs (Transaction *trans, time_t time);
|
||||
void xaccTransSetDateEnteredSecs (GncTransaction *trans, time_t time);
|
||||
/** Modify the date of when the transaction was entered. The entered
|
||||
* date is the date when the register entry was made. */
|
||||
void xaccTransSetDateEnteredTS (Transaction *trans,
|
||||
void xaccTransSetDateEnteredTS (GncTransaction *trans,
|
||||
const Timespec *ts);
|
||||
|
||||
/** Dates and txn-type for A/R and A/P "invoice" postings */
|
||||
void xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts);
|
||||
void xaccTransSetDateDueTS (GncTransaction *trans, const Timespec *ts);
|
||||
|
||||
/** Retrieve the posted date of the transaction. The posted date is
|
||||
the date when this transaction was posted at the bank. (Although
|
||||
having different function names, GetDate and GetDatePosted refer
|
||||
to the same single date.)*/
|
||||
time_t xaccTransGetDate (const Transaction *trans);
|
||||
time_t xaccTransGetDate (const GncTransaction *trans);
|
||||
/** Retrieve the posted date of the transaction. The posted date is
|
||||
the date when this transaction was posted at the bank. (Although
|
||||
having different function names, GetDate and GetDatePosted refer
|
||||
to the same single date.)*/
|
||||
void xaccTransGetDatePostedTS (const Transaction *trans, Timespec *ts);
|
||||
void xaccTransGetDatePostedTS (const GncTransaction *trans, Timespec *ts);
|
||||
/** Retrieve the posted date of the transaction. The posted date is
|
||||
the date when this transaction was posted at the bank. (Although
|
||||
having different function names, GetDate and GetDatePosted refer
|
||||
to the same single date.)*/
|
||||
Timespec xaccTransRetDatePostedTS (const Transaction *trans);
|
||||
Timespec xaccTransRetDatePostedTS (const GncTransaction *trans);
|
||||
|
||||
/** Retrieve the date of when the transaction was entered. The entered
|
||||
* date is the date when the register entry was made.*/
|
||||
void xaccTransGetDateEnteredTS (const Transaction *trans, Timespec *ts);
|
||||
void xaccTransGetDateEnteredTS (const GncTransaction *trans, Timespec *ts);
|
||||
/** Retrieve the date of when the transaction was entered. The entered
|
||||
* date is the date when the register entry was made.*/
|
||||
Timespec xaccTransRetDateEnteredTS (const Transaction *trans);
|
||||
Timespec xaccTransRetDateEnteredTS (const GncTransaction *trans);
|
||||
|
||||
/** Dates and txn-type for A/R and A/P "invoice" postings */
|
||||
Timespec xaccTransRetDateDueTS (const Transaction *trans);
|
||||
Timespec xaccTransRetDateDueTS (const GncTransaction *trans);
|
||||
/** Dates and txn-type for A/R and A/P "invoice" postings */
|
||||
void xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts);
|
||||
void xaccTransGetDateDueTS (const GncTransaction *trans, Timespec *ts);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -453,14 +453,14 @@ void xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts);
|
||||
/** The xaccGetGncAccountByName() is a convenience routine that
|
||||
* is essentially identical to xaccGetPeerGncAccountFromName(),
|
||||
* except that it accepts the handy transaction as root.*/
|
||||
GncAccount * xaccGetGncAccountByName (const Transaction *trans, const char *name);
|
||||
GncAccount * xaccGetAccountByName (const GncTransaction *trans, const char *name);
|
||||
/** The xaccGetGncAccountByFullName routine is similar to xaccGetGncAccountByName, but uses
|
||||
* full names using the given separator.*/
|
||||
GncAccount * xaccGetGncAccountByFullName (const Transaction *trans,
|
||||
GncAccount * xaccGetAccountByFullName (const GncTransaction *trans,
|
||||
const char *name);
|
||||
|
||||
|
||||
/** @name Transaction voiding
|
||||
/** @name GncTransaction voiding
|
||||
@{
|
||||
*/
|
||||
/** xaccTransVoid voids a transaction. A void transaction has no
|
||||
@@ -472,7 +472,7 @@ GncAccount * xaccGetGncAccountByFullName (const Transaction *trans,
|
||||
* @param reason The textual reason why this transaction is being
|
||||
* voided.
|
||||
*/
|
||||
void xaccTransVoid(Transaction *transaction,
|
||||
void xaccTransVoid(GncTransaction *transaction,
|
||||
const char *reason);
|
||||
|
||||
/** xaccTransUnvoid restores a voided transaction to its original
|
||||
@@ -482,9 +482,9 @@ void xaccTransVoid(Transaction *transaction,
|
||||
*
|
||||
* @param transaction The transaction to restore from voided state.
|
||||
*/
|
||||
void xaccTransUnvoid(Transaction *transaction);
|
||||
void xaccTransUnvoid(GncTransaction *transaction);
|
||||
|
||||
/** xaccTransReverse creates a Transaction that reverses the given
|
||||
/** xaccTransReverse creates a GncTransaction that reverses the given
|
||||
* tranaction by inverting all the numerical values in the given
|
||||
* transaction. This function cancels out the effect of an earlier
|
||||
* transaction. This will be needed by write only GncAccounts as a way
|
||||
@@ -495,16 +495,16 @@ void xaccTransUnvoid(Transaction *transaction);
|
||||
*
|
||||
* @return a new transaction which reverses the given transaction
|
||||
*/
|
||||
Transaction * xaccTransReverse(Transaction *transaction);
|
||||
GncTransaction * xaccTransReverse(GncTransaction *transaction);
|
||||
|
||||
/** Returns the transaction that reversed the given transaction.
|
||||
*
|
||||
* @param trans a Transaction that has been reversed
|
||||
* @param trans a GncTransaction that has been reversed
|
||||
*
|
||||
* @param the transaction that reversed the given transaction, or
|
||||
* NULL if the given transaction has not been reversed.
|
||||
*/
|
||||
Transaction * xaccTransGetReversedBy(const Transaction *trans);
|
||||
GncTransaction * xaccTransGetReversedBy(const GncTransaction *trans);
|
||||
|
||||
/** Retrieve information on whether or not a transaction has been voided.
|
||||
*
|
||||
@@ -513,7 +513,7 @@ Transaction * xaccTransGetReversedBy(const Transaction *trans);
|
||||
* @return TRUE if the transaction is void, FALSE otherwise. Also
|
||||
* returns FALSE upon an error.
|
||||
*/
|
||||
gboolean xaccTransGetVoidStatus(const Transaction *transaction);
|
||||
gboolean xaccTransGetVoidStatus(const GncTransaction *transaction);
|
||||
|
||||
/** Returns the user supplied textual reason why a transaction was
|
||||
* voided.
|
||||
@@ -522,7 +522,7 @@ gboolean xaccTransGetVoidStatus(const Transaction *transaction);
|
||||
*
|
||||
* @return A pointer to the user supplied reason for voiding.
|
||||
*/
|
||||
const char *xaccTransGetVoidReason(const Transaction *transaction);
|
||||
const char *xaccTransGetVoidReason(const GncTransaction *transaction);
|
||||
|
||||
/** Returns the time that a transaction was voided.
|
||||
*
|
||||
@@ -531,10 +531,10 @@ const char *xaccTransGetVoidReason(const Transaction *transaction);
|
||||
* @return A Timespec containing the time that this transaction was
|
||||
* voided. Returns a time of zero upon error.
|
||||
*/
|
||||
Timespec xaccTransGetVoidTime(const Transaction *tr);
|
||||
Timespec xaccTransGetVoidTime(const GncTransaction *tr);
|
||||
/** @} */
|
||||
|
||||
/** @name Transaction Parameter names
|
||||
/** @name GncTransaction Parameter names
|
||||
@{
|
||||
*/
|
||||
#define TRANS_KVP "kvp"
|
||||
@@ -558,9 +558,9 @@ Timespec xaccTransGetVoidTime(const Transaction *tr);
|
||||
/** \deprecated */
|
||||
#define xaccTransGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
|
||||
/** \deprecated */
|
||||
#define xaccTransGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define xaccTransGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
/** \deprecated */
|
||||
#define xaccTransReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
|
||||
#define xaccTransReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
|
||||
/** \deprecated */
|
||||
#define xaccTransGetSlots(X) qof_instance_get_slots (QOF_INSTANCE(X))
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ struct _GncTransaction
|
||||
/* Set the transaction's GUID. This should only be done when reading
|
||||
* a transaction from a datafile, or some other external source. Never
|
||||
* call this on an existing transaction! */
|
||||
#define xaccTransSetGUID(t,g) qof_entity_set_guid(QOF_ENTITY(t),g)
|
||||
#define xaccTransSetGUID(t,g) qof_instance_set_guid(QOF_INSTANCE(t),g)
|
||||
|
||||
/* This routine makes a 'duplicate' of the indicated transaction.
|
||||
* This routine cannot be exposed publically since the duplicate
|
||||
|
||||
+24
-24
@@ -89,9 +89,9 @@ xaccAccountHasTrades (Account *acc)
|
||||
if (xaccAccountIsPriced (acc))
|
||||
return TRUE;
|
||||
|
||||
acc_comm = acc->commodity;
|
||||
acc_comm = gnc_account_get_commodity (acc);
|
||||
|
||||
for (node=acc->splits; node; node=node->next)
|
||||
for (node=xaccAccountGetSplitList (acc); node; node=node->next)
|
||||
{
|
||||
Split *s = node->data;
|
||||
Transaction *t = s->parent;
|
||||
@@ -244,7 +244,7 @@ GetOrMakeLotOrphanAccount (AccountGroup *root, gnc_commodity * currency)
|
||||
if (acc == NULL)
|
||||
{
|
||||
/* Guess not. We'll have to build one. */
|
||||
acc = xaccMallocAccount (root->book);
|
||||
acc = xaccMallocAccount (qof_instance_get_book (QOF_INSTANCE (root)));
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountSetName (acc, accname);
|
||||
xaccAccountSetCommodity (acc, currency);
|
||||
@@ -280,12 +280,12 @@ xaccAccountSetDefaultGainAccount (Account *acc, Account *gain_acct)
|
||||
cwd = kvp_frame_get_frame_slash (cwd, "/lot-mgmt/gains-act/");
|
||||
|
||||
/* Accounts are indexed by thier unique currency name */
|
||||
cur_name = gnc_commodity_get_unique_name (acc->commodity);
|
||||
cur_name = gnc_commodity_get_unique_name (gnc_account_get_commodity (acc));
|
||||
|
||||
xaccAccountBeginEdit (acc);
|
||||
vvv = kvp_value_new_guid (xaccAccountGetGUID (gain_acct));
|
||||
kvp_frame_set_slot_nc (cwd, cur_name, vvv);
|
||||
xaccAccountSetSlots_nc (acc, acc->inst.kvp_data);
|
||||
xaccAccountSetSlots_nc (acc, qof_instance_get_kvp_data (QOF_INSTANCE (acc)));
|
||||
xaccAccountCommitEdit (acc);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ xaccAccountGetDefaultGainAccount (Account *acc, gnc_commodity * currency)
|
||||
vvv = kvp_frame_get_slot (cwd, cur_name);
|
||||
gain_acct_guid = kvp_value_get_guid (vvv);
|
||||
|
||||
gain_acct = xaccAccountLookup (gain_acct_guid, acc->inst.book);
|
||||
gain_acct = xaccAccountLookup (gain_acct_guid, qof_instance_get_book (QOF_INSTANCE (acc)));
|
||||
return gain_acct;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ GetOrMakeGainAcct (Account *acc, gnc_commodity * currency)
|
||||
vvv = kvp_frame_get_slot (cwd, cur_name);
|
||||
gain_acct_guid = kvp_value_get_guid (vvv);
|
||||
|
||||
gain_acct = xaccAccountLookup (gain_acct_guid, acc->inst.book);
|
||||
gain_acct = xaccAccountLookup (gain_acct_guid, qof_instance_get_book (QOF_INSTANCE (acc)));
|
||||
|
||||
/* If there is no default place to put gains/losses
|
||||
* for this account, then create such a place */
|
||||
@@ -352,7 +352,7 @@ GetOrMakeGainAcct (Account *acc, gnc_commodity * currency)
|
||||
|
||||
vvv = kvp_value_new_guid (xaccAccountGetGUID (gain_acct));
|
||||
kvp_frame_set_slot_nc (cwd, cur_name, vvv);
|
||||
xaccAccountSetSlots_nc (acc, acc->inst.kvp_data);
|
||||
xaccAccountSetSlots_nc (acc, qof_instance_get_kvp_data (QOF_INSTANCE (acc)));
|
||||
xaccAccountCommitEdit (acc);
|
||||
|
||||
}
|
||||
@@ -529,7 +529,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
|
||||
|
||||
/* Put the remainder of the balance into a new split,
|
||||
* which is in other respects just a clone of this one. */
|
||||
new_split = xaccMallocSplit (acc->inst.book);
|
||||
new_split = xaccMallocSplit (qof_instance_get_book (QOF_INSTANCE (acc)));
|
||||
|
||||
/* Copy most of the split attributes */
|
||||
xaccSplitSetMemo (new_split, xaccSplitGetMemo (split));
|
||||
@@ -547,11 +547,11 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
|
||||
/* Add kvp markup to indicate that these two splits used
|
||||
* to be one before being 'split'
|
||||
*/
|
||||
gnc_kvp_bag_add (split->inst.kvp_data, "lot-split", now,
|
||||
gnc_kvp_bag_add (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split", now,
|
||||
"peer_guid", xaccSplitGetGUID (new_split),
|
||||
NULL);
|
||||
|
||||
gnc_kvp_bag_add (new_split->inst.kvp_data, "lot-split", now,
|
||||
gnc_kvp_bag_add (qof_instance_get_kvp_data (QOF_INSTANCE (new_split)), "lot-split", now,
|
||||
"peer_guid", xaccSplitGetGUID (split),
|
||||
NULL);
|
||||
|
||||
@@ -578,7 +578,7 @@ MakeDefaultLot (Account *acc)
|
||||
gint64 id;
|
||||
char buff[200];
|
||||
|
||||
lot = gnc_lot_new (acc->inst.book);
|
||||
lot = gnc_lot_new (qof_instance_get_book (QOF_INSTANCE (acc)));
|
||||
|
||||
/* Provide a reasonable title for the new lot */
|
||||
id = kvp_frame_get_gint64 (xaccAccountGetSlots (acc), "/lot-mgmt/next-id");
|
||||
@@ -616,7 +616,7 @@ xaccSplitAssign (Split *split)
|
||||
|
||||
ENTER ("(split=%p)", split);
|
||||
|
||||
pcy = acc->policy;
|
||||
pcy = gnc_account_get_policy (acc);
|
||||
xaccAccountBeginEdit (acc);
|
||||
|
||||
/* If we are here, this split does not belong to any lot.
|
||||
@@ -655,14 +655,14 @@ xaccSplitGetCapGainsSplit (const Split *split)
|
||||
|
||||
if (!split) return NULL;
|
||||
|
||||
val = kvp_frame_get_slot (split->inst.kvp_data, "gains-split");
|
||||
val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-split");
|
||||
if (!val) return NULL;
|
||||
gains_guid = kvp_value_get_guid (val);
|
||||
if (!gains_guid) return NULL;
|
||||
|
||||
/* Both splits will be in the same collection, so search there. */
|
||||
gains_split = (Split*) qof_collection_lookup_entity (
|
||||
split->inst.entity.collection, gains_guid);
|
||||
gains_split = (Split*) qof_collection_lookup_element (
|
||||
qof_instance_get_collection (QOF_INSTANCE (split)), gains_guid);
|
||||
PINFO ("split=%p has gains-split=%p", split, gains_split);
|
||||
return gains_split;
|
||||
}
|
||||
@@ -678,14 +678,14 @@ xaccSplitGetGainsSourceSplit (const Split *split)
|
||||
|
||||
if (!split) return NULL;
|
||||
|
||||
val = kvp_frame_get_slot (split->inst.kvp_data, "gains-source");
|
||||
val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-source");
|
||||
if (!val) return NULL;
|
||||
source_guid = kvp_value_get_guid (val);
|
||||
if (!source_guid) return NULL;
|
||||
|
||||
/* Both splits will be in the same collection, so search there. */
|
||||
source_split = (Split*) qof_collection_lookup_entity(
|
||||
split->inst.entity.collection, source_guid);
|
||||
source_split = (Split*) qof_collection_lookup_element(
|
||||
qof_instance_get_collection (QOF_INSTANCE (split)), source_guid);
|
||||
PINFO ("split=%p has source-split=%p", split, source_split);
|
||||
return source_split;
|
||||
}
|
||||
@@ -709,7 +709,7 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
|
||||
if (!split) return;
|
||||
lot = split->lot;
|
||||
if (!lot) return;
|
||||
pcy = lot->account->policy;
|
||||
pcy = gnc_account_get_policy (lot->account);
|
||||
currency = split->parent->common_currency;
|
||||
|
||||
ENTER ("(split=%p gains=%p status=0x%x lot=%s)", split,
|
||||
@@ -945,7 +945,7 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
|
||||
if (NULL == lot_split)
|
||||
{
|
||||
Account *lot_acc = lot->account;
|
||||
QofBook *book = lot_acc->inst.book;
|
||||
QofBook *book = qof_instance_get_book (QOF_INSTANCE (lot_acc));
|
||||
|
||||
new_gain_split = TRUE;
|
||||
|
||||
@@ -984,9 +984,9 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
|
||||
* that this is the gains transaction that corresponds
|
||||
* to the gains source.
|
||||
*/
|
||||
kvp_frame_set_guid (split->inst.kvp_data, "gains-split",
|
||||
kvp_frame_set_guid (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-split",
|
||||
xaccSplitGetGUID (lot_split));
|
||||
kvp_frame_set_guid (lot_split->inst.kvp_data, "gains-source",
|
||||
kvp_frame_set_guid (qof_instance_get_kvp_data (QOF_INSTANCE (lot_split)), "gains-source",
|
||||
xaccSplitGetGUID (split));
|
||||
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ xaccLotComputeCapGains (GNCLot *lot, Account *gain_acc)
|
||||
* to mark all splits dirty if the opening splits are dirty. */
|
||||
|
||||
ENTER("(lot=%p)", lot);
|
||||
pcy = lot->account->policy;
|
||||
pcy = gnc_account_get_policy (lot->account);
|
||||
for (node = lot->splits; node; node = node->next)
|
||||
{
|
||||
Split *s = node->data;
|
||||
|
||||
+28
-28
@@ -365,7 +365,7 @@ gnc_scm2kvp_match_where (SCM where_scm)
|
||||
const gchar *where;
|
||||
|
||||
if (!SCM_LISTP (where_scm))
|
||||
return NULL;
|
||||
return G_TYPE_INVALID;
|
||||
|
||||
where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm));
|
||||
|
||||
@@ -377,7 +377,7 @@ gnc_scm2kvp_match_where (SCM where_scm)
|
||||
res = GNC_ID_ACCOUNT;
|
||||
else {
|
||||
PINFO ("Unknown kvp-match-where: %s", where);
|
||||
res = NULL;
|
||||
res = G_TYPE_INVALID;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -781,63 +781,63 @@ gnc_queryterm2scm (QofQueryTerm *qt)
|
||||
qt_scm = scm_cons (SCM_BOOL (qof_query_term_is_inverted (qt)), qt_scm);
|
||||
|
||||
pd = qof_query_term_get_pred_data (qt);
|
||||
qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
|
||||
qt_scm = scm_cons (scm_str2symbol (g_type_name (pd->type_name)), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pd->how), qt_scm);
|
||||
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING)) {
|
||||
if (pd->type_name == QOF_TYPE_STRING) {
|
||||
query_string_t pdata = (query_string_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (SCM_BOOL (pdata->is_regex), qt_scm);
|
||||
qt_scm = scm_cons (scm_makfrom0str (pdata->matchstring), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE)) {
|
||||
} else if (pd->type_name == QOF_TYPE_DATE) {
|
||||
query_date_t pdata = (query_date_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_timespec2timepair (pdata->date), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC)) {
|
||||
} else if (pd->type_name == QOF_TYPE_NUMERIC) {
|
||||
query_numeric_t pdata = (query_numeric_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_query_numeric2scm (pdata->amount), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID)) {
|
||||
} else if (pd->type_name == QOF_TYPE_GUID) {
|
||||
query_guid_t pdata = (query_guid_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_guid_glist2scm (pdata->guids), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64)) {
|
||||
} else if (pd->type_name == QOF_TYPE_INT64) {
|
||||
query_int64_t pdata = (query_int64_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_gint64_to_scm (pdata->val), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE)) {
|
||||
} else if (pd->type_name == QOF_TYPE_DOUBLE) {
|
||||
query_double_t pdata = (query_double_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_make_real (pdata->val), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN)) {
|
||||
} else if (pd->type_name == QOF_TYPE_BOOLEAN) {
|
||||
query_boolean_t pdata = (query_boolean_t) pd;
|
||||
|
||||
qt_scm = scm_cons (SCM_BOOL (pdata->val), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR)) {
|
||||
} else if (pd->type_name == QOF_TYPE_CHAR) {
|
||||
query_char_t pdata = (query_char_t) pd;
|
||||
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_makfrom0str (pdata->char_list), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP)) {
|
||||
} else if (pd->type_name == QOF_TYPE_KVP) {
|
||||
query_kvp_t pdata = (query_kvp_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_path2scm (pdata->path), qt_scm);
|
||||
qt_scm = scm_cons (gnc_kvp_value2scm (pdata->value), qt_scm);
|
||||
|
||||
} else {
|
||||
PWARN ("query core type %s not supported", pd->type_name);
|
||||
PWARN ("query core type %s not supported", g_type_name (pd->type_name));
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
QofQuery *q = NULL;
|
||||
QofQueryPredData *pd = NULL;
|
||||
SCM scm;
|
||||
const gchar *type = NULL;
|
||||
GType type = G_TYPE_INVALID;
|
||||
GSList *path = NULL;
|
||||
gboolean inverted = FALSE;
|
||||
QofQueryCompare compare_how;
|
||||
@@ -878,7 +878,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
qt_scm = SCM_CDR (qt_scm);
|
||||
if (!SCM_SYMBOLP (scm))
|
||||
break;
|
||||
type = SCM_SYMBOL_CHARS (scm);
|
||||
type = g_type_from_name (SCM_SYMBOL_CHARS (scm));
|
||||
|
||||
/* QofCompareFunc */
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -889,7 +889,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
/* Now compute the predicate */
|
||||
|
||||
if (!safe_strcmp (type, QOF_TYPE_STRING))
|
||||
if (type == QOF_TYPE_STRING)
|
||||
{
|
||||
QofStringMatch options;
|
||||
gboolean is_regex;
|
||||
@@ -914,7 +914,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
pd = qof_query_string_predicate (compare_how, matchstring,
|
||||
options, is_regex);
|
||||
}
|
||||
else if (!safe_strcmp (type, QOF_TYPE_DATE))
|
||||
else if (type == QOF_TYPE_DATE)
|
||||
{
|
||||
QofDateMatch options;
|
||||
Timespec date;
|
||||
@@ -933,7 +933,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_date_predicate (compare_how, options, date);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_NUMERIC)) {
|
||||
} else if (type == QOF_TYPE_NUMERIC) {
|
||||
QofNumericMatch options;
|
||||
gnc_numeric val;
|
||||
|
||||
@@ -951,7 +951,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_numeric_predicate (compare_how, options, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_GUID)) {
|
||||
} else if (type == QOF_TYPE_GUID) {
|
||||
QofGuidMatch options;
|
||||
GList *guids;
|
||||
|
||||
@@ -971,7 +971,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
gnc_guid_glist_free (guids);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_INT64)) {
|
||||
} else if (type == QOF_TYPE_INT64) {
|
||||
gint64 val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -982,7 +982,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_int64_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_DOUBLE)) {
|
||||
} else if (type == QOF_TYPE_DOUBLE) {
|
||||
double val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -993,7 +993,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_double_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_BOOLEAN)) {
|
||||
} else if (type == QOF_TYPE_BOOLEAN) {
|
||||
gboolean val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -1004,7 +1004,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_boolean_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_CHAR)) {
|
||||
} else if (type == QOF_TYPE_CHAR) {
|
||||
QofCharMatch options;
|
||||
const gchar *char_list;
|
||||
|
||||
@@ -1022,7 +1022,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_char_predicate (options, char_list);
|
||||
}
|
||||
else if (!safe_strcmp (type, QOF_TYPE_KVP))
|
||||
else if (type == QOF_TYPE_KVP)
|
||||
{
|
||||
GSList *kvp_path;
|
||||
KvpValue *value;
|
||||
@@ -1046,7 +1046,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
kvp_value_delete (value);
|
||||
|
||||
} else {
|
||||
PWARN ("query core type %s not supported", type);
|
||||
PWARN ("query core type %s not supported", g_type_name (type));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1331,7 +1331,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
||||
/* id type */
|
||||
scm = SCM_CAR (query_term_scm);
|
||||
query_term_scm = SCM_CDR (query_term_scm);
|
||||
id_type = g_strdup (SCM_STRING_CHARS (scm));
|
||||
id_type = g_type_from_name (SCM_STRING_CHARS (scm));
|
||||
|
||||
xaccQueryAddGUIDMatch (q, &guid, id_type, QOF_QUERY_OR);
|
||||
ok = TRUE;
|
||||
@@ -1616,7 +1616,7 @@ gnc_query2scm (QofQuery *q)
|
||||
query_scm = scm_cons (pair, query_scm);
|
||||
|
||||
/* search-for */
|
||||
pair = scm_cons (scm_str2symbol (qof_query_get_search_for (q)), SCM_EOL);
|
||||
pair = scm_cons (scm_str2symbol (g_type_name (qof_query_get_search_for (q))), SCM_EOL);
|
||||
pair = scm_cons (scm_str2symbol ("search-for"), pair);
|
||||
query_scm = scm_cons (pair, query_scm);
|
||||
|
||||
@@ -1939,7 +1939,7 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
#endif
|
||||
|
||||
if (ok && search_for) {
|
||||
qof_query_search_for (q, search_for);
|
||||
qof_query_search_for (q, g_type_from_name (search_for));
|
||||
qof_query_set_sort_order (q, sp1, sp2, sp3);
|
||||
qof_query_set_sort_options (q, so1, so2, so3);
|
||||
qof_query_set_sort_increasing (q, si1, si2, si3);
|
||||
|
||||
@@ -297,7 +297,7 @@ gnc_tracking_find_expense_accounts(Account *stock_account,
|
||||
kvpd_on_account_list = kvp_frame_get_slot(account_frame,
|
||||
expense_to_key[category]);
|
||||
|
||||
return de_kvp_account_list(kvpd_on_account_list, stock_account->inst.book);
|
||||
return de_kvp_account_list(kvpd_on_account_list, qof_instance_get_book (QOF_INSTANCE (stock_account)));
|
||||
}
|
||||
|
||||
/*********************************************************************\
|
||||
@@ -329,7 +329,7 @@ gnc_tracking_find_income_accounts(Account *stock_account,
|
||||
kvpd_on_account_list = kvp_frame_get_slot(income_acc_frame,
|
||||
income_to_key[category]);
|
||||
|
||||
return de_kvp_account_list(kvpd_on_account_list, stock_account->inst.book);
|
||||
return de_kvp_account_list(kvpd_on_account_list, qof_instance_get_book (QOF_INSTANCE (stock_account)));
|
||||
}
|
||||
|
||||
/*********************************************************************\
|
||||
@@ -440,7 +440,7 @@ gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
||||
|
||||
inc_or_expense_account_guid = xaccAccountGetGUID(inc_or_expense_account);
|
||||
stock_account = xaccAccountLookup
|
||||
(stock_account_guid, inc_or_expense_account->inst.book);
|
||||
((GUID*) stock_account_guid, qof_instance_get_book (QOF_INSTANCE (inc_or_expense_account)));
|
||||
|
||||
stock_account_kvpframe = xaccAccountGetSlots(stock_account);
|
||||
|
||||
|
||||
+56
-46
@@ -45,6 +45,9 @@ static QofLogModule log_module = GNC_MOD_ENGINE;
|
||||
static void gnc_budget_class_init(GncBudgetClass *klass);
|
||||
static void gnc_budget_init(GncBudget *sp);
|
||||
static void gnc_budget_finalize(GObject *object);
|
||||
static void gnc_budget_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_budget_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
|
||||
struct _GncBudgetPrivate {
|
||||
gchar* name;
|
||||
@@ -59,6 +62,7 @@ typedef enum _GncBudgetSignalType GncBudgetSignalType;
|
||||
|
||||
enum _GncBudgetSignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -76,7 +80,7 @@ static guint gnc_budget_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_budget_get_type()
|
||||
gnc_budget_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -139,11 +143,11 @@ gnc_budget_set_property (GObject *object,
|
||||
{
|
||||
GncBudget *obj;
|
||||
|
||||
obj = QOF_INSTANCE (object);
|
||||
obj = GNC_BUDGET (object);
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +160,7 @@ gnc_budget_get_property (GObject *object,
|
||||
{
|
||||
GncBudget *obj;
|
||||
|
||||
obj = QOF_INSTANCE(object);
|
||||
obj = GNC_BUDGET (object);
|
||||
|
||||
switch (property_id) {
|
||||
default:
|
||||
@@ -186,10 +190,10 @@ gnc_budget_free(QofInstance *inst)
|
||||
/* We first send the message that this object is about to be
|
||||
* destroyed so that any GUI elements can remove it before it is
|
||||
* actually gone. */
|
||||
qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
CACHE_REMOVE(budget->name);
|
||||
CACHE_REMOVE(budget->description);
|
||||
CACHE_REMOVE(budget->priv->name);
|
||||
CACHE_REMOVE(budget->priv->description);
|
||||
|
||||
qof_instance_release (QOF_INSTANCE (budget));
|
||||
//g_free(budget);
|
||||
@@ -220,20 +224,19 @@ gnc_budget_new(QofBook *book)
|
||||
|
||||
ENTER(" ");
|
||||
budget = g_object_new (GNC_TYPE_BUDGET, NULL);
|
||||
budget->priv = g_new0 (GncBudgetPrivate, 1);
|
||||
|
||||
qof_instance_init (QOF_INSTANCE (budget), GNC_ID_BUDGET, book);
|
||||
|
||||
g_date_set_time_t(&date, time(NULL));
|
||||
g_date_subtract_days(&date, g_date_get_day(&date)-1);
|
||||
recurrenceSet(budget->priv->recurrence, 1, PERIOD_MONTH, &date);
|
||||
recurrenceSet(&budget->priv->recurrence, 1, PERIOD_MONTH, &date);
|
||||
|
||||
gnc_budget_set_name(budget, _("Unnamed Budget"));
|
||||
gnc_budget_set_description(budget, "");
|
||||
gnc_budget_set_num_periods(budget, 12);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_CREATE , NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_CREATE , NULL);
|
||||
|
||||
g_signal_emit_by_name ( QOF_ENTITY (budget), "created");
|
||||
g_signal_emit_by_name ( QOF_INSTANCE (budget), "created");
|
||||
LEAVE(" ");
|
||||
return budget;
|
||||
}
|
||||
@@ -243,8 +246,8 @@ gnc_budget_destroy(GncBudget *budget)
|
||||
{
|
||||
g_return_if_fail(GNC_IS_BUDGET(budget));
|
||||
gnc_budget_begin_edit(budget);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
budget->inst.do_free = TRUE;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
qof_instance_set_do_free (QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
}
|
||||
|
||||
@@ -254,18 +257,18 @@ gnc_budget_set_name(GncBudget* budget, const gchar* name)
|
||||
g_return_if_fail(GNC_IS_BUDGET(budget) && name);
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
CACHE_REPLACE(budget->name, name);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
CACHE_REPLACE(budget->priv->name, name);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (budget) , QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget) , QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
const gchar*
|
||||
gnc_budget_get_name(GncBudget* budget)
|
||||
{
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
||||
return budget->name;
|
||||
return budget->priv->name;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -275,18 +278,18 @@ gnc_budget_set_description(GncBudget* budget, const gchar* description)
|
||||
g_return_if_fail(description);
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
CACHE_REPLACE(budget->description, description);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
CACHE_REPLACE(budget->priv->description, description);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
const gchar*
|
||||
gnc_budget_get_description(GncBudget* budget)
|
||||
{
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
||||
return budget->description;
|
||||
return budget->priv->description;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -294,18 +297,18 @@ gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r)
|
||||
{
|
||||
g_return_if_fail(budget && r);
|
||||
gnc_budget_begin_edit(budget);
|
||||
budget->recurrence = *r;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
budget->priv->recurrence = *r;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen(QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen(QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
const Recurrence *
|
||||
gnc_budget_get_recurrence(GncBudget *budget)
|
||||
{
|
||||
g_return_val_if_fail(budget, NULL);
|
||||
return (budget->priv->recurrence);
|
||||
return (&budget->priv->recurrence);
|
||||
}
|
||||
|
||||
const GUID*
|
||||
@@ -313,7 +316,7 @@ gnc_budget_get_guid(GncBudget* budget)
|
||||
{
|
||||
g_return_val_if_fail(budget, NULL);
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
||||
return qof_entity_get_guid(QOF_ENTITY(budget));
|
||||
return qof_instance_get_guid (QOF_INSTANCE (budget));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -322,18 +325,18 @@ gnc_budget_set_num_periods(GncBudget* budget, guint num_periods)
|
||||
g_return_if_fail(GNC_IS_BUDGET(budget));
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
budget->num_periods = num_periods;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
budget->priv->num_periods = num_periods;
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
guint
|
||||
gnc_budget_get_num_periods(GncBudget* budget)
|
||||
{
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), 0);
|
||||
return budget->num_periods;
|
||||
return budget->priv->num_periods;
|
||||
}
|
||||
|
||||
#define BUF_SIZE (10 + GUID_ENCODING_LENGTH + \
|
||||
@@ -357,10 +360,10 @@ gnc_budget_unset_account_period_value(GncBudget *budget, Account *account,
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
|
||||
kvp_frame_set_value(frame, path, NULL);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (entity), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
|
||||
|
||||
}
|
||||
|
||||
@@ -385,10 +388,10 @@ gnc_budget_set_account_period_value(GncBudget *budget, Account *account,
|
||||
kvp_frame_set_value(frame, path, NULL);
|
||||
else
|
||||
kvp_frame_set_numeric(frame, path, val);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget));
|
||||
qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
|
||||
|
||||
}
|
||||
|
||||
@@ -470,7 +473,7 @@ gnc_budget_get_period_start_date(GncBudget *budget, guint period_num)
|
||||
{
|
||||
Timespec ts;
|
||||
timespecFromTime_t(
|
||||
&ts, recurrenceGetPeriodTime(budget->priv->recurrence, period_num, FALSE));
|
||||
&ts, recurrenceGetPeriodTime(&budget->priv->recurrence, period_num, FALSE));
|
||||
return ts;
|
||||
}
|
||||
|
||||
@@ -480,7 +483,7 @@ gnc_budget_get_account_period_actual_value(
|
||||
{
|
||||
// FIXME: maybe zero is not best error return val.
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget) && acc, gnc_numeric_zero());
|
||||
return recurrenceGetAccountPeriodValue(budget->priv->recurrence,
|
||||
return recurrenceGetAccountPeriodValue(&budget->priv->recurrence,
|
||||
acc, period_num);
|
||||
}
|
||||
|
||||
@@ -499,7 +502,7 @@ gnc_budget_lookup (const GUID *guid, QofBook *book)
|
||||
g_return_val_if_fail(guid, NULL);
|
||||
g_return_val_if_fail(book, NULL);
|
||||
col = qof_book_get_collection (book, GNC_ID_BUDGET);
|
||||
return GNC_BUDGET(qof_collection_lookup_entity (col, guid));
|
||||
return GNC_BUDGET(qof_collection_lookup_element (col, guid));
|
||||
}
|
||||
|
||||
static void just_get_one(QofEntity *ent, gpointer data)
|
||||
@@ -523,6 +526,7 @@ gnc_budget_get_default (QofBook *book)
|
||||
}
|
||||
|
||||
/* Define the QofObject. */
|
||||
/*
|
||||
static QofObject budget_object_def =
|
||||
{
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -537,17 +541,18 @@ static QofObject budget_object_def =
|
||||
printable: (const char* (*)(gpointer)) gnc_budget_get_name,
|
||||
version_cmp: (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
/* Static wrapper getters for the recurrence params */
|
||||
static PeriodType gnc_budget_get_rec_pt(const GncBudget *bgt)
|
||||
{ return recurrenceGetPeriodType(&(bgt->recurrence)); }
|
||||
{ return recurrenceGetPeriodType(&(bgt->priv->recurrence)); }
|
||||
static guint gnc_budget_get_rec_mult(const GncBudget *bgt)
|
||||
{ return recurrenceGetMultiplier(&(bgt->recurrence)); }
|
||||
{ return recurrenceGetMultiplier(&(bgt->priv->recurrence)); }
|
||||
static GDate gnc_budget_get_rec_date(const GncBudget *bgt)
|
||||
{ return recurrenceGetDate(&(bgt->recurrence)); }
|
||||
{ return recurrenceGetDate(&(bgt->priv->recurrence)); }
|
||||
|
||||
/* Register ourselves with the engine. */
|
||||
/*
|
||||
gboolean gnc_budget_register (void)
|
||||
{
|
||||
static QofParam params[] = {
|
||||
@@ -559,15 +564,19 @@ gboolean gnc_budget_register (void)
|
||||
(QofSetterFunc) gnc_budget_set_description },
|
||||
{ "recurrence_period_type", QOF_TYPE_INT32,
|
||||
(QofAccessFunc) gnc_budget_get_rec_pt, NULL },
|
||||
/* Signedness problem: Should be unsigned. */
|
||||
|
||||
Signedness problem: Should be unsigned.
|
||||
|
||||
{ "recurrence_multiplier", QOF_TYPE_INT32,
|
||||
(QofAccessFunc) gnc_budget_get_rec_mult, NULL },
|
||||
/* This is the same way that SchedXaction.c uses QOF_TYPE_DATE
|
||||
|
||||
This is the same way that SchedXaction.c uses QOF_TYPE_DATE
|
||||
but I don't think QOF actually supports a GDate, so I think
|
||||
this is wrong. */
|
||||
this is wrong.
|
||||
|
||||
{ "recurrence_date", QOF_TYPE_DATE,
|
||||
(QofAccessFunc) gnc_budget_get_rec_date, NULL },
|
||||
/* Signedness problem: Should be unsigned. */
|
||||
Signedness problem: Should be unsigned.
|
||||
{ "num_periods", QOF_TYPE_INT32,
|
||||
(QofAccessFunc) gnc_budget_get_num_periods,
|
||||
(QofSetterFunc) gnc_budget_set_num_periods },
|
||||
@@ -581,3 +590,4 @@ gboolean gnc_budget_register (void)
|
||||
qof_class_register(GNC_ID_BUDGET, (QofSortFunc) NULL, params);
|
||||
return qof_object_register(&budget_object_def);
|
||||
}
|
||||
*/
|
||||
@@ -65,10 +65,6 @@
|
||||
#define __GNC_BUDGET_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
/** The budget data.*/
|
||||
typedef struct gnc_budget_private GncBudget;
|
||||
|
||||
#include "qof.h"
|
||||
#include "Account.h"
|
||||
#include "Recurrence.h"
|
||||
@@ -99,7 +95,7 @@ struct _GncBudgetClass {
|
||||
/* Add Signal Functions Here */
|
||||
};
|
||||
|
||||
GType gnc_budget_get_type ();
|
||||
GType gnc_budget_get_type (void);
|
||||
|
||||
|
||||
#define GNC_BUDGET_MAX_NUM_PERIODS_DIGITS 3 // max num periods == 999
|
||||
@@ -116,7 +112,7 @@ void gnc_budget_destroy(GncBudget* budget);
|
||||
|
||||
const GUID* gnc_budget_get_guid(GncBudget* budget);
|
||||
#define gnc_budget_return_guid(X) \
|
||||
(X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
|
||||
(X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
|
||||
|
||||
/** Set/Get the name of the Budget */
|
||||
void gnc_budget_set_name(GncBudget* budget, const gchar* name);
|
||||
|
||||
+171
-137
@@ -49,6 +49,8 @@ static QofLogModule log_module = GNC_MOD_COMMODITY;
|
||||
static void gnc_commodity_class_init(GncCommodityClass *klass);
|
||||
static void gnc_commodity_init(GncCommodity *sp);
|
||||
static void gnc_commodity_finalize(GObject *object);
|
||||
static void gnc_commodity_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_commodity_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncCommodityPrivate {
|
||||
|
||||
@@ -72,6 +74,7 @@ typedef enum _GncCommoditySignalType GncCommoditySignalType;
|
||||
|
||||
enum _GncCommoditySignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -89,7 +92,7 @@ static guint gnc_commodity_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_commodity_get_type()
|
||||
gnc_commodity_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -156,7 +159,7 @@ gnc_commodity_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -182,10 +185,13 @@ gnc_commodity_get_property (GObject *object,
|
||||
|
||||
/* GncCommodityNamespace */
|
||||
/* GObject declarations */
|
||||
|
||||
/* FIXME: This declarations is better in a separated file */
|
||||
static void gnc_commodity_namespace_class_init (GncCommodityNamespaceClass *klass);
|
||||
static void gnc_commodity_namespace_init (GncCommodityNamespace *sp);
|
||||
static void gnc_commodity_namespace_finalize (GObject *object);
|
||||
static void gnc_commodity_namespace_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_commodity_namespace_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
|
||||
struct _GncCommodityNamespacePrivate {
|
||||
gchar * name;
|
||||
@@ -199,13 +205,14 @@ typedef enum _GncCommodityNamespaceSignalType GncCommodityNamespaceSignalType;
|
||||
|
||||
enum _GncCommodityNamespaceSignalType {
|
||||
/* Signals */
|
||||
LAST_SIGNAL
|
||||
FIRST_SIGNAL2,
|
||||
LAST_SIGNAL2
|
||||
};
|
||||
|
||||
/* properties */
|
||||
enum
|
||||
{
|
||||
PROP_0
|
||||
PROP_0_2
|
||||
};
|
||||
|
||||
struct _GncCommodityNamespaceSignal {
|
||||
@@ -213,10 +220,10 @@ struct _GncCommodityNamespaceSignal {
|
||||
};
|
||||
|
||||
static guint gnc_commodity_namespace_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
static GObjectClass *parent_class_2 = NULL;
|
||||
|
||||
GType
|
||||
gnc_commodity_namespace_get_type()
|
||||
gnc_commodity_namespace_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -245,7 +252,7 @@ gnc_commodity_namespace_class_init(GncCommodityNamespaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent(klass);
|
||||
parent_class_2 = g_type_class_peek_parent(klass);
|
||||
object_class->finalize = gnc_commodity_namespace_finalize;
|
||||
object_class->set_property = gnc_commodity_namespace_set_property;
|
||||
object_class->get_property = gnc_commodity_namespace_get_property;
|
||||
@@ -283,7 +290,7 @@ gnc_commodity_namespace_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -731,17 +738,17 @@ gnc_commodity_commit_edit (gnc_commodity *cm)
|
||||
static void
|
||||
mark_commodity_dirty (gnc_commodity *cm)
|
||||
{
|
||||
qof_instance_set_dirty(QOF_INSTANCE (cm));
|
||||
qof_event_gen (QOF_ENTITY (cm), QOF_EVENT_MODIFY, NULL);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (cm), TRUE);
|
||||
qof_event_gen (QOF_INSTANCE (cm), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
reset_printname(gnc_commodity *com)
|
||||
{
|
||||
g_free(com->printname);
|
||||
com->printname = g_strdup_printf("%s (%s)",
|
||||
com->mnemonic ? com->mnemonic : "",
|
||||
com->fullname ? com->fullname : "");
|
||||
g_free(com->priv->printname);
|
||||
com->priv->printname = g_strdup_printf("%s (%s)",
|
||||
com->priv->mnemonic ? com->priv->mnemonic : "",
|
||||
com->priv->fullname ? com->priv->fullname : "");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -749,11 +756,11 @@ reset_unique_name(gnc_commodity *com)
|
||||
{
|
||||
gnc_commodity_namespace *ns;
|
||||
|
||||
g_free(com->unique_name);
|
||||
ns = com->namespace;
|
||||
com->unique_name = g_strdup_printf("%s::%s",
|
||||
ns ? ns->name : "",
|
||||
com->mnemonic ? com->mnemonic : "");
|
||||
g_free(com->priv->unique_name);
|
||||
ns = com->priv->namespace;
|
||||
com->priv->unique_name = g_strdup_printf("%s::%s",
|
||||
ns ? ns->priv->name : "",
|
||||
com->priv->mnemonic ? com->priv->mnemonic : "");
|
||||
}
|
||||
|
||||
gnc_commodity *
|
||||
@@ -761,33 +768,63 @@ gnc_commodity_new(QofBook *book, const char * fullname,
|
||||
const char * namespace, const char * mnemonic,
|
||||
const char * cusip, int fraction)
|
||||
{
|
||||
gnc_commodity * retval = g_object_new (GNC_TYPE_COMMODITY, NULL);
|
||||
gnc_commodity_table *table;
|
||||
gnc_commodity *retval;
|
||||
gnc_commodity_table *ct;
|
||||
|
||||
retval = g_object_new (GNC_TYPE_COMMODITY, NULL);
|
||||
|
||||
retval->priv = g_new0 (GncCommodityPrivate, 1);
|
||||
|
||||
|
||||
qof_instance_init (&retval->inst, GNC_ID_COMMODITY, book);
|
||||
table = gnc_commodity_table_get_table(book);
|
||||
|
||||
if (namespace) {
|
||||
retval->namespace = gnc_commodity_table_find_namespace(table, namespace);
|
||||
if (!retval->namespace)
|
||||
retval->namespace = gnc_commodity_table_add_namespace(table, namespace, book);
|
||||
retval->priv->namespace = gnc_commodity_table_find_namespace(table, namespace);
|
||||
if (!retval->priv->namespace)
|
||||
retval->priv->namespace = gnc_commodity_table_add_namespace(table, namespace, book);
|
||||
} else {
|
||||
retval->namespace = NULL;
|
||||
retval->priv->namespace = NULL;
|
||||
}
|
||||
|
||||
retval->fullname = CACHE_INSERT(fullname);
|
||||
retval->mnemonic = CACHE_INSERT(mnemonic);
|
||||
retval->cusip = CACHE_INSERT(cusip);
|
||||
retval->fraction = fraction;
|
||||
retval->mark = 0;
|
||||
retval->quote_flag = 0;
|
||||
retval->quote_source = NULL;
|
||||
retval->quote_tz = CACHE_INSERT("");
|
||||
retval->priv->fullname = CACHE_INSERT(fullname);
|
||||
retval->priv->mnemonic = CACHE_INSERT(mnemonic);
|
||||
retval->priv->cusip = CACHE_INSERT(cusip);
|
||||
retval->priv->fraction = fraction;
|
||||
retval->priv->mark = 0;
|
||||
retval->priv->quote_flag = 0;
|
||||
retval->priv->quote_source = NULL;
|
||||
retval->priv->quote_tz = CACHE_INSERT("");
|
||||
|
||||
reset_printname(retval);
|
||||
reset_unique_name(retval);
|
||||
if (gnc_commodity_namespace_is_iso(namespace))
|
||||
retval->quote_source = gnc_quote_source_lookup_by_internal("currency");
|
||||
qof_event_gen (&retval->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
retval->priv->quote_source = gnc_quote_source_lookup_by_internal("currency");
|
||||
|
||||
/*================
|
||||
* Code moved from the begin book method, need to be reviewed to ensure correct object
|
||||
* initialization
|
||||
*/
|
||||
|
||||
ENTER ("book=%p", book);
|
||||
|
||||
if (!gnc_commodity_table_get_table(book))
|
||||
{
|
||||
ct = gnc_commodity_table_new ();
|
||||
qof_book_set_data (book, GNC_COMMODITY_TABLE, ct);
|
||||
|
||||
if(!gnc_commodity_table_add_default_data(ct, book))
|
||||
{
|
||||
PWARN("unable to initialize book's commodity_table");
|
||||
}
|
||||
|
||||
LEAVE ("book=%p", book);
|
||||
}
|
||||
|
||||
/*================================*/
|
||||
|
||||
|
||||
qof_event_gen (QOF_INSTANCE (retval), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -802,16 +839,18 @@ gnc_commodity_destroy(gnc_commodity * cm)
|
||||
{
|
||||
QofBook *book;
|
||||
gnc_commodity_table *table;
|
||||
gnc_commodity_table *ct;
|
||||
|
||||
if(!cm) return;
|
||||
|
||||
book = qof_instance_get_book(QOF_INSTANCE (cm));
|
||||
table = gnc_commodity_table_get_table(book);
|
||||
gnc_commodity_table_remove(table, cm);
|
||||
|
||||
qof_event_gen (QOF_ENTITY (cm), QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (cm), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
/* Set at creation */
|
||||
CACHE_REMOVE (cm->fullname);
|
||||
CACHE_REMOVE (cm->priv->fullname);
|
||||
CACHE_REMOVE (cm->priv->cusip);
|
||||
CACHE_REMOVE (cm->priv->mnemonic);
|
||||
CACHE_REMOVE (cm->priv->quote_tz);
|
||||
@@ -828,21 +867,31 @@ gnc_commodity_destroy(gnc_commodity * cm)
|
||||
cm->priv->unique_name = NULL;
|
||||
|
||||
cm->priv->mark = 0;
|
||||
|
||||
qof_instance_release (Qcm->priv->NSTANCE (cm));
|
||||
|
||||
/* =================================
|
||||
* Code moved from book end, review it to ensure correct object destruction
|
||||
*/
|
||||
|
||||
ct = gnc_commodity_table_get_table (book);
|
||||
qof_book_set_data (book, GNC_COMMODITY_TABLE, NULL);
|
||||
gnc_commodity_table_destroy (ct);
|
||||
|
||||
/*==============================*/
|
||||
|
||||
qof_instance_release (QOF_INSTANCE (cm));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gnc_commodity_copy(gnc_commodity * dest, gnc_commodity *src)
|
||||
{
|
||||
gnc_commodity_set_fullname (dest, src->fullname);
|
||||
dest->namespace = src->namespace;
|
||||
gnc_commodity_set_fraction (dest, src->fraction);
|
||||
gnc_commodity_set_cusip (dest, src->cusip);
|
||||
gnc_commodity_set_quote_flag (dest, src->quote_flag);
|
||||
gnc_commodity_set_fullname (dest, src->priv->fullname);
|
||||
dest->priv->namespace = src->priv->namespace;
|
||||
gnc_commodity_set_fraction (dest, src->priv->fraction);
|
||||
gnc_commodity_set_cusip (dest, src->priv->cusip);
|
||||
gnc_commodity_set_quote_flag (dest, src->priv->quote_flag);
|
||||
gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
|
||||
gnc_commodity_set_quote_tz (dest, src->quote_tz);
|
||||
gnc_commodity_set_quote_tz (dest, src->priv->quote_tz);
|
||||
}
|
||||
|
||||
gnc_commodity *
|
||||
@@ -850,16 +899,16 @@ gnc_commodity_clone(gnc_commodity *src)
|
||||
{
|
||||
gnc_commodity * dest = g_object_new (GNC_TYPE_COMMODITY, NULL);
|
||||
|
||||
dest->fullname = CACHE_INSERT(src->fullname);
|
||||
dest->mnemonic = CACHE_INSERT(src->mnemonic);
|
||||
dest->cusip = CACHE_INSERT(src->cusip);
|
||||
dest->quote_tz = CACHE_INSERT(src->quote_tz);
|
||||
dest->priv->fullname = CACHE_INSERT(src->priv->fullname);
|
||||
dest->priv->mnemonic = CACHE_INSERT(src->priv->mnemonic);
|
||||
dest->priv->cusip = CACHE_INSERT(src->priv->cusip);
|
||||
dest->priv->quote_tz = CACHE_INSERT(src->priv->quote_tz);
|
||||
|
||||
dest->namespace = src->namespace;
|
||||
dest->priv->namespace = src->priv->namespace;
|
||||
|
||||
dest->mark = 0;
|
||||
dest->fraction = src->fraction;
|
||||
dest->quote_flag = src->quote_flag;
|
||||
dest->priv->mark = 0;
|
||||
dest->priv->fraction = src->priv->fraction;
|
||||
dest->priv->quote_flag = src->priv->quote_flag;
|
||||
|
||||
gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
|
||||
|
||||
@@ -907,7 +956,7 @@ const char *
|
||||
gnc_commodity_get_namespace_compat(const gnc_commodity * cm)
|
||||
{
|
||||
if (!cm || !cm->priv->namespace) return NULL;
|
||||
if (cm->priv->namespace->iso4217) {
|
||||
if (cm->priv->namespace->priv->iso4217) {
|
||||
/* Data files are still written with ISO4217. */
|
||||
return GNC_COMMODITY_NS_ISO;
|
||||
}
|
||||
@@ -1062,7 +1111,7 @@ gnc_commodity_set_namespace(gnc_commodity * cm, const char * namespace)
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
cm->priv->namespace = nsp;
|
||||
if (nsp->iso4217)
|
||||
if (nsp->priv->iso4217)
|
||||
cm->priv->quote_source = gnc_quote_source_lookup_by_internal("currency");
|
||||
mark_commodity_dirty(cm);
|
||||
reset_printname(cm);
|
||||
@@ -1199,8 +1248,8 @@ gnc_commodity_equiv(const gnc_commodity * a, const gnc_commodity * b)
|
||||
{
|
||||
if(a == b) return TRUE;
|
||||
if(!a || !b) return FALSE;
|
||||
if(a->namespace != b->namespace) return FALSE;
|
||||
if(safe_strcmp(a->mnemonic, b->mnemonic) != 0) return FALSE;
|
||||
if(a->priv->namespace != b->priv->namespace) return FALSE;
|
||||
if(safe_strcmp(a->priv->mnemonic, b->priv->mnemonic) != 0) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1215,35 +1264,35 @@ gnc_commodity_equal(const gnc_commodity * a, const gnc_commodity * b)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (a->namespace != b->namespace)
|
||||
if (a->priv->namespace != b->priv->namespace)
|
||||
{
|
||||
DEBUG ("namespaces differ: %p(%s) vs %p(%s)",
|
||||
a->namespace, gnc_commodity_namespace_get_name(a->namespace),
|
||||
b->namespace, gnc_commodity_namespace_get_name(b->namespace));
|
||||
a->priv->namespace, gnc_commodity_namespace_get_name(a->priv->namespace),
|
||||
b->priv->namespace, gnc_commodity_namespace_get_name(b->priv->namespace));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (safe_strcmp(a->mnemonic, b->mnemonic) != 0)
|
||||
if (safe_strcmp(a->priv->mnemonic, b->priv->mnemonic) != 0)
|
||||
{
|
||||
DEBUG ("mnemonics differ: %s vs %s", a->mnemonic, b->mnemonic);
|
||||
DEBUG ("mnemonics differ: %s vs %s", a->priv->mnemonic, b->priv->mnemonic);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (safe_strcmp(a->fullname, b->fullname) != 0)
|
||||
if (safe_strcmp(a->priv->fullname, b->priv->fullname) != 0)
|
||||
{
|
||||
DEBUG ("fullnames differ: %s vs %s", a->fullname, b->fullname);
|
||||
DEBUG ("fullnames differ: %s vs %s", a->priv->fullname, b->priv->fullname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (safe_strcmp(a->cusip, b->cusip) != 0)
|
||||
if (safe_strcmp(a->priv->cusip, b->priv->cusip) != 0)
|
||||
{
|
||||
DEBUG ("cusips differ: %s vs %s", a->cusip, b->cusip);
|
||||
DEBUG ("cusips differ: %s vs %s", a->priv->cusip, b->priv->cusip);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (a->fraction != b->fraction)
|
||||
if (a->priv->fraction != b->priv->fraction)
|
||||
{
|
||||
DEBUG ("fractions differ: %d vs %d", a->fraction, b->fraction);
|
||||
DEBUG ("fractions differ: %d vs %d", a->priv->fraction, b->priv->fraction);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1259,7 +1308,7 @@ gnc_commodity_namespace_get_name (gnc_commodity_namespace *ns)
|
||||
{
|
||||
if (ns == NULL)
|
||||
return NULL;
|
||||
return ns->name;
|
||||
return ns->priv->name;
|
||||
}
|
||||
|
||||
GList *
|
||||
@@ -1268,7 +1317,7 @@ gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *namesp
|
||||
if (!namespace)
|
||||
return NULL;
|
||||
|
||||
return namespace->cm_list;
|
||||
return namespace->priv->cm_list;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1348,7 +1397,7 @@ gnc_commodity_table_get_number_of_namespaces(gnc_commodity_table* tbl)
|
||||
static void
|
||||
count_coms(gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
GHashTable *tbl = ((gnc_commodity_namespace*)value)->cm_table;
|
||||
GHashTable *tbl = ((gnc_commodity_namespace*)value)->priv->cm_table;
|
||||
guint *count = (guint*)user_data;
|
||||
|
||||
if(safe_strcmp((char*)key, GNC_COMMODITY_NS_CURRENCY) == 0)
|
||||
@@ -1401,7 +1450,7 @@ gnc_commodity_table_lookup(const gnc_commodity_table * table,
|
||||
break;
|
||||
}
|
||||
}
|
||||
return g_hash_table_lookup(nsp->cm_table, (gpointer)mnemonic);
|
||||
return g_hash_table_lookup(nsp->priv->cm_table, (gpointer)mnemonic);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
@@ -1491,9 +1540,9 @@ gnc_commodity_table_insert(gnc_commodity_table * table,
|
||||
if (!table) return NULL;
|
||||
if (!comm) return NULL;
|
||||
|
||||
ENTER ("(table=%p, comm=%p) %s %s", table, comm, comm->mnemonic, comm->fullname);
|
||||
ns_name = gnc_commodity_namespace_get_name(comm->namespace);
|
||||
c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
|
||||
ENTER ("(table=%p, comm=%p) %s %s", table, comm, comm->priv->mnemonic, comm->priv->fullname);
|
||||
ns_name = gnc_commodity_namespace_get_name(comm->priv->namespace);
|
||||
c = gnc_commodity_table_lookup (table, ns_name, comm->priv->mnemonic);
|
||||
|
||||
if (c)
|
||||
{
|
||||
@@ -1506,17 +1555,17 @@ gnc_commodity_table_insert(gnc_commodity_table * table,
|
||||
return c;
|
||||
}
|
||||
|
||||
book = qof_instance_get_book (&comm->inst);
|
||||
book = qof_instance_get_book (QOF_INSTANCE (comm));
|
||||
nsp = gnc_commodity_table_add_namespace(table, ns_name, book);
|
||||
|
||||
PINFO ("insert %p %s into nsp=%p %s", comm->mnemonic, comm->mnemonic,
|
||||
nsp->cm_table, nsp->name);
|
||||
g_hash_table_insert(nsp->cm_table,
|
||||
CACHE_INSERT(comm->mnemonic),
|
||||
PINFO ("insert %p %s into nsp=%p %s", comm->priv->mnemonic, comm->priv->mnemonic,
|
||||
nsp->priv->cm_table, nsp->priv->name);
|
||||
g_hash_table_insert(nsp->priv->cm_table,
|
||||
CACHE_INSERT(comm->priv->mnemonic),
|
||||
(gpointer)comm);
|
||||
nsp->cm_list = g_list_append(nsp->cm_list, comm);
|
||||
nsp->priv->cm_list = g_list_append(nsp->priv->cm_list, comm);
|
||||
|
||||
qof_event_gen (&comm->inst.entity, QOF_EVENT_ADD, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (comm), QOF_EVENT_ADD, NULL);
|
||||
LEAVE ("(table=%p, comm=%p)", table, comm);
|
||||
return comm;
|
||||
}
|
||||
@@ -1537,17 +1586,17 @@ gnc_commodity_table_remove(gnc_commodity_table * table,
|
||||
if (!table) return;
|
||||
if (!comm) return;
|
||||
|
||||
ns_name = gnc_commodity_namespace_get_name(comm->namespace);
|
||||
c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
|
||||
ns_name = gnc_commodity_namespace_get_name(comm->priv->namespace);
|
||||
c = gnc_commodity_table_lookup (table, ns_name, comm->priv->mnemonic);
|
||||
if (c != comm) return;
|
||||
|
||||
qof_event_gen (&comm->inst.entity, QOF_EVENT_REMOVE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (comm), QOF_EVENT_REMOVE, NULL);
|
||||
|
||||
nsp = gnc_commodity_table_find_namespace(table, ns_name);
|
||||
if (!nsp) return;
|
||||
|
||||
nsp->cm_list = g_list_remove(nsp->cm_list, comm);
|
||||
g_hash_table_remove (nsp->cm_table, comm->mnemonic);
|
||||
nsp->priv->cm_list = g_list_remove(nsp->priv->cm_list, comm);
|
||||
g_hash_table_remove (nsp->priv->cm_table, comm->priv->mnemonic);
|
||||
/* XXX minor mem leak, should remove the key as well */
|
||||
}
|
||||
|
||||
@@ -1604,7 +1653,7 @@ g_hash_table_values(GHashTable * table)
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_commodity_table_get_namespaces
|
||||
* gnc_commodity_table_get_namespacesa->
|
||||
* see if any commodities in the namespace exist
|
||||
********************************************************************/
|
||||
|
||||
@@ -1630,7 +1679,7 @@ gboolean
|
||||
gnc_commodity_is_iso(const gnc_commodity * cm)
|
||||
{
|
||||
if (!cm || !cm->priv->namespace) return FALSE;
|
||||
return cm->priv->namespace->iso4217;
|
||||
return cm->priv->namespace->priv->iso4217;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1662,7 +1711,7 @@ gnc_commodity_table_get_commodities(const gnc_commodity_table * table,
|
||||
if (!ns)
|
||||
return NULL;
|
||||
|
||||
return g_hash_table_values(ns->cm_table);
|
||||
return g_hash_table_values(ns->priv->cm_table);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -1676,8 +1725,8 @@ get_quotables_helper1(gpointer key, gpointer value, gpointer data)
|
||||
gnc_commodity *comm = value;
|
||||
GList ** l = data;
|
||||
|
||||
if (!comm->quote_flag ||
|
||||
!comm->quote_source || !comm->quote_source->supported)
|
||||
if (!comm->priv->quote_flag ||
|
||||
!comm->priv->quote_source || !comm->priv->quote_source->supported)
|
||||
return;
|
||||
*l = g_list_prepend(*l, value);
|
||||
}
|
||||
@@ -1687,8 +1736,8 @@ get_quotables_helper2 (gnc_commodity *comm, gpointer data)
|
||||
{
|
||||
GList ** l = data;
|
||||
|
||||
if (!comm->quote_flag ||
|
||||
!comm->quote_source || !comm->quote_source->supported)
|
||||
if (!comm->priv->quote_flag ||
|
||||
!comm->priv->quote_source || !comm->priv->quote_source->supported)
|
||||
return TRUE;
|
||||
*l = g_list_prepend(*l, comm);
|
||||
return TRUE;
|
||||
@@ -1721,7 +1770,7 @@ gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table)
|
||||
DEBUG("Running list of %s commodities", namespace);
|
||||
ns = gnc_commodity_table_find_namespace(table, namespace);
|
||||
if (ns) {
|
||||
g_hash_table_foreach(ns->cm_table, &get_quotables_helper1, (gpointer) &l);
|
||||
g_hash_table_foreach(ns->priv->cm_table, &get_quotables_helper1, (gpointer) &l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1754,17 +1803,19 @@ gnc_commodity_table_add_namespace(gnc_commodity_table * table,
|
||||
if(!ns)
|
||||
{
|
||||
ns = g_object_new (GNC_TYPE_COMMODITY_NAMESPACE, NULL);
|
||||
ns->cm_table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
ns->name = CACHE_INSERT((gpointer)namespace);
|
||||
ns->iso4217 = gnc_commodity_namespace_is_iso(namespace);
|
||||
qof_instance_init (QOF_INSTANCE (ns), GNC_ID_COMMODITY_NAMESPACE, book);
|
||||
qof_event_gen (QOF_ENTITY (ns), QOF_EVENT_CREATE, NULL);
|
||||
ns->priv = g_new0 (GncCommodityNamespacePrivate, 1);
|
||||
|
||||
ns->priv->cm_table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
ns->priv->name = CACHE_INSERT((gpointer)namespace);
|
||||
ns->priv->iso4217 = gnc_commodity_namespace_is_iso(namespace);
|
||||
|
||||
qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
g_hash_table_insert(table->ns_table,
|
||||
(gpointer) ns->name,
|
||||
(gpointer) ns->priv->name,
|
||||
(gpointer) ns);
|
||||
table->ns_list = g_list_append(table->ns_list, ns);
|
||||
qof_event_gen (QOF_ENTITY (ns), QOF_EVENT_ADD, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_ADD, NULL);
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
@@ -1788,7 +1839,7 @@ gnc_commodity_find_commodity_by_guid(const GUID *guid, QofBook *book)
|
||||
QofCollection *col;
|
||||
if (!guid || !book) return NULL;
|
||||
col = qof_book_get_collection (book, GNC_ID_COMMODITY);
|
||||
return (gnc_commodity *) qof_collection_lookup_entity (col, guid);
|
||||
return (gnc_commodity *) qof_collection_lookup_element (col, guid);
|
||||
}
|
||||
|
||||
gnc_commodity_namespace *
|
||||
@@ -1797,7 +1848,7 @@ gnc_commodity_find_namespace_by_guid(const GUID *guid, QofBook *book)
|
||||
QofCollection *col;
|
||||
if (!guid || !book) return NULL;
|
||||
col = qof_book_get_collection (book, GNC_ID_COMMODITY_NAMESPACE);
|
||||
return (gnc_commodity_namespace *) qof_collection_lookup_entity (col, guid);
|
||||
return (gnc_commodity_namespace *) qof_collection_lookup_element (col, guid);
|
||||
}
|
||||
|
||||
|
||||
@@ -1828,19 +1879,19 @@ gnc_commodity_table_delete_namespace(gnc_commodity_table * table,
|
||||
if (!ns)
|
||||
return;
|
||||
|
||||
qof_event_gen (&ns->inst.entity, QOF_EVENT_REMOVE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_REMOVE, NULL);
|
||||
g_hash_table_remove(table->ns_table, namespace);
|
||||
table->ns_list = g_list_remove(table->ns_list, ns);
|
||||
|
||||
g_list_free(ns->cm_list);
|
||||
ns->cm_list = NULL;
|
||||
g_list_free(ns->priv->cm_list);
|
||||
ns->priv->cm_list = NULL;
|
||||
|
||||
g_hash_table_foreach_remove(ns->cm_table, ns_helper, NULL);
|
||||
g_hash_table_destroy(ns->cm_table);
|
||||
CACHE_REMOVE(ns->name);
|
||||
g_hash_table_foreach_remove(ns->priv->cm_table, ns_helper, NULL);
|
||||
g_hash_table_destroy(ns->priv->cm_table);
|
||||
CACHE_REMOVE(ns->priv->name);
|
||||
|
||||
qof_event_gen (&ns->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||
qof_instance_release(&ns->inst);
|
||||
qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_DESTROY, NULL);
|
||||
qof_instance_release(QOF_INSTANCE (ns));
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -1870,7 +1921,7 @@ iter_commodity (gpointer key, gpointer value, gpointer user_data)
|
||||
static void
|
||||
iter_namespace (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
GHashTable *namespace_hash = ((gnc_commodity_namespace *) value)->cm_table;
|
||||
GHashTable *namespace_hash = ((gnc_commodity_namespace *) value)->priv->cm_table;
|
||||
g_hash_table_foreach (namespace_hash, iter_commodity, user_data);
|
||||
}
|
||||
|
||||
@@ -1909,7 +1960,7 @@ gnc_commodity_table_destroy(gnc_commodity_table * t)
|
||||
for (item = t->ns_list; item; item = next) {
|
||||
next = g_list_next(item);
|
||||
ns = item->data;
|
||||
gnc_commodity_table_delete_namespace(t, ns->name);
|
||||
gnc_commodity_table_delete_namespace(t, ns->priv->name);
|
||||
}
|
||||
|
||||
g_list_free(t->ns_list);
|
||||
@@ -2008,7 +2059,7 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book)
|
||||
/********************************************************************
|
||||
********************************************************************/
|
||||
/* QofObject function implementation and registration */
|
||||
|
||||
/*
|
||||
static QofObject commodity_object_def =
|
||||
{
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -2034,37 +2085,20 @@ static QofObject namespace_object_def =
|
||||
foreach: NULL,
|
||||
printable: NULL,
|
||||
};
|
||||
*/
|
||||
|
||||
static void
|
||||
commodity_table_book_begin (QofBook *book)
|
||||
{
|
||||
gnc_commodity_table *ct;
|
||||
ENTER ("book=%p", book);
|
||||
|
||||
if (gnc_commodity_table_get_table(book))
|
||||
return;
|
||||
|
||||
ct = gnc_commodity_table_new ();
|
||||
qof_book_set_data (book, GNC_COMMODITY_TABLE, ct);
|
||||
|
||||
if(!gnc_commodity_table_add_default_data(ct, book))
|
||||
{
|
||||
PWARN("unable to initialize book's commodity_table");
|
||||
}
|
||||
|
||||
LEAVE ("book=%p", book);
|
||||
}
|
||||
|
||||
static void
|
||||
commodity_table_book_end (QofBook *book)
|
||||
{
|
||||
gnc_commodity_table *ct;
|
||||
|
||||
ct = gnc_commodity_table_get_table (book);
|
||||
qof_book_set_data (book, GNC_COMMODITY_TABLE, NULL);
|
||||
gnc_commodity_table_destroy (ct);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
static QofObject commodity_table_object_def =
|
||||
{
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -2091,5 +2125,5 @@ gnc_commodity_table_register (void)
|
||||
return FALSE;
|
||||
return qof_object_register (&commodity_table_object_def);
|
||||
}
|
||||
|
||||
*/
|
||||
/* ========================= END OF FILE ============================== */
|
||||
@@ -37,6 +37,7 @@
|
||||
#define GNC_ENGINE_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include "qof.h"
|
||||
|
||||
/** \name QofLogModule identifiers */
|
||||
@@ -237,7 +238,7 @@ GType gnc_split_get_type (void);
|
||||
|
||||
/* GObject declarations */
|
||||
|
||||
#define GNC_TYPE_TRANSACTION (qof_book_get_type ())
|
||||
#define GNC_TYPE_TRANSACTION (gnc_transaction_get_type ())
|
||||
#define GNC_TRANSACTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TRANSACTION, GncTransaction))
|
||||
#define GNC_TRANSACTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TRANSACTION, GncTransactionClass))
|
||||
#define GNC_IS_TRANSACTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TRANSACTION))
|
||||
@@ -248,7 +249,7 @@ GType gnc_split_get_type (void);
|
||||
typedef struct _GncTransactionClass GncTransactionClass;
|
||||
typedef struct _GncTransaction GncTransaction;
|
||||
typedef struct _GncTransactionPrivate GncTransactionPrivate;
|
||||
typedef struct GncTransaction Transaction; /* Dummy type for backward compatilibity */
|
||||
typedef GncTransaction Transaction; /* Dummy type for backward compatilibity */
|
||||
|
||||
struct _GncTransactionClass {
|
||||
QofInstanceClass parent_class;
|
||||
@@ -278,7 +279,7 @@ GType gnc_transaction_get_type (void);
|
||||
//typedef struct gnc_commodity_s gnc_commodity;
|
||||
/* GObject declarations for GncCommodity */
|
||||
|
||||
#define GNC_TYPE_COMMODITY (gnc_commodity_type ())
|
||||
#define GNC_TYPE_COMMODITY (gnc_commodity_get_type ())
|
||||
#define GNC_COMMODITY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_COMMODITY, GncCommodity))
|
||||
#define GNC_COMMODITY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_COMMODITY, GncCommodityClass))
|
||||
#define GNC_IS_COMMODITY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_COMMODITY))
|
||||
@@ -322,7 +323,7 @@ GType gnc_commodity_get_type (void);
|
||||
typedef struct _GncCommodityNamespaceClass GncCommodityNamespaceClass;
|
||||
typedef struct _GncCommodityNamespace GncCommodityNamespace;
|
||||
typedef struct _GncCommodityNamespacePrivate GncCommodityNamespacePrivate;
|
||||
typedef struct GncCommodityNamespace gnc_commodity_namespace; /* Dummy type for backward compatilibity */
|
||||
typedef GncCommodityNamespace gnc_commodity_namespace; /* Dummy type for backward compatilibity */
|
||||
|
||||
struct _GncCommodityNamespace {
|
||||
QofInstance instance;
|
||||
@@ -365,6 +366,7 @@ typedef struct _GncLotClass GncLotClass;
|
||||
typedef struct _GncLot GncLot;
|
||||
#define GNCLot GncLot /* Dummy type for backward compatilibity */
|
||||
|
||||
|
||||
struct _GncLotClass {
|
||||
QofInstanceClass parent_class;
|
||||
/* virtual table */
|
||||
|
||||
@@ -60,7 +60,7 @@ struct _GncLot
|
||||
unsigned char marker;
|
||||
};
|
||||
|
||||
#define gnc_lot_set_guid(L,G) qof_entity_set_guid(QOF_ENTITY(L),&(G))
|
||||
#define gnc_lot_set_guid(L,G) qof_instance_set_guid(QOF_INSTANCE(L),&(G))
|
||||
|
||||
/* Register with the Query engine */
|
||||
gboolean gnc_lot_register (void);
|
||||
|
||||
+27
-32
@@ -55,6 +55,8 @@ static QofLogModule log_module = GNC_MOD_LOT;
|
||||
static void gnc_lot_class_init(GncLotClass *klass);
|
||||
static void gnc_lot_init(GncLot *sp);
|
||||
static void gnc_lot_finalize(GObject *object);
|
||||
static void gnc_lot_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_lot_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncLotPrivate {
|
||||
/* Private Members */
|
||||
@@ -65,6 +67,7 @@ typedef enum _GncLotSignalType GncLotSignalType;
|
||||
|
||||
enum _GncLotSignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -82,7 +85,7 @@ static guint gnc_lot_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_lot_get_type()
|
||||
gnc_lot_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -99,7 +102,7 @@ gnc_lot_get_type()
|
||||
(GInstanceInitFunc)gnc_lot_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static(QOF_TYPE_ENTITY,
|
||||
type = g_type_register_static(QOF_TYPE_INSTANCE,
|
||||
"GncLot", &our_info, 0);
|
||||
}
|
||||
|
||||
@@ -123,9 +126,13 @@ gnc_lot_class_init(GncLotClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_lot_init(GncLot *obj)
|
||||
gnc_lot_init(GncLot *lot)
|
||||
{
|
||||
/* Initialize private members, etc. */
|
||||
lot->account = NULL;
|
||||
lot->splits = NULL;
|
||||
lot->is_closed = -1;
|
||||
lot->marker = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -149,7 +156,7 @@ gnc_lot_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -175,18 +182,6 @@ gnc_lot_get_property (GObject *object,
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
static void
|
||||
gnc_lot_init (GNCLot *lot, QofBook *book)
|
||||
{
|
||||
ENTER ("(lot=%p, book=%p)", lot, book);
|
||||
lot->account = NULL;
|
||||
lot->splits = NULL;
|
||||
lot->is_closed = -1;
|
||||
lot->marker = 0;
|
||||
|
||||
qof_instance_init(&lot->inst, GNC_ID_LOT, book);
|
||||
LEAVE ("(lot=%p, book=%p)", lot, book);
|
||||
}
|
||||
|
||||
GNCLot *
|
||||
gnc_lot_new (QofBook *book)
|
||||
@@ -195,8 +190,8 @@ gnc_lot_new (QofBook *book)
|
||||
g_return_val_if_fail (book, NULL);
|
||||
|
||||
lot = g_object_new (GNC_TYPE_LOT, NULL);
|
||||
gnc_lot_init (lot, book);
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
|
||||
qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_CREATE, NULL);
|
||||
return lot;
|
||||
}
|
||||
|
||||
@@ -207,7 +202,7 @@ gnc_lot_destroy (GNCLot *lot)
|
||||
if (!lot) return;
|
||||
|
||||
ENTER ("(lot=%p)", lot);
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
|
||||
for (node=lot->splits; node; node=node->next)
|
||||
@@ -253,7 +248,7 @@ gnc_lot_lookup (const GUID *guid, QofBook *book)
|
||||
QofCollection *col;
|
||||
if (!guid || !book) return NULL;
|
||||
col = qof_book_get_collection (book, GNC_ID_LOT);
|
||||
return (GNCLot *) qof_collection_lookup_entity (col, guid);
|
||||
return (GNCLot *) qof_collection_lookup_element (col, guid);
|
||||
}
|
||||
|
||||
QofBook *
|
||||
@@ -312,7 +307,7 @@ const char *
|
||||
gnc_lot_get_notes (GNCLot *lot)
|
||||
{
|
||||
if (!lot) return NULL;
|
||||
return kvp_frame_get_string (lot->inst.kvp_data, "/notes");
|
||||
return kvp_frame_get_string (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/notes");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -320,8 +315,8 @@ gnc_lot_set_title (GNCLot *lot, const char *str)
|
||||
{
|
||||
if (!lot) return;
|
||||
qof_begin_edit(QOF_INSTANCE(lot));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
kvp_frame_set_str (lot->inst.kvp_data, "/title", str);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
|
||||
kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/title", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
@@ -330,8 +325,8 @@ gnc_lot_set_notes (GNCLot *lot, const char *str)
|
||||
{
|
||||
if (!lot) return;
|
||||
gnc_lot_begin_edit(lot);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
kvp_frame_set_str (lot->inst.kvp_data, "/notes", str);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
|
||||
kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/notes", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
@@ -432,7 +427,7 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
|
||||
gnc_num_dbg_to_string (split->value));
|
||||
gnc_lot_begin_edit(lot);
|
||||
acc = xaccSplitGetAccount (split);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
|
||||
if (NULL == lot->account)
|
||||
{
|
||||
xaccAccountInsertLot (acc, lot);
|
||||
@@ -463,7 +458,7 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
|
||||
lot->is_closed = -1;
|
||||
gnc_lot_commit_edit(lot);
|
||||
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -473,7 +468,7 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
|
||||
|
||||
ENTER ("(lot=%p, split=%p)", lot, split);
|
||||
gnc_lot_begin_edit(lot);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
|
||||
lot->splits = g_list_remove (lot->splits, split);
|
||||
split->lot = NULL;
|
||||
lot->is_closed = -1; /* force an is-closed computation */
|
||||
@@ -484,7 +479,7 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
|
||||
lot->account = NULL;
|
||||
}
|
||||
gnc_lot_commit_edit(lot);
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
@@ -549,7 +544,7 @@ gnc_lot_get_latest_split (GNCLot *lot)
|
||||
}
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
/*
|
||||
static QofObject gncLotDesc =
|
||||
{
|
||||
interface_version: QOF_OBJECT_VERSION,
|
||||
@@ -576,7 +571,7 @@ gboolean gnc_lot_register (void)
|
||||
(QofAccessFunc) gnc_lot_get_notes,
|
||||
(QofSetterFunc) gnc_lot_set_notes },
|
||||
{ QOF_PARAM_GUID, QOF_TYPE_GUID,
|
||||
(QofAccessFunc) qof_entity_get_guid, NULL },
|
||||
(QofAccessFunc) qof_instance_get_guid, NULL },
|
||||
{ QOF_PARAM_BOOK, QOF_ID_BOOK,
|
||||
(QofAccessFunc) gnc_lot_get_book, NULL },
|
||||
{ LOT_IS_CLOSED, QOF_TYPE_BOOLEAN,
|
||||
@@ -589,5 +584,5 @@ gboolean gnc_lot_register (void)
|
||||
qof_class_register (GNC_ID_LOT, NULL, params);
|
||||
return qof_object_register(&gncLotDesc);
|
||||
}
|
||||
|
||||
*/
|
||||
/* ========================== END OF FILE ========================= */
|
||||
@@ -140,7 +140,7 @@ void gnc_lot_set_notes (GNCLot *, const char *);
|
||||
* */
|
||||
KvpFrame * gnc_lot_get_slots (GNCLot *);
|
||||
|
||||
#define gnc_lot_get_guid(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define gnc_lot_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
|
||||
#define LOT_IS_CLOSED "is-closed?"
|
||||
#define LOT_BALANCE "balance"
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef struct gnc_price_lookup_helper_s
|
||||
Timespec time;
|
||||
} GNCPriceLookupHelper;
|
||||
|
||||
#define gnc_price_set_guid(P,G) qof_entity_set_guid(QOF_ENTITY(P),(G))
|
||||
#define gnc_price_set_guid(P,G) qof_instance_set_guid(QOF_INSTANCE(P),(G))
|
||||
void gnc_pricedb_substitute_commodity(GNCPriceDB *db,
|
||||
gnc_commodity *old_c,
|
||||
gnc_commodity *new_c);
|
||||
|
||||
+47
-39
@@ -40,16 +40,19 @@ static gboolean remove_price(GNCPriceDB *db, GNCPrice *p, gboolean cleanup);
|
||||
static void gnc_price_class_init(GncPriceDbClass *klass);
|
||||
static void gnc_price_init(GncPriceDb *sp);
|
||||
static void gnc_price_finalize(GObject *object);
|
||||
static void gnc_price_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_price_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncPriceDbPrivate {
|
||||
struct _GncPricePrivate {
|
||||
/* Private Members */
|
||||
};
|
||||
|
||||
typedef struct _GncPriceDbSignal GncPriceDbSignal;
|
||||
typedef enum _GncPriceDbSignalType GncPriceDbSignalType;
|
||||
typedef struct _GncPriceSignal GncPriceSignal;
|
||||
typedef enum _GncPriceSignalType GncPriceSignalType;
|
||||
|
||||
enum _GncPriceDbSignalType {
|
||||
enum _GncPriceSignalType {
|
||||
/* Signals */
|
||||
FIRST_SIGNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -59,7 +62,7 @@ enum
|
||||
PROP_0
|
||||
};
|
||||
|
||||
struct _GncPriceDbSignal {
|
||||
struct _GncPriceSignal {
|
||||
GncPriceDb *object;
|
||||
};
|
||||
|
||||
@@ -67,7 +70,7 @@ static guint gnc_price_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gnc_price_get_gtype()
|
||||
gnc_price_get_gtype (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -84,7 +87,7 @@ gnc_price_get_gtype()
|
||||
(GInstanceInitFunc)gnc_price_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static(QOF_TYPE_ENTITY,
|
||||
type = g_type_register_static(QOF_TYPE_INSTANCE,
|
||||
"GncPriceDb", &our_info, 0);
|
||||
}
|
||||
|
||||
@@ -134,7 +137,7 @@ gnc_price_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -180,8 +183,7 @@ gnc_price_create (QofBook *book)
|
||||
p->type = NULL;
|
||||
p->source = NULL;
|
||||
|
||||
qof_instance_init (&p->inst, GNC_ID_PRICE, book);
|
||||
qof_event_gen (&p->inst.entity, QOF_EVENT_CREATE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (p), QOF_EVENT_CREATE, NULL);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -190,7 +192,7 @@ static void
|
||||
gnc_price_destroy (GNCPrice *p)
|
||||
{
|
||||
ENTER(" ");
|
||||
qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (p), QOF_EVENT_DESTROY, NULL);
|
||||
|
||||
if(p->type) CACHE_REMOVE(p->type);
|
||||
if(p->source) CACHE_REMOVE(p->source);
|
||||
@@ -261,7 +263,7 @@ gnc_price_clone (GNCPrice* p, QofBook *book)
|
||||
void
|
||||
gnc_price_begin_edit (GNCPrice *p)
|
||||
{
|
||||
QOF_BEGIN_EDIT (&p->inst);
|
||||
qof_begin_edit (QOF_INSTANCE (p));
|
||||
}
|
||||
|
||||
static void commit_err (QofInstance *inst, QofBackendError errcode)
|
||||
@@ -283,14 +285,14 @@ gnc_price_commit_edit (GNCPrice *p)
|
||||
void
|
||||
gnc_pricedb_begin_edit (GNCPriceDB *pdb)
|
||||
{
|
||||
QOF_BEGIN_EDIT (&pdb->inst);
|
||||
qof_instance_begin_edit (QOF_INSTANCE (pdb), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_pricedb_commit_edit (GNCPriceDB *pdb)
|
||||
{
|
||||
if (!qof_commit_edit (QOF_INSTANCE(pdb))) return;
|
||||
qof_commit_edit_part2 (&pdb->inst, commit_err, noop, noop);
|
||||
qof_commit_edit_part2 (QOF_INSTANCE (pdb), commit_err, noop, noop);
|
||||
}
|
||||
|
||||
/* ==================================================================== */
|
||||
@@ -299,7 +301,7 @@ gnc_pricedb_commit_edit (GNCPriceDB *pdb)
|
||||
static void
|
||||
gnc_price_set_dirty (GNCPrice *p)
|
||||
{
|
||||
qof_instance_set_dirty(&p->inst);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (p), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -431,7 +433,7 @@ gnc_price_lookup (const GUID *guid, QofBook *book)
|
||||
|
||||
if (!guid || !book) return NULL;
|
||||
col = qof_book_get_collection (book, GNC_ID_PRICE);
|
||||
return (GNCPrice *) qof_collection_lookup_entity (col, guid);
|
||||
return (GNCPrice *) qof_collection_lookup_element (col, guid);
|
||||
}
|
||||
|
||||
gnc_commodity *
|
||||
@@ -682,6 +684,8 @@ gnc_price_list_equal(PriceList *prices1, PriceList *prices2)
|
||||
static void gnc_pricedb_class_init(GncPriceDbClass *klass);
|
||||
static void gnc_pricedb_init(GncPriceDb *sp);
|
||||
static void gnc_pricedb_finalize(GObject *object);
|
||||
static void gnc_pricedb_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gnc_pricedb_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
struct _GncPriceDbPrivate {
|
||||
/* Private Members */
|
||||
@@ -692,13 +696,14 @@ typedef enum _GncPriceDbSignalType GncPriceDbSignalType;
|
||||
|
||||
enum _GncPriceDbSignalType {
|
||||
/* Signals */
|
||||
LAST_SIGNAL
|
||||
FIRST_SIGNAL2,
|
||||
LAST_SIGNAL2
|
||||
};
|
||||
|
||||
/* properties */
|
||||
enum
|
||||
{
|
||||
PROP_0
|
||||
PROP_0_2
|
||||
};
|
||||
|
||||
struct _GncPriceDbSignal {
|
||||
@@ -706,10 +711,10 @@ struct _GncPriceDbSignal {
|
||||
};
|
||||
|
||||
static guint gnc_pricedb_signals[LAST_SIGNAL] = { 0 };
|
||||
static GObjectClass *parent_class = NULL;
|
||||
static GObjectClass *parent_class2 = NULL;
|
||||
|
||||
GType
|
||||
gnc_pricedb_get_type()
|
||||
gnc_pricedb_get_type(void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
@@ -726,7 +731,7 @@ gnc_pricedb_get_type()
|
||||
(GInstanceInitFunc)gnc_pricedb_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static(QOF_TYPE_ENTITY,
|
||||
type = g_type_register_static(QOF_TYPE_INSTANCE,
|
||||
"GncPriceDb", &our_info, 0);
|
||||
}
|
||||
|
||||
@@ -738,7 +743,7 @@ gnc_pricedb_class_init(GncPriceDbClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent(klass);
|
||||
parent_class2 = g_type_class_peek_parent(klass);
|
||||
object_class->finalize = gnc_pricedb_finalize;
|
||||
object_class->set_property = gnc_pricedb_set_property;
|
||||
object_class->get_property = gnc_pricedb_get_property;
|
||||
@@ -776,7 +781,7 @@ gnc_pricedb_set_property (GObject *object,
|
||||
switch (param_id) {
|
||||
default:
|
||||
/* We don't have any other property... */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -821,7 +826,7 @@ gnc_pricedb_create(QofBook * book)
|
||||
}
|
||||
|
||||
result = g_object_new (GNC_TYPE_PRICE_DB, NULL);
|
||||
qof_instance_init (&result->inst, GNC_ID_PRICEDB, book);
|
||||
|
||||
qof_collection_mark_clean(col);
|
||||
|
||||
/** \todo This leaks result when the collection is destroyed. When
|
||||
@@ -1023,9 +1028,9 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
||||
|
||||
if(!db || !p) return FALSE;
|
||||
ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
|
||||
db, p, p->inst.dirty, p->inst.do_free);
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
|
||||
|
||||
if (db->inst.book != p->inst.book)
|
||||
if (qof_instance_get_book (QOF_INSTANCE (db)) != qof_instance_get_book (QOF_INSTANCE (p)))
|
||||
{
|
||||
PERR ("attempted to mix up prices across different books");
|
||||
LEAVE (" ");
|
||||
@@ -1065,10 +1070,10 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
||||
}
|
||||
g_hash_table_insert(currency_hash, currency, price_list);
|
||||
p->db = db;
|
||||
qof_event_gen (&p->inst.entity, QOF_EVENT_ADD, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (p), QOF_EVENT_ADD, NULL);
|
||||
|
||||
LEAVE ("db=%p, pr=%p dirty=%d do-free=%d commodity=%s/%s currency_hash=%p",
|
||||
db, p, p->inst.dirty, p->inst.do_free,
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)),
|
||||
gnc_commodity_get_namespace(p->commodity),
|
||||
gnc_commodity_get_mnemonic(p->commodity),
|
||||
currency_hash);
|
||||
@@ -1083,7 +1088,7 @@ gnc_pricedb_add_price(GNCPriceDB *db, GNCPrice *p)
|
||||
if(!db || !p) return FALSE;
|
||||
|
||||
ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
|
||||
db, p, p->inst.dirty, p->inst.do_free);
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
|
||||
|
||||
if (FALSE == add_price(db, p))
|
||||
{
|
||||
@@ -1092,11 +1097,11 @@ gnc_pricedb_add_price(GNCPriceDB *db, GNCPrice *p)
|
||||
}
|
||||
|
||||
gnc_pricedb_begin_edit(db);
|
||||
qof_instance_set_dirty(&db->inst);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (db), TRUE);
|
||||
gnc_pricedb_commit_edit(db);
|
||||
|
||||
LEAVE ("db=%p, pr=%p dirty=%d do-free=%d",
|
||||
db, p, p->inst.dirty, p->inst.do_free);
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1115,7 +1120,7 @@ remove_price(GNCPriceDB *db, GNCPrice *p, gboolean cleanup)
|
||||
|
||||
if(!db || !p) return FALSE;
|
||||
ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
|
||||
db, p, p->inst.dirty, p->inst.do_free);
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
|
||||
|
||||
commodity = gnc_price_get_commodity(p);
|
||||
if(!commodity) { LEAVE (" no commodity"); return FALSE; }
|
||||
@@ -1130,7 +1135,7 @@ remove_price(GNCPriceDB *db, GNCPrice *p, gboolean cleanup)
|
||||
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
||||
if(!currency_hash) { LEAVE (" no currency hash"); return FALSE; }
|
||||
|
||||
qof_event_gen (&p->inst.entity, QOF_EVENT_REMOVE, NULL);
|
||||
qof_event_gen (QOF_INSTANCE (p), QOF_EVENT_REMOVE, NULL);
|
||||
price_list = g_hash_table_lookup(currency_hash, currency);
|
||||
gnc_price_ref(p);
|
||||
if(!gnc_price_list_remove(&price_list, p)) {
|
||||
@@ -1169,17 +1174,17 @@ gnc_pricedb_remove_price(GNCPriceDB *db, GNCPrice *p)
|
||||
gboolean rc;
|
||||
if(!db || !p) return FALSE;
|
||||
ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
|
||||
db, p, p->inst.dirty, p->inst.do_free);
|
||||
db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
|
||||
|
||||
gnc_price_ref(p);
|
||||
rc = remove_price (db, p, TRUE);
|
||||
gnc_pricedb_begin_edit(db);
|
||||
qof_instance_set_dirty(&db->inst);
|
||||
qof_instance_set_dirty(QOF_INSTANCE (db), TRUE);
|
||||
gnc_pricedb_commit_edit(db);
|
||||
|
||||
/* invoke the backend to delete this price */
|
||||
gnc_price_begin_edit (p);
|
||||
p->inst.do_free = TRUE;
|
||||
qof_instance_set_do_free (QOF_INSTANCE (p), TRUE);
|
||||
gnc_price_commit_edit (p);
|
||||
p->db = NULL;
|
||||
gnc_price_unref(p);
|
||||
@@ -2632,14 +2637,17 @@ price_foreach(const QofCollection *col, QofEntityForeachCB cb, gpointer data)
|
||||
}
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
/*
|
||||
static const char *
|
||||
price_printable(gpointer obj)
|
||||
{
|
||||
GNCPrice *pr = obj;
|
||||
gnc_commodity *commodity;
|
||||
gnc_commodity *currency;
|
||||
static char buff[2048]; /* nasty static OK for printing */
|
||||
|
||||
******nasty static OK for printing****
|
||||
|
||||
static char buff[2048];
|
||||
char *val, *da;
|
||||
|
||||
if(!pr) return "";
|
||||
@@ -2708,5 +2716,5 @@ gnc_pricedb_register (void)
|
||||
return FALSE;
|
||||
return qof_object_register (&pricedb_object_def);
|
||||
}
|
||||
|
||||
*/
|
||||
/* ========================= END OF FILE ============================== */
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
typedef struct _GncPriceClass GncPriceClass;
|
||||
typedef struct _GncPrice GncPrice;
|
||||
typedef struct GncPrice GNCPrice; /* Dummy type for backward compatilibity */
|
||||
typedef GncPrice GNCPrice; /* Dummy type for backward compatilibity */
|
||||
|
||||
struct _GncPriceClass {
|
||||
QofInstanceClass parent_class;
|
||||
@@ -50,7 +50,7 @@ struct _GncPriceClass {
|
||||
/* Add Signal Functions Here */
|
||||
};
|
||||
|
||||
GType gnc_price_get_gtype ();
|
||||
GType gnc_price_get_gtype (void);
|
||||
|
||||
/** @addtogroup PriceDB
|
||||
@{ */
|
||||
@@ -221,8 +221,8 @@ gnc_numeric gnc_price_get_value(GNCPrice *p);
|
||||
gint32 gnc_price_get_version(GNCPrice *p);
|
||||
gboolean gnc_price_equal(GNCPrice *p1, GNCPrice *p2);
|
||||
|
||||
#define gnc_price_get_guid(X) qof_entity_get_guid(QOF_ENTITY(X))
|
||||
#define gnc_price_return_guid(X) (*(qof_entity_get_guid(QOF_ENTITY(X))))
|
||||
#define gnc_price_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X))
|
||||
#define gnc_price_return_guid(X) (*(qof_instance_get_guid(QOF_INSTANCE(X))))
|
||||
#define gnc_price_get_book(X) qof_instance_get_book(QOF_INSTANCE(X))
|
||||
/** @} */
|
||||
|
||||
@@ -280,7 +280,7 @@ gboolean gnc_price_list_equal(PriceList *prices1, PriceList *prices2);
|
||||
|
||||
typedef struct _GncPriceDbClass GncPriceDbClass;
|
||||
typedef struct _GncPriceDb GncPriceDb;
|
||||
typedef struct GncPriceDb GNCPriceDB; /* Dummy type for backward compatilibity */
|
||||
typedef GncPriceDb GNCPriceDB; /* Dummy type for backward compatilibity */
|
||||
|
||||
struct _GncPriceDbClass {
|
||||
QofInstanceClass parent_class;
|
||||
@@ -289,7 +289,7 @@ struct _GncPriceDbClass {
|
||||
/* Add Signal Functions Here */
|
||||
};
|
||||
|
||||
GType gnc_pricedb_get_type ();
|
||||
GType gnc_pricedb_get_type (void);
|
||||
|
||||
/* XXX backwards-compat defines, remove these someday */
|
||||
#define gnc_book_get_pricedb gnc_pricedb_get_db
|
||||
|
||||
@@ -968,7 +968,7 @@ test_recursion (QofSession *original, guint counter)
|
||||
copy = qof_session_new();
|
||||
if(debug) { qof_session_begin(copy, QOF_STDOUT, TRUE, FALSE); }
|
||||
/* TODO: implement QOF_TYPE_CHOICE testing. */
|
||||
qof_entity_copy_coll_r(copy, grand_coll);
|
||||
qof_instancecopy_coll_r(copy, grand_coll);
|
||||
/* test the original */
|
||||
qof_object_foreach(GRAND_MODULE_NAME, book, check_cb, &c);
|
||||
book = qof_session_get_book(copy);
|
||||
|
||||
+7
-7
@@ -195,13 +195,13 @@ foreach (@files)
|
||||
s/GNCEntityTable/QofEntityTable/g;
|
||||
s/xaccGUIDTypeEntityTable/qof_guid_type/g;
|
||||
|
||||
s/xaccEntityTableNew/qof_entity_new/g;
|
||||
s/xaccEntityTableDestroy/qof_entity_destroy/g;
|
||||
s/xaccGUIDNewEntityTable/qof_entity_guid_new/g;
|
||||
s/xaccLookupEntity/qof_entity_lookup/g;
|
||||
s/xaccStoreEntity/qof_entity_store/g;
|
||||
s/xaccRemoveEntity/qof_entity_remove/g;
|
||||
s/xaccForeachEntity/qof_entity_foreach/g;
|
||||
s/xaccEntityTableNew/qof_instancenew/g;
|
||||
s/xaccEntityTableDestroy/qof_instancedestroy/g;
|
||||
s/xaccGUIDNewEntityTable/qof_instanceguid_new/g;
|
||||
s/xaccLookupEntity/qof_instancelookup/g;
|
||||
s/xaccStoreEntity/qof_instancestore/g;
|
||||
s/xaccRemoveEntity/qof_instanceremove/g;
|
||||
s/xaccForeachEntity/qof_instanceforeach/g;
|
||||
|
||||
s/foreachObjectCB/QofEntityForeachCB/g;
|
||||
s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g;
|
||||
|
||||
@@ -189,7 +189,7 @@ gnc_search_dialog_double_click_entry (GNCQueryList *list, gpointer item,
|
||||
/* Select the time */
|
||||
gnc_search_dialog_select_cb (NULL, sw);
|
||||
else if (sw->buttons)
|
||||
/* Call the first button (usually view/edit) */
|
||||
/* Call the first button (uSPLIT_ACCOUNT_GUIDsually view/edit) */
|
||||
gnc_search_callback_button_execute (sw->buttons, sw);
|
||||
}
|
||||
#endif
|
||||
@@ -349,7 +349,7 @@ search_update_query (GNCSearchWindow *sw)
|
||||
|
||||
/* Make sure we supply a book! */
|
||||
if (sw->start_q == NULL) {
|
||||
sw->start_q = gncQueryCreateFor (sw->search_for);
|
||||
sw->start_q = gncQueryCreateFor (g_type_from_name (sw->search_for));
|
||||
gncQuerySetBook (sw->start_q, gnc_get_current_book ());
|
||||
} else {
|
||||
/* We've got a query -- purge it of any "active" parameters */
|
||||
@@ -357,7 +357,7 @@ search_update_query (GNCSearchWindow *sw)
|
||||
}
|
||||
|
||||
/* Now create a new query to work from */
|
||||
q = gncQueryCreateFor (sw->search_for);
|
||||
q = gncQueryCreateFor (g_type_from_name (sw->search_for));
|
||||
|
||||
/* Walk the list of criteria */
|
||||
for (node = sw->crit_list; node; node = node->next) {
|
||||
@@ -488,14 +488,14 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
|
||||
|
||||
if (!sw->q) {
|
||||
if (!sw->start_q) {
|
||||
sw->start_q = gncQueryCreateFor (sw->search_for);
|
||||
sw->start_q = gncQueryCreateFor (g_type_from_name (sw->search_for));
|
||||
gncQuerySetBook (sw->start_q, gnc_get_current_book ());
|
||||
}
|
||||
sw->q = gncQueryCopy (sw->start_q);
|
||||
op = QUERY_AND;
|
||||
}
|
||||
|
||||
gncQueryAddGUIDMatch (sw->q, g_slist_prepend (NULL, QUERY_PARAM_GUID),
|
||||
gncQueryAddGUIDMatch (sw->q, g_slist_prepend (NULL, GINT_TO_POINTER (QUERY_PARAM_GUID)),
|
||||
guid, op);
|
||||
|
||||
/* Watch this entity so we'll refresh once it's actually changed */
|
||||
@@ -791,7 +791,7 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
|
||||
if (sw->type_label)
|
||||
type_label = sw->type_label;
|
||||
else
|
||||
type_label = _(gncObjectGetTypeLabel (sw->search_for));
|
||||
type_label = _(gncObjectGetTypeLabel (g_type_from_name (sw->search_for)));
|
||||
gtk_label_set_text (GTK_LABEL (label), type_label);
|
||||
|
||||
/* Set the 'add criterion' button */
|
||||
@@ -826,7 +826,7 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
|
||||
/* Figure out if we this object-type has an "active" parameter, and
|
||||
* if not, then set the active-check button insensitive
|
||||
*/
|
||||
if (gncQueryObjectGetParameter (sw->search_for, QUERY_PARAM_ACTIVE) == NULL)
|
||||
if (gncQueryObjectGetParameter (g_type_from_name (sw->search_for), QUERY_PARAM_ACTIVE) == NULL)
|
||||
gtk_widget_set_sensitive (sw->active_only_check, FALSE);
|
||||
|
||||
/* Deal with the cancel button */
|
||||
@@ -920,7 +920,7 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, const gchar *title,
|
||||
GNCSearchWindow *sw = g_new0 (GNCSearchWindow, 1);
|
||||
|
||||
g_return_val_if_fail (obj_type, NULL);
|
||||
g_return_val_if_fail (*obj_type != '\0', NULL);
|
||||
g_return_val_if_fail (obj_type != G_TYPE_INVALID, NULL);
|
||||
g_return_val_if_fail (param_list, NULL);
|
||||
|
||||
/* Make sure the caller supplies callbacks xor result_callback */
|
||||
@@ -942,7 +942,7 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, const gchar *title,
|
||||
sw->type_label = type_label;
|
||||
|
||||
/* Grab the get_guid function */
|
||||
sw->get_guid = qof_class_get_parameter (sw->search_for, QOF_PARAM_GUID);
|
||||
sw->get_guid = qof_class_get_parameter (g_type_from_name (sw->search_for), g_type_name (QOF_PARAM_GUID));
|
||||
if (start_query)
|
||||
sw->start_q = gncQueryCopy (start_query);
|
||||
sw->q = show_start_query;
|
||||
@@ -1019,7 +1019,7 @@ get_params_list (GNCIdTypeConst type)
|
||||
ACCOUNT_MATCH_ALL_TYPE,
|
||||
type, SPLIT_TRANS, TRANS_SPLITLIST,
|
||||
SPLIT_ACCOUNT_GUID, NULL);
|
||||
list = gnc_search_param_prepend (list, "Split Account", GNC_ID_ACCOUNT,
|
||||
list = gnc_search_param_prepend (list, "Split Account", (gchar*) g_type_name (GNC_ID_ACCOUNT),
|
||||
type, SPLIT_ACCOUNT, QUERY_PARAM_GUID,
|
||||
NULL);
|
||||
list = gnc_search_param_prepend (list, "Split->Txn->Void?", NULL, type,
|
||||
@@ -1077,12 +1077,12 @@ gnc_search_dialog_test (void)
|
||||
};
|
||||
|
||||
if (params == NULL)
|
||||
params = get_params_list (GNC_ID_SPLIT);
|
||||
params = get_params_list ((gchar*) g_type_name (GNC_ID_SPLIT));
|
||||
|
||||
if (display == NULL)
|
||||
display = get_display_list (GNC_ID_SPLIT);
|
||||
display = get_display_list ((gchar*) g_type_name (GNC_ID_SPLIT));
|
||||
|
||||
sw = gnc_search_dialog_create (GNC_ID_SPLIT, _("Find Transaction"),
|
||||
sw = gnc_search_dialog_create ((gchar*) g_type_name (GNC_ID_SPLIT), _("Find Transaction"),
|
||||
params, display,
|
||||
NULL, NULL, buttons, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
@@ -289,7 +289,7 @@ gnc_general_search_new (GNCIdTypeConst type, const char *label,
|
||||
|
||||
g_return_val_if_fail (type && label && search_cb, NULL);
|
||||
|
||||
get_guid = qof_class_get_parameter (type, QOF_PARAM_GUID);
|
||||
get_guid = qof_class_get_parameter (g_type_from_name (type), g_type_name (QOF_PARAM_GUID));
|
||||
g_return_val_if_fail (get_guid, NULL);
|
||||
|
||||
gsl = g_object_new (GNC_TYPE_GENERAL_SEARCH, NULL);
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct {
|
||||
} QFB;
|
||||
|
||||
static void
|
||||
shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
|
||||
shared_quickfill_destroy (gpointer user_data)
|
||||
{
|
||||
QFB *qfb = user_data;
|
||||
gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
|
||||
@@ -134,7 +134,7 @@ gnc_query_list_construct (GNCQueryList *list, GList *param_list, Query *query)
|
||||
/* cache the function to get the guid of this query type */
|
||||
priv = GNC_QUERY_LIST_GET_PRIVATE(list);
|
||||
priv->get_guid =
|
||||
qof_class_get_parameter (qof_query_get_search_for(query), QOF_PARAM_GUID);
|
||||
qof_class_get_parameter (qof_query_get_search_for(query), g_type_name (QOF_PARAM_GUID));
|
||||
|
||||
/* Initialize the CList */
|
||||
gnc_query_list_init_clist(list);
|
||||
@@ -187,10 +187,10 @@ update_booleans (GNCQueryList *list, gint row)
|
||||
for (i = 0, node = list->column_params; node; node = node->next, i++)
|
||||
{
|
||||
GNCSearchParam *param = node->data;
|
||||
const char *type = gnc_search_param_get_param_type (param);
|
||||
QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
|
||||
|
||||
/* if this is a boolean, ignore it now -- we'll use a checkmark later */
|
||||
if (safe_strcmp (type, QUERYCORE_BOOLEAN))
|
||||
if ( type == QUERYCORE_BOOLEAN)
|
||||
continue;
|
||||
|
||||
result = (gboolean) GPOINTER_TO_INT(gnc_search_param_compute_value(param, entry));
|
||||
@@ -696,9 +696,9 @@ gnc_query_list_set_query_sort (GNCQueryList *list, gboolean new_column)
|
||||
* debred column, then invert the sort order.
|
||||
*/
|
||||
if (list->numeric_inv_sort) {
|
||||
const char *type = gnc_search_param_get_param_type (param);
|
||||
if (!safe_strcmp(type, QUERYCORE_NUMERIC) ||
|
||||
!safe_strcmp(type, QUERYCORE_DEBCRED))
|
||||
QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
|
||||
if ((type == QUERYCORE_NUMERIC) ||
|
||||
(type == QUERYCORE_DEBCRED))
|
||||
sort_order = !sort_order;
|
||||
}
|
||||
|
||||
@@ -800,11 +800,11 @@ gnc_query_list_fill(GNCQueryList *list)
|
||||
{
|
||||
GNCSearchParam *param = node->data;
|
||||
GSList *converters = gnc_search_param_get_converters (param);
|
||||
const char *type = gnc_search_param_get_param_type (param);
|
||||
QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
|
||||
gpointer res = item->data;
|
||||
|
||||
/* if this is a boolean, ignore it now -- we'll use a checkmark later */
|
||||
if (!safe_strcmp (type, QUERYCORE_BOOLEAN)) {
|
||||
if ( type == QUERYCORE_BOOLEAN) {
|
||||
strings[i++] = g_strdup("");
|
||||
continue;
|
||||
}
|
||||
@@ -820,8 +820,8 @@ gnc_query_list_fill(GNCQueryList *list)
|
||||
}
|
||||
|
||||
/* Now convert this to a text value for the row */
|
||||
if (!safe_strcmp(type, QUERYCORE_DEBCRED) ||
|
||||
!safe_strcmp(type, QUERYCORE_NUMERIC))
|
||||
if (type == QUERYCORE_DEBCRED ||
|
||||
type == QUERYCORE_NUMERIC)
|
||||
{
|
||||
gnc_numeric (*nfcn)(gpointer, QofParam *) =
|
||||
(gnc_numeric(*)(gpointer, QofParam *))(qp->param_getfcn);
|
||||
|
||||
@@ -163,7 +163,7 @@ gnc_search_param_set_param_path (GNCSearchParam *param,
|
||||
GSList *param_path)
|
||||
{
|
||||
GNCSearchParamPrivate *priv;
|
||||
GNCIdTypeConst type = NULL;
|
||||
GNCIdTypeConst type = (gchar*) g_type_name (G_TYPE_INVALID);
|
||||
GSList *converters = NULL;
|
||||
|
||||
g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
|
||||
@@ -178,7 +178,7 @@ gnc_search_param_set_param_path (GNCSearchParam *param,
|
||||
for (; param_path; param_path = param_path->next) {
|
||||
GNCIdType param_name = param_path->data;
|
||||
const QueryObjectDef *objDef =
|
||||
gncQueryObjectGetParameter (search_type, param_name);
|
||||
gncQueryObjectGetParameter (g_type_from_name (search_type), param_name);
|
||||
|
||||
/* If it doesn't exist, then we've reached the end */
|
||||
if (objDef == NULL)
|
||||
@@ -188,7 +188,7 @@ gnc_search_param_set_param_path (GNCSearchParam *param,
|
||||
converters = g_slist_prepend (converters, (gpointer) objDef);
|
||||
|
||||
/* And reset for the next parameter */
|
||||
type = search_type = objDef->param_type;
|
||||
type = search_type = (gchar*) g_type_name (objDef->param_type);
|
||||
}
|
||||
|
||||
/* Save the type */
|
||||
@@ -208,7 +208,7 @@ gnc_search_param_override_param_type (GNCSearchParam *param,
|
||||
GNCSearchParamPrivate *priv;
|
||||
|
||||
g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
|
||||
g_return_if_fail (param_type != NULL && *param_type != '\0');
|
||||
g_return_if_fail (param_type != G_TYPE_INVALID);
|
||||
|
||||
priv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
|
||||
priv->type = param_type;
|
||||
@@ -242,10 +242,10 @@ gnc_search_param_get_param_type (GNCSearchParam *param)
|
||||
{
|
||||
GNCSearchParamPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GNC_IS_SEARCH_PARAM (param), NULL);
|
||||
g_return_val_if_fail (GNC_IS_SEARCH_PARAM (param), (gchar*) g_type_name (G_TYPE_INVALID));
|
||||
|
||||
priv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
|
||||
return priv->type;
|
||||
return (gchar*) priv->type;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -291,7 +291,7 @@ gnc_search_param_type_match (GNCSearchParam *a, GNCSearchParam *b)
|
||||
a_priv = GNC_SEARCH_PARAM_GET_PRIVATE(a);
|
||||
b_priv = GNC_SEARCH_PARAM_GET_PRIVATE(b);
|
||||
if (a_priv->type == b_priv->type ||
|
||||
!safe_strcmp (a_priv->type, b_priv->type))
|
||||
(a_priv->type == b_priv->type))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@@ -384,7 +384,7 @@ gnc_search_param_set_param_fcn (GNCSearchParam *param,
|
||||
GNCSearchParamPrivate *priv;
|
||||
|
||||
g_return_if_fail (param);
|
||||
g_return_if_fail (param_type && *param_type);
|
||||
g_return_if_fail (param_type != G_TYPE_INVALID);
|
||||
g_return_if_fail (fcn);
|
||||
g_return_if_fail (GNC_IS_SEARCH_PARAM(param));
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ chart_collection_cb(QofEntity *ent, gpointer user_data)
|
||||
if(0 == safe_strcmp(EQUITY_ACCOUNT_NAME, xaccAccountGetName(acc))
|
||||
&& (xaccAccountGetType(acc) == ACCT_TYPE_EQUITY))
|
||||
{
|
||||
success = qof_entity_copy_to_session(data->chart_session, ent);
|
||||
success = qof_instancecopy_to_session(data->chart_session, ent);
|
||||
if(!success) { return; }
|
||||
guid = qof_entity_get_guid(ent);
|
||||
guid = qof_instance_get_guid(ent);
|
||||
book = qof_session_get_book(data->chart_session);
|
||||
copy_coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
|
||||
data->equity_account = (Account*)qof_collection_lookup_entity(copy_coll, guid);
|
||||
@@ -94,7 +94,7 @@ chart_reference_cb(QofEntity *ent, gpointer user_data)
|
||||
data = (chart_data*)user_data;
|
||||
while(data->param_ref_list != NULL) {
|
||||
ref_param = data->param_ref_list->data;
|
||||
reference = qof_entity_get_reference_from(ent, ref_param);
|
||||
reference = qof_instanceget_reference_from(ent, ref_param);
|
||||
qof_session_update_reference_list(data->chart_session, reference);
|
||||
data->param_ref_list = data->param_ref_list->next;
|
||||
}
|
||||
@@ -119,13 +119,13 @@ chart_entity_cb(QofEntity *ent, gpointer user_data)
|
||||
data = (chart_data*)user_data;
|
||||
trans_time = data->chart_time_t;
|
||||
data->param_ref_list = NULL;
|
||||
guid = qof_entity_get_guid(ent);
|
||||
guid = qof_instance_get_guid(ent);
|
||||
acc_ent = (Account*)ent;
|
||||
ref = NULL;
|
||||
equity_account = data->equity_account;
|
||||
g_return_if_fail(equity_account != NULL);
|
||||
balance = xaccAccountGetBalanceAsOfDate(acc_ent, data->chart_time_t);
|
||||
qof_entity_copy_to_session(data->chart_session, ent);
|
||||
qof_instancecopy_to_session(data->chart_session, ent);
|
||||
book = qof_session_get_book(data->chart_session);
|
||||
coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
|
||||
acc_ent = (Account*)qof_collection_lookup_entity(coll, guid);
|
||||
@@ -151,7 +151,7 @@ chart_entity_cb(QofEntity *ent, gpointer user_data)
|
||||
xaccSplitSetValue (split, balance);
|
||||
ref = qof_class_get_referenceList(GNC_ID_SPLIT);
|
||||
while(ref != NULL) {
|
||||
ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
|
||||
ent_ref = qof_instanceget_reference_from((QofEntity*)split, ref->data);
|
||||
qof_session_update_reference_list(data->chart_session, ent_ref);
|
||||
ref = g_list_next(ref);
|
||||
}
|
||||
@@ -168,14 +168,14 @@ chart_entity_cb(QofEntity *ent, gpointer user_data)
|
||||
xaccAccountCommitEdit (acc_ent);
|
||||
ref = qof_class_get_referenceList(GNC_ID_TRANS);
|
||||
while(ref != NULL) {
|
||||
ent_ref = qof_entity_get_reference_from((QofEntity*)trans, ref->data);
|
||||
ent_ref = qof_instanceget_reference_from((QofEntity*)trans, ref->data);
|
||||
qof_session_update_reference_list(data->chart_session, ent_ref);
|
||||
ref = g_list_next(ref);
|
||||
}
|
||||
g_list_free(ref);
|
||||
ref = qof_class_get_referenceList(GNC_ID_SPLIT);
|
||||
while(ref != NULL) {
|
||||
ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
|
||||
ent_ref = qof_instanceget_reference_from((QofEntity*)split, ref->data);
|
||||
qof_session_update_reference_list(data->chart_session, ent_ref);
|
||||
ref = g_list_next(ref);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
*/
|
||||
/** @addtogroup ChartExport Export a chart of accounts.
|
||||
|
||||
Remember to use qof_entity_copy routines
|
||||
like ::qof_entity_copy_to_session so that the QofBook is marked
|
||||
Remember to use qof_instancecopy routines
|
||||
like ::qof_instancecopy_to_session so that the QofBook is marked
|
||||
as \a partial.
|
||||
|
||||
\par guidelines Guidelines for partial book export
|
||||
|
||||
@@ -230,7 +230,7 @@ gnc_restore_all_state (gpointer session, gpointer unused)
|
||||
|
||||
/* Get the book GUID */
|
||||
book = qof_session_get_book(session);
|
||||
guid = qof_entity_get_guid(QOF_ENTITY(book));
|
||||
guid = qof_instance_get_guid(QOF_INSTANCE(book));
|
||||
guid_string = guid_to_string(guid);
|
||||
|
||||
keyfile = gnc_find_state_file(url, guid_string, &filename);
|
||||
@@ -317,7 +317,7 @@ gnc_save_all_state (gpointer session, gpointer unused)
|
||||
|
||||
/* Get the book GUID */
|
||||
book = qof_session_get_book(session);
|
||||
guid = qof_entity_get_guid(QOF_ENTITY(book));
|
||||
guid = qof_instance_get_guid(QOF_INSTANCE(book));
|
||||
guid_string = guid_to_string(guid);
|
||||
|
||||
/* Find the filename to use. This returns the data from the
|
||||
|
||||
Reference in new issue
Block a user