From 8edf447808c2c4bc21ea63c44c3b92befaa10f95 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Thu, 19 Jul 2018 16:44:00 +0100 Subject: [PATCH] Drop the tree model before updating transaction association tree view To avoid delays with large transaction associations trees, drop the model from the transaction association tree view while it is being updated and then reconnect it after the model has been updated. --- gnucash/gnome/dialog-trans-assoc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c index ef2c50f0ff..9429a32dc0 100644 --- a/gnucash/gnome/dialog-trans-assoc.c +++ b/gnucash/gnome/dialog-trans-assoc.c @@ -165,7 +165,10 @@ assoc_dialog_update (AssocDialog *assoc_dialog) GtkTreeIter iter; gboolean valid; + /* disconnect the model from the treeview */ model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view)); + g_object_ref (G_OBJECT(model)); + gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL); /* Get first row in list store */ valid = gtk_tree_model_get_iter_first (model, &iter); @@ -205,6 +208,9 @@ assoc_dialog_update (AssocDialog *assoc_dialog) g_free (filename); valid = gtk_tree_model_iter_next (model, &iter); } + /* reconnect the model to the treeview */ + gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), model); + g_object_unref(G_OBJECT(model)); } static void @@ -299,7 +305,10 @@ get_trans_info (AssocDialog *assoc_dialog) /* Get list of Accounts */ accts = gnc_account_get_descendants_sorted (root); + /* disconnect the model from the treeview */ model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view)); + g_object_ref (G_OBJECT(model)); + gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL); /* Go through list of accounts */ for (ptr = accts; ptr; ptr = g_list_next (ptr)) @@ -352,6 +361,11 @@ get_trans_info (AssocDialog *assoc_dialog) qof_query_destroy (query); g_list_free (splits); } + + /* reconnect the model to the treeview */ + gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), model); + g_object_unref(G_OBJECT(model)); + g_list_free (accts); g_list_free (trans_list); }