aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-16 23:40:37 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-12-16 23:58:54 +0800
commita9cfed5938aef37d95c009411f965ebc185547c1 (patch)
treed0c6eb1d5acea6752425169aae47e8f4ed4b55ea /mail/em-folder-utils.c
parentdf85cb1b7a47f713cb775f648f735e642a1bb71b (diff)
downloadgsoc2013-evolution-a9cfed5938aef37d95c009411f965ebc185547c1.tar.gz
gsoc2013-evolution-a9cfed5938aef37d95c009411f965ebc185547c1.tar.zst
gsoc2013-evolution-a9cfed5938aef37d95c009411f965ebc185547c1.zip
Avoid passing EMailBackend as much as possible.
More mail API churn... reversing some previous API decisions. I've made some key API changes to EMailSession on the account-mgmt branch which should allow for this, and will hopefully also benefit the "email-factory" branch. EMailBackend barely needs to exist anymore, except as the owner of EMailSession. For several low-level functions, we replace its EMailBackend parameter with EMailSession and EAlertSink parameters; the latter so it can still pass user alerts up the chain.
Diffstat (limited to 'mail/em-folder-utils.c')
-rw-r--r--mail/em-folder-utils.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 2ac87d7efd..2ee275d098 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -330,11 +330,11 @@ struct _copy_folder_data {
};
static void
-emfu_copy_folder_selected (EMailBackend *backend,
+emfu_copy_folder_selected (EMailSession *session,
+ EAlertSink *alert_sink,
const gchar *uri,
gpointer data)
{
- EMailSession *session;
struct _copy_folder_data *cfd = data;
CamelStore *tostore = NULL;
CamelService *service;
@@ -346,16 +346,14 @@ emfu_copy_folder_selected (EMailBackend *backend,
if (uri == NULL)
goto fail;
- session = e_mail_backend_get_session (backend);
-
service = CAMEL_SERVICE (cfd->source_store);
em_utils_connect_service_sync (service, NULL, &local_error);
if (local_error != NULL) {
- e_mail_backend_submit_alert (
- backend, cfd->delete ?
- "mail:no-move-folder-notexist" :
- "mail:no-copy-folder-notexist",
+ e_alert_submit (
+ alert_sink, cfd->delete ?
+ "mail:no-move-folder-notexist" :
+ "mail:no-copy-folder-notexist",
cfd->source_folder_name, uri,
local_error->message, NULL);
goto fail;
@@ -368,8 +366,9 @@ emfu_copy_folder_selected (EMailBackend *backend,
if (cfd->delete && store_is_local &&
emfu_is_special_local_folder (cfd->source_folder_name)) {
- e_mail_backend_submit_alert (
- backend, "mail:no-rename-special-folder",
+ e_alert_submit (
+ alert_sink,
+ "mail:no-rename-special-folder",
cfd->source_folder_name, NULL);
goto fail;
}
@@ -384,10 +383,10 @@ emfu_copy_folder_selected (EMailBackend *backend,
CAMEL_SERVICE (tostore), NULL, &local_error);
if (local_error != NULL) {
- e_mail_backend_submit_alert (
- backend, cfd->delete ?
- "mail:no-move-folder-to-notexist" :
- "mail:no-copy-folder-to-notexist",
+ e_alert_submit (
+ alert_sink, cfd->delete ?
+ "mail:no-move-folder-to-notexist" :
+ "mail:no-copy-folder-to-notexist",
cfd->source_folder_name, uri,
local_error->message, NULL);
goto fail;
@@ -452,7 +451,8 @@ emfu_copy_folder_exclude (EMFolderTree *tree,
void
em_folder_utils_copy_folder (GtkWindow *parent,
- EMailBackend *backend,
+ EMailSession *session,
+ EAlertSink *alert_sink,
const gchar *folder_uri,
gint delete)
{
@@ -460,17 +460,15 @@ em_folder_utils_copy_folder (GtkWindow *parent,
EMFolderSelector *selector;
EMFolderTree *folder_tree;
EMFolderTreeModel *model;
- EMailSession *session;
const gchar *label;
const gchar *title;
struct _copy_folder_data *cfd;
GError *error = NULL;
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_ALERT_SINK (alert_sink));
g_return_if_fail (folder_uri != NULL);
- session = e_mail_backend_get_session (backend);
-
cfd = g_malloc (sizeof (*cfd));
cfd->delete = delete;
@@ -491,7 +489,7 @@ em_folder_utils_copy_folder (GtkWindow *parent,
model = em_folder_tree_model_get_default ();
dialog = em_folder_selector_new (
- parent, backend, model,
+ parent, model,
EM_FOLDER_SELECTOR_CAN_CREATE,
title, NULL, label);
@@ -505,7 +503,7 @@ em_folder_utils_copy_folder (GtkWindow *parent,
const gchar *uri;
uri = em_folder_selector_get_selected_uri (selector);
- emfu_copy_folder_selected (backend, uri, cfd);
+ emfu_copy_folder_selected (session, alert_sink, uri, cfd);
}
gtk_widget_destroy (dialog);
@@ -544,13 +542,12 @@ new_folder_created_cb (CamelStore *store,
void
em_folder_utils_create_folder (GtkWindow *parent,
- EMailBackend *backend,
+ EMailSession *session,
EMFolderTree *emft,
const gchar *initial_uri)
{
EShell *shell;
EShellSettings *shell_settings;
- EMailSession *session;
EMFolderSelector *selector;
EMFolderTree *folder_tree;
EMFolderTreeModel *model;
@@ -561,13 +558,12 @@ em_folder_utils_create_folder (GtkWindow *parent,
GError *error = NULL;
g_return_if_fail (GTK_IS_WINDOW (parent));
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
- shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
model = em_folder_tree_model_new ();
- session = e_mail_backend_get_session (backend);
em_folder_tree_model_set_session (model, session);
list = camel_session_list_services (CAMEL_SESSION (session));
@@ -602,7 +598,7 @@ em_folder_utils_create_folder (GtkWindow *parent,
g_list_free (list);
dialog = em_folder_selector_create_new (
- parent, backend, model, 0,
+ parent, model, 0,
_("Create Folder"),
_("Specify where to create the folder:"));
@@ -660,7 +656,7 @@ em_folder_utils_create_folder (GtkWindow *parent,
else
skip_slash = folder_name;
- rule = em_vfolder_rule_new (backend);
+ rule = em_vfolder_rule_new (session);
e_filter_rule_set_name (rule, skip_slash);
vfolder_gui_add_rule (EM_VFOLDER_RULE (rule));
} else {