aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers/elm-importer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-07 11:38:52 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-13 01:58:59 +0800
commita06e4484b8df804124b5bcf88d94dec5acfba270 (patch)
tree4fa42793d7dc461f2b3767296d76592182c48222 /mail/importers/elm-importer.c
parent5e0758bb6934a7859b1d8a247c8fb21c156772cf (diff)
downloadgsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.gz
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.bz2
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.lz
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.xz
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.zst
gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.zip
Give MailSession a permanent home.
Global variables in shared libraries are a bad idea. EMailBackend now owns the MailSession instance, which is actually now EMailSession. Move the blocking utility functions in mail-tools.c to e-mail-session.c and add asynchronous variants. Same approach as Camel. Replace EMailReader.get_shell_backend() with EMailReader.get_backend(), which returns an EMailBackend. Easier access to the EMailSession.
Diffstat (limited to 'mail/importers/elm-importer.c')
-rw-r--r--mail/importers/elm-importer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index 0164378942..18548fc21b 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -41,7 +41,9 @@
#include "mail-importer.h"
#include "mail/mail-mt.h"
+#include "mail/e-mail-backend.h"
#include "e-util/e-import.h"
+#include "shell/e-shell.h"
#define d(x)
@@ -184,9 +186,19 @@ static MailImporterSpecial elm_special_folders[] = {
static void
elm_import_exec (struct _elm_import_msg *m)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EMailSession *session;
const gchar *maildir;
gchar *elmdir;
+ /* XXX Dig up the EMailSession from the default EShell.
+ * Since the EImport framework doesn't allow for user
+ * data, I don't see how else to get to it. */
+ shell = e_shell_get_default ();
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
+
maildir = elm_get_rc(m->import, "maildir");
if (maildir == NULL)
maildir = "Mail";
@@ -197,7 +209,7 @@ elm_import_exec (struct _elm_import_msg *m)
elmdir = g_strdup (maildir);
mail_importer_import_folders_sync (
- elmdir, elm_special_folders, 0, m->status);
+ session, elmdir, elm_special_folders, 0, m->status);
g_free (elmdir);
}