aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capplet/settings/mail-account-view.c10
-rw-r--r--capplet/settings/mail-account-view.h2
-rw-r--r--capplet/settings/mail-capplet-shell.c12
-rw-r--r--capplet/settings/mail-view.c2
-rw-r--r--capplet/settings/mail-view.h4
-rw-r--r--mail/e-mail-reader-utils.c4
-rw-r--r--mail/e-mail-reader.c4
-rw-r--r--mail/e-mail-session.c9
-rw-r--r--mail/e-mail-sidebar.c6
-rw-r--r--mail/e-mail-sidebar.h2
-rw-r--r--mail/em-account-editor.c120
-rw-r--r--mail/em-account-editor.h8
-rw-r--r--mail/em-composer-utils.c9
-rw-r--r--mail/em-filter-context.c48
-rw-r--r--mail/em-filter-context.h6
-rw-r--r--mail/em-filter-folder-element.c65
-rw-r--r--mail/em-filter-folder-element.h6
-rw-r--r--mail/em-folder-selection-button.c94
-rw-r--r--mail/em-folder-selection-button.h10
-rw-r--r--mail/em-folder-selector.c7
-rw-r--r--mail/em-folder-tree.c102
-rw-r--r--mail/em-folder-tree.h6
-rw-r--r--mail/em-folder-utils.c23
-rw-r--r--mail/em-folder-utils.h2
-rw-r--r--mail/em-utils.c4
-rw-r--r--mail/em-vfolder-context.c50
-rw-r--r--mail/em-vfolder-context.h6
-rw-r--r--mail/em-vfolder-editor.c6
-rw-r--r--mail/em-vfolder-rule.c57
-rw-r--r--mail/em-vfolder-rule.h6
-rw-r--r--mail/importers/evolution-mbox-importer.c7
-rw-r--r--mail/mail-autofilter.c28
-rw-r--r--mail/mail-autofilter.h2
-rw-r--r--mail/mail-vfolder.c10
-rw-r--r--mail/mail-vfolder.h2
-rw-r--r--modules/mail/e-mail-shell-backend.c17
-rw-r--r--modules/mail/e-mail-shell-sidebar.c7
-rw-r--r--modules/mail/e-mail-shell-view-actions.c13
-rw-r--r--modules/mail/em-account-prefs.c68
-rw-r--r--modules/mail/em-account-prefs.h4
-rw-r--r--modules/startup-wizard/evolution-startup-wizard.c2
-rw-r--r--plugins/dbx-import/dbx-importer.c5
-rw-r--r--plugins/mark-all-read/mark-all-read.c5
-rw-r--r--plugins/pst-import/pst-importer.c7
44 files changed, 441 insertions, 426 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index 128e541f91..128e0f1558 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -32,7 +32,7 @@
#include <libedataserver/e-account-list.h>
#include "mail-view.h"
#include "e-util/e-config.h"
-#include "mail/e-mail-session.h"
+#include "mail/e-mail-backend.h"
#include "mail-guess-servers.h"
struct _MailAccountViewPrivate {
@@ -1035,7 +1035,7 @@ next_page (GtkWidget *entry, MailAccountView *mav)
static void
mail_account_view_construct (MailAccountView *view,
- EMailSession *session)
+ EMailBackend *backend)
{
gint i;
EShell *shell;
@@ -1058,7 +1058,7 @@ mail_account_view_construct (MailAccountView *view,
view->current_page = 0;
gtk_box_pack_start ((GtkBox *) view, view->scroll, TRUE, TRUE, 0);
view->edit = em_account_editor_new_for_pages (
- view->original, EMAE_PAGES, session,
+ view->original, EMAE_PAGES, backend,
"org.gnome.evolution.mail.config.accountWizard", view->wpages);
gtk_widget_hide (e_config_create_widget (E_CONFIG (view->edit->config)));
view->edit->emae_check_servers = emae_check_servers;
@@ -1096,13 +1096,13 @@ mail_account_view_construct (MailAccountView *view,
MailAccountView *
mail_account_view_new (EAccount *account,
- EMailSession *session)
+ EMailBackend *backend)
{
MailAccountView *view = g_object_new (MAIL_ACCOUNT_VIEW_TYPE, NULL);
view->type = MAIL_VIEW_ACCOUNT;
view->uri = "account://";
view->original = account;
- mail_account_view_construct (view, session);
+ mail_account_view_construct (view, backend);
return view;
}
diff --git a/capplet/settings/mail-account-view.h b/capplet/settings/mail-account-view.h
index ac03b1a536..1b04533403 100644
--- a/capplet/settings/mail-account-view.h
+++ b/capplet/settings/mail-account-view.h
@@ -87,7 +87,7 @@ typedef struct _MailAccountViewClass {
} MailAccountViewClass;
GType mail_account_view_get_type (void);
-MailAccountView *mail_account_view_new (EAccount *account, EMailSession *session);
+MailAccountView *mail_account_view_new (EAccount *account, EMailBackend *backend);
GtkWidget * mail_account_view_get_tab_widget (MailAccountView *mcv);
void mail_account_view_activate (MailAccountView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act);
#endif
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index fecc0a67ad..2908531e57 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -66,7 +66,7 @@ static guint mail_capplet_shell_signals[LAST_SIGNAL];
struct _MailCappletShellPrivate {
- EMailSession *session;
+ EMailBackend *backend;
GtkWidget *box;
GtkWidget * top_bar;
@@ -202,6 +202,7 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean
{
MailCappletShellPrivate *priv = shell->priv;
GtkStyle *style = gtk_widget_get_default_style ();
+ EMailSession *session;
gchar *custom_dir;
gtk_window_set_icon_name ((GtkWindow *)shell, "evolution");
@@ -238,17 +239,18 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean
camel_provider_init ();
- shell->priv->session = e_mail_session_new ();
+ shell->priv->backend = g_object_new (E_TYPE_MAIL_BACKEND, NULL);
+ session = e_mail_backend_get_session (shell->priv->backend);
shell->view = mail_view_new ();
- shell->view->session = shell->priv->session;
+ shell->view->backend = shell->priv->backend;
gtk_widget_show ((GtkWidget *) shell->view);
gtk_box_pack_end ((GtkBox *) priv->box, (GtkWidget *) shell->view, TRUE, TRUE, 2);
- mail_config_init (shell->priv->session);
+ mail_config_init (session);
mail_msg_init ();
custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
- e_mail_store_init (shell->priv->session, custom_dir);
+ e_mail_store_init (session, custom_dir);
g_free (custom_dir);
if (just_druid) {
diff --git a/capplet/settings/mail-view.c b/capplet/settings/mail-view.c
index 71fdf07dc3..67a86d7872 100644
--- a/capplet/settings/mail-view.c
+++ b/capplet/settings/mail-view.c
@@ -433,7 +433,7 @@ mail_view_add_account (MailView *mv,
MailAccountView *msv;
gint position = 0;
- msv = mail_account_view_new (data, mv->session);
+ msv = mail_account_view_new (data, mv->backend);
gtk_widget_show ((GtkWidget *) msv);
if (!block)
mv->priv->current_view = (MailViewChild *) msv;
diff --git a/capplet/settings/mail-view.h b/capplet/settings/mail-view.h
index 558bb945a7..6f814fd81e 100644
--- a/capplet/settings/mail-view.h
+++ b/capplet/settings/mail-view.h
@@ -24,7 +24,7 @@
#define _MAIL_VIEW_H_
#include <shell/e-shell-view.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include "anjal-mail-view.h"
@@ -48,7 +48,7 @@ typedef struct _MailViewPrivate MailViewPrivate;
typedef struct _MailView {
AnjalMailView parent;
- EMailSession *session;
+ EMailBackend *backend;
GtkWidget *tree; /* Actual tree */
GtkWidget *folder_tree;
GtkWidget *slider;
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 51eff2a325..1fe121dcb7 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1009,7 +1009,6 @@ mail_reader_create_filter_cb (CamelFolder *folder,
AsyncContext *context)
{
EMailBackend *backend;
- EMailSession *session;
EAlertSink *alert_sink;
CamelMimeMessage *message;
GError *error = NULL;
@@ -1043,10 +1042,9 @@ mail_reader_create_filter_cb (CamelFolder *folder,
context->activity = NULL;
backend = e_mail_reader_get_backend (context->reader);
- session = e_mail_backend_get_session (backend);
filter_gui_add_from_message (
- session, message,
+ backend, message,
context->filter_source,
context->filter_type);
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 3802eaaded..18d7621a9d 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -294,7 +294,7 @@ action_mail_copy_cb (GtkAction *action,
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
- folder_tree = em_folder_tree_new (session);
+ folder_tree = em_folder_tree_new (backend);
emu_restore_folder_tree_state (EM_FOLDER_TREE (folder_tree));
em_folder_tree_set_excluded (
@@ -797,7 +797,7 @@ action_mail_move_cb (GtkAction *action,
session = e_mail_backend_get_session (backend);
- folder_tree = em_folder_tree_new (session);
+ folder_tree = em_folder_tree_new (backend);
emu_restore_folder_tree_state (EM_FOLDER_TREE (folder_tree));
em_folder_tree_set_excluded (
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index b89e571c59..05f0fa09b9 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -289,6 +289,8 @@ main_get_filter_driver (CamelSession *session,
const gchar *type,
GError **error)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
EMailSession *ms = E_MAIL_SESSION (session);
CamelFilterDriver *driver;
EFilterRule *rule = NULL;
@@ -297,12 +299,17 @@ main_get_filter_driver (CamelSession *session,
GConfClient *client;
ERuleContext *fc;
+ shell = e_shell_get_default ();
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (shell_backend), NULL);
+
client = gconf_client_get_default ();
config_dir = mail_session_get_config_dir ();
user = g_build_filename (config_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
- fc = (ERuleContext *) em_filter_context_new (ms);
+ fc = (ERuleContext *) em_filter_context_new (
+ E_MAIL_BACKEND (shell_backend));
e_rule_context_load (fc, system, user);
g_free (system);
g_free (user);
diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c
index f9cb30eab2..80043f035a 100644
--- a/mail/e-mail-sidebar.c
+++ b/mail/e-mail-sidebar.c
@@ -473,12 +473,12 @@ e_mail_sidebar_get_type (void)
}
GtkWidget *
-e_mail_sidebar_new (EMailSession *session)
+e_mail_sidebar_new (EMailBackend *backend)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
- E_TYPE_MAIL_SIDEBAR, "session", session, NULL);
+ E_TYPE_MAIL_SIDEBAR, "backend", backend, NULL);
}
GKeyFile *
diff --git a/mail/e-mail-sidebar.h b/mail/e-mail-sidebar.h
index ebb6d0a37c..8941c99746 100644
--- a/mail/e-mail-sidebar.h
+++ b/mail/e-mail-sidebar.h
@@ -76,7 +76,7 @@ struct _EMailSidebarClass {
};
GType e_mail_sidebar_get_type (void);
-GtkWidget * e_mail_sidebar_new (EMailSession *session);
+GtkWidget * e_mail_sidebar_new (EMailBackend *backend);
GKeyFile * e_mail_sidebar_get_key_file (EMailSidebar *sidebar);
void e_mail_sidebar_set_key_file (EMailSidebar *sidebar,
GKeyFile *key_file);
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 66d8ea68c8..78ed7791d9 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -58,8 +58,8 @@
#include "widgets/misc/e-signature-editor.h"
#include "widgets/misc/e-port-entry.h"
+#include "e-mail-backend.h"
#include "e-mail-local.h"
-#include "e-mail-session.h"
#include "e-mail-store.h"
#include "em-config.h"
#include "em-folder-selection-button.h"
@@ -140,7 +140,7 @@ typedef struct _EMAccountEditorService {
struct _EMAccountEditorPrivate {
- EMailSession *session;
+ EMailBackend *backend;
EAccount *modified_account;
EAccount *original_account;
gboolean new_account;
@@ -211,9 +211,9 @@ struct _EMAccountEditorPrivate {
enum {
PROP_0,
+ PROP_BACKEND,
PROP_MODIFIED_ACCOUNT,
- PROP_ORIGINAL_ACCOUNT,
- PROP_SESSION
+ PROP_ORIGINAL_ACCOUNT
};
static void emae_refresh_authtype (EMAccountEditor *emae, EMAccountEditorService *service);
@@ -268,13 +268,13 @@ emae_set_original_account (EMAccountEditor *emae,
}
static void
-emae_set_session (EMAccountEditor *emae,
- EMailSession *session)
+emae_set_backend (EMAccountEditor *emae,
+ EMailBackend *backend)
{
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (emae->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (emae->priv->backend == NULL);
- emae->priv->session = g_object_ref (session);
+ emae->priv->backend = g_object_ref (backend);
}
static void
@@ -284,14 +284,14 @@ emae_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ORIGINAL_ACCOUNT:
- emae_set_original_account (
+ case PROP_BACKEND:
+ emae_set_backend (
EM_ACCOUNT_EDITOR (object),
g_value_get_object (value));
return;
- case PROP_SESSION:
- emae_set_session (
+ case PROP_ORIGINAL_ACCOUNT:
+ emae_set_original_account (
EM_ACCOUNT_EDITOR (object),
g_value_get_object (value));
return;
@@ -307,24 +307,24 @@ emae_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_MODIFIED_ACCOUNT:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_account_editor_get_modified_account (
+ em_account_editor_get_backend (
EM_ACCOUNT_EDITOR (object)));
return;
- case PROP_ORIGINAL_ACCOUNT:
+ case PROP_MODIFIED_ACCOUNT:
g_value_set_object (
value,
- em_account_editor_get_original_account (
+ em_account_editor_get_modified_account (
EM_ACCOUNT_EDITOR (object)));
return;
- case PROP_SESSION:
+ case PROP_ORIGINAL_ACCOUNT:
g_value_set_object (
value,
- em_account_editor_get_session (
+ em_account_editor_get_original_account (
EM_ACCOUNT_EDITOR (object)));
return;
}
@@ -339,9 +339,9 @@ emae_dispose (GObject *object)
priv = EM_ACCOUNT_EDITOR (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
if (priv->modified_account != NULL) {
@@ -398,6 +398,17 @@ emae_class_init (GObjectClass *class)
g_object_class_install_property (
object_class,
+ PROP_BACKEND,
+ g_param_spec_object (
+ "backend",
+ "Mail Backend",
+ NULL,
+ E_TYPE_MAIL_BACKEND,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
PROP_MODIFIED_ACCOUNT,
g_param_spec_object (
"modified-account",
@@ -416,17 +427,6 @@ emae_class_init (GObjectClass *class)
E_TYPE_ACCOUNT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (
- object_class,
- PROP_SESSION,
- g_param_spec_object (
- "session",
- "Mail Session",
- NULL,
- E_TYPE_MAIL_SESSION,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -482,17 +482,17 @@ em_account_editor_get_type (void)
EMAccountEditor *
em_account_editor_new (EAccount *account,
EMAccountEditorType type,
- EMailSession *session,
+ EMailBackend *backend,
const gchar *id)
{
EMAccountEditor *emae;
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
emae = g_object_new (
EM_TYPE_ACCOUNT_EDITOR,
"original-account", account,
- "session", session, NULL);
+ "backend", backend, NULL);
em_account_editor_construct (emae, type, id);
@@ -513,18 +513,18 @@ em_account_editor_new (EAccount *account,
EMAccountEditor *
em_account_editor_new_for_pages (EAccount *account,
EMAccountEditorType type,
- EMailSession *session,
+ EMailBackend *backend,
const gchar *id,
GtkWidget **pages)
{
EMAccountEditor *emae;
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
emae = g_object_new (
EM_TYPE_ACCOUNT_EDITOR,
"original-account", account,
- "session", session, NULL);
+ "backend", backend, NULL);
emae->pages = pages;
em_account_editor_construct (emae, type, id);
@@ -532,28 +532,28 @@ em_account_editor_new_for_pages (EAccount *account,
return emae;
}
-EAccount *
-em_account_editor_get_modified_account (EMAccountEditor *emae)
+EMailBackend *
+em_account_editor_get_backend (EMAccountEditor *emae)
{
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
- return emae->priv->modified_account;
+ return emae->priv->backend;
}
EAccount *
-em_account_editor_get_original_account (EMAccountEditor *emae)
+em_account_editor_get_modified_account (EMAccountEditor *emae)
{
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
- return emae->priv->original_account;
+ return emae->priv->modified_account;
}
-EMailSession *
-em_account_editor_get_session (EMAccountEditor *emae)
+EAccount *
+em_account_editor_get_original_account (EMAccountEditor *emae)
{
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
- return emae->priv->session;
+ return emae->priv->original_account;
}
/* ********************************************************************** */
@@ -1108,14 +1108,14 @@ emae_account_folder (EMAccountEditor *emae, const gchar *name, gint item, gint d
{
EAccount *account;
EMFolderSelectionButton *folder;
- EMailSession *session;
+ EMailBackend *backend;
const gchar *uri;
account = em_account_editor_get_modified_account (emae);
- session = em_account_editor_get_session (emae);
+ backend = em_account_editor_get_backend (emae);
folder = (EMFolderSelectionButton *) e_builder_get_widget (builder, name);
- em_folder_selection_button_set_session (folder, session);
+ em_folder_selection_button_set_backend (folder, backend);
uri = e_account_get_string (account, item);
if (uri != NULL) {
@@ -1981,6 +1981,7 @@ emae_check_authtype (GtkWidget *w,
EMAccountEditorService *service)
{
CamelService *camel_service;
+ EMailBackend *backend;
EMailSession *session;
EAccount *account;
GtkWidget *editor;
@@ -1990,7 +1991,8 @@ emae_check_authtype (GtkWidget *w,
account = em_account_editor_get_modified_account (service->emae);
editor = E_CONFIG (service->emae->config)->window;
- session = em_account_editor_get_session (service->emae);
+ backend = em_account_editor_get_backend (service->emae);
+ session = e_mail_backend_get_session (backend);
if (service->type == CAMEL_PROVIDER_TRANSPORT)
uid = g_strconcat (account->uid, "-transport", NULL);
@@ -3035,7 +3037,7 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
EMAccountEditor *emae = data;
EMAccountEditorPrivate *priv = emae->priv;
EMFolderSelectionButton *button;
- EMailSession *session;
+ EMailBackend *backend;
EAccount *account;
GtkWidget *widget;
GtkBuilder *builder;
@@ -3046,10 +3048,10 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
return NULL;
account = em_account_editor_get_modified_account (emae);
- session = em_account_editor_get_session (emae);
+ backend = em_account_editor_get_backend (emae);
- /* Make sure we have a valid EMailSession. */
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ /* Make sure we have a valid EMailBackend. */
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
builder = gtk_builder_new ();
e_load_ui_builder_definition (builder, "mail-config.ui");
@@ -3072,7 +3074,7 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
widget = e_builder_get_widget (builder, "trash_folder_butt");
button = EM_FOLDER_SELECTION_BUTTON (widget);
- em_folder_selection_button_set_session (button, session);
+ em_folder_selection_button_set_backend (button, backend);
priv->trash_folder_button = GTK_BUTTON (button);
setup_checkable_folder (
@@ -3085,7 +3087,7 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
widget = e_builder_get_widget (builder, "junk_folder_butt");
button = EM_FOLDER_SELECTION_BUTTON (widget);
- em_folder_selection_button_set_session (button, session);
+ em_folder_selection_button_set_backend (button, backend);
priv->junk_folder_button = GTK_BUTTON (button);
setup_checkable_folder (
@@ -3783,9 +3785,11 @@ emae_commit (EConfig *ec, GSList *items, gpointer data)
if (account->enabled
&& emae->priv->source.provider
&& (emae->priv->source.provider->flags & CAMEL_PROVIDER_IS_STORAGE)) {
+ EMailBackend *backend;
EMailSession *session;
- session = em_account_editor_get_session (emae);
+ backend = em_account_editor_get_backend (emae);
+ session = e_mail_backend_get_session (backend);
e_mail_store_add_by_account (session, account);
}
}
diff --git a/mail/em-account-editor.h b/mail/em-account-editor.h
index 7be79c6c5e..a34fd8af2d 100644
--- a/mail/em-account-editor.h
+++ b/mail/em-account-editor.h
@@ -26,7 +26,7 @@
#include <gtk/gtk.h>
#include <mail/em-config.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
/* Standard GObject macros */
#define EM_TYPE_ACCOUNT_EDITOR \
@@ -99,19 +99,19 @@ GType em_account_editor_get_type (void);
EMAccountEditor *
em_account_editor_new (EAccount *account,
EMAccountEditorType type,
- EMailSession *session,
+ EMailBackend *backend,
const gchar *id);
EMAccountEditor *
em_account_editor_new_for_pages (EAccount *account,
EMAccountEditorType type,
- EMailSession *session,
+ EMailBackend *backend,
const gchar *id,
GtkWidget **pages);
+EMailBackend * em_account_editor_get_backend (EMAccountEditor *emae);
EAccount * em_account_editor_get_modified_account
(EMAccountEditor *emae);
EAccount * em_account_editor_get_original_account
(EMAccountEditor *emae);
-EMailSession * em_account_editor_get_session (EMAccountEditor *emae);
void em_account_editor_commit (EMAccountEditor *emae);
gboolean em_account_editor_check (EMAccountEditor *emae,
const gchar *page);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index bc836a890d..f58e8955dd 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -2787,15 +2787,18 @@ static void
post_header_clicked_cb (EComposerPostHeader *header,
EMsgComposer *composer)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
GtkTreeSelection *selection;
- CamelSession *session;
GtkWidget *folder_tree;
GtkWidget *dialog;
GList *list;
- session = e_msg_composer_get_session (composer);
+ /* FIXME Figure out a way to pass the mail backend in. */
+ shell = e_msg_composer_get_shell (composer);
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
- folder_tree = em_folder_tree_new (E_MAIL_SESSION (session));
+ folder_tree = em_folder_tree_new (E_MAIL_BACKEND (shell_backend));
emu_restore_folder_tree_state (EM_FOLDER_TREE (folder_tree));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c
index ff25e49cb9..fead5ec3c8 100644
--- a/mail/em-filter-context.c
+++ b/mail/em-filter-context.c
@@ -37,13 +37,13 @@
#include "em-filter-folder-element.h"
struct _EMFilterContextPrivate {
- EMailSession *session;
+ EMailBackend *backend;
GList *actions;
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_BACKEND
};
G_DEFINE_TYPE (
@@ -52,13 +52,13 @@ G_DEFINE_TYPE (
E_TYPE_RULE_CONTEXT)
static void
-filter_context_set_session (EMFilterContext *context,
- EMailSession *session)
+filter_context_set_backend (EMFilterContext *context,
+ EMailBackend *backend)
{
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (context->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (context->priv->backend == NULL);
- context->priv->session = g_object_ref (session);
+ context->priv->backend = g_object_ref (backend);
}
static void
@@ -68,8 +68,8 @@ filter_context_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- filter_context_set_session (
+ case PROP_BACKEND:
+ filter_context_set_backend (
EM_FILTER_CONTEXT (object),
g_value_get_object (value));
return;
@@ -85,10 +85,10 @@ filter_context_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_filter_context_get_session (
+ em_filter_context_get_backend (
EM_FILTER_CONTEXT (object)));
return;
}
@@ -103,9 +103,9 @@ filter_context_dispose (GObject *object)
priv = EM_FILTER_CONTEXT (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
g_list_foreach (priv->actions, (GFunc) g_object_unref, NULL);
@@ -232,7 +232,7 @@ filter_context_new_element (ERuleContext *context,
priv = EM_FILTER_CONTEXT (context)->priv;
if (strcmp (type, "folder") == 0)
- return em_filter_folder_element_new (priv->session);
+ return em_filter_folder_element_new (priv->backend);
if (strcmp (type, "system-flag") == 0)
return e_filter_option_new ();
@@ -267,12 +267,12 @@ em_filter_context_class_init (EMFilterContextClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
@@ -303,20 +303,20 @@ em_filter_context_init (EMFilterContext *context)
}
EMFilterContext *
-em_filter_context_new (EMailSession *session)
+em_filter_context_new (EMailBackend *backend)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
- EM_TYPE_FILTER_CONTEXT, "session", session, NULL);
+ EM_TYPE_FILTER_CONTEXT, "backend", backend, NULL);
}
-EMailSession *
-em_filter_context_get_session (EMFilterContext *context)
+EMailBackend *
+em_filter_context_get_backend (EMFilterContext *context)
{
g_return_val_if_fail (EM_IS_FILTER_CONTEXT (context), NULL);
- return context->priv->session;
+ return context->priv->backend;
}
void
diff --git a/mail/em-filter-context.h b/mail/em-filter-context.h
index 3545bf16eb..d80809b8e4 100644
--- a/mail/em-filter-context.h
+++ b/mail/em-filter-context.h
@@ -25,7 +25,7 @@
#ifndef EM_FILTER_CONTEXT_H
#define EM_FILTER_CONTEXT_H
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <filter/e-rule-context.h>
/* Standard GObject macros */
@@ -64,8 +64,8 @@ struct _EMFilterContextClass {
GType em_filter_context_get_type (void);
EMFilterContext *
- em_filter_context_new (EMailSession *session);
-EMailSession * em_filter_context_get_session (EMFilterContext *context);
+ em_filter_context_new (EMailBackend *backend);
+EMailBackend * em_filter_context_get_backend (EMFilterContext *context);
void em_filter_context_add_action (EMFilterContext *context,
EFilterPart *action);
EFilterPart * em_filter_context_find_action (EMFilterContext *context,
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index 4a5d3595aa..a7be46431b 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -40,13 +40,13 @@
#include "e-util/e-alert.h"
struct _EMFilterFolderElementPrivate {
- EMailSession *session;
+ EMailBackend *backend;
gchar *uri;
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_BACKEND
};
static gboolean validate (EFilterElement *fe, EAlert **alert);
@@ -64,18 +64,23 @@ G_DEFINE_TYPE (
E_TYPE_FILTER_ELEMENT)
static void
-filter_folder_element_set_session (EMFilterFolderElement *element,
- EMailSession *session)
+filter_folder_element_set_backend (EMFilterFolderElement *element,
+ EMailBackend *backend)
{
- if (!session)
- session = e_mail_backend_get_session (
- E_MAIL_BACKEND (e_shell_get_backend_by_name (
- e_shell_get_default (), "mail")));
+ /* FIXME Dirty hack. Backend should be passed in always. */
+ if (backend == NULL) {
+ EShellBackend *shell_backend;
+ EShell *shell;
+
+ shell = e_shell_get_default ();
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ backend = E_MAIL_BACKEND (shell_backend);
+ }
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (element->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (element->priv->backend == NULL);
- element->priv->session = g_object_ref (session);
+ element->priv->backend = g_object_ref (backend);
}
static void
@@ -85,8 +90,8 @@ filter_folder_element_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- filter_folder_element_set_session (
+ case PROP_BACKEND:
+ filter_folder_element_set_backend (
EM_FILTER_FOLDER_ELEMENT (object),
g_value_get_object (value));
return;
@@ -102,10 +107,10 @@ filter_folder_element_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_filter_folder_element_get_session (
+ em_filter_folder_element_get_backend (
EM_FILTER_FOLDER_ELEMENT (object)));
return;
}
@@ -120,9 +125,9 @@ filter_folder_element_dispose (GObject *object)
priv = EM_FILTER_FOLDER_ELEMENT (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
/* Chain up to parent's dispose() method. */
@@ -168,12 +173,12 @@ em_filter_folder_element_class_init (EMFilterFolderElementClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
@@ -187,21 +192,21 @@ em_filter_folder_element_init (EMFilterFolderElement *element)
}
EFilterElement *
-em_filter_folder_element_new (EMailSession *session)
+em_filter_folder_element_new (EMailBackend *backend)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
EM_TYPE_FILTER_FOLDER_ELEMENT,
- "session", session, NULL);
+ "backend", backend, NULL);
}
-EMailSession *
-em_filter_folder_element_get_session (EMFilterFolderElement *element)
+EMailBackend *
+em_filter_folder_element_get_backend (EMFilterFolderElement *element)
{
g_return_val_if_fail (EM_IS_FILTER_FOLDER_ELEMENT (element), NULL);
- return element->priv->session;
+ return element->priv->backend;
}
const gchar *
@@ -310,13 +315,13 @@ static GtkWidget *
get_widget (EFilterElement *fe)
{
EMFilterFolderElement *ff = (EMFilterFolderElement *) fe;
- EMailSession *session;
+ EMailBackend *backend;
GtkWidget *button;
- session = em_filter_folder_element_get_session (ff);
+ backend = em_filter_folder_element_get_backend (ff);
button = em_folder_selection_button_new (
- session, _("Select Folder"), NULL);
+ backend, _("Select Folder"), NULL);
em_folder_selection_button_set_selection (
EM_FOLDER_SELECTION_BUTTON (button), ff->priv->uri);
gtk_widget_show (button);
diff --git a/mail/em-filter-folder-element.h b/mail/em-filter-folder-element.h
index f71b4c128b..c188907ae7 100644
--- a/mail/em-filter-folder-element.h
+++ b/mail/em-filter-folder-element.h
@@ -25,7 +25,7 @@
#ifndef EM_FILTER_FOLDER_ELEMENT_H
#define EM_FILTER_FOLDER_ELEMENT_H
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <filter/e-filter-element.h>
/* Standard GObject macros */
@@ -63,8 +63,8 @@ struct _EMFilterFolderElementClass {
};
GType em_filter_folder_element_get_type (void);
-EFilterElement *em_filter_folder_element_new (EMailSession *session);
-EMailSession * em_filter_folder_element_get_session
+EFilterElement *em_filter_folder_element_new (EMailBackend *backend);
+EMailBackend * em_filter_folder_element_get_backend
(EMFilterFolderElement *element);
const gchar * em_filter_folder_element_get_uri
(EMFilterFolderElement *element);
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index 9ca3267e4c..c18a62e33a 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -41,7 +41,7 @@
((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonPrivate))
struct _EMFolderSelectionButtonPrivate {
- EMailSession *session;
+ EMailBackend *backend;
GtkWidget *icon;
GtkWidget *label;
@@ -52,8 +52,8 @@ struct _EMFolderSelectionButtonPrivate {
enum {
PROP_0,
+ PROP_BACKEND,
PROP_CAPTION,
- PROP_SESSION,
PROP_TITLE
};
@@ -82,7 +82,7 @@ folder_selection_button_unselected (EMFolderSelectionButton *button)
static void
folder_selection_button_set_contents (EMFolderSelectionButton *button)
{
- CamelSession *session;
+ EMailBackend *backend;
CamelStore *store = NULL;
EAccount *account;
GtkLabel *label;
@@ -90,12 +90,16 @@ folder_selection_button_set_contents (EMFolderSelectionButton *button)
gchar *folder_name = NULL;
label = GTK_LABEL (button->priv->label);
- session = CAMEL_SESSION (button->priv->session);
+ backend = em_folder_selection_button_get_backend (button);
- if (button->priv->uri != NULL)
+ if (backend != NULL && button->priv->uri != NULL) {
+ EMailSession *session;
+
+ session = e_mail_backend_get_session (backend);
e_mail_folder_uri_parse (
- session, button->priv->uri,
+ CAMEL_SESSION (session), button->priv->uri,
&store, &folder_name, NULL);
+ }
if (store == NULL || folder_name == NULL) {
folder_selection_button_unselected (button);
@@ -127,16 +131,16 @@ folder_selection_button_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_CAPTION:
- em_folder_selection_button_set_caption (
+ case PROP_BACKEND:
+ em_folder_selection_button_set_backend (
EM_FOLDER_SELECTION_BUTTON (object),
- g_value_get_string (value));
+ g_value_get_object (value));
return;
- case PROP_SESSION:
- em_folder_selection_button_set_session (
+ case PROP_CAPTION:
+ em_folder_selection_button_set_caption (
EM_FOLDER_SELECTION_BUTTON (object),
- g_value_get_object (value));
+ g_value_get_string (value));
return;
case PROP_TITLE:
@@ -156,17 +160,17 @@ folder_selection_button_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_CAPTION:
- g_value_set_string (
+ case PROP_BACKEND:
+ g_value_set_object (
value,
- em_folder_selection_button_get_caption (
+ em_folder_selection_button_get_backend (
EM_FOLDER_SELECTION_BUTTON (object)));
return;
- case PROP_SESSION:
- g_value_set_object (
+ case PROP_CAPTION:
+ g_value_set_string (
value,
- em_folder_selection_button_get_session (
+ em_folder_selection_button_get_caption (
EM_FOLDER_SELECTION_BUTTON (object)));
return;
@@ -188,9 +192,9 @@ folder_selection_button_dispose (GObject *object)
priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object);
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
/* Chain up to parent's dispose() method. */
@@ -229,7 +233,7 @@ folder_selection_button_clicked (GtkButton *button)
parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
- emft = (EMFolderTree *) em_folder_tree_new (priv->session);
+ emft = (EMFolderTree *) em_folder_tree_new (priv->backend);
emu_restore_folder_tree_state (emft);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (emft));
@@ -279,23 +283,23 @@ em_folder_selection_button_class_init (EMFolderSelectionButtonClass *class)
g_object_class_install_property (
object_class,
- PROP_CAPTION,
- g_param_spec_string (
- "caption",
- NULL,
+ PROP_BACKEND,
+ g_param_spec_object (
+ "backend",
NULL,
NULL,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (
object_class,
- PROP_SESSION,
- g_param_spec_object (
- "session",
+ PROP_CAPTION,
+ g_param_spec_string (
+ "caption",
+ NULL,
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@@ -345,15 +349,15 @@ em_folder_selection_button_init (EMFolderSelectionButton *emfsb)
}
GtkWidget *
-em_folder_selection_button_new (EMailSession *session,
+em_folder_selection_button_new (EMailBackend *backend,
const gchar *title,
const gchar *caption)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
EM_TYPE_FOLDER_SELECTION_BUTTON,
- "session", session, "title", title,
+ "backend", backend, "title", title,
"caption", caption, NULL);
}
@@ -400,31 +404,31 @@ em_folder_selection_button_set_selection (EMFolderSelectionButton *button,
folder_selection_button_set_contents (button);
}
-EMailSession *
-em_folder_selection_button_get_session (EMFolderSelectionButton *button)
+EMailBackend *
+em_folder_selection_button_get_backend (EMFolderSelectionButton *button)
{
g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
- return button->priv->session;
+ return button->priv->backend;
}
void
-em_folder_selection_button_set_session (EMFolderSelectionButton *button,
- EMailSession *session)
+em_folder_selection_button_set_backend (EMFolderSelectionButton *button,
+ EMailBackend *backend)
{
g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
- if (session != NULL) {
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_object_ref (session);
+ if (backend != NULL) {
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_object_ref (backend);
}
- if (button->priv->session != NULL)
- g_object_unref (button->priv->session);
+ if (button->priv->backend != NULL)
+ g_object_unref (button->priv->backend);
- button->priv->session = session;
+ button->priv->backend = backend;
- g_object_notify (G_OBJECT (button), "session");
+ g_object_notify (G_OBJECT (button), "backend");
}
const gchar *
diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h
index 504e17cddb..8b31100e84 100644
--- a/mail/em-folder-selection-button.h
+++ b/mail/em-folder-selection-button.h
@@ -25,7 +25,7 @@
#define EM_FOLDER_SELECTION_BUTTON_H
#include <gtk/gtk.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
/* Standard GObject macros */
#define EM_TYPE_FOLDER_SELECTION_BUTTON \
@@ -67,7 +67,7 @@ struct _EMFolderSelectionButtonClass {
GType em_folder_selection_button_get_type (void);
GtkWidget * em_folder_selection_button_new
- (EMailSession *session,
+ (EMailBackend *backend,
const gchar *title,
const gchar *caption);
const gchar * em_folder_selection_button_get_caption
@@ -80,10 +80,10 @@ const gchar * em_folder_selection_button_get_selection
void em_folder_selection_button_set_selection
(EMFolderSelectionButton *button,
const gchar *uri);
-void em_folder_selection_button_set_session
+void em_folder_selection_button_set_backend
(EMFolderSelectionButton *button,
- EMailSession *session);
-EMailSession * em_folder_selection_button_get_session
+ EMailBackend *backend);
+EMailBackend * em_folder_selection_button_get_backend
(EMFolderSelectionButton *button);
const gchar * em_folder_selection_button_get_title
(EMFolderSelectionButton *button);
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index 0f2bbc79f2..71e056e762 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -111,14 +111,17 @@ em_folder_selector_get_type (void)
static void
emfs_response (GtkWidget *dialog, gint response, EMFolderSelector *emfs)
{
+ EMailBackend *backend;
+
if (response != EM_FOLDER_SELECTOR_RESPONSE_NEW)
return;
g_object_set_data ((GObject *)emfs->emft, "select", GUINT_TO_POINTER (1));
+ backend = em_folder_tree_get_backend (emfs->emft);
+
em_folder_utils_create_folder (
- GTK_WINDOW (dialog), emfs->emft,
- em_folder_tree_get_session (emfs->emft), NULL);
+ GTK_WINDOW (dialog), backend, emfs->emft, NULL);
g_signal_stop_emission_by_name (emfs, "response");
}
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index e24b7d329b..613f10dc05 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -77,7 +77,7 @@ struct _selected_uri {
};
struct _EMFolderTreePrivate {
- EMailSession *session;
+ EMailBackend *backend;
/* selected_uri structures of each path pending selection. */
GSList *select_uris;
@@ -119,10 +119,10 @@ struct _EMFolderTreePrivate {
enum {
PROP_0,
+ PROP_BACKEND,
PROP_COPY_TARGET_LIST,
PROP_ELLIPSIZE,
- PROP_PASTE_TARGET_LIST,
- PROP_SESSION
+ PROP_PASTE_TARGET_LIST
};
enum {
@@ -454,6 +454,7 @@ folder_tree_expand_node (const gchar *key,
GtkTreeModel *model;
GtkTreePath *path;
EAccount *account;
+ EMailBackend *backend;
EMailSession *session;
CamelStore *store;
const gchar *p;
@@ -473,7 +474,8 @@ folder_tree_expand_node (const gchar *key,
tree_view = GTK_TREE_VIEW (folder_tree);
model = gtk_tree_view_get_model (tree_view);
- session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
+ session = e_mail_backend_get_session (backend);
if ((account = e_get_account_by_uid (uid)) && account->enabled) {
store = (CamelStore *) camel_session_get_service (
@@ -717,13 +719,13 @@ exit:
}
static void
-folder_tree_set_session (EMFolderTree *folder_tree,
- EMailSession *session)
+folder_tree_set_backend (EMFolderTree *folder_tree,
+ EMailBackend *backend)
{
- g_return_if_fail (CAMEL_IS_SESSION (session));
- g_return_if_fail (folder_tree->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (folder_tree->priv->backend == NULL);
- folder_tree->priv->session = g_object_ref (session);
+ folder_tree->priv->backend = g_object_ref (backend);
}
static GtkTargetList *
@@ -763,16 +765,16 @@ folder_tree_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ELLIPSIZE:
- em_folder_tree_set_ellipsize (
+ case PROP_BACKEND:
+ folder_tree_set_backend (
EM_FOLDER_TREE (object),
- g_value_get_enum (value));
+ g_value_get_object (value));
return;
- case PROP_SESSION:
- folder_tree_set_session (
+ case PROP_ELLIPSIZE:
+ em_folder_tree_set_ellipsize (
EM_FOLDER_TREE (object),
- g_value_get_object (value));
+ g_value_get_enum (value));
return;
}
@@ -786,6 +788,13 @@ folder_tree_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_BACKEND:
+ g_value_set_object (
+ value,
+ em_folder_tree_get_backend (
+ EM_FOLDER_TREE (object)));
+ return;
+
case PROP_COPY_TARGET_LIST:
g_value_set_boxed (
value,
@@ -806,13 +815,6 @@ folder_tree_get_property (GObject *object,
folder_tree_get_paste_target_list (
EM_FOLDER_TREE (object)));
return;
-
- case PROP_SESSION:
- g_value_set_object (
- value,
- em_folder_tree_get_session (
- EM_FOLDER_TREE (object)));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -845,9 +847,9 @@ folder_tree_dispose (GObject *object)
priv->autoexpand_id = 0;
}
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
if (priv->text_renderer != NULL) {
@@ -1103,6 +1105,17 @@ folder_tree_class_init (EMFolderTreeClass *class)
tree_view_class->test_collapse_row = folder_tree_test_collapse_row;
tree_view_class->row_expanded = folder_tree_row_expanded;
+ g_object_class_install_property (
+ object_class,
+ PROP_BACKEND,
+ g_param_spec_object (
+ "backend",
+ NULL,
+ NULL,
+ E_TYPE_MAIL_BACKEND,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
/* Inherited from ESelectableInterface */
g_object_class_override_property (
object_class,
@@ -1126,17 +1139,6 @@ folder_tree_class_init (EMFolderTreeClass *class)
PROP_PASTE_TARGET_LIST,
"paste-target-list");
- 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));
-
signals[FOLDER_SELECTED] = g_signal_new (
"folder-selected",
G_OBJECT_CLASS_TYPE (object_class),
@@ -1702,22 +1704,20 @@ em_folder_tree_get_type (void)
}
GtkWidget *
-em_folder_tree_new (EMailSession *session)
+em_folder_tree_new (EMailBackend *backend)
{
+ EMailSession *session;
const gchar *data_dir;
- EShell *default_shell;
- EShellBackend *mail_backend;
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
- default_shell = e_shell_get_default ();
- mail_backend = e_shell_get_backend_by_name (default_shell, "mail");
- data_dir = e_shell_backend_get_data_dir (mail_backend);
+ session = e_mail_backend_get_session (backend);
+ data_dir = e_shell_backend_get_data_dir (E_SHELL_BACKEND (backend));
e_mail_store_init (session, data_dir);
return g_object_new (
- EM_TYPE_FOLDER_TREE, "session", session, NULL);
+ EM_TYPE_FOLDER_TREE, "backend", backend, NULL);
}
PangoEllipsizeMode
@@ -1742,12 +1742,12 @@ em_folder_tree_set_ellipsize (EMFolderTree *folder_tree,
g_object_notify (G_OBJECT (folder_tree), "ellipsize");
}
-EMailSession *
-em_folder_tree_get_session (EMFolderTree *folder_tree)
+EMailBackend *
+em_folder_tree_get_backend (EMFolderTree *folder_tree)
{
g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), NULL);
- return folder_tree->priv->session;
+ return folder_tree->priv->backend;
}
static void
@@ -2052,6 +2052,7 @@ tree_drag_data_received (GtkWidget *widget,
GtkTreeModel *model;
GtkTreeView *tree_view;
GtkTreePath *dest_path = NULL;
+ EMailBackend *backend;
EMailSession *session;
struct _DragDataReceivedAsync *m;
gboolean is_store;
@@ -2062,7 +2063,8 @@ tree_drag_data_received (GtkWidget *widget,
tree_view = GTK_TREE_VIEW (folder_tree);
model = gtk_tree_view_get_model (tree_view);
- session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
+ session = e_mail_backend_get_session (backend);
if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &dest_path, &pos))
return;
@@ -2726,9 +2728,11 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree,
gboolean expand_only)
{
EMFolderTreePrivate *priv = folder_tree->priv;
+ EMailBackend *backend;
EMailSession *session;
- session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
+ session = e_mail_backend_get_session (backend);
/* FIXME: need to remove any currently selected stuff? */
if (!expand_only)
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index f0f89e9fb0..bc131d4f77 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -25,7 +25,7 @@
#define EM_FOLDER_TREE_H
#include <gtk/gtk.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <mail/em-folder-tree-model.h>
/* Standard GObject macros */
@@ -89,12 +89,12 @@ struct _EMFolderTreeClass {
};
GType em_folder_tree_get_type (void);
-GtkWidget * em_folder_tree_new (EMailSession *session);
+GtkWidget * em_folder_tree_new (EMailBackend *backend);
PangoEllipsizeMode
em_folder_tree_get_ellipsize (EMFolderTree *folder_tree);
void em_folder_tree_set_ellipsize (EMFolderTree *folder_tree,
PangoEllipsizeMode ellipsize);
-EMailSession * em_folder_tree_get_session (EMFolderTree *folder_tree);
+EMailBackend * em_folder_tree_get_backend (EMFolderTree *folder_tree);
void em_folder_tree_enable_drag_and_drop
(EMFolderTree *folder_tree);
void em_folder_tree_set_excluded (EMFolderTree *folder_tree,
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index a3f7847768..498167d2b4 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -473,7 +473,7 @@ em_folder_utils_copy_folder (GtkWindow *parent,
}
/* XXX Do we leak this reference. */
- emft = (EMFolderTree *) em_folder_tree_new (session);
+ emft = (EMFolderTree *) em_folder_tree_new (backend);
emu_restore_folder_tree_state (emft);
em_folder_tree_set_excluded_func (
@@ -512,7 +512,7 @@ new_folder_created_cb (CamelStore *store,
g_warning ("%s", error->message);
g_error_free (error);
- } else {
+ } else if (context->folder_tree != NULL) {
gpointer data;
gboolean expand_only;
@@ -531,10 +531,11 @@ new_folder_created_cb (CamelStore *store,
void
em_folder_utils_create_folder (GtkWindow *parent,
+ EMailBackend *backend,
EMFolderTree *emft,
- EMailSession *session,
const gchar *initial_uri)
{
+ EMailSession *session;
EMFolderTree *folder_tree;
CamelStore *store = NULL;
const gchar *folder_uri;
@@ -542,14 +543,12 @@ em_folder_utils_create_folder (GtkWindow *parent,
GtkWidget *dialog;
GError *error = NULL;
- /* FIXME The EMailSession argument isn't really necessary.
- * We could extract it via em_folder_tree_get_session(). */
-
g_return_if_fail (GTK_IS_WINDOW (parent));
- g_return_if_fail (EM_IS_FOLDER_TREE (emft));
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
- folder_tree = (EMFolderTree *) em_folder_tree_new (session);
+ session = e_mail_backend_get_session (backend);
+
+ folder_tree = (EMFolderTree *) em_folder_tree_new (backend);
emu_restore_folder_tree_state (folder_tree);
dialog = em_folder_selector_create_new (
@@ -584,16 +583,18 @@ em_folder_utils_create_folder (GtkWindow *parent,
if (CAMEL_IS_VEE_STORE (store)) {
EFilterRule *rule;
- rule = em_vfolder_rule_new (session);
+ rule = em_vfolder_rule_new (backend);
e_filter_rule_set_name (rule, folder_name);
vfolder_gui_add_rule (EM_VFOLDER_RULE (rule));
} else {
AsyncContext *context;
context = g_slice_new0 (AsyncContext);
- context->folder_tree = g_object_ref (emft);
context->folder_uri = g_strdup (folder_uri);
+ if (EM_IS_FOLDER_TREE (emft))
+ context->folder_tree = g_object_ref (emft);
+
/* FIXME Not passing a GCancellable. */
e_mail_store_create_folder (
store, folder_name, G_PRIORITY_DEFAULT, NULL,
diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h
index e3d86d1d02..e76c5df66f 100644
--- a/mail/em-folder-utils.h
+++ b/mail/em-folder-utils.h
@@ -45,8 +45,8 @@ void em_folder_utils_copy_folder (GtkWindow *parent,
const gchar *folder_uri,
gboolean delete);
void em_folder_utils_create_folder (GtkWindow *parent,
+ EMailBackend *backend,
EMFolderTree *emft,
- EMailSession *session,
const gchar *initial_uri);
const gchar * em_folder_utils_get_icon_name (guint32 flags);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index c832c898c6..f7f957ba82 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -291,7 +291,6 @@ em_utils_edit_filters (GtkWidget *parent,
const gchar *config_dir;
gchar *user, *system;
EMFilterContext *fc;
- EMailSession *session;
g_return_if_fail (E_IS_MAIL_BACKEND (backend));
@@ -301,9 +300,8 @@ em_utils_edit_filters (GtkWidget *parent,
}
config_dir = mail_session_get_config_dir ();
- session = e_mail_backend_get_session (backend);
- fc = em_filter_context_new (session);
+ fc = em_filter_context_new (backend);
user = g_build_filename (config_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
e_rule_context_load ((ERuleContext *) fc, system, user);
diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c
index ebad8f2bac..371914c886 100644
--- a/mail/em-vfolder-context.c
+++ b/mail/em-vfolder-context.c
@@ -36,12 +36,12 @@
#include "em-filter-folder-element.h"
struct _EMVFolderContextPrivate {
- EMailSession *session;
+ EMailBackend *backend;
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_BACKEND
};
G_DEFINE_TYPE (
@@ -50,13 +50,13 @@ G_DEFINE_TYPE (
E_TYPE_RULE_CONTEXT)
static void
-vfolder_context_set_session (EMVFolderContext *context,
- EMailSession *session)
+vfolder_context_set_backend (EMVFolderContext *context,
+ EMailBackend *backend)
{
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (context->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (context->priv->backend == NULL);
- context->priv->session = g_object_ref (session);
+ context->priv->backend = g_object_ref (backend);
}
static void
@@ -66,8 +66,8 @@ vfolder_context_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- vfolder_context_set_session (
+ case PROP_BACKEND:
+ vfolder_context_set_backend (
EM_VFOLDER_CONTEXT (object),
g_value_get_object (value));
return;
@@ -83,10 +83,10 @@ vfolder_context_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_vfolder_context_get_session (
+ em_vfolder_context_get_backend (
EM_VFOLDER_CONTEXT (object)));
return;
}
@@ -101,9 +101,9 @@ vfolder_context_dispose (GObject *object)
priv = EM_VFOLDER_CONTEXT (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
/* Chain up to parent's dispose() method. */
@@ -125,11 +125,11 @@ vfolder_context_new_element (ERuleContext *context,
return e_filter_int_new_type("score", -3, 3);
if (strcmp (type, "folder") == 0)
- return em_filter_folder_element_new (priv->session);
+ return em_filter_folder_element_new (priv->backend);
/* XXX Legacy type name. Same as "folder" now. */
if (strcmp (type, "folder-curi") == 0)
- return em_filter_folder_element_new (priv->session);
+ return em_filter_folder_element_new (priv->backend);
return E_RULE_CONTEXT_CLASS (em_vfolder_context_parent_class)->
new_element (context, type);
@@ -153,12 +153,12 @@ em_vfolder_context_class_init (EMVFolderContextClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
@@ -184,18 +184,18 @@ em_vfolder_context_init (EMVFolderContext *context)
}
EMVFolderContext *
-em_vfolder_context_new (EMailSession *session)
+em_vfolder_context_new (EMailBackend *backend)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
- EM_TYPE_VFOLDER_CONTEXT, "session", session, NULL);
+ EM_TYPE_VFOLDER_CONTEXT, "backend", backend, NULL);
}
-EMailSession *
-em_vfolder_context_get_session (EMVFolderContext *context)
+EMailBackend *
+em_vfolder_context_get_backend (EMVFolderContext *context)
{
g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL);
- return context->priv->session;
+ return context->priv->backend;
}
diff --git a/mail/em-vfolder-context.h b/mail/em-vfolder-context.h
index c0fd041abc..4a5406356b 100644
--- a/mail/em-vfolder-context.h
+++ b/mail/em-vfolder-context.h
@@ -25,7 +25,7 @@
#ifndef EM_VFOLDER_CONTEXT_H
#define EM_VFOLDER_CONTEXT_H
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <filter/e-rule-context.h>
/* Standard GObject macros */
@@ -64,8 +64,8 @@ struct _EMVFolderContextClass {
GType em_vfolder_context_get_type (void);
EMVFolderContext *
- em_vfolder_context_new (EMailSession *session);
-EMailSession * em_vfolder_context_get_session (EMVFolderContext *context);
+ em_vfolder_context_new (EMailBackend *backend);
+EMailBackend * em_vfolder_context_get_backend (EMVFolderContext *context);
G_END_DECLS
diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c
index b1f58ed242..7da89fb59b 100644
--- a/mail/em-vfolder-editor.c
+++ b/mail/em-vfolder-editor.c
@@ -46,15 +46,15 @@ static EFilterRule *
vfolder_editor_create_rule (ERuleEditor *rule_editor)
{
EMVFolderContext *context;
- EMailSession *session;
+ EMailBackend *backend;
EFilterRule *rule;
EFilterPart *part;
context = EM_VFOLDER_CONTEXT (rule_editor->context);
- session = em_vfolder_context_get_session (context);
+ backend = em_vfolder_context_get_backend (context);
/* create a rule with 1 part in it */
- rule = em_vfolder_rule_new (session);
+ rule = em_vfolder_rule_new (backend);
part = e_rule_context_next_part (rule_editor->context, NULL);
e_filter_rule_add_part (rule, e_filter_part_clone (part));
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index e409cdc016..01622711d3 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -43,12 +43,12 @@
#include "e-util/e-util-private.h"
struct _EMVFolderRulePrivate {
- EMailSession *session;
+ EMailBackend *backend;
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_BACKEND
};
static gint validate (EFilterRule *, EAlert **alert);
@@ -72,25 +72,22 @@ G_DEFINE_TYPE (
E_TYPE_FILTER_RULE)
static void
-vfolder_rule_set_session (EMVFolderRule *rule,
- EMailSession *session)
+vfolder_rule_set_backend (EMVFolderRule *rule,
+ EMailBackend *backend)
{
- if (session == NULL) {
+ if (backend == NULL) {
EShell *shell;
EShellBackend *shell_backend;
- EMailBackend *backend;
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);
}
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (rule->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (rule->priv->backend == NULL);
- rule->priv->session = g_object_ref (session);
+ rule->priv->backend = g_object_ref (backend);
}
static void
@@ -100,8 +97,8 @@ vfolder_rule_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- vfolder_rule_set_session (
+ case PROP_BACKEND:
+ vfolder_rule_set_backend (
EM_VFOLDER_RULE (object),
g_value_get_object (value));
return;
@@ -117,10 +114,10 @@ vfolder_rule_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_vfolder_rule_get_session (
+ em_vfolder_rule_get_backend (
EM_VFOLDER_RULE (object)));
return;
}
@@ -135,9 +132,9 @@ vfolder_rule_dispose (GObject *object)
priv = EM_VFOLDER_RULE (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
/* Chain up to parent's dispose() method. */
@@ -180,12 +177,12 @@ em_vfolder_rule_class_init (EMVFolderRuleClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
@@ -201,20 +198,20 @@ em_vfolder_rule_init (EMVFolderRule *rule)
}
EFilterRule *
-em_vfolder_rule_new (EMailSession *session)
+em_vfolder_rule_new (EMailBackend *backend)
{
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
- EM_TYPE_VFOLDER_RULE, "session", session, NULL);
+ EM_TYPE_VFOLDER_RULE, "backend", backend, NULL);
}
-EMailSession *
-em_vfolder_rule_get_session (EMVFolderRule *rule)
+EMailBackend *
+em_vfolder_rule_get_backend (EMVFolderRule *rule)
{
g_return_val_if_fail (EM_IS_VFOLDER_RULE (rule), NULL);
- return rule->priv->session;
+ return rule->priv->backend;
}
void
@@ -593,16 +590,16 @@ static void
source_add (GtkWidget *widget, struct _source_data *data)
{
EMFolderTree *emft;
- EMailSession *session;
+ EMailBackend *backend;
GtkWidget *dialog;
gpointer parent;
parent = gtk_widget_get_toplevel (widget);
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
- session = em_vfolder_rule_get_session (data->vr);
+ backend = em_vfolder_rule_get_backend (data->vr);
- emft = (EMFolderTree *) em_folder_tree_new (session);
+ emft = (EMFolderTree *) em_folder_tree_new (backend);
emu_restore_folder_tree_state (emft);
em_folder_tree_set_excluded (emft, EMFT_EXCLUDE_NOSELECT);
diff --git a/mail/em-vfolder-rule.h b/mail/em-vfolder-rule.h
index 136c29a52b..fa6df8576e 100644
--- a/mail/em-vfolder-rule.h
+++ b/mail/em-vfolder-rule.h
@@ -24,7 +24,7 @@
#ifndef EM_VFOLDER_RULE_H
#define EM_VFOLDER_RULE_H
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <filter/e-filter-rule.h>
/* Standard GObject macros */
@@ -75,8 +75,8 @@ struct _EMVFolderRuleClass {
};
GType em_vfolder_rule_get_type (void);
-EFilterRule * em_vfolder_rule_new (EMailSession *session);
-EMailSession * em_vfolder_rule_get_session (EMVFolderRule *rule);
+EFilterRule * em_vfolder_rule_new (EMailBackend *backend);
+EMailBackend * em_vfolder_rule_get_backend (EMVFolderRule *rule);
void em_vfolder_rule_add_source (EMVFolderRule *rule,
const gchar *uri);
void em_vfolder_rule_remove_source (EMVFolderRule *rule,
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index 9c251027e3..174c34b7a0 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -82,18 +82,16 @@ mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im)
{
EShell *shell;
EShellBackend *shell_backend;
- EMailSession *session;
GtkWindow *window;
GtkWidget *hbox, *w;
GtkLabel *label;
gchar *select_uri = NULL;
- /* XXX Dig up the EMailSession from the default EShell.
+ /* XXX Dig up the mail backend from the default EShell.
* Since the EImport framework doesn't allow for user
* data, I don't see how else to get to it. */
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));
/* preselect the folder selected in a mail view */
window = e_shell_get_active_window (shell);
@@ -130,7 +128,8 @@ mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im)
label = GTK_LABEL (w);
w = em_folder_selection_button_new (
- session, _("Select folder"),
+ E_MAIL_BACKEND (shell_backend),
+ _("Select folder"),
_("Select folder to import into"));
gtk_label_set_mnemonic_widget (label, w);
em_folder_selection_button_set_selection (
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 56cc5e9813..0efe54ba7f 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -316,7 +316,7 @@ em_vfolder_rule_from_message (EMVFolderContext *context,
CamelFolder *folder)
{
EFilterRule *rule;
- EMailSession *session;
+ EMailBackend *backend;
gchar *uri;
g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL);
@@ -325,9 +325,9 @@ em_vfolder_rule_from_message (EMVFolderContext *context,
uri = e_mail_folder_uri_from_folder (folder);
- session = em_vfolder_context_get_session (context);
+ backend = em_vfolder_context_get_backend (context);
- rule = em_vfolder_rule_new (session);
+ rule = em_vfolder_rule_new (backend);
em_vfolder_rule_add_source (EM_VFOLDER_RULE (rule), uri);
rule_from_message (rule, E_RULE_CONTEXT (context), msg, flags);
@@ -343,7 +343,7 @@ em_vfolder_rule_from_address (EMVFolderContext *context,
CamelFolder *folder)
{
EFilterRule *rule;
- EMailSession *session;
+ EMailBackend *backend;
gchar *uri;
g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL);
@@ -352,9 +352,9 @@ em_vfolder_rule_from_address (EMVFolderContext *context,
uri = e_mail_folder_uri_from_folder (folder);
- session = em_vfolder_context_get_session (context);
+ backend = em_vfolder_context_get_backend (context);
- rule = em_vfolder_rule_new (session);
+ rule = em_vfolder_rule_new (backend);
em_vfolder_rule_add_source (EM_VFOLDER_RULE (rule), uri);
rule_from_address (rule, E_RULE_CONTEXT (context), addr, flags);
@@ -386,7 +386,7 @@ filter_rule_from_message (EMFilterContext *context,
}
void
-filter_gui_add_from_message (EMailSession *session,
+filter_gui_add_from_message (EMailBackend *backend,
CamelMimeMessage *msg,
const gchar *source,
gint flags)
@@ -396,10 +396,10 @@ filter_gui_add_from_message (EMailSession *session,
gchar *user, *system;
EFilterRule *rule;
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
- fc = em_filter_context_new (session);
+ fc = em_filter_context_new (backend);
config_dir = mail_session_get_config_dir ();
user = g_build_filename (config_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
@@ -422,7 +422,6 @@ mail_filter_rename_folder (EMailBackend *backend,
const gchar *new_folder_name)
{
EMFilterContext *fc;
- EMailSession *session;
const gchar *config_dir;
gchar *user, *system;
GList *changed;
@@ -437,9 +436,7 @@ mail_filter_rename_folder (EMailBackend *backend,
old_uri = e_mail_folder_uri_build (store, old_folder_name);
new_uri = e_mail_folder_uri_build (store, new_folder_name);
- session = e_mail_backend_get_session (backend);
-
- fc = em_filter_context_new (session);
+ fc = em_filter_context_new (backend);
config_dir = mail_session_get_config_dir ();
user = g_build_filename (config_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
@@ -467,7 +464,6 @@ mail_filter_delete_folder (EMailBackend *backend,
const gchar *folder_name)
{
EMFilterContext *fc;
- EMailSession *session;
const gchar *config_dir;
gchar *user, *system;
GList *deleted;
@@ -479,9 +475,7 @@ mail_filter_delete_folder (EMailBackend *backend,
uri = e_mail_folder_uri_build (store, folder_name);
- session = e_mail_backend_get_session (backend);
-
- fc = em_filter_context_new (session);
+ fc = em_filter_context_new (backend);
config_dir = mail_session_get_config_dir ();
user = g_build_filename (config_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
diff --git a/mail/mail-autofilter.h b/mail/mail-autofilter.h
index 418c2e38f1..43671177ae 100644
--- a/mail/mail-autofilter.h
+++ b/mail/mail-autofilter.h
@@ -51,7 +51,7 @@ EFilterRule * em_vfolder_rule_from_address (EMVFolderContext *context,
CamelFolder *folder);
/* easiest place to put this */
-void filter_gui_add_from_message (EMailSession *session,
+void filter_gui_add_from_message (EMailBackend *backend,
CamelMimeMessage *msg,
const gchar *source,
gint flags);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index e726433897..526e0ea1ad 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -805,13 +805,15 @@ rule_add_sources (EMailSession *session,
static void
rule_changed (EFilterRule *rule, CamelFolder *folder)
{
+ EMailBackend *backend;
EMailSession *session;
GList *sources_uri = NULL, *sources_folder = NULL;
GString *query;
const gchar *full_name;
full_name = camel_folder_get_full_name (folder);
- session = em_vfolder_rule_get_session (EM_VFOLDER_RULE (rule));
+ backend = em_vfolder_rule_get_backend (EM_VFOLDER_RULE (rule));
+ session = e_mail_backend_get_session (backend);
/* if the folder has changed name, then add it, then remove the old manually */
if (strcmp (full_name, rule->name) != 0) {
@@ -1109,7 +1111,7 @@ vfolder_load_storage (EMailBackend *backend)
/* load our rules */
user = g_build_filename (config_dir, "vfolders.xml", NULL);
- context = em_vfolder_context_new (session);
+ context = em_vfolder_context_new (backend);
xmlfile = g_build_filename (EVOLUTION_PRIVDATADIR, "vfoldertypes.xml", NULL);
if (e_rule_context_load ((ERuleContext *) context,
@@ -1345,12 +1347,12 @@ vfolder_create_part (const gchar *name)
/* clones a filter/search rule into a matching vfolder rule
* (assuming the same system definitions) */
EFilterRule *
-vfolder_clone_rule (EMailSession *session, EFilterRule *in)
+vfolder_clone_rule (EMailBackend *backend, EFilterRule *in)
{
EFilterRule *rule;
xmlNodePtr xml;
- rule = em_vfolder_rule_new (session);
+ rule = em_vfolder_rule_new (backend);
xml = e_filter_rule_xml_encode (in);
e_filter_rule_xml_decode (rule, xml, (ERuleContext *) context);
diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h
index 3e41bfce37..42bea19bf3 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -36,7 +36,7 @@ void vfolder_edit (EShellView *shell_view);
void vfolder_edit_rule (EMailBackend *backend,
const gchar *folder_uri);
EFilterPart * vfolder_create_part (const gchar *name);
-EFilterRule * vfolder_clone_rule (EMailSession *session,
+EFilterRule * vfolder_clone_rule (EMailBackend *backend,
EFilterRule *in);
void vfolder_gui_add_rule (EMVFolderRule *rule);
void vfolder_gui_add_from_message (EMailSession *session,
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 0c02a48a05..f7e9b81ae1 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -106,7 +106,7 @@ action_mail_folder_new_cb (GtkAction *action,
{
EMFolderTree *folder_tree = NULL;
EMailShellSidebar *mail_shell_sidebar;
- EMailSession *mail_session;
+ EMailBackend *backend;
EShellSidebar *shell_sidebar;
EShellView *shell_view;
const gchar *view_name;
@@ -114,19 +114,16 @@ action_mail_folder_new_cb (GtkAction *action,
/* Take care not to unnecessarily load the mail shell view. */
view_name = e_shell_window_get_active_view (shell_window);
if (g_strcmp0 (view_name, BACKEND_NAME) != 0) {
- EShellBackend *mail_backend;
+ EShellBackend *shell_backend;
EShell *shell;
shell = e_shell_window_get_shell (shell_window);
- mail_backend =
+ shell_backend =
e_shell_get_backend_by_name (shell, BACKEND_NAME);
- g_return_if_fail (mail_backend != NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (shell_backend));
- mail_session =
- e_mail_backend_get_session (
- E_MAIL_BACKEND (mail_backend));
- g_return_if_fail (mail_session != NULL);
+ backend = E_MAIL_BACKEND (shell_backend);
goto exit;
}
@@ -136,11 +133,11 @@ action_mail_folder_new_cb (GtkAction *action,
mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
- mail_session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
exit:
em_folder_utils_create_folder (
- GTK_WINDOW (shell_window), folder_tree, mail_session, NULL);
+ GTK_WINDOW (shell_window), backend, folder_tree, NULL);
}
static void
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index c910310010..760ebb0b2e 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -116,8 +116,6 @@ mail_shell_sidebar_constructed (GObject *object)
EShellWindow *shell_window;
EShellView *shell_view;
EShell *shell;
- EMailBackend *backend;
- EMailSession *session;
GtkTreeSelection *selection;
GtkTreeView *tree_view;
GtkWidget *container;
@@ -134,9 +132,6 @@ mail_shell_sidebar_constructed (GObject *object)
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. */
@@ -154,7 +149,7 @@ mail_shell_sidebar_constructed (GObject *object)
container = widget;
- widget = e_mail_sidebar_new (session);
+ widget = e_mail_sidebar_new (E_MAIL_BACKEND (shell_backend));
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 f5c5524648..7c55908b31 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -125,7 +125,6 @@ action_mail_create_search_folder_cb (GtkAction *action,
EFilterRule *search_rule;
EMVFolderRule *vfolder_rule;
EMailBackend *backend;
- EMailSession *session;
EMailView *mail_view;
CamelFolder *folder;
const gchar *search_text;
@@ -135,9 +134,6 @@ action_mail_create_search_folder_cb (GtkAction *action,
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_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);
@@ -152,7 +148,8 @@ action_mail_create_search_folder_cb (GtkAction *action,
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
- search_rule = vfolder_clone_rule (session, search_rule);
+ backend = E_MAIL_BACKEND (shell_backend);
+ search_rule = vfolder_clone_rule (backend, search_rule);
g_return_if_fail (search_rule != NULL);
rule_name = g_strdup_printf ("%s %s", search_rule->name, search_text);
@@ -426,7 +423,7 @@ action_mail_folder_new_cb (GtkAction *action,
{
EShellView *shell_view;
EShellWindow *shell_window;
- EMailSession *session;
+ EMailBackend *backend;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
gchar *selected_uri;
@@ -437,12 +434,12 @@ action_mail_folder_new_cb (GtkAction *action,
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
- session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
selected_uri = em_folder_tree_get_selected_uri (folder_tree);
em_folder_utils_create_folder (
GTK_WINDOW (shell_window),
- folder_tree, session, selected_uri);
+ backend, folder_tree, selected_uri);
g_free (selected_uri);
}
diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c
index 356351a2f1..b5c458385c 100644
--- a/modules/mail/em-account-prefs.c
+++ b/modules/mail/em-account-prefs.c
@@ -43,14 +43,14 @@
#include "capplet/settings/mail-capplet-shell.h"
struct _EMAccountPrefsPrivate {
- EMailSession *session;
+ EMailBackend *backend;
gpointer assistant; /* weak pointer */
gpointer editor; /* weak pointer */
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_BACKEND
};
G_DEFINE_TYPE (
@@ -63,11 +63,13 @@ account_prefs_enable_account_cb (EAccountTreeView *tree_view,
EMAccountPrefs *prefs)
{
EAccount *account;
+ EMailSession *session;
account = e_account_tree_view_get_selected (tree_view);
g_return_if_fail (account != NULL);
- e_mail_store_add_by_account (prefs->priv->session, account);
+ session = e_mail_backend_get_session (prefs->priv->backend);
+ e_mail_store_add_by_account (session, account);
}
static void
@@ -75,6 +77,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
EMAccountPrefs *prefs)
{
EAccountList *account_list;
+ EMailSession *session;
EAccount *account;
gpointer parent;
gint response;
@@ -85,8 +88,10 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
account_list = e_account_tree_view_get_account_list (tree_view);
g_return_if_fail (account_list != NULL);
+ session = e_mail_backend_get_session (prefs->priv->backend);
+
if (!e_account_list_account_has_proxies (account_list, account)) {
- e_mail_store_remove_by_account (prefs->priv->session, account);
+ e_mail_store_remove_by_account (session, account);
return;
}
@@ -103,17 +108,17 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view,
e_account_list_remove_account_proxies (account_list, account);
- e_mail_store_remove_by_account (prefs->priv->session, account);
+ e_mail_store_remove_by_account (session, account);
}
static void
-account_prefs_set_session (EMAccountPrefs *prefs,
- EMailSession *session)
+account_prefs_set_backend (EMAccountPrefs *prefs,
+ EMailBackend *backend)
{
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (prefs->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (prefs->priv->backend == NULL);
- prefs->priv->session = g_object_ref (session);
+ prefs->priv->backend = g_object_ref (backend);
}
static void
@@ -123,8 +128,8 @@ account_prefs_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- account_prefs_set_session (
+ case PROP_BACKEND:
+ account_prefs_set_backend (
EM_ACCOUNT_PREFS (object),
g_value_get_object (value));
return;
@@ -140,10 +145,10 @@ account_prefs_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_account_prefs_get_session (
+ em_account_prefs_get_backend (
EM_ACCOUNT_PREFS (object)));
return;
}
@@ -158,9 +163,9 @@ account_prefs_dispose (GObject *object)
priv = EM_ACCOUNT_PREFS (object)->priv;
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
if (priv->assistant != NULL) {
@@ -206,7 +211,7 @@ account_prefs_add_account (EAccountManager *manager)
* The new mail account assistant.
*/
emae = em_account_editor_new (
- NULL, EMAE_ASSISTANT, priv->session,
+ NULL, EMAE_ASSISTANT, priv->backend,
"org.gnome.evolution.mail.config.accountAssistant");
e_config_create_window (
E_CONFIG (emae->config), NULL,
@@ -256,7 +261,7 @@ account_prefs_edit_account (EAccountManager *manager)
* The account editor window.
*/
emae = em_account_editor_new (
- account, EMAE_NOTEBOOK, priv->session,
+ account, EMAE_NOTEBOOK, priv->backend,
"org.gnome.evolution.mail.config.accountEditor");
e_config_create_window (
E_CONFIG (emae->config), parent, _("Account Editor"));
@@ -275,12 +280,14 @@ account_prefs_delete_account (EAccountManager *manager)
EMAccountPrefsPrivate *priv;
EAccountTreeView *tree_view;
EAccountList *account_list;
+ EMailSession *session;
EAccount *account;
gboolean has_proxies;
gpointer parent;
gint response;
priv = EM_ACCOUNT_PREFS (manager)->priv;
+ session = e_mail_backend_get_session (priv->backend);
account_list = e_account_manager_get_account_list (manager);
tree_view = e_account_manager_get_tree_view (manager);
@@ -309,7 +316,7 @@ account_prefs_delete_account (EAccountManager *manager)
/* Remove the account from the folder tree. */
if (account->enabled)
- e_mail_store_remove_by_account (priv->session, account);
+ e_mail_store_remove_by_account (session, account);
/* Remove all the proxies the account has created. */
if (has_proxies)
@@ -341,12 +348,12 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- E_TYPE_MAIL_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
@@ -377,30 +384,25 @@ 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. */
+ /* XXX Figure out a better way to get the mail backend. */
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,
- "session", session, NULL);
+ "backend", shell_backend, NULL);
}
-EMailSession *
-em_account_prefs_get_session (EMAccountPrefs *prefs)
+EMailBackend *
+em_account_prefs_get_backend (EMAccountPrefs *prefs)
{
g_return_val_if_fail (EM_IS_ACCOUNT_PREFS (prefs), NULL);
- return prefs->priv->session;
+ return prefs->priv->backend;
}
diff --git a/modules/mail/em-account-prefs.h b/modules/mail/em-account-prefs.h
index c00b860d35..667b83f42f 100644
--- a/modules/mail/em-account-prefs.h
+++ b/modules/mail/em-account-prefs.h
@@ -25,7 +25,7 @@
#include <gtk/gtk.h>
#include <table/e-table.h>
#include <libedataserver/e-account-list.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <misc/e-account-manager.h>
#include <widgets/misc/e-preferences-window.h>
@@ -65,7 +65,7 @@ struct _EMAccountPrefsClass {
GType em_account_prefs_get_type (void);
GtkWidget * em_account_prefs_new (EPreferencesWindow *window);
-EMailSession * em_account_prefs_get_session (EMAccountPrefs *prefs);
+EMailBackend * em_account_prefs_get_backend (EMAccountPrefs *prefs);
G_END_DECLS
diff --git a/modules/startup-wizard/evolution-startup-wizard.c b/modules/startup-wizard/evolution-startup-wizard.c
index 8f1b118a53..605e10ce6a 100644
--- a/modules/startup-wizard/evolution-startup-wizard.c
+++ b/modules/startup-wizard/evolution-startup-wizard.c
@@ -447,7 +447,7 @@ startup_wizard_new_assistant (EStartupWizard *extension)
e_mail_local_init (session, data_dir);
emae = em_account_editor_new (
- NULL, EMAE_ASSISTANT, session,
+ NULL, EMAE_ASSISTANT, backend,
"org.gnome.evolution.mail.config.accountWizard");
config = E_CONFIG (emae->config);
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index c9ecca9127..9b6f44c171 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -203,7 +203,6 @@ org_gnome_evolution_readdbx_getwidget (EImport *ei,
{
EShell *shell;
EShellBackend *shell_backend;
- EMailSession *session;
GtkWidget *hbox, *w;
GtkLabel *label;
gchar *select_uri = NULL;
@@ -246,10 +245,10 @@ org_gnome_evolution_readdbx_getwidget (EImport *ei,
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));
w = em_folder_selection_button_new (
- session, _("Select folder"),
+ E_MAIL_BACKEND (shell_backend),
+ _("Select folder"),
_("Select folder to import into"));
gtk_label_set_mnemonic_widget (label, w);
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 85a117d414..7a5c79e95f 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -515,6 +515,7 @@ action_mail_mark_read_recursive_cb (GtkAction *action,
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EMFolderTree *folder_tree;
+ EMailBackend *backend;
EMailSession *session;
AsyncContext *context;
CamelStore *store = NULL;
@@ -529,7 +530,9 @@ action_mail_mark_read_recursive_cb (GtkAction *action,
g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
- session = em_folder_tree_get_session (folder_tree);
+ backend = em_folder_tree_get_backend (folder_tree);
+ session = e_mail_backend_get_session (backend);
+
folder_uri = em_folder_tree_get_selected_uri (folder_tree);
g_return_if_fail (folder_uri != NULL);
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index e17c50ad72..9ede806b73 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -292,7 +292,6 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, EI
{
EShell *shell;
EShellBackend *shell_backend;
- EMailSession *session;
GtkWidget *hbox, *framebox, *w;
gchar *foldername;
@@ -313,9 +312,11 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, EI
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));
- w = em_folder_selection_button_new (session, _("Select folder"), _("Select folder to import into"));
+ w = em_folder_selection_button_new (
+ E_MAIL_BACKEND (shell_backend),
+ _("Select folder"),
+ _("Select folder to import into"));
foldername = get_suggested_foldername ((EImportTargetURI *) target);
((EImportTargetURI *) target)->uri_dest = g_strdup (foldername);
em_folder_selection_button_set_selection ((EMFolderSelectionButton *) w, foldername);