aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@gnome.org>2010-04-27 19:18:51 +0800
committerSrinivasa Ragavan <sragavan@gnome.org>2010-04-27 19:18:51 +0800
commit5b21823d0e5c5a6ad927a180fb9aa8b9419f6612 (patch)
tree82b035bda2b729da8ae77eb99f7ee69951f0b4d2
parentf1d7e36a2f26f1633f9282f8210879ca7f1ea0a0 (diff)
downloadgsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar.gz
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar.bz2
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar.lz
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar.xz
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.tar.zst
gsoc2013-evolution-5b21823d0e5c5a6ad927a180fb9aa8b9419f6612.zip
Listen for account added signal from the EAccountList. Helps to refresh
account while loading from the capplet externally.
-rw-r--r--mail/em-folder-tree-model.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 3daacc52c5..b779caf63a 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -37,10 +37,13 @@
#include <camel/camel-file-utils.h>
+#include "e-mail-store.h"
+
#include "mail-config.h"
#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"
@@ -80,6 +83,7 @@ struct _EMFolderTreeModelPrivate {
gulong account_changed_id;
gulong account_removed_id;
+ gulong account_added_id;
};
enum {
@@ -256,6 +260,26 @@ 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)
+{
+ mail_get_store (e_account_get_string (account, E_ACCOUNT_SOURCE_URL), NULL, add_new_store, account);
+}
+
static void
folder_tree_model_selection_finalized_cb (EMFolderTreeModel *model)
{
@@ -332,6 +356,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);
@@ -512,6 +538,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",