Add a function that allow you to expand the account tree to show a

specific account.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11899 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2005-11-10 03:46:19 +00:00
parent 47ec7e6864
commit a50a738147
3 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,8 @@
2005-11-09 David Hampton <hampton@employees.org>
* src/gnome-utils/gnc-tree-view-account.[ch]: Add a function that
allow you to expand the account tree to show a specific account.
* src/report/report-system/report.scm:
* src/business/business-reports/business-reports.scm:
* src/gnome-utils/ui/gnc-main-window-ui.xml:

View File

@ -545,7 +545,6 @@ gnc_tree_view_account_new (gboolean show_root)
g_free(path_string); \
}
#if 0
static GtkTreePath *
gnc_tree_view_account_get_path_from_account (GncTreeViewAccount *view,
Account *account)
@ -579,12 +578,11 @@ gnc_tree_view_account_get_path_from_account (GncTreeViewAccount *view,
}
/* convert back to a sorted path */
s_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), f_path);
s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), f_path);
gtk_tree_path_free(f_path);
debug_path(LEAVE, s_path);
return s_path;
}
#endif
static gboolean
gnc_tree_view_account_get_iter_from_account (GncTreeViewAccount *view,
@ -1162,6 +1160,25 @@ gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view,
return;
}
void
gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view,
Account *account)
{
GtkTreePath *path;
g_return_if_fail(view != NULL);
g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
ENTER("view %p, account %p", view, account);
path = gnc_tree_view_account_get_path_from_account(view, account);
if (path) {
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
gtk_tree_path_free(path);
}
LEAVE(" ");
}
/*
* Retrieve the account currently under the cursor.
*/

View File

@ -428,6 +428,16 @@ void gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view,
void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view,
Account *account);
/** This function forces the account tree expand whatever levels are
* necessary to make the specified account visible.
*
* @param view A pointer to an account tree view.
*
* @param account A pointer to the account to show.
*/
void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account);
/** @} */
/** @} */