aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree-model.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-05-27 01:09:33 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-05-27 01:09:33 +0800
commitc9ec8c3f4dce2b02c91268529977770364ef87fe (patch)
treed574f2be1b5438407e59e2fead1321766c9bbc83 /mail/em-folder-tree-model.c
parent6fec6bf39467dd32625847be1b021a7e5bc94d76 (diff)
parent96538878911586a9e9ca26b81e1916c04e538980 (diff)
downloadgsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.gz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.bz2
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.lz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.xz
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.zst
gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.zip
Merge branch 'express2'
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r--mail/em-folder-tree-model.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index e7262db9d0..37552bb555 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -39,6 +39,7 @@
#include "mail-session.h"
#include "mail-tools.h"
#include "mail-mt.h"
+#include "mail-ops.h"
/* sigh, these 2 only needed for outbox total count checking - a mess */
#include "mail-folder-cache.h"
@@ -48,6 +49,7 @@
#include "em-event.h"
#include "e-mail-local.h"
+#include "e-mail-store.h"
#include "shell/e-shell.h"
#define d(x)
@@ -75,6 +77,7 @@ struct _EMFolderTreeModelPrivate {
gulong account_changed_id;
gulong account_removed_id;
+ gulong account_added_id;
};
enum {
@@ -251,6 +254,29 @@ account_removed_cb (EAccountList *accounts,
em_folder_tree_model_remove_store (model, si->store);
}
+/* HACK: FIXME: the component should listen to the account object directly */
+static void
+add_new_store (gchar *uri, CamelStore *store, gpointer user_data)
+{
+ EAccount *account = user_data;
+
+ if (store == NULL)
+ return;
+
+ e_mail_store_add (store, account->name);
+}
+
+static void
+account_added_cb (EAccountList *accounts,
+ EAccount *account,
+ EMFolderTreeModel *model)
+{
+ const gchar *uri;
+
+ uri = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
+ mail_get_store (uri, NULL, add_new_store, account);
+}
+
static void
folder_tree_model_selection_finalized_cb (EMFolderTreeModel *model)
{
@@ -327,6 +353,8 @@ folder_tree_model_finalize (GObject *object)
priv->accounts, priv->account_changed_id);
g_signal_handler_disconnect (
priv->accounts, priv->account_removed_id);
+ g_signal_handler_disconnect (
+ priv->accounts, priv->account_added_id);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -507,6 +535,9 @@ folder_tree_model_init (EMFolderTreeModel *model)
model->priv->account_removed_id = g_signal_connect (
model->priv->accounts, "account-removed",
G_CALLBACK (account_removed_cb), model);
+ model->priv->account_added_id = g_signal_connect (
+ model->priv->accounts, "account-added",
+ G_CALLBACK (account_added_cb), model);
g_signal_connect (mail_folder_cache_get_default (),
"folder-unread-updated",