[Gnucash-changes] r11899 - gnucash/trunk - Add a function that
allow you to expand the account tree to show a
David Hampton
hampton at cvs.gnucash.org
Wed Nov 9 22:46:20 EST 2005
Author: hampton
Date: 2005-11-09 22:46:19 -0500 (Wed, 09 Nov 2005)
New Revision: 11899
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h
Log:
Add a function that allow you to expand the account tree to show a
specific account.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2005-11-10 03:27:52 UTC (rev 11898)
+++ gnucash/trunk/ChangeLog 2005-11-10 03:46:19 UTC (rev 11899)
@@ -1,5 +1,8 @@
2005-11-09 David Hampton <hampton at 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:
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c 2005-11-10 03:27:52 UTC (rev 11898)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c 2005-11-10 03:46:19 UTC (rev 11899)
@@ -545,7 +545,6 @@
g_free(path_string); \
}
-#if 0
static GtkTreePath *
gnc_tree_view_account_get_path_from_account (GncTreeViewAccount *view,
Account *account)
@@ -579,12 +578,11 @@
}
/* 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 @@
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.
*/
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h 2005-11-10 03:27:52 UTC (rev 11898)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h 2005-11-10 03:46:19 UTC (rev 11899)
@@ -428,6 +428,16 @@
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);
+
+
/** @} */
/** @} */
More information about the gnucash-changes
mailing list