diff -u trunk/src/engine/Account.c gda-dev/src/engine/Account.c --- trunk/src/engine/Account.c 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/Account.c 2007-04-07 13:24:50.000000000 -0400 @@ -1303,9 +1303,11 @@ if (gnc_commodity_is_iso(com)) { /* compatability hack - Gnucash 1.8 gets currency quotes when a non-default currency is assigned to an account. */ + gnc_commodity_begin_edit(com); gnc_commodity_set_quote_flag(com, TRUE); gnc_commodity_set_quote_source(com, gnc_commodity_get_default_quote_source(com)); + gnc_commodity_commit_edit(com); } xaccAccountCommitEdit(acc); } diff -u trunk/src/engine/gnc-budget.c gda-dev/src/engine/gnc-budget.c --- trunk/src/engine/gnc-budget.c 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/gnc-budget.c 2007-04-07 13:24:50.000000000 -0400 @@ -99,13 +99,13 @@ static void noop (QofInstance *inst) {} -static void +void gnc_budget_begin_edit(GncBudget *bgt) { qof_begin_edit(QOF_INSTANCE(bgt)); } -static void +void gnc_budget_commit_edit(GncBudget *bgt) { if (!qof_commit_edit(QOF_INSTANCE(bgt))) return; @@ -128,9 +128,11 @@ g_date_subtract_days(&date, g_date_get_day(&date)-1); recurrenceSet(&budget->recurrence, 1, PERIOD_MONTH, &date); + gnc_budget_begin_edit(budget); gnc_budget_set_name(budget, _("Unnamed Budget")); gnc_budget_set_description(budget, ""); gnc_budget_set_num_periods(budget, 12); + gnc_budget_commit_edit(budget); qof_event_gen( &budget->inst, QOF_EVENT_CREATE , NULL); diff -u trunk/src/engine/gnc-lot.c gda-dev/src/engine/gnc-lot.c --- trunk/src/engine/gnc-lot.c 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/gnc-lot.c 2007-04-07 13:24:50.000000000 -0400 @@ -168,26 +168,26 @@ } Account * -gnc_lot_get_account (GNCLot *lot) +gnc_lot_get_account (const GNCLot *lot) { if (!lot) return NULL; return lot->account; } KvpFrame * -gnc_lot_get_slots (GNCLot *lot) +gnc_lot_get_slots (const GNCLot *lot) { return qof_instance_get_slots(QOF_INSTANCE(lot)); } SplitList * -gnc_lot_get_split_list (GNCLot *lot) +gnc_lot_get_split_list (const GNCLot *lot) { if (!lot) return NULL; return lot->splits; } -gint gnc_lot_count_splits (GNCLot *lot) +gint gnc_lot_count_splits (const GNCLot *lot) { if (!lot) return 0; return g_list_length (lot->splits); @@ -197,14 +197,14 @@ /* Hmm, we should probably inline these. */ const char * -gnc_lot_get_title (GNCLot *lot) +gnc_lot_get_title (const GNCLot *lot) { if (!lot) return NULL; return kvp_frame_get_string (lot->inst.kvp_data, "/title"); } const char * -gnc_lot_get_notes (GNCLot *lot) +gnc_lot_get_notes (const GNCLot *lot) { if (!lot) return NULL; return kvp_frame_get_string (lot->inst.kvp_data, "/notes"); @@ -272,7 +272,7 @@ /* ============================================================= */ void -gnc_lot_get_balance_before (GNCLot *lot, Split *split, +gnc_lot_get_balance_before (const GNCLot *lot, const Split *split, gnc_numeric *amount, gnc_numeric *value) { GList *node; @@ -283,7 +283,7 @@ if (lot && lot->splits) { Transaction *ta, *tb; - Split *target; + const Split *target; /* If this is a gains split, find the source of the gains and use its transaction for the comparison. Gains splits are in separate transactions that may sort after non-gains transactions. */ diff -u trunk/src/engine/gnc-lot.h gda-dev/src/engine/gnc-lot.h --- trunk/src/engine/gnc-lot.h 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/gnc-lot.h 2007-04-07 13:34:57.000000000 -0400 @@ -105,12 +105,12 @@ * either gnc_lot_add_split() or gnc_lot_remove_split() will * invalidate the returned pointer. */ -SplitList * gnc_lot_get_split_list (GNCLot *); -gint gnc_lot_count_splits (GNCLot *); +SplitList * gnc_lot_get_split_list (const GNCLot *); +gint gnc_lot_count_splits (const GNCLot *); /** The gnc_lot_get_account() routine returns the account with which * this lot is associated. */ -Account * gnc_lot_get_account (GNCLot *); +Account * gnc_lot_get_account (const GNCLot *); /** The gnc_lot_get_balance() routine returns the balance of the lot. * The commodity in which this balance is expressed is the commodity @@ -121,7 +121,7 @@ * value in the lot considering only splits in transactions prior to the * one containing the given split or other splits in the same transaction. * The first return value is the amount and the second is the value. */ -void gnc_lot_get_balance_before (GNCLot *, Split *, +void gnc_lot_get_balance_before (const GNCLot *, const Split *, gnc_numeric *, gnc_numeric *); /** The gnc_lot_is_closed() routine returns a boolean flag: is this @@ -146,15 +146,15 @@ Split * gnc_lot_get_latest_split (GNCLot *lot); /** Get and set the account title, or the account notes. */ -const char * gnc_lot_get_title (GNCLot *); -const char * gnc_lot_get_notes (GNCLot *); +const char * gnc_lot_get_title (const GNCLot *); +const char * gnc_lot_get_notes (const GNCLot *); void gnc_lot_set_title (GNCLot *, const char *); void gnc_lot_set_notes (GNCLot *, const char *); /** Every lot has a place to hang kvp data. This routine returns that * place. * */ -KvpFrame * gnc_lot_get_slots (GNCLot *); +KvpFrame * gnc_lot_get_slots (const GNCLot *); #define gnc_lot_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X)) diff -u trunk/src/engine/gnc-pricedb.c gda-dev/src/engine/gnc-pricedb.c --- trunk/src/engine/gnc-pricedb.c 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/gnc-pricedb.c 2007-04-07 13:38:13.000000000 -0400 @@ -330,14 +330,14 @@ } gnc_commodity * -gnc_price_get_commodity(GNCPrice *p) +gnc_price_get_commodity(const GNCPrice *p) { if(!p) return NULL; return p->commodity; } Timespec -gnc_price_get_time(GNCPrice *p) +gnc_price_get_time(const GNCPrice *p) { if(!p) { Timespec result; @@ -349,21 +349,21 @@ } const char * -gnc_price_get_source(GNCPrice *p) +gnc_price_get_source(const GNCPrice *p) { if(!p) return NULL; return p->source; } const char * -gnc_price_get_typestr(GNCPrice *p) +gnc_price_get_typestr(const GNCPrice *p) { if(!p) return NULL; return p->type; } gnc_numeric -gnc_price_get_value(GNCPrice *p) +gnc_price_get_value(const GNCPrice *p) { if(!p) { PERR("price NULL.\n"); @@ -373,21 +373,21 @@ } gnc_commodity * -gnc_price_get_currency(GNCPrice *p) +gnc_price_get_currency(const GNCPrice *p) { if(!p) return NULL; return p->currency; } gint32 -gnc_price_get_version(GNCPrice *p) +gnc_price_get_version(const GNCPrice *p) { if(!p) return 0; return (p->version); } gboolean -gnc_price_equal (GNCPrice *p1, GNCPrice *p2) +gnc_price_equal (const GNCPrice *p1, const GNCPrice *p2) { Timespec ts1; Timespec ts2; diff -u trunk/src/engine/gnc-pricedb.h gda-dev/src/engine/gnc-pricedb.h --- trunk/src/engine/gnc-pricedb.h 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/gnc-pricedb.h 2007-04-07 13:36:09.000000000 -0400 @@ -220,14 +220,14 @@ /** As mentioned above all of the getters return data that's internal to the GNCPrice, not copies, so don't free these values. */ GNCPrice * gnc_price_lookup (const GUID *guid, QofBook *book); -gnc_commodity * gnc_price_get_commodity(GNCPrice *p); -gnc_commodity * gnc_price_get_currency(GNCPrice *p); -Timespec gnc_price_get_time(GNCPrice *p); -const char * gnc_price_get_source(GNCPrice *p); -const char * gnc_price_get_typestr(GNCPrice *p); -gnc_numeric gnc_price_get_value(GNCPrice *p); -gint32 gnc_price_get_version(GNCPrice *p); -gboolean gnc_price_equal(GNCPrice *p1, GNCPrice *p2); +gnc_commodity * gnc_price_get_commodity(const GNCPrice *p); +gnc_commodity * gnc_price_get_currency(const GNCPrice *p); +Timespec gnc_price_get_time(const GNCPrice *p); +const char * gnc_price_get_source(const GNCPrice *p); +const char * gnc_price_get_typestr(const GNCPrice *p); +gnc_numeric gnc_price_get_value(const GNCPrice *p); +gint32 gnc_price_get_version(const GNCPrice *p); +gboolean gnc_price_equal(const GNCPrice *p1, const GNCPrice *p2); #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)))) diff -u trunk/src/engine/SchedXaction.c gda-dev/src/engine/SchedXaction.c --- trunk/src/engine/SchedXaction.c 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/SchedXaction.c 2007-04-07 13:31:58.000000000 -0400 @@ -239,7 +239,7 @@ /* ============================================================ */ FreqSpec * -xaccSchedXactionGetFreqSpec( SchedXaction *sx ) +xaccSchedXactionGetFreqSpec( const SchedXaction *sx ) { return sx->freq; } @@ -257,7 +257,7 @@ } GList* -gnc_sx_get_schedule(SchedXaction *sx) +gnc_sx_get_schedule(const SchedXaction *sx) { return sx->schedule; } @@ -273,7 +273,7 @@ } gchar * -xaccSchedXactionGetName( SchedXaction *sx ) +xaccSchedXactionGetName( const SchedXaction *sx ) { return sx->name; } @@ -308,7 +308,7 @@ } gboolean -xaccSchedXactionHasEndDate( SchedXaction *sx ) +xaccSchedXactionHasEndDate( const SchedXaction *sx ) { return g_date_valid( &sx->end_date ); } @@ -355,13 +355,13 @@ } gboolean -xaccSchedXactionHasOccurDef( SchedXaction *sx ) +xaccSchedXactionHasOccurDef( const SchedXaction *sx ) { return ( xaccSchedXactionGetNumOccur( sx ) != 0 ); } gint -xaccSchedXactionGetNumOccur( SchedXaction *sx ) +xaccSchedXactionGetNumOccur( const SchedXaction *sx ) { return sx->num_occurances_total; } @@ -376,7 +376,7 @@ } gint -xaccSchedXactionGetRemOccur( SchedXaction *sx ) +xaccSchedXactionGetRemOccur( const SchedXaction *sx ) { return sx->num_occurances_remain; } @@ -401,7 +401,7 @@ KvpValue * -xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot ) +xaccSchedXactionGetSlot( const SchedXaction *sx, const char *slot ) { if (!sx) return NULL; @@ -422,7 +422,7 @@ } gboolean -xaccSchedXactionGetEnabled( SchedXaction *sx ) +xaccSchedXactionGetEnabled( const SchedXaction *sx ) { return sx->enabled; } @@ -437,7 +437,7 @@ } void -xaccSchedXactionGetAutoCreate( SchedXaction *sx, +xaccSchedXactionGetAutoCreate( const SchedXaction *sx, gboolean *outAutoCreate, gboolean *outNotify ) { @@ -463,7 +463,7 @@ } gint -xaccSchedXactionGetAdvanceCreation( SchedXaction *sx ) +xaccSchedXactionGetAdvanceCreation( const SchedXaction *sx ) { return sx->advanceCreateDays; } @@ -478,7 +478,7 @@ } gint -xaccSchedXactionGetAdvanceReminder( SchedXaction *sx ) +xaccSchedXactionGetAdvanceReminder( const SchedXaction *sx ) { return sx->advanceRemindDays; } @@ -604,7 +604,7 @@ } gint -gnc_sx_get_instance_count( SchedXaction *sx, void *stateData ) +gnc_sx_get_instance_count( const SchedXaction *sx, void *stateData ) { gint toRet = -1; temporalStateData *tsd; @@ -627,7 +627,7 @@ } GList * -xaccSchedXactionGetSplits( SchedXaction *sx ) +xaccSchedXactionGetSplits( const SchedXaction *sx ) { g_return_val_if_fail( sx, NULL ); return xaccAccountGetSplitList(sx->template_acct); diff -u trunk/src/engine/SchedXaction.h gda-dev/src/engine/SchedXaction.h --- trunk/src/engine/SchedXaction.h 2007-04-07 12:12:56.000000000 -0400 +++ gda-dev/src/engine/SchedXaction.h 2007-04-07 13:30:56.000000000 -0400 @@ -150,18 +150,18 @@ void gnc_sx_commit_edit (SchedXaction *sx); /** @return GList **/ -GList* gnc_sx_get_schedule(SchedXaction *sx); +GList* gnc_sx_get_schedule(const SchedXaction *sx); /** @param[in] schedule A GList **/ void gnc_sx_set_schedule(SchedXaction *sx, GList *schedule); -FreqSpec *xaccSchedXactionGetFreqSpec( SchedXaction *sx ); +FreqSpec *xaccSchedXactionGetFreqSpec( const SchedXaction *sx ); /** * The FreqSpec is given to the SchedXaction for mem mgmt; it should * not be freed by the external code. */ void xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs ); -gchar *xaccSchedXactionGetName( SchedXaction *sx ); +gchar *xaccSchedXactionGetName( const SchedXaction *sx ); /** * A copy of the name is made. */ @@ -170,7 +170,7 @@ GDate* xaccSchedXactionGetStartDate( SchedXaction *sx ); void xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart ); -int xaccSchedXactionHasEndDate( SchedXaction *sx ); +int xaccSchedXactionHasEndDate( const SchedXaction *sx ); /** * Returns invalid date when there is no end-date specified. */ @@ -187,13 +187,13 @@ * Returns true if the scheduled transaction has a defined number of * occurances, false if not. */ -gboolean xaccSchedXactionHasOccurDef( SchedXaction *sx ); -gint xaccSchedXactionGetNumOccur( SchedXaction *sx ); +gboolean xaccSchedXactionHasOccurDef( const SchedXaction *sx ); +gint xaccSchedXactionGetNumOccur( const SchedXaction *sx ); /** * Set to '0' to turn off number-of-occurances definition. */ void xaccSchedXactionSetNumOccur( SchedXaction *sx, gint numNum ); -gint xaccSchedXactionGetRemOccur( SchedXaction *sx ); +gint xaccSchedXactionGetRemOccur( const SchedXaction *sx ); void xaccSchedXactionSetRemOccur( SchedXaction *sx, gint numRemain ); /** \brief Set the instance count. @@ -205,30 +205,30 @@ * @param sx The instance whose state should be retrieved. * @param stateData may be NULL. */ -gint gnc_sx_get_instance_count( SchedXaction *sx, void *stateData ); +gint gnc_sx_get_instance_count( const SchedXaction *sx, void *stateData ); /** * Sets the instance count to something other than the default. As the * default is the incorrect value '0', callers should DTRT here. */ void gnc_sx_set_instance_count( SchedXaction *sx, gint instanceNum ); -GList *xaccSchedXactionGetSplits( SchedXaction *sx ); +GList *xaccSchedXactionGetSplits( const SchedXaction *sx ); void xaccSchedXactionSetSplits( SchedXaction *sx, GList *newSplits ); -gboolean xaccSchedXactionGetEnabled( SchedXaction *sx ); +gboolean xaccSchedXactionGetEnabled( const SchedXaction *sx ); void xaccSchedXactionSetEnabled( SchedXaction *sx, gboolean newEnabled ); -void xaccSchedXactionGetAutoCreate( SchedXaction *sx, +void xaccSchedXactionGetAutoCreate( const SchedXaction *sx, gboolean *outAutoCreate, gboolean *outNotify ); void xaccSchedXactionSetAutoCreate( SchedXaction *sx, gboolean newAutoCreate, gboolean newNotify ); -gint xaccSchedXactionGetAdvanceCreation( SchedXaction *sx ); +gint xaccSchedXactionGetAdvanceCreation( const SchedXaction *sx ); void xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays ); -gint xaccSchedXactionGetAdvanceReminder( SchedXaction *sx ); +gint xaccSchedXactionGetAdvanceReminder( const SchedXaction *sx ); void xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays ); /** \name Temporal state data. @@ -323,7 +323,7 @@ #define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X)) /** \deprecated to be replaced with 'dirty' kvp's */ -KvpValue *xaccSchedXactionGetSlot( SchedXaction *sx, +KvpValue *xaccSchedXactionGetSlot( const SchedXaction *sx, const char *slot ); /** \deprecated to be replaced with 'dirty' kvp's */ void xaccSchedXactionSetSlot( SchedXaction *sx,