Bug #644688: Account edit fails to detect that no changes have been made and marks the account 'dirty'.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20425 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls
2011-03-15 14:24:58 +00:00
parent d7dc1e271c
commit d8fd93fc3a
3 changed files with 16 additions and 7 deletions

View File

@@ -2148,7 +2148,7 @@ xaccAccountSetName (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (str == priv->accountName)
if (safe_strcmp(str, priv->accountName) == 0)
return;
xaccAccountBeginEdit(acc);
@@ -2167,7 +2167,7 @@ xaccAccountSetCode (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (str == priv->accountCode)
if (safe_strcmp(str, priv->accountCode) == 0)
return;
xaccAccountBeginEdit(acc);
@@ -2186,7 +2186,7 @@ xaccAccountSetDescription (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (str == priv->description)
if (safe_strcmp(str, priv->description) == 0)
return;
xaccAccountBeginEdit(acc);

View File

@@ -409,20 +409,23 @@ gnc_ui_to_account(AccountWindow *aw)
gtk_text_buffer_get_end_iter (aw->notes_text_buffer, &end);
string = gtk_text_buffer_get_text (aw->notes_text_buffer, &start, &end, FALSE);
old_string = xaccAccountGetNotes (account);
if (safe_strcmp (string, old_string) != 0)
if (null_strcmp (string, old_string) != 0)
xaccAccountSetNotes (account, string);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->tax_related_button));
xaccAccountSetTaxRelated (account, flag);
if (xaccAccountGetTaxRelated (account) != flag)
xaccAccountSetTaxRelated (account, flag);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->placeholder_button));
xaccAccountSetPlaceholder (account, flag);
if (xaccAccountGetPlaceholder (account) != flag)
xaccAccountSetPlaceholder (account, flag);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->hidden_button));
xaccAccountSetHidden (account, flag);
if (xaccAccountGetHidden (account) != flag)
xaccAccountSetHidden (account, flag);
parent_account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT (aw->parent_tree));

View File

@@ -2292,18 +2292,24 @@ gnc_tree_view_account_name_edited_cb(Account *account, GtkTreeViewColumn *col, c
void
gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_code)
{
if (safe_strcmp(xaccAccountGetCode(account), new_code) == 0)
return;
xaccAccountSetCode(account, new_code);
}
void
gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_desc)
{
if (safe_strcmp(xaccAccountGetDescription(account), new_desc) == 0)
return;
xaccAccountSetDescription(account, new_desc);
}
void
gnc_tree_view_account_notes_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_notes)
{
if (safe_strcmp(xaccAccountGetNotes(account), new_notes) == 0)
return;
xaccAccountSetNotes(account, new_notes);
}