diff options
author | Not Zed <NotZed@Ximian.com> | 2002-10-25 00:03:05 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-10-25 00:03:05 +0800 |
commit | 93391a57675cb2012fd7dd65ab89098ed578a1b0 (patch) | |
tree | 359176313ffd77ccf087b9eb3bd80014833ceabe /mail | |
parent | 1bb481409ffa20416c7531ebe4327d77db1796e2 (diff) | |
download | gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar.gz gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar.bz2 gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar.lz gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar.xz gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.tar.zst gsoc2013-evolution-93391a57675cb2012fd7dd65ab89098ed578a1b0.zip |
Use a hashtable to only insert nodes we dont have already, rather than
2002-10-24 Not Zed <NotZed@Ximian.com>
* subscribe-dialog.c (fe_got_children): Use a hashtable to only
insert nodes we dont have already, rather than relying on the
scanning logic. Also, only re-sort this tree level once done
rather than on each insert.
(folder_etree_init): Setup hash to track nodes setup.
(folder_etree_clear_tree): Reset hash.
(fe_destroy): Free hash.
svn path=/trunk/; revision=18426
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/subscribe-dialog.c | 19 |
2 files changed, 23 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4fc14e5648..9511ffcf3c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2002-10-24 Not Zed <NotZed@Ximian.com> + + * subscribe-dialog.c (fe_got_children): Use a hashtable to only + insert nodes we dont have already, rather than relying on the + scanning logic. Also, only re-sort this tree level once done + rather than on each insert. + (folder_etree_init): Setup hash to track nodes setup. + (folder_etree_clear_tree): Reset hash. + (fe_destroy): Free hash. + 2002-10-23 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (folder_browser_query_changed): Only perform diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index cab48a72ce..37e58c0e4e 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -137,6 +137,8 @@ struct _FolderETree { GHashTable *scan_ops; GHashTable *subscribe_ops; + GHashTable *node_full_name; + CamelStore *store; EvolutionStorage *e_storage; char *service_name; @@ -702,7 +704,6 @@ fe_sort_folder (ETreeMemory *etmm, ETreePath left, ETreePath right, gpointer use } /* scanning */ - static void fe_got_children (CamelStore *store, char *prefix, CamelFolderInfo *info, gpointer data) { @@ -718,7 +719,7 @@ fe_got_children (CamelStore *store, char *prefix, CamelFolderInfo *info, gpointe ETreePath child_path; ftree_node *node; - if (strcmp (info->full_name, prefix) == 0) + if (g_hash_table_lookup(closure->ftree->node_full_name, info->full_name)) continue; node = ftree_node_new (store, info); @@ -726,12 +727,14 @@ fe_got_children (CamelStore *store, char *prefix, CamelFolderInfo *info, gpointe closure->path, 0, node); - e_tree_memory_sort_node (E_TREE_MEMORY (closure->ftree), - closure->path, - fe_sort_folder, - NULL); + g_hash_table_insert(closure->ftree->node_full_name, ftree_node_get_full_name(node), child_path); } + e_tree_memory_sort_node (E_TREE_MEMORY (closure->ftree), + closure->path, + fe_sort_folder, + NULL); + if (closure->data) closure->data->flags |= FTREE_NODE_GOT_CHILDREN; @@ -864,6 +867,7 @@ fe_destroy (GtkObject *obj) g_hash_table_destroy (ftree->scan_ops); g_hash_table_destroy (ftree->subscribe_ops); + g_hash_table_destroy(ftree->node_full_name); camel_object_unref (CAMEL_OBJECT (ftree->store)); bonobo_object_unref (BONOBO_OBJECT (ftree->e_storage)); @@ -912,6 +916,7 @@ folder_etree_init (GtkObject *object) ftree->search = g_strdup (""); ftree->activity_level = 0; + ftree->node_full_name = g_hash_table_new(g_str_hash, g_str_equal); } static FolderETree * @@ -960,6 +965,8 @@ folder_etree_clear_tree (FolderETree *ftree) e_tree_memory_freeze (E_TREE_MEMORY (ftree)); e_tree_memory_node_remove (E_TREE_MEMORY (ftree), ftree->root); fe_create_root_node (ftree); + g_hash_table_destroy(ftree->node_full_name); + ftree->node_full_name = g_hash_table_new(g_str_hash, g_str_equal); e_tree_memory_thaw (E_TREE_MEMORY (ftree)); } |