mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Improve setting up the commodity tree view filters
Before setting up the commodity tree view filters, disconnect the model from the tree view and then connect them after the re-filter.
This commit is contained in:
parent
397c5d1358
commit
93c8535ea9
@ -576,6 +576,11 @@ gnc_tree_view_commodity_set_filter (GncTreeViewCommodity *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));
|
||||
|
||||
/* disconnect model from view */
|
||||
g_object_ref (G_OBJECT(s_model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(view), NULL);
|
||||
|
||||
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
|
||||
gnc_tree_view_commodity_filter_helper,
|
||||
fd,
|
||||
@ -584,6 +589,11 @@ gnc_tree_view_commodity_set_filter (GncTreeViewCommodity *view,
|
||||
/* Whack any existing levels. The top two levels have been created
|
||||
* before this routine can be called. */
|
||||
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
|
||||
|
||||
/* connect model to view */
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(view), s_model);
|
||||
g_object_unref (G_OBJECT(s_model));
|
||||
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user