diff options
author | Gustavo Noronha Silva <gustavo.noronha@collabora.com> | 2011-06-29 02:44:45 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gustavo.noronha@collabora.com> | 2011-06-29 02:44:45 +0800 |
commit | 13bddd5581df8c19b4e57c3d0d7ace62b3c44c97 (patch) | |
tree | cf4010bbf4a72d3f24cf55d3810af9181e391645 /capplet | |
parent | 913fbc65742343885dbde4e1b02105809d6aa0a8 (diff) | |
download | gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar.gz gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar.bz2 gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar.lz gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar.xz gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.tar.zst gsoc2013-evolution-13bddd5581df8c19b4e57c3d0d7ace62b3c44c97.zip |
Fix crash when adding account in express mode
The settings library started using an EMailBackend object, but since
it is abstract it can't be instantiated directly. So we use the EShell
to get the mail backend for us instead, after loading the modules.
Diffstat (limited to 'capplet')
-rw-r--r-- | capplet/settings/Makefile.am | 1 | ||||
-rw-r--r-- | capplet/settings/mail-capplet-shell.c | 28 |
2 files changed, 28 insertions, 1 deletions
diff --git a/capplet/settings/Makefile.am b/capplet/settings/Makefile.am index e6ea573c11..dd8c3c9a45 100644 --- a/capplet/settings/Makefile.am +++ b/capplet/settings/Makefile.am @@ -25,6 +25,7 @@ libevolution_mail_settings_la_CPPFLAGS = \ -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ -DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \ + -DEVOLUTION_MODULEDIR=\""$(moduledir)"\" \ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \ -DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \ diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c index 5a70fad6d4..ebcb5cd355 100644 --- a/capplet/settings/mail-capplet-shell.c +++ b/capplet/settings/mail-capplet-shell.c @@ -43,6 +43,8 @@ #include <mail/mail-mt.h> #include <mail/e-mail-store.h> +#include <shell/e-shell.h> + enum { CTRL_W_PRESSED, CTRL_Q_PRESSED, @@ -202,6 +204,7 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean { MailCappletShellPrivate *priv = shell->priv; GtkStyle *style = gtk_widget_get_default_style (); + EShell *eshell; EMailSession *session; gchar *custom_dir; @@ -239,7 +242,30 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean camel_provider_init (); - shell->priv->backend = g_object_new (E_TYPE_MAIL_BACKEND, NULL); + eshell = e_shell_get_default (); + + if (eshell == NULL) { + GError *error = NULL; + + eshell = g_initable_new ( + E_TYPE_SHELL, NULL, &error, + "application-id", "org.gnome.Evolution", + "flags", 0, + "geometry", NULL, + "module-directory", EVOLUTION_MODULEDIR, + "meego-mode", FALSE, + "express-mode", FALSE, + "small-screen-mode", FALSE, + "online", FALSE, + NULL); + + if (error != NULL) + g_error ("%s", error->message); + + e_shell_load_modules (eshell); + } + + shell->priv->backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (eshell, "mail")); session = e_mail_backend_get_session (shell->priv->backend); shell->view = mail_view_new (); |