Speed up loading of the Imap Editor Treeview

Drop the model before loading the treeview and then create a new filter
model and add that back to the treeview after populating the model.
This commit is contained in:
Robert Fewell 2018-03-29 17:43:59 +01:00
parent 6c43c3afe0
commit f0c03a7885

View File

@ -602,6 +602,10 @@ get_account_info (ImapDialog *imap_dialog)
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(filter));
// Disconnect the filter model from the treeview
g_object_ref (G_OBJECT(model));
gtk_tree_view_set_model (GTK_TREE_VIEW(imap_dialog->view), NULL);
// Clear the tree store
gtk_tree_store_clear (GTK_TREE_STORE(model));
@ -629,6 +633,14 @@ get_account_info (ImapDialog *imap_dialog)
show_filter_option (imap_dialog, FALSE);
get_account_info_online (accts, model);
}
// create a new filter model and reconnect to treeview
filter = gtk_tree_model_filter_new (GTK_TREE_MODEL(model), NULL);
gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER(filter), FILTER);
g_object_unref (G_OBJECT(model));
gtk_tree_view_set_model (GTK_TREE_VIEW(imap_dialog->view), filter);
g_object_unref (G_OBJECT(filter));
// if there are any entries, show first row
show_first_row (imap_dialog);