r20425 - gnucash/trunk/src - Bug #644688: Account edit fails to detect that no changes have been made and marks the account 'dirty'.

John Ralls jralls at code.gnucash.org
Tue Mar 15 10:24:59 EDT 2011


Author: jralls
Date: 2011-03-15 10:24:58 -0400 (Tue, 15 Mar 2011)
New Revision: 20425
Trac: http://svn.gnucash.org/trac/changeset/20425

Modified:
   gnucash/trunk/src/engine/Account.c
   gnucash/trunk/src/gnome-utils/dialog-account.c
   gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
Log:
Bug #644688: Account edit fails to detect that no changes have been made and marks the account 'dirty'.

Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c	2011-03-15 10:08:01 UTC (rev 20424)
+++ gnucash/trunk/src/engine/Account.c	2011-03-15 14:24:58 UTC (rev 20425)
@@ -2148,7 +2148,7 @@
 
     /* optimizations */
     priv = GET_PRIVATE(acc);
-    if (str == priv->accountName)
+    if (safe_strcmp(str, priv->accountName) == 0)
         return;
 
     xaccAccountBeginEdit(acc);
@@ -2167,7 +2167,7 @@
 
     /* optimizations */
     priv = GET_PRIVATE(acc);
-    if (str == priv->accountCode)
+    if (safe_strcmp(str, priv->accountCode) == 0)
         return;
 
     xaccAccountBeginEdit(acc);
@@ -2186,7 +2186,7 @@
 
     /* optimizations */
     priv = GET_PRIVATE(acc);
-    if (str == priv->description)
+    if (safe_strcmp(str, priv->description) == 0)
         return;
 
     xaccAccountBeginEdit(acc);

Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c	2011-03-15 10:08:01 UTC (rev 20424)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c	2011-03-15 14:24:58 UTC (rev 20425)
@@ -409,20 +409,23 @@
     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));
 

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2011-03-15 10:08:01 UTC (rev 20424)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2011-03-15 14:24:58 UTC (rev 20425)
@@ -2292,18 +2292,24 @@
 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);
 }
 



More information about the gnucash-changes mailing list