mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Generalize Account Filter By... (step 2)
Narrow the account filter function to use only the AccountFilterDialog. Now it's multi-purpose. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12211 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b77990b623
commit
5f77dd4bf7
@ -447,9 +447,9 @@ gnc_plugin_page_account_tree_create_widget (GncPluginPage *plugin_page)
|
|||||||
gtk_widget_show (GTK_WIDGET (tree_view));
|
gtk_widget_show (GTK_WIDGET (tree_view));
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_window), 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_tree_view_account_set_filter (
|
||||||
gnc_plugin_page_account_tree_filter_accounts,
|
GNC_TREE_VIEW_ACCOUNT(tree_view),
|
||||||
plugin_page, NULL);
|
gnc_plugin_page_account_tree_filter_accounts, &priv->fd, NULL);
|
||||||
|
|
||||||
priv->component_id =
|
priv->component_id =
|
||||||
gnc_register_gui_component(PLUGIN_PAGE_ACCT_TREE_CM_CLASS,
|
gnc_register_gui_component(PLUGIN_PAGE_ACCT_TREE_CM_CLASS,
|
||||||
@ -1291,26 +1291,22 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
|
|||||||
*
|
*
|
||||||
* @param account The account that was toggled.
|
* @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
|
* @return TRUE if the account should be visible. FALSE if the
|
||||||
* account should be hidden. */
|
* account should be hidden. */
|
||||||
gboolean
|
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)
|
||||||
{
|
{
|
||||||
|
AccountFilterDialog *fd = user_data;
|
||||||
GncPluginPageAccountTree *page = user_data;
|
|
||||||
GncPluginPageAccountTreePrivate *priv;
|
|
||||||
GNCAccountType acct_type;
|
GNCAccountType acct_type;
|
||||||
gnc_numeric total;
|
gnc_numeric total;
|
||||||
gboolean result;
|
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);
|
if (fd->hide_zero_total) {
|
||||||
|
|
||||||
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
|
|
||||||
if (priv->fd.hide_zero_total) {
|
|
||||||
total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
|
total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
|
||||||
if (gnc_numeric_zero_p(total)) {
|
if (gnc_numeric_zero_p(total)) {
|
||||||
LEAVE(" hide: zero balance");
|
LEAVE(" hide: zero balance");
|
||||||
@ -1319,7 +1315,7 @@ gnc_plugin_page_account_tree_filter_accounts (Account *account, gpointer user_da
|
|||||||
}
|
}
|
||||||
|
|
||||||
acct_type = xaccAccountGetType(account);
|
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");
|
LEAVE(" %s", result ? "show" : "hide");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user