[Gnucash-changes] r14283 - gnucash/trunk - Replace gnc_tree_model_account_path_changed with manual checks whether

Andreas Köhler andi5 at cvs.gnucash.org
Wed May 31 15:30:51 EDT 2006


Author: andi5
Date: 2006-05-31 15:30:49 -0400 (Wed, 31 May 2006)
New Revision: 14283
Trac: http://svn.gnucash.org/trac/changeset/14283

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
Log:
Replace gnc_tree_model_account_path_changed with manual checks whether
the inserted (resp. deleted) account is the first (resp. last) account
in its level and call gtm_row_has_child_toggled only in these cases.
Might fix #343405, as GtkTreeModelFilter seems to make (false)
assumptions when being woken up too often.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-05-31 05:15:28 UTC (rev 14282)
+++ gnucash/trunk/ChangeLog	2006-05-31 19:30:49 UTC (rev 14283)
@@ -1,3 +1,12 @@
+2006-05-31  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/gnome-utils/gnc-tree-model-account.c: Replace
+	  gnc_tree_model_account_path_changed with manual checks whether
+	  the inserted (resp. deleted) account is the first (resp. last)
+	  account in its level and call gtm_row_has_child_toggled only in
+	  these cases. Might fix #343405, as GtkTreeModelFilter seems to
+	  make (false) assumptions when being woken up too often.
+
 2006-05-31  Derek Atkins  <derek at ihtfp.com>
 
 	* po/es.po:  Updated Spanish Translation from Eneko Lacunza

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2006-05-31 05:15:28 UTC (rev 14282)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2006-05-31 19:30:49 UTC (rev 14283)
@@ -1426,41 +1426,6 @@
 /*   Account Tree Model - Engine Event Handling Functions   */
 /************************************************************/
 
-/** This function performs common updating to the model after an
- *  account has been added or removed.  The parent entry needs to be
- *  tapped on the shoulder so that it can correctly update the
- *  disclosure triangle (first added child/last removed child) or
- *  possibly rebuild its child list of that level of accounts is
- *  visible.
- *
- *  @internal
- *
- *  @param model The account tree model containing the account that
- *  has been added or deleted.
- *
- *  @param path The path to the newly added item, or the just removed
- *  item.
- */
-static void
-gnc_tree_model_account_path_changed (GncTreeModelAccount *model,
-				     GtkTreePath *path)
-{
-  GtkTreeIter iter;
-
-  while (gtk_tree_path_get_depth(path) > 0) {
-    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path))
-      break;
-    gtk_tree_model_row_changed (GTK_TREE_MODEL(model), path, &iter);
-    gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL(model), path, &iter);
-    gtk_tree_path_up(path);
-  }
-
-  do {
-    model->stamp++;
-  } while (model->stamp == 0);
-}
-
-
 /** This function is the handler for all event messages from the
  *  engine.  Its purpose is to update the account tree model any time
  *  an account is added to the engine or deleted from the engine.
@@ -1533,8 +1498,10 @@
 	break;
       }
       gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), path, &iter);
-      if (gtk_tree_path_up (path))
-	gnc_tree_model_account_path_changed(model, path);
+      if (gtk_tree_path_up (path) &&
+	  gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path) &&
+	  gtk_tree_model_iter_n_children (GTK_TREE_MODEL(model), &iter) == 1)
+	gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL(model), path, &iter);
       break;
 
     case QOF_EVENT_REMOVE:
@@ -1550,7 +1517,10 @@
       }
       gtk_tree_path_append_index (path, ed->idx);
       gtk_tree_model_row_deleted (GTK_TREE_MODEL(model), path);
-      gnc_tree_model_account_path_changed(model, path);
+      if (gtk_tree_path_up (path) &&
+	  gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path) &&
+	  gtk_tree_model_iter_n_children (GTK_TREE_MODEL(model), &iter) == 0)
+	gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL(model), path, &iter);
       break;
 
     case QOF_EVENT_MODIFY:



More information about the gnucash-changes mailing list