Fixes necessary to marry private-kvp branch with c++ work

This commit is contained in:
Geert Janssens 2014-05-07 17:55:42 +02:00
parent 45cb5504f3
commit 49a5909ff2
12 changed files with 37 additions and 20 deletions

View File

@ -54,7 +54,7 @@ check_PROGRAMS = \
test-print-queries \
test-sx
EXTRA_DIST = \
EXTRA_DIST += \
test-load-module
AM_CPPFLAGS = \

View File

@ -58,6 +58,9 @@ const gchar *address_version_string = "2.0.0";
#define addr_email_string "addr:email"
#define addr_slots_string "addr:slots"
/* EFFECTIVE FRIEND FUNCTION */
extern KvpFrame *qof_instance_get_slots (const QofInstance*);
static void
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
{
@ -189,7 +192,7 @@ address_slots_handler (xmlNodePtr node, gpointer addr_pdata)
struct address_pdata *pdata = addr_pdata;
return dom_tree_to_kvp_frame_given
(node, xaccAccountGetSlots (pdata->address));
(node, qof_instance_get_slots (QOF_INSTANCE (pdata->address)));
}
static struct dom_tree_handler address_handlers_v2[] =

View File

@ -92,6 +92,9 @@ const gchar *entry_version_string = "2.0.0";
#define entry_bill_string "entry:bill"
#define entry_slots_string "entry:slots"
/* EFFECTIVE FRIEND FUNCTION */
extern KvpFrame *qof_instance_get_slots (const QofInstance*);
static void
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
{
@ -675,7 +678,7 @@ entry_slots_handler (xmlNodePtr node, gpointer entry_pdata)
struct entry_pdata *pdata = entry_pdata;
return dom_tree_to_kvp_frame_given
(node, xaccAccountGetSlots (pdata->entry));
(node, qof_instance_get_slots (QOF_INSTANCE (pdata->entry)));
}
static struct dom_tree_handler entry_handlers_v2[] =

View File

@ -62,6 +62,9 @@ const gchar *job_version_string = "2.0.0";
#define job_active_string "job:active"
#define job_slots_string "job:slots"
/* EFFECTIVE FRIEND FUNCTION */
extern KvpFrame *qof_instance_get_slots (const QofInstance*);
static xmlNodePtr
job_dom_tree_create (GncJob *job)
{
@ -207,7 +210,7 @@ job_slots_handler (xmlNodePtr node, gpointer job_pdata)
struct job_pdata *pdata = job_pdata;
return dom_tree_to_kvp_frame_given
(node, xaccAccountGetSlots (pdata->job));
(node, qof_instance_get_slots (QOF_INSTANCE (pdata->job)));
}
static struct dom_tree_handler job_handlers_v2[] =

View File

@ -46,7 +46,7 @@
#include "gnc-order-xml-v2.h"
#include "gnc-owner-xml-v2.h"
#define _GNC_MOD_NAME GNC_ID_ORDER
#define _GNC_MOD_NAME GNC_ID_ORDER
static QofLogModule log_module = GNC_MOD_IO;
@ -64,6 +64,9 @@ const gchar *order_version_string = "2.0.0";
#define order_active_string "order:active"
#define order_slots_string "order:slots"
/* EFFECTIVE FRIEND FUNCTION */
extern KvpFrame *qof_instance_get_slots (const QofInstance*);
static void
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
{
@ -248,7 +251,7 @@ order_slots_handler (xmlNodePtr node, gpointer order_pdata)
struct order_pdata *pdata = order_pdata;
return dom_tree_to_kvp_frame_given
(node, xaccAccountGetSlots (pdata->order));
(node, qof_instance_get_slots (QOF_INSTANCE (pdata->order)));
}
static struct dom_tree_handler order_handlers_v2[] =

View File

@ -67,6 +67,9 @@ const gchar *taxtable_version_string = "2.0.0";
#define ttentry_type_string "tte:type"
#define ttentry_amount_string "tte:amount"
/* EFFECTIVE FRIEND FUNCTION */
extern KvpFrame *qof_instance_get_slots (const QofInstance*);
static void
maybe_add_guid (xmlNodePtr ptr, const char *tag, GncTaxTable *table)
{
@ -382,7 +385,7 @@ taxtable_slots_handler (xmlNodePtr node, gpointer taxtable_pdata)
struct taxtable_pdata *pdata = taxtable_pdata;
return dom_tree_to_kvp_frame_given
(node, xaccAccountGetSlots (pdata->table));
(node, qof_instance_get_slots (QOF_INSTANCE (pdata->table)));
}
static struct dom_tree_handler taxtable_handlers_v2[] =

View File

@ -96,12 +96,12 @@ static void gnc_features_test_one(gpointer pkey, gpointer value,
gchar *gnc_features_test_unknown (QofBook *book)
{
/* Setup the known_features hash table */
gnc_features_init();
GList* features_list = NULL;
GHashTable *features_used = qof_book_get_features (book);
/* Setup the known_features hash table */
gnc_features_init();
/* Iterate over the members of this frame for unknown features */
g_hash_table_foreach (features_used, &gnc_features_test_one,
&features_list);

View File

@ -26,8 +26,7 @@
#include "config.h"
#include "gnc-ofx-kvp.h"
static void force_account_dirty(Account *acct);
/* OUTSIDE SLOT ACCESS */
static const char *KEY_ASSOC_INCOME_ACCOUNT = "ofx/associated-income-account";
Account *gnc_ofx_kvp_get_assoc_account(const Account* investment_account)
@ -36,7 +35,7 @@ Account *gnc_ofx_kvp_get_assoc_account(const Account* investment_account)
GncGUID *income_guid= NULL;
g_assert(investment_account);
qof_instance_get (QOF_INSTANCE (investment_account),
"ofx-income-account", &income_guid,
KEY_ASSOC_INCOME_ACCOUNT, &income_guid,
NULL);
return xaccAccountLookup(income_guid,
gnc_account_get_book(investment_account));
@ -53,7 +52,7 @@ void gnc_ofx_kvp_set_assoc_account(Account* investment_account,
income_acc_guid = xaccAccountGetGUID(income_account);
xaccAccountBeginEdit(investment_account);
qof_instance_set (QOF_INSTANCE (investment_account),
"ofx-income-account", income_acc_guid,
KEY_ASSOC_INCOME_ACCOUNT, income_acc_guid,
NULL);
xaccAccountCommitEdit(investment_account);
}

View File

@ -80,7 +80,8 @@ QOF_GOBJECT_DISPOSE(qof_book);
QOF_GOBJECT_FINALIZE(qof_book);
static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
#undef G_PARAM_READWRITE
#define G_PARAM_READWRITE static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_WRITABLE)
/* ====================================================================== */
/* constructor / destructor */
@ -151,11 +152,11 @@ qof_book_get_property (GObject* object,
qof_instance_get_kvp (QOF_INSTANCE (book), key, value);
g_free (key);
case PROP_OPT_FY_END:
key = "fy_end";
key = const_cast<char*>("fy_end");
qof_instance_get_kvp (QOF_INSTANCE (book), key, value);
break;
case PROP_AB_TEMPLATES:
key = AB_KEY "/" AB_TEMPLATES;
key = const_cast<char*>(AB_KEY "/" AB_TEMPLATES);
qof_instance_get_kvp (QOF_INSTANCE (book), key, value);
break;
default:
@ -208,11 +209,11 @@ qof_book_set_property (GObject *object,
g_free (key);
break;
case PROP_OPT_FY_END:
key = "fy_end";
key = const_cast<char*>("fy_end");
qof_instance_set_kvp (QOF_INSTANCE (book), key, value);
break;
case PROP_AB_TEMPLATES:
key = AB_KEY "/" AB_TEMPLATES;
key = const_cast<char*>(AB_KEY "/" AB_TEMPLATES);
qof_instance_set_kvp (QOF_INSTANCE (book), key, value);
break;
default:

View File

@ -113,4 +113,5 @@ void qof_instance_get_kvp (QofInstance *inst, const gchar *key, GValue *value);
}
#endif
#endif /* QOF_INSTANCE_P_H */

View File

@ -268,6 +268,8 @@ qof_log_prettify (const char *name)
begin = g_strrstr (buffer, "*");
if (begin == NULL)
begin = g_strrstr (buffer, " ");
else if (* (begin + 1) == ' ')
++ begin;
if (begin != NULL)
p = begin + 1;
else

View File

@ -682,7 +682,6 @@ gnc_template_register_save_xfrm_cell (BasicCell * cell,
/* set the actual account to the fake account for these templates */
xaccAccountInsertSplit (template_acc, sd->split);
qof_instance_set_dirty (QOF_INSTANCE (sd->split));
}
static void