aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-08-23 21:02:26 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-09-14 20:08:53 +0800
commite6af016f389dea16b1de3af146557aaa8906210c (patch)
tree21c2a29f3be63823f03c55ad015f2f592af3e557
parent974a8a3b1a55f14132fa4f5f807237e2497e9b40 (diff)
downloadgsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar.gz
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar.bz2
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar.lz
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar.xz
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.tar.zst
gsoc2013-evolution-e6af016f389dea16b1de3af146557aaa8906210c.zip
Very slow filling of EMSubscriptionEditor tree view
-rw-r--r--mail/em-subscription-editor.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index e484b5a121..ba7bcc1458 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -146,13 +146,12 @@ store_data_free (StoreData *data)
static void
subscription_editor_populate (EMSubscriptionEditor *editor,
CamelFolderInfo *folder_info,
- GtkTreeIter *parent)
+ GtkTreeIter *parent,
+ GSList **expand_paths)
{
- GtkTreeView *tree_view;
GtkListStore *list_store;
GtkTreeStore *tree_store;
- tree_view = editor->priv->active->tree_view;
list_store = GTK_LIST_STORE (editor->priv->active->list_store);
tree_store = GTK_TREE_STORE (editor->priv->active->tree_store);
@@ -189,21 +188,26 @@ subscription_editor_populate (EMSubscriptionEditor *editor,
path = gtk_tree_model_get_path (
GTK_TREE_MODEL (tree_store), &iter);
- gtk_tree_view_expand_to_path (tree_view, path);
- gtk_tree_path_free (path);
+ *expand_paths = g_slist_prepend (*expand_paths, path);
}
g_free (casefolded);
if (folder_info->child != NULL)
subscription_editor_populate (
- editor, folder_info->child, &iter);
+ editor, folder_info->child, &iter, expand_paths);
folder_info = folder_info->next;
}
}
static void
+expand_paths_cb (gpointer path, gpointer tree_view)
+{
+ gtk_tree_view_expand_to_path (tree_view, path);
+}
+
+static void
subscription_editor_get_folder_info_done (CamelStore *store,
GAsyncResult *result,
EMSubscriptionEditor *editor)
@@ -212,9 +216,11 @@ subscription_editor_get_folder_info_done (CamelStore *store,
GtkTreeView *tree_view;
GtkTreeModel *list_store;
GtkTreeModel *tree_store;
+ GtkTreeModel *model;
GtkTreeSelection *selection;
CamelFolderInfo *folder_info;
GdkWindow *window;
+ GSList *expand_paths = NULL;
GError *error = NULL;
folder_info = camel_store_get_folder_info_finish (
@@ -253,7 +259,15 @@ subscription_editor_get_folder_info_done (CamelStore *store,
gtk_list_store_clear (GTK_LIST_STORE (list_store));
gtk_tree_store_clear (GTK_TREE_STORE (tree_store));
- subscription_editor_populate (editor, folder_info, NULL);
+
+ model = gtk_tree_view_get_model (tree_view);
+ gtk_tree_view_set_model (tree_view, NULL);
+ subscription_editor_populate (editor, folder_info, NULL, &expand_paths);
+ gtk_tree_view_set_model (tree_view, model);
+
+ g_slist_foreach (expand_paths, expand_paths_cb, tree_view);
+ g_slist_foreach (expand_paths, (GFunc) gtk_tree_path_free, NULL);
+ g_slist_free (expand_paths);
path = gtk_tree_path_new_first ();
selection = gtk_tree_view_get_selection (tree_view);