aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-attachment-handler.c95
-rw-r--r--modules/mail/e-mail-junk-hook.c15
-rw-r--r--modules/mail/e-mail-shell-backend.c32
-rw-r--r--modules/mail/e-mail-shell-content.c30
-rw-r--r--modules/mail/e-mail-shell-settings.c22
-rw-r--r--modules/mail/e-mail-shell-settings.h4
-rw-r--r--modules/mail/e-mail-shell-sidebar.c10
-rw-r--r--modules/mail/e-mail-shell-view-actions.c107
-rw-r--r--modules/mail/e-mail-shell-view-private.c34
-rw-r--r--modules/mail/e-mail-shell-view-private.h2
-rw-r--r--modules/mail/e-mail-shell-view.c15
-rw-r--r--modules/mail/em-account-prefs.c163
-rw-r--r--modules/mail/em-account-prefs.h6
-rw-r--r--modules/mail/em-mailer-prefs.c25
-rw-r--r--modules/mail/em-mailer-prefs.h3
-rw-r--r--modules/startup-wizard/evolution-startup-wizard.c15
16 files changed, 453 insertions, 125 deletions
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 55ffc808fd..2b74b2a1ed 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -24,15 +24,16 @@
#include <glib/gi18n.h>
#include "e-util/e-alert-dialog.h"
+#include "mail/e-mail-backend.h"
#include "mail/em-composer-utils.h"
-#include "mail/mail-tools.h"
#define E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerPrivate))
struct _EMailAttachmentHandlerPrivate {
- gint placeholder;
+ EShell *shell;
+ EMailSession *session;
};
static gpointer parent_class;
@@ -57,16 +58,17 @@ static GtkTargetEntry target_table[] = {
static void
mail_attachment_handler_forward (GtkAction *action,
- EAttachmentView *view)
+ EAttachmentHandler *handler)
{
- EShell *shell;
+ EMailAttachmentHandlerPrivate *priv;
EAttachment *attachment;
+ EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
GList *selected;
- /* FIXME Pass this in somehow. */
- shell = e_shell_get_default ();
+ view = e_attachment_handler_get_view (handler);
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
selected = e_attachment_view_get_selected_attachments (view);
g_return_if_fail (g_list_length (selected) == 1);
@@ -75,7 +77,8 @@ mail_attachment_handler_forward (GtkAction *action,
mime_part = e_attachment_get_mime_part (attachment);
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
- em_utils_forward_message (shell, CAMEL_MIME_MESSAGE (wrapper), NULL);
+ em_utils_forward_message (
+ priv->shell, CAMEL_MIME_MESSAGE (wrapper), NULL);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
g_list_free (selected);
@@ -83,16 +86,17 @@ mail_attachment_handler_forward (GtkAction *action,
static void
mail_attachment_handler_reply_all (GtkAction *action,
- EAttachmentView *view)
+ EAttachmentHandler *handler)
{
- EShell *shell;
+ EMailAttachmentHandlerPrivate *priv;
EAttachment *attachment;
+ EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
GList *selected;
- /* FIXME Pass this in somehow. */
- shell = e_shell_get_default ();
+ view = e_attachment_handler_get_view (handler);
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
selected = e_attachment_view_get_selected_attachments (view);
g_return_if_fail (g_list_length (selected) == 1);
@@ -102,7 +106,7 @@ mail_attachment_handler_reply_all (GtkAction *action,
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
em_utils_reply_to_message (
- shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
+ priv->shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
REPLY_MODE_ALL, NULL);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
@@ -111,16 +115,17 @@ mail_attachment_handler_reply_all (GtkAction *action,
static void
mail_attachment_handler_reply_sender (GtkAction *action,
- EAttachmentView *view)
+ EAttachmentHandler *handler)
{
- EShell *shell;
+ EMailAttachmentHandlerPrivate *priv;
EAttachment *attachment;
+ EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
GList *selected;
- /* FIXME Pass this in somehow. */
- shell = e_shell_get_default ();
+ view = e_attachment_handler_get_view (handler);
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
selected = e_attachment_view_get_selected_attachments (view);
g_return_if_fail (g_list_length (selected) == 1);
@@ -130,7 +135,7 @@ mail_attachment_handler_reply_sender (GtkAction *action,
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
em_utils_reply_to_message (
- shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
+ priv->shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
REPLY_MODE_SENDER, NULL);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
@@ -168,7 +173,8 @@ mail_attachment_handler_message_rfc822 (EAttachmentView *view,
gint y,
GtkSelectionData *selection_data,
guint info,
- guint time)
+ guint time,
+ EAttachmentHandler *handler)
{
static GdkAtom atom = GDK_NONE;
EAttachmentStore *store;
@@ -231,9 +237,11 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
gint y,
GtkSelectionData *selection_data,
guint info,
- guint time)
+ guint time,
+ EAttachmentHandler *handler)
{
static GdkAtom atom = GDK_NONE;
+ EMailAttachmentHandlerPrivate *priv;
CamelDataWrapper *wrapper;
CamelMimeMessage *message;
CamelMultipart *multipart;
@@ -257,6 +265,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
return;
store = e_attachment_view_get_store (view);
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
parent = gtk_widget_get_toplevel (GTK_WIDGET (view));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
@@ -290,7 +299,8 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
/* The first string is the folder URI. */
/* FIXME Not passing a GCancellable here. */
- folder = mail_tool_uri_to_folder (data, 0, NULL, &local_error);
+ folder = e_mail_session_uri_to_folder_sync (
+ priv->session, data, 0, NULL, &local_error);
if (folder == NULL)
goto exit;
@@ -384,7 +394,8 @@ exit:
}
static void
-mail_attachment_handler_update_actions (EAttachmentView *view)
+mail_attachment_handler_update_actions (EAttachmentView *view,
+ EAttachmentHandler *handler)
{
EAttachment *attachment;
CamelMimePart *mime_part;
@@ -417,25 +428,58 @@ exit:
}
static void
+mail_attachment_handler_dispose (GObject *object)
+{
+ EMailAttachmentHandlerPrivate *priv;
+
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (object);
+
+ if (priv->shell != NULL) {
+ g_object_unref (priv->shell);
+ priv->shell = NULL;
+ }
+
+ if (priv->session != NULL) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
mail_attachment_handler_constructed (GObject *object)
{
+ EMailAttachmentHandlerPrivate *priv;
+ EShell *shell;
+ EShellBackend *shell_backend;
EAttachmentHandler *handler;
EAttachmentView *view;
+ EMailSession *session;
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
GError *error = NULL;
handler = E_ATTACHMENT_HANDLER (object);
+ priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (object);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
+ 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));
+
+ priv->shell = g_object_ref (shell);
+ priv->session = g_object_ref (session);
+
view = e_attachment_handler_get_view (handler);
action_group = e_attachment_view_add_action_group (view, "mail");
gtk_action_group_add_actions (
action_group, standard_entries,
- G_N_ELEMENTS (standard_entries), view);
+ G_N_ELEMENTS (standard_entries), handler);
ui_manager = e_attachment_view_get_ui_manager (view);
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
@@ -448,17 +492,17 @@ mail_attachment_handler_constructed (GObject *object)
g_signal_connect (
view, "update-actions",
G_CALLBACK (mail_attachment_handler_update_actions),
- NULL);
+ handler);
g_signal_connect (
view, "drag-data-received",
G_CALLBACK (mail_attachment_handler_message_rfc822),
- NULL);
+ handler);
g_signal_connect (
view, "drag-data-received",
G_CALLBACK (mail_attachment_handler_x_uid_list),
- NULL);
+ handler);
}
static GdkDragAction
@@ -487,6 +531,7 @@ mail_attachment_handler_class_init (EMailAttachmentHandlerClass *class)
g_type_class_add_private (class, sizeof (EMailAttachmentHandlerPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = mail_attachment_handler_dispose;
object_class->constructed = mail_attachment_handler_constructed;
handler_class = E_ATTACHMENT_HANDLER_CLASS (class);
diff --git a/modules/mail/e-mail-junk-hook.c b/modules/mail/e-mail-junk-hook.c
index ae87df1b30..ac88f1ea4c 100644
--- a/modules/mail/e-mail-junk-hook.c
+++ b/modules/mail/e-mail-junk-hook.c
@@ -28,7 +28,7 @@
#include "mail/em-junk.h"
#include "mail/em-utils.h"
-#include "mail/mail-session.h"
+#include "mail/e-mail-session.h"
#define E_MAIL_JUNK_HOOK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -209,6 +209,10 @@ mail_junk_hook_construct (EPluginHook *hook,
xmlNodePtr node)
{
EMailJunkHookPrivate *priv;
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
gchar *property;
priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (hook);
@@ -258,8 +262,15 @@ mail_junk_hook_construct (EPluginHook *hook,
if (priv->interface.commit_reports == NULL)
return -1;
+ shell = e_shell_get_default ();
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
mail_session_add_junk_plugin (
- priv->interface.plugin_name, &priv->interface.camel);
+ session, priv->interface.plugin_name,
+ &priv->interface.camel);
return 0;
}
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 24d3ecab58..02b073a82b 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -38,6 +38,7 @@
#include "e-mail-browser.h"
#include "e-mail-reader.h"
+#include "e-mail-session.h"
#include "e-mail-store.h"
#include "em-account-editor.h"
#include "em-account-prefs.h"
@@ -52,7 +53,6 @@
#include "mail-config.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
-#include "mail-session.h"
#include "mail-vfolder.h"
#include "importers/mail-importer.h"
@@ -237,12 +237,14 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
gpointer user_data)
{
EShellBackend *shell_backend = user_data;
+ EMailBackend *backend;
CamelURL *url = user_data;
EShell *shell;
const gchar *forward;
const gchar *reply;
const gchar *uid;
+ backend = E_MAIL_BACKEND (shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
if (folder == NULL) {
@@ -290,7 +292,7 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
GtkWidget *browser;
/* FIXME Should pass in the shell module. */
- browser = e_mail_browser_new (shell_backend);
+ browser = e_mail_browser_new (backend);
e_mail_reader_set_folder (
E_MAIL_READER (browser), folder, folder_uri);
e_mail_reader_set_message (E_MAIL_READER (browser), uid);
@@ -306,8 +308,13 @@ mail_shell_backend_handle_uri_cb (EShell *shell,
const gchar *uri,
EMailShellBackend *mail_shell_backend)
{
+ EMailBackend *backend;
+ EMailSession *session;
gboolean handled = TRUE;
+ backend = E_MAIL_BACKEND (mail_shell_backend);
+ session = e_mail_backend_get_session (backend);
+
if (g_str_has_prefix (uri, "mailto:")) {
if (em_utils_check_user_can_send_mail ())
em_utils_compose_new_message_with_mailto (
@@ -321,7 +328,7 @@ mail_shell_backend_handle_uri_cb (EShell *shell,
gchar *curi = em_uri_to_camel (uri);
mail_get_folder (
- curi, 0,
+ session, curi, 0,
mail_shell_backend_handle_email_uri_cb,
mail_shell_backend, mail_msg_unordered_push);
g_free (curi);
@@ -357,8 +364,14 @@ mail_shell_backend_send_receive_cb (EShell *shell,
GtkWindow *parent,
EShellBackend *shell_backend)
{
+ EMailBackend *backend;
+ EMailSession *session;
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
em_utils_clear_get_password_canceled_accounts_flag ();
- mail_send_receive (parent);
+ mail_send_receive (parent, session);
}
static void
@@ -469,7 +482,7 @@ mail_shell_backend_constructed (GObject *object)
G_CALLBACK (mail_shell_backend_window_created_cb),
shell_backend);
- e_mail_shell_settings_init (shell);
+ e_mail_shell_settings_init (shell_backend);
/* Setup preference widget factories */
preferences_window = e_shell_get_preferences_window (shell);
@@ -513,6 +526,8 @@ mail_shell_backend_start (EShellBackend *shell_backend)
EMailShellBackendPrivate *priv;
EShell *shell;
EShellSettings *shell_settings;
+ EMailBackend *backend;
+ EMailSession *session;
gboolean enable_search_folders;
priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
@@ -520,12 +535,15 @@ mail_shell_backend_start (EShellBackend *shell_backend)
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
enable_search_folders = e_shell_settings_get_boolean (
shell_settings, "mail-enable-search-folders");
if (enable_search_folders)
- vfolder_load_storage ();
+ vfolder_load_storage (session);
- mail_autoreceive_init (shell_backend, session);
+ mail_autoreceive_init (backend);
if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
priv->mail_sync_source_id = g_timeout_add_seconds (
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 6ba52737ba..fd1db02fa8 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -244,6 +244,20 @@ mail_shell_content_get_action_group (EMailReader *reader)
return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window);
}
+static EMailBackend *
+mail_shell_content_get_backend (EMailReader *reader)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
+
+ /* Forward this to our internal EMailView, which
+ * also implements the EMailReader interface. */
+ reader = E_MAIL_READER (priv->mail_view);
+
+ return e_mail_reader_get_backend (reader);
+}
+
static EMFormatHTML *
mail_shell_content_get_formatter (EMailReader *reader)
{
@@ -300,20 +314,6 @@ mail_shell_content_get_popup_menu (EMailReader *reader)
return e_mail_reader_get_popup_menu (reader);
}
-static EShellBackend *
-mail_shell_content_get_shell_backend (EMailReader *reader)
-{
- EMailShellContentPrivate *priv;
-
- priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
-
- /* Forward this to our internal EMailView, which
- * also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
-
- return e_mail_reader_get_shell_backend (reader);
-}
-
static GtkWindow *
mail_shell_content_get_window (EMailReader *reader)
{
@@ -412,11 +412,11 @@ static void
mail_shell_content_reader_init (EMailReaderInterface *interface)
{
interface->get_action_group = mail_shell_content_get_action_group;
+ interface->get_backend = mail_shell_content_get_backend;
interface->get_formatter = mail_shell_content_get_formatter;
interface->get_hide_deleted = mail_shell_content_get_hide_deleted;
interface->get_message_list = mail_shell_content_get_message_list;
interface->get_popup_menu = mail_shell_content_get_popup_menu;
- interface->get_shell_backend = mail_shell_content_get_shell_backend;
interface->get_window = mail_shell_content_get_window;
interface->set_folder = mail_shell_content_set_folder;
interface->show_search_bar = mail_shell_content_show_search_bar;
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 690a0ef5b8..5452a1939a 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -24,18 +24,28 @@
#include <gconf/gconf-client.h>
#include <libedataserver/e-account-list.h>
-#include "e-util/e-signature-list.h"
-#include "mail/e-mail-label-list-store.h"
-#include "mail/mail-session.h"
+#include <e-util/e-signature-list.h>
+
+#include <mail/e-mail-backend.h>
+#include <mail/e-mail-label-list-store.h>
+
+#include <shell/e-shell.h>
void
-e_mail_shell_settings_init (EShell *shell)
+e_mail_shell_settings_init (EShellBackend *shell_backend)
{
+ EShell *shell;
EShellSettings *shell_settings;
+ EMailBackend *backend;
+ EMailSession *session;
gpointer object;
+ shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
/*** Global Objects ***/
e_shell_settings_install_property (
@@ -58,9 +68,9 @@ e_mail_shell_settings_init (EShell *shell)
NULL,
G_PARAM_READWRITE));
- g_object_ref (session);
e_shell_settings_set_pointer (
- shell_settings, "mail-session", session);
+ shell_settings, "mail-session",
+ g_object_ref (session));
/*** Mail Preferences ***/
diff --git a/modules/mail/e-mail-shell-settings.h b/modules/mail/e-mail-shell-settings.h
index 4267fd8a60..1faf6c6faf 100644
--- a/modules/mail/e-mail-shell-settings.h
+++ b/modules/mail/e-mail-shell-settings.h
@@ -22,11 +22,11 @@
#ifndef E_MAIL_SHELL_SETTINGS_H
#define E_MAIL_SHELL_SETTINGS_H
-#include <shell/e-shell.h>
+#include <shell/e-shell-backend.h>
G_BEGIN_DECLS
-void e_mail_shell_settings_init (EShell *shell);
+void e_mail_shell_settings_init (EShellBackend *shell_backend);
G_END_DECLS
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index ac736a0a67..bc1cbcdda2 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -23,6 +23,7 @@
#include "e-util/e-binding.h"
+#include "mail/e-mail-backend.h"
#include "mail/e-mail-sidebar.h"
#include "mail/em-folder-utils.h"
@@ -116,10 +117,13 @@ mail_shell_sidebar_constructed (GObject *object)
{
EMailShellSidebar *mail_shell_sidebar;
EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EShellView *shell_view;
EShell *shell;
+ EMailBackend *backend;
+ EMailSession *session;
GtkTreeSelection *selection;
GtkTreeView *tree_view;
GtkWidget *container;
@@ -130,11 +134,15 @@ mail_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
shell_settings = e_shell_get_shell_settings (shell);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (object);
/* Build sidebar widgets. */
@@ -152,7 +160,7 @@ mail_shell_sidebar_constructed (GObject *object)
container = widget;
- widget = e_mail_sidebar_new ();
+ widget = e_mail_sidebar_new (session);
gtk_container_add (GTK_CONTAINER (container), widget);
mail_shell_sidebar->priv->folder_tree = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 4b4a1d8024..852edbd147 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -50,6 +50,10 @@ action_mail_account_disable_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
EMFolderTree *folder_tree;
EAccountList *account_list;
EAccount *account;
@@ -57,6 +61,12 @@ action_mail_account_disable_cb (GtkAction *action,
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
folder_uri = em_folder_tree_get_selected_uri (folder_tree);
g_return_if_fail (folder_uri != NULL);
@@ -70,7 +80,7 @@ action_mail_account_disable_cb (GtkAction *action,
account->enabled = !account->enabled;
e_account_list_change (account_list, account);
- e_mail_store_remove_by_uri (folder_uri);
+ e_mail_store_remove_by_uri (session, folder_uri);
if (account->parent_uid != NULL)
e_account_list_remove (account_list, account);
@@ -87,24 +97,32 @@ action_mail_create_search_folder_cb (GtkAction *action,
EMailShellContent *mail_shell_content;
EMailReader *reader;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellSearchbar *searchbar;
EFilterRule *search_rule;
EMVFolderRule *vfolder_rule;
+ EMailBackend *backend;
+ EMailSession *session;
EMailView *mail_view;
const gchar *folder_uri;
const gchar *search_text;
gchar *rule_name;
- vfolder_load_storage ();
-
shell_view = E_SHELL_VIEW (mail_shell_view);
- search_rule = e_shell_view_get_search_rule (shell_view);
- g_return_if_fail (search_rule != NULL);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
searchbar = e_mail_shell_content_get_searchbar (mail_shell_content);
+ vfolder_load_storage (session);
+
+ search_rule = e_shell_view_get_search_rule (shell_view);
+ g_return_if_fail (search_rule != NULL);
+
search_text = e_shell_searchbar_get_search_text (searchbar);
if (search_text == NULL || *search_text == '\0')
search_text = "''";
@@ -141,21 +159,39 @@ static void
action_mail_flush_outbox_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- mail_send ();
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
+ mail_send (session);
}
static void
action_mail_folder_copy_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShellView *shell_view;
- EShellWindow *shell_window;
EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
CamelFolderInfo *folder_info;
EMFolderTree *folder_tree;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -164,7 +200,7 @@ action_mail_folder_copy_cb (GtkAction *action,
/* XXX Leaking folder_info? */
em_folder_utils_copy_folder (
- GTK_WINDOW (shell_window), folder_info, FALSE);
+ GTK_WINDOW (shell_window), session, folder_info, FALSE);
}
static void
@@ -272,14 +308,21 @@ static void
action_mail_folder_move_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShellView *shell_view;
- EShellWindow *shell_window;
EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
CamelFolderInfo *folder_info;
EMFolderTree *folder_tree;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -288,7 +331,7 @@ action_mail_folder_move_cb (GtkAction *action,
/* XXX Leaking folder_info? */
em_folder_utils_copy_folder (
- GTK_WINDOW (shell_window), folder_info, TRUE);
+ GTK_WINDOW (shell_window), session, folder_info, TRUE);
}
static void
@@ -411,14 +454,24 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
EMFolderTree *folder_tree;
gchar *folder_uri;
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
folder_uri = em_folder_tree_get_selected_uri (folder_tree);
- em_folder_utils_unsubscribe_folder (folder_uri);
+ em_folder_utils_unsubscribe_folder (session, folder_uri);
g_free (folder_uri);
}
@@ -426,13 +479,20 @@ static void
action_mail_global_expunge_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
+ EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
- em_utils_empty_trash (GTK_WIDGET (shell_window));
+ em_utils_empty_trash (GTK_WIDGET (shell_window), session);
}
static void
@@ -813,13 +873,20 @@ static void
action_mail_tools_filters_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
+ EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
- em_utils_edit_filters (GTK_WIDGET (shell_window));
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
+ em_utils_edit_filters (GTK_WIDGET (shell_window), session);
}
static void
@@ -834,8 +901,11 @@ action_mail_tools_subscriptions_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
EMFolderTree *folder_tree;
EAccount *account = NULL;
GtkWidget *dialog;
@@ -843,10 +913,14 @@ action_mail_tools_subscriptions_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
uri = em_folder_tree_get_selected_uri (folder_tree);
if (uri != NULL) {
account = mail_config_get_account_by_source_url (uri);
@@ -854,7 +928,8 @@ action_mail_tools_subscriptions_cb (GtkAction *action,
}
dialog = em_subscription_editor_new (
- GTK_WINDOW (shell_window), session, account);
+ GTK_WINDOW (shell_window),
+ CAMEL_SESSION (session), account);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 8d4fa9922e..e8febf59ca 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -801,14 +801,17 @@ mail_shell_view_create_filter_cb (CamelFolder *folder,
gpointer user_data)
{
struct {
+ EMailSession *session;
const gchar *source;
gint type;
} *filter_data = user_data;
if (message != NULL)
filter_gui_add_from_message (
- message, filter_data->source, filter_data->type);
+ filter_data->session, message,
+ filter_data->source, filter_data->type);
+ g_object_unref (filter_data->session);
g_free (filter_data);
}
@@ -817,6 +820,10 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
gint filter_type)
{
EMailShellContent *mail_shell_content;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
CamelFolder *folder;
@@ -825,6 +832,7 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
GPtrArray *uids;
struct {
+ EMailSession *session;
const gchar *source;
gint type;
} *filter_data;
@@ -834,6 +842,12 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
folder_uri = e_mail_reader_get_folder_uri (reader);
@@ -848,6 +862,7 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
if (uids->len == 1) {
filter_data = g_malloc (sizeof (*filter_data));
+ filter_data->session = g_object_ref (session);
filter_data->source = filter_source;
filter_data->type = filter_type;
@@ -868,14 +883,17 @@ mail_shell_view_create_vfolder_cb (CamelFolder *folder,
gpointer user_data)
{
struct {
+ EMailSession *session;
gchar *uri;
gint type;
} *vfolder_data = user_data;
if (message != NULL)
vfolder_gui_add_from_message (
- message, vfolder_data->type, vfolder_data->uri);
+ vfolder_data->session, message,
+ vfolder_data->type, vfolder_data->uri);
+ g_object_unref (vfolder_data->session);
g_free (vfolder_data->uri);
g_free (vfolder_data);
}
@@ -885,6 +903,10 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
gint vfolder_type)
{
EMailShellContent *mail_shell_content;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMailBackend *backend;
+ EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
CamelFolder *folder;
@@ -892,6 +914,7 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
GPtrArray *uids;
struct {
+ EMailSession *session;
gchar *uri;
gint type;
} *vfolder_data;
@@ -901,6 +924,12 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
folder_uri = e_mail_reader_get_folder_uri (reader);
@@ -908,6 +937,7 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
if (uids->len == 1) {
vfolder_data = g_malloc (sizeof (*vfolder_data));
+ vfolder_data->session = g_object_ref (session);
vfolder_data->uri = g_strdup (folder_uri);
vfolder_data->type = vfolder_type;
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 816fcef02d..dbd2d217d5 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -43,6 +43,7 @@
#include "e-mail-label-list-store.h"
#include "e-mail-local.h"
#include "e-mail-reader.h"
+#include "e-mail-session.h"
#include "e-mail-sidebar.h"
#include "e-mail-store.h"
#include "em-composer-utils.h"
@@ -56,7 +57,6 @@
#include "mail-config.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
-#include "mail-session.h"
#include "mail-tools.h"
#include "mail-vfolder.h"
#include "message-list.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index d7f77de215..4696a39456 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -212,6 +212,8 @@ mail_shell_view_execute_search (EShellView *shell_view)
EShellSettings *shell_settings;
EShellSearchbar *searchbar;
EActionComboBox *combo_box;
+ EMailBackend *backend;
+ EMailSession *session;
EMFolderTree *folder_tree;
GtkTreeSelection *selection;
GtkWidget *message_list;
@@ -249,6 +251,9 @@ mail_shell_view_execute_search (EShellView *shell_view)
shell = e_shell_window_get_shell (shell_window);
shell_settings = e_shell_get_shell_settings (shell);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
searchbar = e_mail_shell_content_get_searchbar (mail_shell_content);
@@ -550,7 +555,7 @@ all_accounts:
/* FIXME Using data_dir like this is not portable. */
uri = g_strdup_printf ("vfolder:%s/vfolder", data_dir);
- store = camel_session_get_store (session, uri, NULL);
+ store = camel_session_get_store (CAMEL_SESSION (session), uri, NULL);
g_free (uri);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
@@ -562,7 +567,8 @@ all_accounts:
while (iter != NULL) {
folder_uri = iter->data;
/* FIXME Not passing a GCancellable or GError here. */
- folder = mail_tool_uri_to_folder (folder_uri, 0, NULL, NULL);
+ folder = e_mail_session_uri_to_folder_sync (
+ E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL);
if (folder != NULL)
list = g_list_append (list, folder);
@@ -577,7 +583,8 @@ all_accounts:
while (iter != NULL) {
folder_uri = iter->data;
/* FIXME Not passing a GCancellable or GError here. */
- folder = mail_tool_uri_to_folder (folder_uri, 0, NULL, NULL);
+ folder = e_mail_session_uri_to_folder_sync (
+ E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL);
if (folder != NULL)
list = g_list_append (list, folder);
@@ -733,7 +740,7 @@ current_account:
/* FIXME Using data_dir like this is not portable. */
uri = g_strdup_printf ("vfolder:%s/vfolder", data_dir);
- store = camel_session_get_store (session, uri, NULL);
+ store = camel_session_get_store (CAMEL_SESSION (session), uri, NULL);
g_free (uri);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index 7b3b61fa9a..5b734a4638 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -35,6 +35,7 @@
#include "e-util/e-alert-dialog.h"
#include "e-util/e-account-utils.h"
+#include "e-mail-backend.h"
#include "e-mail-store.h"
#include "em-config.h"
#include "em-account-editor.h"
@@ -46,28 +47,37 @@
((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate))
struct _EMAccountPrefsPrivate {
+ EMailSession *session;
gpointer assistant; /* weak pointer */
gpointer editor; /* weak pointer */
};
+enum {
+ PROP_0,
+ PROP_SESSION
+};
+
G_DEFINE_TYPE (
EMAccountPrefs,
em_account_prefs,
E_TYPE_ACCOUNT_MANAGER)
static void
-account_prefs_enable_account_cb (EAccountTreeView *tree_view)
+account_prefs_enable_account_cb (EAccountTreeView *tree_view,
+ EMAccountPrefs *prefs)
{
EAccount *account;
account = e_account_tree_view_get_selected (tree_view);
g_return_if_fail (account != NULL);
- e_mail_store_add_by_uri (account->source->url, account->name);
+ e_mail_store_add_by_uri (
+ prefs->priv->session, account->source->url, account->name);
}
static void
-account_prefs_disable_account_cb (EAccountTreeView *tree_view)
+account_prefs_disable_account_cb (EAccountTreeView *tree_view,
+ EMAccountPrefs *prefs)
{
EAccountList *account_list;
EAccount *account;
@@ -96,7 +106,81 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view)
e_account_list_remove_account_proxies (account_list, account);
- e_mail_store_remove_by_uri (account->source->url);
+ e_mail_store_remove_by_uri (
+ prefs->priv->session, account->source->url);
+}
+
+static void
+account_prefs_set_session (EMAccountPrefs *prefs,
+ EMailSession *session)
+{
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (prefs->priv->session == NULL);
+
+ prefs->priv->session = g_object_ref (session);
+}
+
+static void
+account_prefs_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SESSION:
+ account_prefs_set_session (
+ EM_ACCOUNT_PREFS (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_prefs_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SESSION:
+ g_value_set_object (
+ value,
+ em_account_prefs_get_session (
+ EM_ACCOUNT_PREFS (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_prefs_dispose (GObject *object)
+{
+ EMAccountPrefsPrivate *priv;
+
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object);
+
+ if (priv->session != NULL) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ if (priv->assistant != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->assistant), &priv->assistant);
+ priv->assistant = NULL;
+ }
+
+ if (priv->editor != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->editor), &priv->editor);
+ priv->editor = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (em_account_prefs_parent_class)->dispose (object);
}
static void
@@ -126,7 +210,7 @@ account_prefs_add_account (EAccountManager *manager)
* The new mail account assistant.
*/
emae = em_account_editor_new (
- NULL, EMAE_ASSISTANT,
+ NULL, EMAE_ASSISTANT, priv->session,
"org.gnome.evolution.mail.config.accountAssistant");
e_config_create_window (
E_CONFIG (emae->config), NULL,
@@ -176,7 +260,7 @@ account_prefs_edit_account (EAccountManager *manager)
* The account editor window.
*/
emae = em_account_editor_new (
- account, EMAE_NOTEBOOK,
+ account, EMAE_NOTEBOOK, priv->session,
"org.gnome.evolution.mail.config.accountEditor");
e_config_create_window (
E_CONFIG (emae->config), parent, _("Account Editor"));
@@ -229,7 +313,8 @@ account_prefs_delete_account (EAccountManager *manager)
/* Remove the account from the folder tree. */
if (account->enabled && account->source && account->source->url)
- e_mail_store_remove_by_uri (account->source->url);
+ e_mail_store_remove_by_uri (
+ priv->session, account->source->url);
/* Remove all the proxies the account has created. */
if (has_proxies)
@@ -242,29 +327,6 @@ account_prefs_delete_account (EAccountManager *manager)
}
static void
-account_prefs_dispose (GObject *object)
-{
- EMAccountPrefsPrivate *priv;
-
- priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object);
-
- if (priv->assistant != NULL) {
- g_object_remove_weak_pointer (
- G_OBJECT (priv->assistant), &priv->assistant);
- priv->assistant = NULL;
- }
-
- if (priv->editor != NULL) {
- g_object_remove_weak_pointer (
- G_OBJECT (priv->editor), &priv->editor);
- priv->editor = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (em_account_prefs_parent_class)->dispose (object);
-}
-
-static void
em_account_prefs_class_init (EMAccountPrefsClass *class)
{
GObjectClass *object_class;
@@ -273,12 +335,25 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
g_type_class_add_private (class, sizeof (EMAccountPrefsPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = account_prefs_set_property;
+ object_class->get_property = account_prefs_get_property;
object_class->dispose = account_prefs_dispose;
account_manager_class = E_ACCOUNT_MANAGER_CLASS (class);
account_manager_class->add_account = account_prefs_add_account;
account_manager_class->edit_account = account_prefs_edit_account;
account_manager_class->delete_account = account_prefs_delete_account;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SESSION,
+ g_param_spec_object (
+ "session",
+ NULL,
+ NULL,
+ E_TYPE_MAIL_SESSION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -294,22 +369,42 @@ em_account_prefs_init (EMAccountPrefs *prefs)
g_signal_connect (
tree_view, "enable-account",
- G_CALLBACK (account_prefs_enable_account_cb), NULL);
+ G_CALLBACK (account_prefs_enable_account_cb), prefs);
g_signal_connect (
tree_view, "disable-account",
- G_CALLBACK (account_prefs_disable_account_cb), NULL);
+ G_CALLBACK (account_prefs_disable_account_cb), prefs);
}
GtkWidget *
em_account_prefs_new (EPreferencesWindow *window)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
EAccountList *account_list;
account_list = e_get_account_list ();
-
g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL);
+ /* XXX Figure out a better way to get the EMailSession. */
+ shell = e_preferences_window_get_shell (window);
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
return g_object_new (
- EM_TYPE_ACCOUNT_PREFS, "account-list", account_list, NULL);
+ EM_TYPE_ACCOUNT_PREFS,
+ "account-list", account_list,
+ "session", session, NULL);
+}
+
+EMailSession *
+em_account_prefs_get_session (EMAccountPrefs *prefs)
+{
+ g_return_val_if_fail (EM_IS_ACCOUNT_PREFS (prefs), NULL);
+
+ return prefs->priv->session;
}
diff --git a/modules/mail/em-account-prefs.h b/modules/mail/em-account-prefs.h
index 5fe49b6b31..c00b860d35 100644
--- a/modules/mail/em-account-prefs.h
+++ b/modules/mail/em-account-prefs.h
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include <table/e-table.h>
#include <libedataserver/e-account-list.h>
+#include <mail/e-mail-session.h>
#include <misc/e-account-manager.h>
#include <widgets/misc/e-preferences-window.h>
@@ -62,8 +63,9 @@ struct _EMAccountPrefsClass {
EAccountManagerClass parent_class;
};
-GType em_account_prefs_get_type (void);
-GtkWidget *em_account_prefs_new (EPreferencesWindow *window);
+GType em_account_prefs_get_type (void);
+GtkWidget * em_account_prefs_new (EPreferencesWindow *window);
+EMailSession * em_account_prefs_get_session (EMAccountPrefs *prefs);
G_END_DECLS
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 570da0ebff..60a8795a63 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -44,13 +44,13 @@
#include "widgets/misc/e-charset-combo-box.h"
#include "shell/e-shell-utils.h"
+#include "e-mail-backend.h"
#include "e-mail-label-manager.h"
#include "e-mail-reader-utils.h"
#include "mail-config.h"
#include "em-folder-selection-button.h"
#include "em-junk.h"
#include "em-config.h"
-#include "mail-session.h"
enum {
HEADER_LIST_NAME_COLUMN, /* displayable name of the header (may be a translation) */
@@ -104,6 +104,7 @@ em_mailer_prefs_finalize (GObject *object)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) object;
+ g_object_unref (prefs->session);
g_object_unref (prefs->builder);
if (prefs->labels_change_notify_id) {
@@ -660,7 +661,7 @@ static void
junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
{
gchar *def_plugin = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
- const GList *plugins = mail_session_get_junk_plugins ();
+ const GList *plugins = mail_session_get_junk_plugins (prefs->session);
gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL);
while (plugins) {
@@ -669,7 +670,8 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
if (iface->plugin_name && def_plugin && !strcmp (iface->plugin_name, def_plugin)) {
gboolean status;
- session->junk_plugin = CAMEL_JUNK_PLUGIN (&iface->camel);
+ CAMEL_SESSION (prefs->session)->junk_plugin =
+ CAMEL_JUNK_PLUGIN (&iface->camel);
status = e_plugin_invoke (iface->hook->plugin, iface->validate_binary, NULL) != NULL;
if ((gboolean)status == TRUE) {
gchar *text, *html;
@@ -701,7 +703,7 @@ junk_plugin_setup (GtkComboBox *combo_box, EMMailerPrefs *prefs)
GtkCellRenderer *cell;
gint index = 0;
gboolean def_set = FALSE;
- const GList *plugins = mail_session_get_junk_plugins ();
+ const GList *plugins = mail_session_get_junk_plugins (prefs->session);
gchar *pdefault = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", NULL);
store = gtk_list_store_new (1, G_TYPE_STRING);
@@ -1127,12 +1129,23 @@ GtkWidget *
em_mailer_prefs_new (EPreferencesWindow *window)
{
EMMailerPrefs *new;
- EShell *shell = e_preferences_window_get_shell (window);
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ /* XXX Figure out a better way to get the EMailSession. */
+ shell = e_preferences_window_get_shell (window);
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
new = g_object_new (EM_TYPE_MAILER_PREFS, NULL);
+ /* FIXME This should be a constructor property. */
+ new->session = g_object_ref (session);
+
/* FIXME Kill this function. */
em_mailer_prefs_construct (new, shell);
diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h
index a6b3f1876e..d28fd5f5e4 100644
--- a/modules/mail/em-mailer-prefs.h
+++ b/modules/mail/em-mailer-prefs.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <shell/e-shell.h>
+#include <mail/e-mail-session.h>
#include <widgets/misc/e-preferences-window.h>
/* Standard GObject macros */
@@ -55,6 +56,8 @@ typedef struct _EMMailerPrefsClass EMMailerPrefsClass;
struct _EMMailerPrefs {
GtkVBox parent_object;
+ EMailSession *session;
+
GtkBuilder *builder;
GConfClient *gconf;
diff --git a/modules/startup-wizard/evolution-startup-wizard.c b/modules/startup-wizard/evolution-startup-wizard.c
index e1b8551574..6f07d6856e 100644
--- a/modules/startup-wizard/evolution-startup-wizard.c
+++ b/modules/startup-wizard/evolution-startup-wizard.c
@@ -25,6 +25,7 @@
#include <e-util/e-extension.h>
#include <e-util/e-import.h>
+#include <mail/e-mail-backend.h>
#include <mail/em-account-editor.h>
#include <capplet/settings/mail-capplet-shell.h>
#include <calendar/gui/calendar-config.h>
@@ -424,14 +425,24 @@ startup_wizard_progress_page (EConfig *config,
static GtkWidget *
startup_wizard_new_assistant (EStartupWizard *extension)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
EMAccountEditor *emae;
EConfig *config;
EConfigItem *config_item;
GtkWidget *widget;
GSList *items = NULL;
+ shell = startup_wizard_get_shell (extension);
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+
emae = em_account_editor_new (
- NULL, EMAE_ASSISTANT,
+ NULL, EMAE_ASSISTANT, session,
"org.gnome.evolution.mail.config.accountWizard");
config = E_CONFIG (emae->config);
@@ -515,7 +526,7 @@ startup_wizard_run (EStartupWizard *extension)
const gchar *startup_view;
gboolean express_mode;
- shell = e_shell_get_default ();
+ shell = startup_wizard_get_shell (extension);
express_mode = e_shell_get_express_mode (shell);
startup_view = e_shell_get_startup_view (shell);