mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add begin_edit/commit_edit brackets around object modifications. Some
other related edit changes. Bug #339943 should be fixed as of this change. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13928 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -1,5 +1,21 @@
|
||||
2006-05-06 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/dialog-commodity.c:
|
||||
* src/engine/gnc-lot.[ch]:
|
||||
* src/engine/gnc-commodity.[ch]:
|
||||
* src/engine/SchedXaction.[ch]: Add begin_edit/commit_edit
|
||||
brackets around object modifications. Bug #339943 should be fixed
|
||||
as of this change.
|
||||
|
||||
* src/engine/gnc-pricedb.c: No longer need special handling when
|
||||
marking prices as dirty.
|
||||
|
||||
* src/engine/Account.c: Remove redundant setting an account dirty.
|
||||
Set collection clean/dirty functions.
|
||||
|
||||
* src/engine/gnc-engine.c: Unconditionally enable qof alternate
|
||||
dirty mode.
|
||||
|
||||
* lib/libqof/qof/qofbook.[ch]:
|
||||
* lib/libqof/qof/qofid-p.h:
|
||||
* lib/libqof/qof/qofinstance.[ch]:
|
||||
|
||||
@@ -1245,7 +1245,6 @@ 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);
|
||||
qof_instance_set_dirty(&acc->inst);
|
||||
xaccAccountCommitEdit(acc);
|
||||
|
||||
commodity = DxaccAccountGetCurrency (acc);
|
||||
@@ -2657,8 +2656,8 @@ static QofObject account_object_def = {
|
||||
create: (gpointer)xaccMallocAccount,
|
||||
book_begin: NULL,
|
||||
book_end: NULL,
|
||||
is_dirty: NULL,
|
||||
mark_clean: NULL,
|
||||
is_dirty: qof_collection_is_dirty,
|
||||
mark_clean: qof_collection_mark_clean,
|
||||
foreach: qof_collection_foreach,
|
||||
printable: (const char* (*)(gpointer)) xaccAccountGetName,
|
||||
version_cmp: (int (*)(gpointer,gpointer)) qof_instance_version_cmp,
|
||||
|
||||
@@ -181,6 +181,28 @@ xaccSchedXactionFree( SchedXaction *sx )
|
||||
|
||||
/* ============================================================ */
|
||||
|
||||
void
|
||||
gnc_sx_begin_edit (SchedXaction *sx)
|
||||
{
|
||||
qof_begin_edit (&sx->inst);
|
||||
}
|
||||
|
||||
static inline void commit_err (QofInstance *inst, QofBackendError errcode)
|
||||
{
|
||||
PERR ("Failed to commit: %d", errcode);
|
||||
}
|
||||
|
||||
static inline void noop (QofInstance *inst) {}
|
||||
|
||||
void
|
||||
gnc_sx_commit_edit (SchedXaction *sx)
|
||||
{
|
||||
if (!qof_commit_edit (QOF_INSTANCE(sx))) return;
|
||||
qof_commit_edit_part2 (&sx->inst, commit_err, noop, noop);
|
||||
}
|
||||
|
||||
/* ============================================================ */
|
||||
|
||||
FreqSpec *
|
||||
xaccSchedXactionGetFreqSpec( SchedXaction *sx )
|
||||
{
|
||||
@@ -192,9 +214,11 @@ xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs )
|
||||
{
|
||||
g_return_if_fail( fs );
|
||||
|
||||
gnc_sx_begin_edit(sx);
|
||||
xaccFreqSpecFree( sx->freq );
|
||||
sx->freq = fs;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
gchar *
|
||||
@@ -207,12 +231,14 @@ void
|
||||
xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName )
|
||||
{
|
||||
g_return_if_fail( newName != NULL );
|
||||
gnc_sx_begin_edit(sx);
|
||||
if ( sx->name != NULL ) {
|
||||
g_free( sx->name );
|
||||
sx->name = NULL;
|
||||
}
|
||||
sx->name = g_strdup( newName );
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
GDate*
|
||||
@@ -224,8 +250,10 @@ xaccSchedXactionGetStartDate( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->start_date = *newStart;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -254,8 +282,10 @@ xaccSchedXactionSetEndDate( SchedXaction *sx, GDate *newEnd )
|
||||
return;
|
||||
}
|
||||
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->end_date = *newEnd;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
GDate*
|
||||
@@ -267,8 +297,10 @@ xaccSchedXactionGetLastOccurDate( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->last_date = *newLastOccur;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -286,8 +318,10 @@ xaccSchedXactionGetNumOccur( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetNumOccur( SchedXaction *sx, gint newNum )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = sx->num_occurances_total = newNum;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -307,8 +341,10 @@ xaccSchedXactionSetRemOccur( SchedXaction *sx,
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = numRemain;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,8 +364,10 @@ 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(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -348,9 +386,11 @@ xaccSchedXactionSetAutoCreate( SchedXaction *sx,
|
||||
gboolean newNotify )
|
||||
{
|
||||
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->autoCreateOption = newAutoCreate;
|
||||
sx->autoCreateNotify = newNotify;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -363,8 +403,10 @@ xaccSchedXactionGetAdvanceCreation( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->advanceCreateDays = createDays;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -376,8 +418,10 @@ xaccSchedXactionGetAdvanceReminder( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays )
|
||||
{
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->advanceRemindDays = reminderDays;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
|
||||
@@ -657,10 +701,12 @@ void
|
||||
gnc_sx_revert_to_temporal_state( SchedXaction *sx, void *stateData )
|
||||
{
|
||||
temporalStateData *tsd = (temporalStateData*)stateData;
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->last_date = tsd->last_date;
|
||||
sx->num_occurances_remain = tsd->num_occur_rem;
|
||||
sx->instance_num = tsd->num_inst;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -738,8 +784,8 @@ static QofObject SXDesc =
|
||||
create : (gpointer)xaccSchedXactionMalloc,
|
||||
book_begin : NULL,
|
||||
book_end : NULL,
|
||||
is_dirty : NULL,
|
||||
mark_clean : NULL,
|
||||
is_dirty : qof_collection_is_dirty,
|
||||
mark_clean : qof_collection_mark_clean,
|
||||
foreach : qof_collection_foreach,
|
||||
printable : NULL,
|
||||
version_cmp : (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
|
||||
@@ -57,6 +57,9 @@ SchedXaction *xaccSchedXactionMalloc(QofBook *book);
|
||||
*/
|
||||
void xaccSchedXactionFree( SchedXaction *sx );
|
||||
|
||||
void gnc_sx_begin_edit (SchedXaction *sx);
|
||||
void gnc_sx_commit_edit (SchedXaction *sx);
|
||||
|
||||
FreqSpec *xaccSchedXactionGetFreqSpec( SchedXaction *sx );
|
||||
/**
|
||||
* The FreqSpec is given to the SchedXaction for mem mgmt; it should
|
||||
|
||||
@@ -467,6 +467,30 @@ gnc_quote_source_set_fq_installed (GList *sources_list)
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* QoF Helpers
|
||||
********************************************************************/
|
||||
|
||||
void
|
||||
gnc_commodity_begin_edit (gnc_commodity *cm)
|
||||
{
|
||||
qof_begin_edit(&cm->inst);
|
||||
}
|
||||
|
||||
static inline void commit_err (QofInstance *inst, QofBackendError errcode)
|
||||
{
|
||||
PERR ("Failed to commit: %d", errcode);
|
||||
}
|
||||
|
||||
static inline void noop (QofInstance *inst) {}
|
||||
|
||||
void
|
||||
gnc_commodity_commit_edit (gnc_commodity *cm)
|
||||
{
|
||||
if (!qof_commit_edit (QOF_INSTANCE(cm))) return;
|
||||
qof_commit_edit_part2 (&cm->inst, commit_err, noop, noop);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_commodity_new
|
||||
********************************************************************/
|
||||
@@ -775,12 +799,14 @@ gnc_commodity_set_mnemonic(gnc_commodity * cm, const char * mnemonic)
|
||||
if(!cm) return;
|
||||
if(cm->mnemonic == mnemonic) return;
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
CACHE_REMOVE (cm->mnemonic);
|
||||
cm->mnemonic = CACHE_INSERT(mnemonic);
|
||||
|
||||
mark_commodity_dirty (cm);
|
||||
reset_printname(cm);
|
||||
reset_unique_name(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -801,12 +827,14 @@ gnc_commodity_set_namespace(gnc_commodity * cm, const char * namespace)
|
||||
if (cm->namespace == nsp)
|
||||
return;
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
cm->namespace = nsp;
|
||||
if (nsp->iso4217)
|
||||
cm->quote_source = gnc_quote_source_lookup_by_internal("currency");
|
||||
mark_commodity_dirty(cm);
|
||||
reset_printname(cm);
|
||||
reset_unique_name(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -822,8 +850,10 @@ gnc_commodity_set_fullname(gnc_commodity * cm, const char * fullname)
|
||||
CACHE_REMOVE (cm->fullname);
|
||||
cm->fullname = CACHE_INSERT (fullname);
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
mark_commodity_dirty(cm);
|
||||
reset_printname(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -837,9 +867,11 @@ gnc_commodity_set_cusip(gnc_commodity * cm,
|
||||
if(!cm) return;
|
||||
if(cm->cusip == cusip) return;
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
CACHE_REMOVE (cm->cusip);
|
||||
cm->cusip = CACHE_INSERT (cusip);
|
||||
mark_commodity_dirty(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -850,8 +882,10 @@ void
|
||||
gnc_commodity_set_fraction(gnc_commodity * cm, int fraction)
|
||||
{
|
||||
if(!cm) return;
|
||||
gnc_commodity_begin_edit(cm);
|
||||
cm->fraction = fraction;
|
||||
mark_commodity_dirty(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@@ -875,8 +909,10 @@ gnc_commodity_set_quote_flag(gnc_commodity *cm, const gboolean flag)
|
||||
ENTER ("(cm=%p, flag=%d)", cm, flag);
|
||||
|
||||
if(!cm) return;
|
||||
gnc_commodity_begin_edit(cm);
|
||||
cm->quote_flag = flag;
|
||||
mark_commodity_dirty(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
@@ -890,8 +926,10 @@ gnc_commodity_set_quote_source(gnc_commodity *cm, gnc_quote_source *src)
|
||||
ENTER ("(cm=%p, src=%p(%s))", cm, src, src ? src->internal_name : "unknown");
|
||||
|
||||
if(!cm) return;
|
||||
gnc_commodity_begin_edit(cm);
|
||||
cm->quote_source = src;
|
||||
mark_commodity_dirty(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
@@ -906,10 +944,11 @@ gnc_commodity_set_quote_tz(gnc_commodity *cm, const char *tz)
|
||||
|
||||
if(!cm || tz == cm->quote_tz) return;
|
||||
|
||||
gnc_commodity_begin_edit(cm);
|
||||
CACHE_REMOVE (cm->quote_tz);
|
||||
cm->quote_tz = CACHE_INSERT (tz);
|
||||
|
||||
mark_commodity_dirty(cm);
|
||||
gnc_commodity_commit_edit(cm);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
@@ -1802,8 +1841,8 @@ static QofObject commodity_table_object_def =
|
||||
create: NULL,
|
||||
book_begin: commodity_table_book_begin,
|
||||
book_end: commodity_table_book_end,
|
||||
is_dirty: NULL,
|
||||
mark_clean: NULL,
|
||||
is_dirty: qof_collection_is_dirty,
|
||||
mark_clean: qof_collection_mark_clean,
|
||||
foreach: NULL,
|
||||
printable: NULL,
|
||||
version_cmp: NULL,
|
||||
|
||||
@@ -881,6 +881,9 @@ gnc_commodity * gnc_commodity_obtain_twin (gnc_commodity *from, QofBook *book);
|
||||
* commodity table.
|
||||
*/
|
||||
gboolean gnc_commodity_table_register (void);
|
||||
|
||||
void gnc_commodity_begin_edit (gnc_commodity *cm);
|
||||
void gnc_commodity_commit_edit (gnc_commodity *cm);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -101,6 +101,28 @@ gnc_lot_destroy (GNCLot *lot)
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
void
|
||||
gnc_lot_begin_edit (GNCLot *lot)
|
||||
{
|
||||
qof_begin_edit(&lot->inst);
|
||||
}
|
||||
|
||||
static inline void commit_err (QofInstance *inst, QofBackendError errcode)
|
||||
{
|
||||
PERR ("Failed to commit: %d", errcode);
|
||||
}
|
||||
|
||||
static inline void noop (QofInstance *inst) {}
|
||||
|
||||
void
|
||||
gnc_lot_commit_edit (GNCLot *lot)
|
||||
{
|
||||
if (!qof_commit_edit (QOF_INSTANCE(lot))) return;
|
||||
qof_commit_edit_part2 (&lot->inst, commit_err, noop, noop);
|
||||
}
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
GNCLot *
|
||||
gnc_lot_lookup (const GUID *guid, QofBook *book)
|
||||
{
|
||||
@@ -173,16 +195,20 @@ void
|
||||
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));
|
||||
return kvp_frame_set_str (lot->inst.kvp_data, "/title", str);
|
||||
kvp_frame_set_str (lot->inst.kvp_data, "/title", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_lot_set_notes (GNCLot *lot, const char *str)
|
||||
{
|
||||
if (!lot) return;
|
||||
gnc_lot_begin_edit(lot);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
return kvp_frame_set_str (lot->inst.kvp_data, "/notes", str);
|
||||
kvp_frame_set_str (lot->inst.kvp_data, "/notes", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
/* ============================================================= */
|
||||
@@ -280,6 +306,7 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
|
||||
gnc_lot_get_title (lot),
|
||||
gnc_num_dbg_to_string (split->amount),
|
||||
gnc_num_dbg_to_string (split->value));
|
||||
gnc_lot_begin_edit(lot);
|
||||
acc = xaccSplitGetAccount (split);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
if (NULL == lot->account)
|
||||
@@ -292,10 +319,14 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
|
||||
"be added to this lot!\n"
|
||||
"\tlot account=\'%s\', split account=\'%s\'\n",
|
||||
xaccAccountGetName(lot->account), xaccAccountGetName (acc));
|
||||
gnc_lot_commit_edit(lot);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lot == split->lot) return; /* handle not-uncommon no-op */
|
||||
if (lot == split->lot) {
|
||||
gnc_lot_commit_edit(lot);
|
||||
return; /* handle not-uncommon no-op */
|
||||
}
|
||||
if (split->lot)
|
||||
{
|
||||
gnc_lot_remove_split (split->lot, split);
|
||||
@@ -306,6 +337,7 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
|
||||
|
||||
/* for recomputation of is-closed */
|
||||
lot->is_closed = -1;
|
||||
gnc_lot_commit_edit(lot);
|
||||
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
@@ -316,6 +348,7 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
|
||||
if (!lot || !split) return;
|
||||
|
||||
ENTER ("(lot=%p, split=%p)", lot, split);
|
||||
gnc_lot_begin_edit(lot);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
lot->splits = g_list_remove (lot->splits, split);
|
||||
split->lot = NULL;
|
||||
@@ -326,6 +359,7 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
|
||||
xaccAccountRemoveLot (lot->account, lot);
|
||||
lot->account = NULL;
|
||||
}
|
||||
gnc_lot_commit_edit(lot);
|
||||
qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ void gnc_lot_destroy (GNCLot *);
|
||||
GNCLot * gnc_lot_lookup (const GUID *guid, QofBook *book);
|
||||
QofBook * gnc_lot_get_book (GNCLot *);
|
||||
|
||||
void gnc_lot_begin_edit (GNCLot *lot);
|
||||
void gnc_lot_commit_edit (GNCLot *lot);
|
||||
|
||||
/** The gnc_lot_add_split() routine adds a split to this lot. Note
|
||||
* that *all* splits in a lot must also be in the same account.
|
||||
* Note that this routine adds the split unconditionally, with
|
||||
|
||||
@@ -176,16 +176,7 @@ gnc_pricedb_commit_edit (GNCPriceDB *pdb)
|
||||
static void
|
||||
gnc_price_set_dirty (GNCPrice *p)
|
||||
{
|
||||
if (p->db) {
|
||||
qof_instance_set_dirty(&p->inst);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is a transient price structure, probably for the add new
|
||||
* price dialog. The user may end up cancelling it instead of
|
||||
* saving it, so don't mark the collection dirty. We'll mark it
|
||||
* dirty later if the price is ever saved to the db. */
|
||||
p->inst.dirty = TRUE;
|
||||
qof_instance_set_dirty(&p->inst);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1171,11 +1171,13 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
|
||||
if (gnc_commodity_namespace_is_iso (namespace)) {
|
||||
if (w->edit_commodity) {
|
||||
c = w->edit_commodity;
|
||||
gnc_commodity_begin_edit(c);
|
||||
gnc_commodity_set_quote_flag (c, gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON (w->get_quote_check)));
|
||||
selection = gnc_option_menu_get_active (w->quote_tz_menu);
|
||||
string = gnc_timezone_menu_position_to_string(selection);
|
||||
gnc_commodity_set_quote_tz(c, string);
|
||||
gnc_commodity_commit_edit(c);
|
||||
return TRUE;
|
||||
}
|
||||
gnc_warning_dialog(w->dialog,
|
||||
@@ -1198,9 +1200,10 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
|
||||
if (!w->edit_commodity) {
|
||||
c = gnc_commodity_new(book, fullname, namespace, mnemonic, code, fraction);
|
||||
w->edit_commodity = c;
|
||||
}
|
||||
else {
|
||||
gnc_commodity_begin_edit(c);
|
||||
} else {
|
||||
c = w->edit_commodity;
|
||||
gnc_commodity_begin_edit(c);
|
||||
|
||||
gnc_commodity_table_remove (gnc_get_current_commodities(), c);
|
||||
|
||||
@@ -1225,6 +1228,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
|
||||
selection = gnc_option_menu_get_active (w->quote_tz_menu);
|
||||
string = gnc_timezone_menu_position_to_string(selection);
|
||||
gnc_commodity_set_quote_tz(c, string);
|
||||
gnc_commodity_commit_edit(c);
|
||||
|
||||
/* remember the commodity */
|
||||
c = gnc_commodity_table_insert(gnc_get_current_commodities(), c);
|
||||
|
||||
Reference in New Issue
Block a user