aboutsummaryrefslogtreecommitdiffstats
path: root/capplet/settings/mail-capplet-shell.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 /capplet/settings/mail-capplet-shell.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 'capplet/settings/mail-capplet-shell.c')
-rw-r--r--capplet/settings/mail-capplet-shell.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index 63f8625caa..9153edb7ab 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -38,7 +38,6 @@
#include "mail-decoration.h"
#include <mail/em-utils.h>
#include <mail/em-composer-utils.h>
-#include <mail/mail-session.h>
#include <mail/mail-mt.h>
#include <mail/e-mail-store.h>
@@ -68,6 +67,7 @@ static guint mail_capplet_shell_signals[LAST_SIGNAL];
struct _MailCappletShellPrivate {
+ EMailSession *session;
GtkWidget *box;
GtkWidget * top_bar;
@@ -237,17 +237,23 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean
}
+ if (camel_init (e_get_user_data_dir (), TRUE) != 0)
+ exit (0);
+
+ camel_provider_init ();
+
+ shell->priv->session = e_mail_session_new ();
+
shell->view = mail_view_new ();
+ shell->view->session = shell->priv->session;
gtk_widget_show ((GtkWidget *)shell->view);
tmp = gtk_vbox_new (FALSE, 0);
gtk_box_pack_end ((GtkBox *)priv->box, (GtkWidget *)shell->view, TRUE, TRUE, 2);
- /* This also initializes Camel, so it needs to happen early. */
- mail_session_start ();
- mail_config_init ();
+ mail_config_init (CAMEL_SESSION (shell->priv->session));
mail_msg_init ();
custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
- e_mail_store_init (custom_dir);
+ e_mail_store_init (shell->priv->session, custom_dir);
g_free (custom_dir);
if (just_druid) {