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/groupwise-features/proxy-login.c | |
parent | 5e0758bb6934a7859b1d8a247c8fb21c156772cf (diff) | |
download | gsoc2013-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 'plugins/groupwise-features/proxy-login.c')
-rw-r--r-- | plugins/groupwise-features/proxy-login.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 12d095bb31..74b67f0ef5 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -30,6 +30,7 @@ #include <libedataserverui/e-passwords.h> #include <mail/em-folder-tree.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-store.h> #include <mail/mail-config.h> #include <mail/em-folder-selector.h> @@ -307,6 +308,9 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) EAccountList *accounts = e_get_account_list (); EAccount *srcAccount; EAccount *dstAccount; + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EGwConnection *proxy_cnc, *cnc; CamelURL *uri = NULL, *parent = NULL; gchar *password = NULL, *user_name = NULL; @@ -315,6 +319,10 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) gint i; gint permissions = 0; + 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)); + for (i=0; email[i]!='\0' && email[i]!='@' ; i++); if (email[i]=='@') name = g_strndup (email, i); @@ -360,7 +368,7 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) e_account_list_change (accounts, srcAccount); e_account_list_save (accounts); g_object_set_data ((GObject *)dstAccount, "permissions", GINT_TO_POINTER(permissions)); - mail_get_store (e_account_get_string (dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); + mail_get_store (session, e_account_get_string (dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); g_free (proxy_source_url); g_free (parent_source_url); @@ -381,9 +389,16 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EAccount *account = user_data; gint permissions = GPOINTER_TO_INT(g_object_get_data ((GObject *)account, "permissions")); + 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)); + if (store == NULL) return; @@ -391,7 +406,7 @@ proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) store->mode &= !CAMEL_STORE_WRITE; store->flags |= CAMEL_STORE_PROXY; - e_mail_store_add (store, account->name); + e_mail_store_add (session, store, account->name); } static void |