[Gnucash-changes] r12211 - gnucash/trunk/src/gnome - Generalize Account Filter By... (step 2)

Chris Shoemaker chris at cvs.gnucash.org
Fri Dec 30 18:34:21 EST 2005


Author: chris
Date: 2005-12-30 18:34:20 -0500 (Fri, 30 Dec 2005)
New Revision: 12211
Trac: http://svn.gnucash.org/trac/changeset/12211

Modified:
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
Log:
Generalize Account Filter By... (step 2)

Narrow the account filter function to use only the AccountFilterDialog.
Now it's multi-purpose.



Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2005-12-30 23:28:53 UTC (rev 12210)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2005-12-30 23:34:20 UTC (rev 12211)
@@ -447,9 +447,9 @@
 	gtk_widget_show (GTK_WIDGET (tree_view));
 	gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET(tree_view));
 
-	gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT(tree_view),
-					  gnc_plugin_page_account_tree_filter_accounts,
-					  plugin_page, NULL);
+	gnc_tree_view_account_set_filter (
+            GNC_TREE_VIEW_ACCOUNT(tree_view),
+            gnc_plugin_page_account_tree_filter_accounts, &priv->fd, NULL);
 
 	priv->component_id =
 	  gnc_register_gui_component(PLUGIN_PAGE_ACCT_TREE_CM_CLASS,
@@ -1291,26 +1291,22 @@
  *
  *  @param account The account that was toggled.
  *
- *  @param user_data A pointer to the account tree page.
+ *  @param user_data A pointer to the AccountFilterDialog struct.
  *
  *  @return TRUE if the account should be visible.  FALSE if the
  *  account should be hidden. */
 gboolean
-gnc_plugin_page_account_tree_filter_accounts (Account *account, gpointer user_data)
+gnc_plugin_page_account_tree_filter_accounts (Account *account, 
+                                              gpointer user_data)
 {
-  
-  GncPluginPageAccountTree *page = user_data;
-  GncPluginPageAccountTreePrivate *priv;
+  AccountFilterDialog *fd = user_data;
   GNCAccountType acct_type;
   gnc_numeric total;
   gboolean result;
 
-  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(page), TRUE);
+  ENTER("account %p:%s", account, xaccAccountGetName(account));
 
-  ENTER("account %p:%s, page %p", account, xaccAccountGetName(account), page);
-
-  priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
-  if (priv->fd.hide_zero_total) {
+  if (fd->hide_zero_total) {
     total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
     if (gnc_numeric_zero_p(total)) {
       LEAVE(" hide: zero balance");
@@ -1319,7 +1315,7 @@
   }
   
   acct_type = xaccAccountGetType(account);
-  result = (priv->fd.visible_types & (1 << acct_type)) ? TRUE : FALSE;
+  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
   LEAVE(" %s", result ? "show" : "hide");
   return result;
 }



More information about the gnucash-changes mailing list