[Gnucash-changes] r13595 - gnucash/trunk - Avoid calculation of account period total for the top level account.

Andreas Köhler andi5 at cvs.gnucash.org
Sat Mar 11 10:23:20 EST 2006


Author: andi5
Date: 2006-03-11 10:23:19 -0500 (Sat, 11 Mar 2006)
New Revision: 13595
Trac: http://svn.gnucash.org/trac/changeset/13595

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
Log:
Avoid calculation of account period total for the top level account.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-11 01:23:43 UTC (rev 13594)
+++ gnucash/trunk/ChangeLog	2006-03-11 15:23:19 UTC (rev 13595)
@@ -1,3 +1,8 @@
+2006-03-11  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/gnome-utils/gnc-tree-view-account.c: Avoid calculation of
+	  account period total for the top level account.
+
 2006-03-10  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/gnc-main-window.c: Walk through the list of

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2006-03-11 01:23:43 UTC (rev 13594)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2006-03-11 15:23:19 UTC (rev 13595)
@@ -70,6 +70,8 @@
                                                      GtkTreeIter *iter,
                                                      gpointer data);
 
+static Account *gtva_get_top_level_from_model (GtkTreeModel *s_model);
+
 static void gtva_setup_column_renderer_edited_cb(GncTreeViewAccount *account_view,
                                                  GtkTreeViewColumn *column,
                                                  GtkCellRenderer *renderer,
@@ -370,6 +372,12 @@
     g_return_if_fail(GTK_TREE_MODEL_SORT(s_model));
 
     acct = gnc_tree_view_account_get_account_from_iter(s_model, iter);
+
+    if (acct == gtva_get_top_level_from_model(s_model)) {
+      g_object_set(cell, "text", "", NULL);
+      return;
+    }
+
     t1 = gnc_accounting_period_fiscal_start();
     t2 = gnc_accounting_period_fiscal_end();
     
@@ -889,6 +897,19 @@
 /*           Account Tree View Get/Set Functions            */
 /************************************************************/
 
+static Account *
+gtva_get_top_level_from_model (GtkTreeModel *s_model)
+{
+  GtkTreeModel *model, *f_model;
+
+  g_return_val_if_fail (GTK_TREE_MODEL_SORT (s_model), NULL);
+
+  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
+  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
+
+  return gnc_tree_model_account_get_toplevel (GNC_TREE_MODEL_ACCOUNT (model));
+}
+
 /*
  * Return the account associated with the top level pseudo-account for
  * the tree.
@@ -896,15 +917,12 @@
 Account *
 gnc_tree_view_account_get_top_level (GncTreeViewAccount *view)
 {
-  GtkTreeModel *model, *f_model, *s_model;
+  GtkTreeModel *s_model;
 
-  g_return_val_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view), NULL);
+  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
+  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
 
-  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
-  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
-  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
-
-  return gnc_tree_model_account_get_toplevel (GNC_TREE_MODEL_ACCOUNT(model));
+  return gtva_get_top_level_from_model (s_model);
 }
 
 /*



More information about the gnucash-changes mailing list