diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-19 02:12:47 +0800 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-19 02:46:33 +0800 |
commit | 43e436121ab61b9850122806122741099ce64857 (patch) | |
tree | 86f8f401f7a6b3be748a09606788a0420bb534b6 /mail | |
parent | e2a748116df1399acde19effb5cba78704e9d06e (diff) | |
download | gsoc2013-evolution-43e436121ab61b9850122806122741099ce64857.tar.gz gsoc2013-evolution-43e436121ab61b9850122806122741099ce64857.tar.zst gsoc2013-evolution-43e436121ab61b9850122806122741099ce64857.zip |
Implement get_data/config_dir vfuncs for mail backend
Now the backend specifies the data dir for the mail module. Obviously it uses
the same directory as it previously used, it's just that the responsibility for
defining that value has moved to a different place.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 17 | ||||
-rw-r--r-- | mail/mail-session.c | 30 |
2 files changed, 32 insertions, 15 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 5d5effe72c..64880ff98f 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -14,8 +14,11 @@ * You should have received a copy of the GNU Lesser General Public * License along with the program; if not, see <http://www.gnu.org/licenses/> * + * Authors: + * Jonathon Jongsma <jonathon.jongsma@collabora.co.uk> * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * Copyright (C) 2009 Intel Corporation * */ @@ -55,6 +58,18 @@ static gpointer parent_class; /* FIXME Kill this thing. It's a horrible hack. */ extern gint camel_application_is_exiting; +static const gchar * +mail_shell_backend_get_data_dir (EShellBackend *backend) +{ + return mail_session_get_data_dir (); +} + +static const gchar * +mail_shell_backend_get_config_dir (EShellBackend *backend) +{ + return mail_session_get_config_dir (); +} + /* Callback for various asynchronous CamelStore operations where * the EActivity's reference count is used as a counting semaphore. */ static void @@ -431,6 +446,8 @@ mail_backend_class_init (EMailBackendClass *class) shell_backend_class = E_SHELL_BACKEND_CLASS (class); shell_backend_class->migrate = e_mail_migrate; + shell_backend_class->get_data_dir = mail_shell_backend_get_data_dir; + shell_backend_class->get_config_dir = mail_shell_backend_get_config_dir; } static void diff --git a/mail/mail-session.c b/mail/mail-session.c index 2360c064c0..3dade5b918 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -14,8 +14,10 @@ * * * Authors: + * Jonathon Jongsma <jonathon.jongsma@collabora.co.uk> * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * Copyright (C) 2009 Intel Corporation * */ @@ -85,8 +87,9 @@ typedef struct _MailSessionClass { } MailSessionClass; -static EShellBackend *session_shell_backend; static CamelSessionClass *ms_parent_class; +static gchar * mail_data_dir; +static gchar * mail_config_dir; static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, CamelException *ex); static void forget_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, CamelException *ex); @@ -113,6 +116,9 @@ finalise (MailSession *session) gconf_client_notify_remove (mail_config_get_gconf_client (), session_check_junk_notify_id); mail_async_event_destroy(session->async); + + g_free (mail_data_dir); + g_free (mail_config_dir); } static void @@ -518,7 +524,7 @@ main_get_filter_driver (CamelSession *session, const gchar *type, CamelException gconf = mail_config_get_gconf_client (); - data_dir = e_shell_backend_get_data_dir (session_shell_backend); + data_dir = mail_session_get_data_dir (); user = g_build_filename (data_dir, "filters.xml", NULL); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); fc = (ERuleContext *) em_filter_context_new (); @@ -717,15 +723,11 @@ mail_session_init (EShellBackend *shell_backend) EShell *shell; GConfClient *gconf; gboolean online; - const gchar *data_dir; - - session_shell_backend = shell_backend; shell = e_shell_backend_get_shell (shell_backend); online = e_shell_get_online (shell); - data_dir = e_get_user_data_dir (); - if (camel_init (data_dir, TRUE) != 0) + if (camel_init (e_get_user_data_dir (), TRUE) != 0) exit (0); camel_provider_init(); @@ -734,8 +736,10 @@ mail_session_init (EShellBackend *shell_backend) e_account_combo_box_set_session (session); /* XXX Don't ask... */ e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */ - data_dir = e_shell_backend_get_data_dir (shell_backend); - camel_session_construct (session, data_dir); + mail_data_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL); + mail_config_dir = g_build_filename (mail_data_dir, "config", NULL); + + camel_session_construct (session, mail_data_dir); gconf = mail_config_get_gconf_client (); gconf_client_add_dir (gconf, "/apps/evolution/mail/junk", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); @@ -805,16 +809,12 @@ mail_session_set_junk_headers (const gchar **name, const gchar **value, gint len const gchar * mail_session_get_data_dir (void) { - g_return_val_if_fail (session_shell_backend, NULL); - - return e_shell_backend_get_data_dir (session_shell_backend); + return mail_data_dir; } const gchar * mail_session_get_config_dir (void) { - g_return_val_if_fail (session_shell_backend, NULL); - - return e_shell_backend_get_config_dir (session_shell_backend); + return mail_config_dir; } |