Skip to content

Commit

Permalink
Use the existing QOF API to modify the instance dirty flag.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13912 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
David Hampton committed May 3, 2006
1 parent 222b2b2 commit 2ba716c
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 51 deletions.
20 changes: 20 additions & 0 deletions ChangeLog
@@ -1,3 +1,23 @@
2006-05-02 David Hampton <hampton@employees.org>

* src/backend/postgres/price.c:
* src/business/business-core/gncJob.c:
* src/business/business-core/gncInvoice.c:
* src/business/business-core/gncVendor.c:
* src/business/business-core/gncEntry.c:
* src/business/business-core/gncCustomer.c:
* src/business/business-core/gncBillTerm.c:
* src/business/business-core/gncOrder.c:
* src/business/business-core/gncEmployee.c:
* src/business/business-core/gncTaxTable.c:
* src/engine/gnc-budget.c:
* src/engine/Account.c:
* src/engine/Group.c:
* src/engine/gnc-commodity.c:
* src/engine/SchedXaction.c:
* lib/libqof/qof/qofobject.c: Use the existing QOF API to modify
the instance dirty flag.

2006-05-02 Andreas Köhler <andi5.py@gmx.net>

* src/gnome/glade/sched-xact.glade: Correct option strings in sx
Expand Down
3 changes: 2 additions & 1 deletion src/backend/postgres/price.c
Expand Up @@ -520,7 +520,8 @@ pgend_price_commit_edit (QofBackend * bend, GNCPrice *pr)
SEND_QUERY (be,bufp,);
FINISH_QUERY(be->connection);

if (pr->db) pr->db->inst.dirty = FALSE;
if (pr->db)
qof_instance_mark_clean(&pr->db->inst);

LEAVE ("commited");
return;
Expand Down
5 changes: 2 additions & 3 deletions src/business/business-core/gncBillTerm.c
Expand Up @@ -84,8 +84,7 @@ FROM_STRING_DEC(GncBillTermType, ENUM_TERMS_TYPE)
static inline void
mark_term (GncBillTerm *term)
{
term->inst.dirty = TRUE;
qof_collection_mark_dirty (term->inst.entity.collection);
qof_instance_set_dirty(&term->inst);
qof_event_gen (&term->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down Expand Up @@ -151,7 +150,7 @@ void gncBillTermDestroy (GncBillTerm *term)
DEBUG("destroying bill term %s (%p)",
guid_to_string(qof_instance_get_guid(&term->inst)), term);
term->inst.do_free = TRUE;
qof_collection_mark_dirty (term->inst.entity.collection);
qof_instance_set_dirty (&term->inst);
gncBillTermCommitEdit (term);
}

Expand Down
5 changes: 2 additions & 3 deletions src/business/business-core/gncCustomer.c
Expand Up @@ -78,8 +78,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
G_INLINE_FUNC void mark_customer (GncCustomer *customer);
void mark_customer (GncCustomer *customer)
{
customer->inst.dirty = TRUE;
qof_collection_mark_dirty (customer->inst.entity.collection);
qof_instance_set_dirty(&customer->inst);
qof_event_gen (&customer->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down Expand Up @@ -160,7 +159,7 @@ void gncCustomerDestroy (GncCustomer *cust)
{
if (!cust) return;
cust->inst.do_free = TRUE;
qof_collection_mark_dirty (cust->inst.entity.collection);
qof_instance_set_dirty (&cust->inst);
gncCustomerCommitEdit (cust);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncEmployee.c
Expand Up @@ -61,8 +61,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
G_INLINE_FUNC void mark_employee (GncEmployee *employee);
void mark_employee (GncEmployee *employee)
{
employee->inst.dirty = TRUE;
qof_collection_mark_dirty (employee->inst.entity.collection);
qof_instance_set_dirty(&employee->inst);
qof_event_gen (&employee->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncEntry.c
Expand Up @@ -168,8 +168,7 @@ gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type
G_INLINE_FUNC void mark_entry (GncEntry *entry);
void mark_entry (GncEntry *entry)
{
entry->inst.dirty = TRUE;
qof_collection_mark_dirty (entry->inst.entity.collection);
qof_instance_set_dirty(&entry->inst);
qof_event_gen (&entry->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncInvoice.c
Expand Up @@ -90,8 +90,7 @@ static void mark_invoice (GncInvoice *invoice);
static void
mark_invoice (GncInvoice *invoice)
{
invoice->inst.dirty = TRUE;
qof_collection_mark_dirty (invoice->inst.entity.collection);
qof_instance_set_dirty(&invoice->inst);
qof_event_gen (&invoice->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncJob.c
Expand Up @@ -56,8 +56,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
G_INLINE_FUNC void mark_job (GncJob *job);
void mark_job (GncJob *job)
{
job->inst.dirty = TRUE;
qof_collection_mark_dirty (job->inst.entity.collection);
qof_instance_set_dirty(&job->inst);
qof_event_gen (&job->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncOrder.c
Expand Up @@ -70,8 +70,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
G_INLINE_FUNC void mark_order (GncOrder *order);
void mark_order (GncOrder *order)
{
order->inst.dirty = TRUE;
qof_collection_mark_dirty (order->inst.entity.collection);
qof_instance_set_dirty(&order->inst);
qof_event_gen (&order->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
5 changes: 2 additions & 3 deletions src/business/business-core/gncTaxTable.c
Expand Up @@ -143,8 +143,7 @@ gncTaxIncludedStringToType (const char *str, GncTaxIncluded *type)
static inline void
mark_table (GncTaxTable *table)
{
table->inst.dirty = TRUE;
qof_collection_mark_dirty (table->inst.entity.collection);
qof_instance_set_dirty(&table->inst);
qof_event_gen (&table->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down Expand Up @@ -289,7 +288,7 @@ gncTaxTableDestroy (GncTaxTable *table)
{
if (!table) return;
table->inst.do_free = TRUE;
qof_collection_mark_dirty (table->inst.entity.collection);
qof_instance_set_dirty (&table->inst);
gncTaxTableCommitEdit (table);
}

Expand Down
3 changes: 1 addition & 2 deletions src/business/business-core/gncVendor.c
Expand Up @@ -67,8 +67,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
G_INLINE_FUNC void mark_vendor (GncVendor *vendor);
void mark_vendor (GncVendor *vendor)
{
vendor->inst.dirty = TRUE;
qof_collection_mark_dirty (vendor->inst.entity.collection);
qof_instance_set_dirty(&vendor->inst);
qof_event_gen (&vendor->inst.entity, QOF_EVENT_MODIFY, NULL);
}

Expand Down
14 changes: 7 additions & 7 deletions src/engine/Account.c
Expand Up @@ -101,7 +101,7 @@ void
mark_account (Account *acc)
{
if (acc->parent) acc->parent->saved = FALSE;
acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
}

/********************************************************************\
Expand Down Expand Up @@ -215,7 +215,7 @@ Account *
xaccCloneAccountSimple (const Account *from, QofBook *book)
{
Account *ret = xaccCloneAccountCommon(from, book);
ret->inst.dirty = TRUE;
qof_instance_set_dirty(&ret->inst);
return ret;
}

Expand Down Expand Up @@ -393,7 +393,7 @@ xaccAccountCommitEdit (Account *acc)
g_list_free (acc->lots);
acc->lots = NULL;

acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
acc->inst.editlevel--;
}
else
Expand Down Expand Up @@ -675,7 +675,7 @@ xaccAccountSetGUID (Account *acc, const GUID *guid)
PINFO("acct=%p", acc);
xaccAccountBeginEdit (acc);
qof_entity_set_guid (&acc->inst.entity, guid);
acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit (acc);
}

Expand Down Expand Up @@ -1245,7 +1245,7 @@ DxaccAccountSetCurrency (Account * acc, gnc_commodity * currency)
kvp_frame_set_slot_nc(acc->inst.kvp_data, "old-currency",
kvp_value_new_string(string));
mark_account (acc);
acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit(acc);

commodity = DxaccAccountGetCurrency (acc);
Expand Down Expand Up @@ -2488,7 +2488,7 @@ dxaccAccountSetPriceSrc(Account *acc, const char *src)
mark_account (acc);
}

acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit(acc);
}

Expand Down Expand Up @@ -2523,7 +2523,7 @@ dxaccAccountSetQuoteTZ(Account *acc, const char *tz)
tz ? kvp_value_new_string(tz) : NULL);
mark_account (acc);
}
acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit(acc);
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/Group.c
Expand Up @@ -797,7 +797,7 @@ xaccGroupInsertAccount (AccountGroup *grp, Account *acc)
/* Gather event data */
qof_event_gen (&acc->inst.entity, QOF_EVENT_ADD, NULL);

acc->inst.dirty = TRUE;
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit (acc);
}

Expand Down Expand Up @@ -861,7 +861,7 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
to->accounts = g_list_append (to->accounts, to_acc);

to_acc->parent = to;
to_acc->inst.dirty = TRUE;
qof_instance_set_dirty(&to_acc->inst);

/* Copy child accounts too. */
if (from_acc->children)
Expand Down
24 changes: 12 additions & 12 deletions src/engine/SchedXaction.c
Expand Up @@ -194,7 +194,7 @@ xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs )

xaccFreqSpecFree( sx->freq );
sx->freq = fs;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

gchar *
Expand All @@ -211,8 +211,8 @@ xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName )
g_free( sx->name );
sx->name = NULL;
}
sx->inst.dirty = TRUE;
sx->name = g_strdup( newName );
qof_instance_set_dirty(&sx->inst);
}

GDate*
Expand All @@ -225,7 +225,7 @@ void
xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart )
{
sx->start_date = *newStart;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

gboolean
Expand Down Expand Up @@ -255,7 +255,7 @@ xaccSchedXactionSetEndDate( SchedXaction *sx, GDate *newEnd )
}

sx->end_date = *newEnd;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

GDate*
Expand All @@ -268,7 +268,7 @@ void
xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur )
{
sx->last_date = *newLastOccur;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

gboolean
Expand All @@ -287,7 +287,7 @@ void
xaccSchedXactionSetNumOccur( SchedXaction *sx, gint newNum )
{
sx->num_occurances_remain = sx->num_occurances_total = newNum;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

gint
Expand All @@ -308,7 +308,7 @@ xaccSchedXactionSetRemOccur( SchedXaction *sx,
else
{
sx->num_occurances_remain = numRemain;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}
}

Expand All @@ -329,7 +329,7 @@ xaccSchedXactionSetSlot( SchedXaction *sx,
if (!sx) return;

kvp_frame_set_slot( sx->inst.kvp_data, slot, value );
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

void
Expand All @@ -350,7 +350,7 @@ xaccSchedXactionSetAutoCreate( SchedXaction *sx,

sx->autoCreateOption = newAutoCreate;
sx->autoCreateNotify = newNotify;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
return;
}

Expand All @@ -364,7 +364,7 @@ void
xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays )
{
sx->advanceCreateDays = createDays;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

gint
Expand All @@ -376,8 +376,8 @@ xaccSchedXactionGetAdvanceReminder( SchedXaction *sx )
void
xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays )
{
sx->inst.dirty = TRUE;
sx->advanceRemindDays = reminderDays;
qof_instance_set_dirty(&sx->inst);
}


Expand Down Expand Up @@ -660,7 +660,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;
sx->inst.dirty = TRUE;
qof_instance_set_dirty(&sx->inst);
}

void
Expand Down
12 changes: 6 additions & 6 deletions src/engine/gnc-budget.c
Expand Up @@ -79,7 +79,7 @@ gnc_budget_free(GncBudget* budget)

g_return_if_fail(GNC_IS_BUDGET(budget));

qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->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. */
Expand All @@ -98,7 +98,7 @@ gnc_budget_set_name(GncBudget* budget, const gchar* name)
g_return_if_fail(GNC_IS_BUDGET(budget) && name);

CACHE_REPLACE(budget->name, name);
qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->inst);

qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
}
Expand All @@ -117,7 +117,7 @@ gnc_budget_set_description(GncBudget* budget, const gchar* description)
g_return_if_fail(description);

CACHE_REPLACE(budget->description, description);
qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->inst);

qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
}
Expand All @@ -134,7 +134,7 @@ gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r)
{
g_return_if_fail(budget && r);
budget->recurrence = *r;
qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->inst);

qof_event_gen(&budget->inst.entity, QOF_EVENT_MODIFY, NULL);
}
Expand All @@ -159,7 +159,7 @@ gnc_budget_set_num_periods(GncBudget* budget, guint num_periods)
{
g_return_if_fail(GNC_IS_BUDGET(budget));
budget->num_periods = num_periods;
qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->inst);

qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ gnc_budget_set_account_period_value(GncBudget *budget, Account *account,
g_sprintf(bufend, "/%d", period_num);

kvp_frame_set_numeric(frame, path, val);
qof_collection_mark_dirty(budget->inst.entity.collection);
qof_instance_set_dirty(&budget->inst);

qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);

Expand Down

0 comments on commit 2ba716c

Please sign in to comment.