aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree-model.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r--mail/em-folder-tree-model.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 5b22bd0f9d..9da5711cf0 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -556,11 +556,6 @@ folder_tree_model_init (EMFolderTreeModel *model)
model->priv->account_added_id = g_signal_connect (
model->priv->accounts, "account-added",
G_CALLBACK (account_added_cb), model);
-
- g_signal_connect_swapped (
- mail_folder_cache_get_default (),
- "folder-unread-updated",
- G_CALLBACK (folder_tree_model_set_unread_count), model);
}
GType
@@ -665,6 +660,20 @@ em_folder_tree_model_set_session (EMFolderTreeModel *model,
model->priv->session = session;
+ /* FIXME Technically we should be disconnecting this signal
+ * when replacing an old session with a new session,
+ * but at present this function is only called once. */
+ if (session != NULL) {
+ MailFolderCache *folder_cache;
+
+ folder_cache = e_mail_session_get_folder_cache (session);
+
+ g_signal_connect_swapped (
+ folder_cache, "folder-unread-updated",
+ G_CALLBACK (folder_tree_model_set_unread_count),
+ model);
+ }
+
g_object_notify (G_OBJECT (model), "session");
}
@@ -677,6 +686,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
{
GtkTreeRowReference *uri_row, *path_row;
GtkTreeStore *tree_store;
+ MailFolderCache *folder_cache;
+ EMailSession *session;
guint unread;
GtkTreePath *path;
GtkTreeIter sub;
@@ -696,6 +707,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
tree_store = GTK_TREE_STORE (model);
+ session = em_folder_tree_model_get_session (model);
+ folder_cache = e_mail_session_get_folder_cache (session);
+
if (!fully_loaded)
load = (fi->child == NULL) && !(fi->flags &
(CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -717,7 +731,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
* be functionised. */
unread = fi->unread;
if (mail_folder_cache_get_folder_from_uri (
- mail_folder_cache_get_default (), fi->uri, &folder) && folder) {
+ folder_cache, fi->uri, &folder) && folder) {
is_drafts = em_utils_folder_is_drafts (folder, fi->uri);
if (is_drafts || em_utils_folder_is_outbox (folder, fi->uri)) {