diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-07 11:38:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-13 01:58:59 +0800 |
commit | a06e4484b8df804124b5bcf88d94dec5acfba270 (patch) | |
tree | 4fa42793d7dc461f2b3767296d76592182c48222 /plugins/dbx-import | |
parent | 5e0758bb6934a7859b1d8a247c8fb21c156772cf (diff) | |
download | gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.gz 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 'plugins/dbx-import')
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c index c4f1d462c1..3079442ad6 100644 --- a/plugins/dbx-import/dbx-importer.c +++ b/plugins/dbx-import/dbx-importer.c @@ -65,6 +65,7 @@ #include <libedataserver/e-data-server-util.h> #include <libedataserverui/e-source-selector-dialog.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-local.h> #include <mail/mail-mt.h> #include <mail/mail-tools.h> @@ -542,6 +543,9 @@ dbx_read_email (DbxImporter *m, guint32 offset, gint bodyfd, gint *flags) static void dbx_import_file (DbxImporter *m) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; gchar *filename; CamelFolder *folder; gint tmpfile; @@ -551,9 +555,16 @@ dbx_import_file (DbxImporter *m) filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ + /* 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)); + camel_operation_push_message (NULL, _("Importing '%s'"), filename); - folder = mail_tool_uri_to_folder ( - m->parent_uri, CAMEL_STORE_FOLDER_CREATE, + folder = e_mail_session_uri_to_folder_sync ( + session, m->parent_uri, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); if (!folder) return; |