aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/Makefile.am4
-rw-r--r--mail/e-mail-reader.c14
-rw-r--r--mail/e-mail-shell-backend.c548
-rw-r--r--mail/e-mail-shell-backend.h42
-rw-r--r--mail/e-mail-shell-migrate.c5
-rw-r--r--mail/e-mail-shell-sidebar.c35
-rw-r--r--mail/e-mail-shell-view-actions.c24
-rw-r--r--mail/e-mail-shell-view-private.c4
-rw-r--r--mail/e-mail-shell-view-private.h2
-rw-r--r--mail/em-account-editor.c32
-rw-r--r--mail/em-account-prefs.c12
-rw-r--r--mail/em-composer-utils.c39
-rw-r--r--mail/em-filter-folder-element.c11
-rw-r--r--mail/em-folder-properties.c8
-rw-r--r--mail/em-folder-selection-button.c75
-rw-r--r--mail/em-folder-selection-button.h8
-rw-r--r--mail/em-folder-selection.c6
-rw-r--r--mail/em-folder-selection.h5
-rw-r--r--mail/em-folder-selector.c4
-rw-r--r--mail/em-folder-tree-model.c80
-rw-r--r--mail/em-folder-tree-model.h8
-rw-r--r--mail/em-folder-tree.c195
-rw-r--r--mail/em-folder-tree.h6
-rw-r--r--mail/em-folder-utils.c26
-rw-r--r--mail/em-folder-utils.h3
-rw-r--r--mail/em-utils.c18
-rw-r--r--mail/em-vfolder-rule.c9
-rw-r--r--mail/importers/evolution-mbox-importer.c16
-rw-r--r--mail/importers/mail-importer.c5
-rw-r--r--mail/mail-config.c9
-rw-r--r--mail/mail-folder-cache.c67
-rw-r--r--mail/mail-folder-cache.h4
-rw-r--r--mail/mail-ops.c13
-rw-r--r--mail/mail-send-recv.c39
-rw-r--r--mail/mail-vfolder.c32
35 files changed, 321 insertions, 1087 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am
index eab6cea110..5e9a7b9781 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -52,6 +52,8 @@ libevolution_module_mail_la_SOURCES = \
e-mail-label-manager.h \
e-mail-label-tree-view.c \
e-mail-label-tree-view.h \
+ e-mail-local.c \
+ e-mail-local.h \
e-mail-reader.c \
e-mail-reader.h \
e-mail-reader-utils.c \
@@ -74,6 +76,8 @@ libevolution_module_mail_la_SOURCES = \
e-mail-shell-view-actions.h \
e-mail-shell-view-private.c \
e-mail-shell-view-private.h \
+ e-mail-store.c \
+ e-mail-store.h \
e-searching-tokenizer.c \
e-searching-tokenizer.h \
em-account-editor.c \
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 787bd0ca61..a58e0acd46 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -148,9 +148,7 @@ static void
action_mail_copy_cb (GtkAction *action,
EMailReader *reader)
{
- EShellBackend *shell_backend;
MessageList *message_list;
- EMFolderTreeModel *model;
CamelFolder *folder;
GtkWidget *folder_tree;
GtkWidget *dialog;
@@ -158,11 +156,8 @@ action_mail_copy_cb (GtkAction *action,
const gchar *uri;
message_list = e_mail_reader_get_message_list (reader);
- shell_backend = e_mail_reader_get_shell_backend (reader);
- model = e_mail_shell_backend_get_folder_tree_model (
- E_MAIL_SHELL_BACKEND (shell_backend));
- folder_tree = em_folder_tree_new_with_model (model);
+ folder_tree = em_folder_tree_new ();
selected = message_list_get_selected (message_list);
folder = message_list->folder;
@@ -558,9 +553,7 @@ static void
action_mail_move_cb (GtkAction *action,
EMailReader *reader)
{
- EShellBackend *shell_backend;
MessageList *message_list;
- EMFolderTreeModel *model;
CamelFolder *folder;
GtkWidget *folder_tree;
GtkWidget *dialog;
@@ -568,11 +561,8 @@ action_mail_move_cb (GtkAction *action,
const gchar *uri;
message_list = e_mail_reader_get_message_list (reader);
- shell_backend = e_mail_reader_get_shell_backend (reader);
- model = e_mail_shell_backend_get_folder_tree_model (
- E_MAIL_SHELL_BACKEND (shell_backend));
- folder_tree = em_folder_tree_new_with_model (model);
+ folder_tree = em_folder_tree_new ();
selected = message_list_get_selected (message_list);
folder = message_list->folder;
diff --git a/mail/e-mail-shell-backend.c b/mail/e-mail-shell-backend.c
index 05bf2e4f79..906312ccff 100644
--- a/mail/e-mail-shell-backend.c
+++ b/mail/e-mail-shell-backend.c
@@ -44,12 +44,12 @@
#include "e-attachment-handler-mail.h"
#include "e-mail-browser.h"
#include "e-mail-reader.h"
+#include "e-mail-store.h"
#include "em-account-prefs.h"
#include "em-composer-prefs.h"
#include "em-composer-utils.h"
#include "em-config.h"
#include "em-event.h"
-#include "em-folder-tree-model.h"
#include "em-folder-utils.h"
#include "em-format-hook.h"
#include "em-format-html-display.h"
@@ -58,8 +58,6 @@
#include "em-network-prefs.h"
#include "em-utils.h"
#include "mail-config.h"
-#include "mail-folder-cache.h"
-#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
#include "mail-session.h"
@@ -72,35 +70,7 @@
#define BACKEND_NAME "mail"
-typedef struct _StoreInfo StoreInfo;
-
-/* XXX Temporary */
-CamelStore *vfolder_store;
-
-struct _StoreInfo {
- CamelStore *store;
- gint ref_count;
- gchar *name;
-
- /* Keep a reference to these so they remain around for the session. */
- CamelFolder *vtrash;
- CamelFolder *vjunk;
-
- /* Initialization callback. */
- void (*done) (CamelStore *store,
- CamelFolderInfo *info,
- gpointer user_data);
- gpointer done_user_data;
-
- guint removed : 1;
-};
-
struct _EMailShellBackendPrivate {
- GHashTable *store_hash;
- MailAsyncEvent *async_event;
- EMFolderTreeModel *folder_tree_model;
- CamelStore *local_store;
-
gint mail_sync_in_progress;
guint mail_sync_timeout_source_id;
};
@@ -111,20 +81,6 @@ const gchar *x_mailer = "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT;
static gpointer parent_class;
static GType mail_shell_backend_type;
-/* The array elements correspond to EMailFolderType. */
-static struct {
- const gchar *name;
- gchar *uri;
- CamelFolder *folder;
-} default_local_folders[] = {
- { N_("Inbox") },
- { N_("Drafts") },
- { N_("Outbox") },
- { N_("Sent") },
- { N_("Templates") },
- { "Inbox" } /* "always local" inbox */
-};
-
/* XXX So many things need the shell backend that it's
* just easier for now to make it globally available.
* We should fix this, though. */
@@ -132,148 +88,6 @@ EMailShellBackend *global_mail_shell_backend = NULL;
extern gint camel_application_is_exiting;
-static StoreInfo *
-store_info_new (CamelStore *store,
- const gchar *name)
-{
- CamelService *service;
- StoreInfo *si;
-
- g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
-
- service = CAMEL_SERVICE (store);
-
- si = g_slice_new0 (StoreInfo);
- si->ref_count = 1;
-
- if (name == NULL)
- si->name = camel_service_get_name (service, TRUE);
- else
- si->name = g_strdup (name);
-
- si->store = store;
- camel_object_ref (store);
-
- /* If these are vfolders then they need to be opened now,
- * otherwise they won't keep track of all folders. */
- if (store->flags & CAMEL_STORE_VTRASH)
- si->vtrash = camel_store_get_trash (store, NULL);
- if (store->flags & CAMEL_STORE_VJUNK)
- si->vjunk = camel_store_get_junk (store, NULL);
-
- return si;
-}
-
-static StoreInfo *
-store_info_ref (StoreInfo *si)
-{
- g_return_val_if_fail (si != NULL, si);
- g_return_val_if_fail (si->ref_count > 0, si);
-
- g_atomic_int_add (&si->ref_count, 1);
-
- return si;
-}
-
-static void
-store_info_unref (StoreInfo *si)
-{
- g_return_if_fail (si != NULL);
- g_return_if_fail (si->ref_count > 0);
-
- if (g_atomic_int_exchange_and_add (&si->ref_count, -1) > 1)
- return;
-
- if (si->vtrash != NULL)
- camel_object_unref (si->vtrash);
- if (si->vjunk != NULL)
- camel_object_unref (si->vjunk);
- camel_object_unref (si->store);
- g_free (si->name);
-
- g_slice_free (StoreInfo, si);
-}
-
-static void
-store_hash_free (StoreInfo *si)
-{
- si->removed = 1;
- store_info_unref (si);
-}
-
-static gboolean
-mail_shell_backend_add_store_done (CamelStore *store,
- CamelFolderInfo *info,
- gpointer user_data)
-{
- StoreInfo *si = user_data;
-
- if (si->done != NULL)
- si->done (store, info, si);
-
- if (!si->removed) {
- /* Let the counters know about the already-opened
- * junk and trash folders. */
- if (si->vtrash != NULL)
- mail_note_folder (si->vtrash);
- if (si->vjunk != NULL)
- mail_note_folder (si->vjunk);
- }
-
- store_info_unref (si);
-
- return TRUE;
-}
-
-static void
-mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend,
- CamelStore *store,
- const gchar *name,
- void (*done) (CamelStore *store,
- CamelFolderInfo *info,
- gpointer user_data))
-{
- EMFolderTreeModel *folder_tree_model;
- GHashTable *store_hash;
- StoreInfo *si;
-
- store_hash = mail_shell_backend->priv->store_hash;
- folder_tree_model = mail_shell_backend->priv->folder_tree_model;
-
- si = store_info_new (store, name);
- si->done = done;
- g_hash_table_insert (store_hash, store, si);
-
- em_folder_tree_model_add_store (folder_tree_model, store, si->name);
-
- mail_note_store (
- mail_shell_backend, store, NULL,
- mail_shell_backend_add_store_done, store_info_ref (si));
-}
-
-static void
-mail_shell_backend_add_local_store_done (CamelStore *store,
- CamelFolderInfo *info,
- gpointer unused)
-{
- gint ii;
-
- for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) {
- if (default_local_folders[ii].folder != NULL)
- mail_note_folder (default_local_folders[ii].folder);
- }
-}
-
-static void
-mail_shell_backend_add_local_store (EMailShellBackend *mail_shell_backend,
- CamelStore *local_store,
- const gchar *name)
-{
- mail_shell_backend_add_store (
- mail_shell_backend, local_store, name,
- mail_shell_backend_add_local_store_done);
-}
-
static void
mail_shell_backend_init_hooks (void)
{
@@ -309,109 +123,6 @@ mail_shell_backend_init_importers (void)
}
static void
-mail_shell_backend_init_local_store (EShellBackend *shell_backend)
-{
- EMailShellBackendPrivate *priv;
- CamelException ex;
- CamelService *service;
- CamelURL *url;
- MailAsyncEvent *async_event;
- const gchar *data_dir;
- gchar *temp;
- gint ii;
-
- priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
-
- camel_exception_init (&ex);
-
- async_event = priv->async_event;
- data_dir = e_shell_backend_get_data_dir (shell_backend);
-
- url = camel_url_new ("mbox:", NULL);
- temp = g_build_filename (data_dir, "local", NULL);
- camel_url_set_path (url, temp);
- g_free (temp);
-
- temp = camel_url_to_string (url, 0);
- service = camel_session_get_service (
- session, temp, CAMEL_PROVIDER_STORE, &ex);
- g_free (temp);
-
- if (service == NULL)
- goto fail;
-
- for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) {
- /* FIXME Should this URI be account relative? */
- camel_url_set_fragment (url, default_local_folders[ii].name);
- default_local_folders[ii].uri = camel_url_to_string (url, 0);
- default_local_folders[ii].folder = camel_store_get_folder (
- CAMEL_STORE (service), default_local_folders[ii].name,
- CAMEL_STORE_FOLDER_CREATE, &ex);
- camel_exception_clear (&ex);
- }
-
- camel_url_free (url);
-
- camel_object_ref (service);
- g_object_ref (shell_backend);
-
- mail_async_event_emit (
- async_event, MAIL_ASYNC_GUI,
- (MailAsyncFunc) mail_shell_backend_add_local_store,
- shell_backend, service, _("On This Computer"));
-
- priv->local_store = CAMEL_STORE (service);
-
- return;
-
-fail:
- g_warning ("Could not initialize local store/folder: %s", ex.desc);
-
- camel_exception_clear (&ex);
- camel_url_free (url);
-}
-
-static void
-mail_shell_backend_load_accounts (EShellBackend *shell_backend)
-{
- EAccountList *account_list;
- EIterator *iter;
-
- account_list = e_get_account_list ();
-
- for (iter = e_list_get_iterator ((EList *) account_list);
- e_iterator_is_valid (iter); e_iterator_next (iter)) {
-
- EAccountService *service;
- EAccount *account;
- const gchar *name;
- const gchar *url;
-
- account = (EAccount *) e_iterator_get (iter);
- service = account->source;
- name = account->name;
- url = service->url;
-
- if (!account->enabled)
- continue;
-
- if (url == NULL || *url == '\0')
- continue;
-
- /* HACK: mbox URL's are handled by the local store setup
- * above. Any that come through as account sources
- * are really movemail sources! */
- if (g_str_has_prefix (url, "mbox:"))
- continue;
-
- e_mail_shell_backend_load_store_by_uri (
- E_MAIL_SHELL_BACKEND (shell_backend), url, name);
- }
-
- g_object_unref (iter);
-}
-
-static void
mail_shell_backend_mail_icon_cb (EShellWindow *shell_window,
const gchar *icon_name)
{
@@ -577,9 +288,8 @@ mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
if (session == NULL || !camel_session_is_online (session))
goto exit;
- e_mail_shell_backend_stores_foreach (
- mail_shell_backend, (GHFunc)
- mail_shell_backend_sync_store_cb,
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_backend_sync_store_cb,
mail_shell_backend);
exit:
@@ -741,9 +451,8 @@ mail_shell_backend_prepare_for_offline_cb (EShell *shell,
camel_session_set_network_state (session, FALSE);
}
- e_mail_shell_backend_stores_foreach (
- mail_shell_backend, (GHFunc)
- mail_shell_store_prepare_for_offline_cb, activity);
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_store_prepare_for_offline_cb, activity);
}
/* Helper for mail_shell_backend_prepare_for_online_cb() */
@@ -766,9 +475,8 @@ mail_shell_backend_prepare_for_online_cb (EShell *shell,
{
camel_session_set_online (session, TRUE);
- e_mail_shell_backend_stores_foreach (
- mail_shell_backend, (GHFunc)
- mail_shell_store_prepare_for_online_cb, activity);
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_store_prepare_for_online_cb, activity);
}
static void
@@ -858,48 +566,12 @@ mail_shell_backend_window_created_cb (EShell *shell,
}
static void
-mail_shell_backend_dispose (GObject *object)
-{
- EMailShellBackendPrivate *priv;
-
- priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
-
- g_hash_table_remove_all (priv->store_hash);
-
- if (priv->folder_tree_model != NULL) {
- g_object_unref (priv->folder_tree_model);
- priv->folder_tree_model = NULL;
- }
-
- if (priv->local_store != NULL) {
- camel_object_unref (priv->local_store);
- priv->local_store = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-mail_shell_backend_finalize (GObject *object)
-{
- EMailShellBackendPrivate *priv;
-
- priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
-
- g_hash_table_destroy (priv->store_hash);
- mail_async_event_destroy (priv->async_event);
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
mail_shell_backend_constructed (GObject *object)
{
EMailShellBackendPrivate *priv;
EShell *shell;
EShellBackend *shell_backend;
+ const gchar *data_dir;
priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
@@ -917,16 +589,6 @@ mail_shell_backend_constructed (GObject *object)
/* XXX This never gets unreffed. */
global_mail_shell_backend = g_object_ref (shell_backend);
- priv->store_hash = g_hash_table_new_full (
- g_direct_hash, g_direct_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) store_hash_free);
-
- priv->async_event = mail_async_event_new ();
-
- priv->folder_tree_model = em_folder_tree_model_new (
- E_MAIL_SHELL_BACKEND (shell_backend));
-
g_signal_connect (
shell, "notify::online",
G_CALLBACK (mail_shell_backend_notify_online_cb),
@@ -960,8 +622,8 @@ mail_shell_backend_constructed (GObject *object)
mail_config_init ();
mail_msg_init ();
- mail_shell_backend_init_local_store (shell_backend);
- mail_shell_backend_load_accounts (shell_backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ e_mail_store_init (data_dir);
/* Initialize settings before initializing preferences,
* since the preferences bind to the shell settings. */
@@ -1009,8 +671,6 @@ mail_shell_backend_class_init (EMailShellBackendClass *class)
g_type_class_add_private (class, sizeof (EMailShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->dispose = mail_shell_backend_dispose;
- object_class->finalize = mail_shell_backend_finalize;
object_class->constructed = mail_shell_backend_constructed;
shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -1059,194 +719,6 @@ e_mail_shell_backend_register_type (GTypeModule *type_module)
"EMailShellBackend", &type_info, 0);
}
-/******************************** Public API *********************************/
-
-CamelFolder *
-e_mail_shell_backend_get_folder (EMailShellBackend *mail_shell_backend,
- EMailFolderType folder_type)
-{
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
-
- return default_local_folders[folder_type].folder;
-}
-
-const gchar *
-e_mail_shell_backend_get_folder_uri (EMailShellBackend *mail_shell_backend,
- EMailFolderType folder_type)
-{
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
-
- return default_local_folders[folder_type].uri;
-}
-
-EMFolderTreeModel *
-e_mail_shell_backend_get_folder_tree_model (EMailShellBackend *mail_shell_backend)
-{
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
-
- return mail_shell_backend->priv->folder_tree_model;
-}
-
-void
-e_mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend,
- CamelStore *store,
- const gchar *name)
-{
- g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
- g_return_if_fail (CAMEL_IS_STORE (store));
- g_return_if_fail (name != NULL);
-
- mail_shell_backend_add_store (mail_shell_backend, store, name, NULL);
-}
-
-CamelStore *
-e_mail_shell_backend_get_local_store (EMailShellBackend *mail_shell_backend)
-{
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
-
- return mail_shell_backend->priv->local_store;
-}
-
-CamelStore *
-e_mail_shell_backend_load_store_by_uri (EMailShellBackend *mail_shell_backend,
- const gchar *uri,
- const gchar *name)
-{
- CamelStore *store;
- CamelProvider *provider;
- CamelException ex;
-
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
- g_return_val_if_fail (uri != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- camel_exception_init (&ex);
-
- /* Load the service, but don't connect. Check its provider,
- * and if this belongs in the shell's folder list, add it. */
-
- provider = camel_provider_get (uri, &ex);
- if (provider == NULL)
- goto fail;
-
- if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
- return NULL;
-
- store = (CamelStore *) camel_session_get_service (
- session, uri, CAMEL_PROVIDER_STORE, &ex);
- if (store == NULL)
- goto fail;
-
- e_mail_shell_backend_add_store (mail_shell_backend, store, name);
-
- camel_object_unref (store);
-
- return store;
-
-fail:
- /* FIXME: Show an error dialog. */
- g_warning (
- "Couldn't get service: %s: %s", uri,
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
-
- return NULL;
-}
-
-/* Helper for e_mail_shell_backend_remove_store() */
-static void
-mail_shell_backend_remove_store_cb (CamelStore *store,
- gpointer event_data,
- gpointer user_data)
-{
- camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
- camel_object_unref (store);
-}
-
-void
-e_mail_shell_backend_remove_store (EMailShellBackend *mail_shell_backend,
- CamelStore *store)
-{
- GHashTable *store_hash;
- MailAsyncEvent *async_event;
- EMFolderTreeModel *folder_tree_model;
-
- g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
- g_return_if_fail (CAMEL_IS_STORE (store));
-
- store_hash = mail_shell_backend->priv->store_hash;
- async_event = mail_shell_backend->priv->async_event;
- folder_tree_model = mail_shell_backend->priv->folder_tree_model;
-
- /* Because the store hash holds a reference to each store used
- * as a key in it, none of them will ever be gc'ed, meaning any
- * call to camel_session_get_{service,store} with the same URL
- * will always return the same object. So this works. */
-
- if (g_hash_table_lookup (store_hash, store) == NULL)
- return;
-
- camel_object_ref (store);
- g_hash_table_remove (store_hash, store);
- mail_note_store_remove (store);
- em_folder_tree_model_remove_store (folder_tree_model, store);
-
- mail_async_event_emit (
- async_event, MAIL_ASYNC_THREAD,
- (MailAsyncFunc) mail_shell_backend_remove_store_cb,
- store, NULL, NULL);
-}
-
-void
-e_mail_shell_backend_remove_store_by_uri (EMailShellBackend *mail_shell_backend,
- const gchar *uri)
-{
- CamelStore *store;
- CamelProvider *provider;
-
- g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
- g_return_if_fail (uri != NULL);
-
- provider = camel_provider_get (uri, NULL);
- if (provider == NULL)
- return;
-
- if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
- return;
-
- store = (CamelStore *) camel_session_get_service (
- session, uri, CAMEL_PROVIDER_STORE, NULL);
- if (store != NULL) {
- e_mail_shell_backend_remove_store (mail_shell_backend, store);
- camel_object_unref (store);
- }
-}
-
-void
-e_mail_shell_backend_stores_foreach (EMailShellBackend *mail_shell_backend,
- GHFunc func,
- gpointer user_data)
-{
- GHashTable *store_hash;
- GHashTableIter iter;
- gpointer key, value;
-
- g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
- g_return_if_fail (func != NULL);
-
- store_hash = mail_shell_backend->priv->store_hash;
-
- g_hash_table_iter_init (&iter, store_hash);
-
- while (g_hash_table_iter_next (&iter, &key, &value))
- func (key, ((StoreInfo *) value)->name, user_data);
-}
-
/******************* Code below here belongs elsewhere. *******************/
#include "filter/filter-option.h"
diff --git a/mail/e-mail-shell-backend.h b/mail/e-mail-shell-backend.h
index 248768062f..4bc1a36706 100644
--- a/mail/e-mail-shell-backend.h
+++ b/mail/e-mail-shell-backend.h
@@ -63,56 +63,16 @@ struct _EMailShellBackendClass {
EShellBackendClass parent_class;
};
-typedef enum {
- E_MAIL_FOLDER_INBOX,
- E_MAIL_FOLDER_DRAFTS,
- E_MAIL_FOLDER_OUTBOX,
- E_MAIL_FOLDER_SENT,
- E_MAIL_FOLDER_TEMPLATES,
- E_MAIL_FOLDER_LOCAL_INBOX
-} EMailFolderType;
-
-struct _EMFolderTreeModel;
-
/* Globally available shell backend.
*
* XXX I don't like having this globally available but passing it around
* to all the various utilities that need to access the backend's data
- * directory and local folders is too much of a pain for now. */
+ * directory is too much of a pain for now. */
extern EMailShellBackend *global_mail_shell_backend;
GType e_mail_shell_backend_get_type (void);
void e_mail_shell_backend_register_type
(GTypeModule *type_module);
-CamelFolder * e_mail_shell_backend_get_folder
- (EMailShellBackend *mail_shell_backend,
- EMailFolderType folder_type);
-const gchar * e_mail_shell_backend_get_folder_uri
- (EMailShellBackend *mail_shell_backend,
- EMailFolderType folder_type);
-struct _EMFolderTreeModel *
- e_mail_shell_backend_get_folder_tree_model
- (EMailShellBackend *mail_shell_backend);
-void e_mail_shell_backend_add_store
- (EMailShellBackend *mail_shell_backend,
- CamelStore *store,
- const gchar *name);
-CamelStore * e_mail_shell_backend_get_local_store
- (EMailShellBackend *mail_shell_backend);
-CamelStore * e_mail_shell_backend_load_store_by_uri
- (EMailShellBackend *mail_shell_backend,
- const gchar *uri,
- const gchar *name);
-void e_mail_shell_backend_remove_store
- (EMailShellBackend *mail_shell_backend,
- CamelStore *store);
-void e_mail_shell_backend_remove_store_by_uri
- (EMailShellBackend *mail_shell_backend,
- const gchar *uri);
-void e_mail_shell_backend_stores_foreach
- (EMailShellBackend *mail_shell_backend,
- GHFunc func,
- gpointer user_data);
/* XXX Find a better place for this function. */
GSList * e_mail_labels_get_filter_options(void);
diff --git a/mail/e-mail-shell-migrate.c b/mail/e-mail-shell-migrate.c
index 5ebc833902..2158580bf9 100644
--- a/mail/e-mail-shell-migrate.c
+++ b/mail/e-mail-shell-migrate.c
@@ -66,6 +66,7 @@
#include "e-mail-shell-backend.h"
#include "shell/e-shell-migrate.h"
+#include "e-mail-store.h"
#include "mail-config.h"
#include "em-utils.h"
@@ -2958,9 +2959,7 @@ migrate_to_db (EShellBackend *shell_backend)
CamelException ex;
camel_exception_init (&ex);
- e_mail_shell_backend_load_store_by_uri (
- E_MAIL_SHELL_BACKEND (shell_backend),
- service->url, name);
+ e_mail_store_add_by_uri (service->url, name);
store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, &ex);
info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex);
diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c
index 83e8b7d0a0..2e5dffcb96 100644
--- a/mail/e-mail-shell-sidebar.c
+++ b/mail/e-mail-shell-sidebar.c
@@ -27,7 +27,8 @@
#include "em-utils.h"
#include "em-folder-utils.h"
-#include "e-mail-shell-backend.h"
+#include "e-mail-local.h"
+#include "e-mail-store.h"
#define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -52,7 +53,6 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar)
{
EShellView *shell_view;
EShellSidebar *shell_sidebar;
- EMFolderTreeModel *folder_tree_model;
EMFolderTree *folder_tree;
GtkTreeModel *tree_model;
GtkTreeView *tree_view;
@@ -68,10 +68,9 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar)
key_file = e_shell_view_get_state_key_file (shell_view);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
- folder_tree_model = em_folder_tree_get_model (folder_tree);
tree_view = GTK_TREE_VIEW (folder_tree);
- tree_model = GTK_TREE_MODEL (folder_tree_model);
+ tree_model = gtk_tree_view_get_model (tree_view);
/* Restore selected folder. */
@@ -123,7 +122,7 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar)
continue;
reference = em_folder_tree_model_lookup_uri (
- folder_tree_model, uri);
+ EM_FOLDER_TREE_MODEL (tree_model), uri);
if (reference == NULL)
continue;
@@ -410,14 +409,12 @@ mail_shell_sidebar_finalize (GObject *object)
static void
mail_shell_sidebar_constructed (GObject *object)
{
- EMailShellBackend *mail_shell_backend;
EMailShellSidebar *mail_shell_sidebar;
- EMFolderTreeModel *folder_tree_model;
EShellSidebar *shell_sidebar;
- EShellBackend *shell_backend;
EShellView *shell_view;
GtkTreeSelection *selection;
GtkTreeView *tree_view;
+ GtkTreeModel *model;
GtkWidget *container;
GtkWidget *widget;
@@ -426,14 +423,9 @@ 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);
- mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (object);
- folder_tree_model = e_mail_shell_backend_get_folder_tree_model (
- mail_shell_backend);
-
/* Build sidebar widgets. */
container = GTK_WIDGET (object);
@@ -449,7 +441,7 @@ mail_shell_sidebar_constructed (GObject *object)
container = widget;
- widget = em_folder_tree_new_with_model (folder_tree_model);
+ widget = em_folder_tree_new ();
em_folder_tree_set_excluded (EM_FOLDER_TREE (widget), 0);
em_folder_tree_enable_drag_and_drop (EM_FOLDER_TREE (widget));
gtk_container_add (GTK_CONTAINER (container), widget);
@@ -458,11 +450,14 @@ mail_shell_sidebar_constructed (GObject *object)
tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree);
selection = gtk_tree_view_get_selection (tree_view);
+ model = gtk_tree_view_get_model (tree_view);
- if (em_folder_tree_model_get_selection (folder_tree_model) == NULL)
+ if (em_folder_tree_model_get_selection (
+ EM_FOLDER_TREE_MODEL (model)) == NULL)
mail_shell_sidebar_restore_state (mail_shell_sidebar);
- em_folder_tree_model_set_selection (folder_tree_model, selection);
+ em_folder_tree_model_set_selection (
+ EM_FOLDER_TREE_MODEL (model), selection);
g_signal_connect_swapped (
tree_view, "row-collapsed",
@@ -475,7 +470,7 @@ mail_shell_sidebar_constructed (GObject *object)
shell_sidebar);
g_signal_connect_swapped (
- folder_tree_model, "loaded-row",
+ model, "loaded-row",
G_CALLBACK (mail_shell_sidebar_model_loaded_row_cb),
shell_sidebar);
@@ -488,9 +483,7 @@ mail_shell_sidebar_constructed (GObject *object)
static guint32
mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
{
- EMailShellBackend *mail_shell_backend;
EMailShellSidebar *mail_shell_sidebar;
- EShellBackend *shell_backend;
EShellView *shell_view;
EMFolderTree *folder_tree;
GtkTreeSelection *selection;
@@ -512,10 +505,8 @@ mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
guint32 state = 0;
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
- mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
- local_store = e_mail_shell_backend_get_local_store (mail_shell_backend);
+ local_store = e_mail_local_get_store ();
mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
index e9cba33117..25e7d80da3 100644
--- a/mail/e-mail-shell-view-actions.c
+++ b/mail/e-mail-shell-view-actions.c
@@ -49,14 +49,12 @@ static void
action_mail_account_disable_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EMailShellBackend *mail_shell_backend;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
EAccountList *account_list;
EAccount *account;
gchar *folder_uri;
- mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -72,8 +70,7 @@ action_mail_account_disable_cb (GtkAction *action,
account->enabled = !account->enabled;
e_account_list_change (account_list, account);
- e_mail_shell_backend_remove_store_by_uri (
- mail_shell_backend, folder_uri);
+ e_mail_store_remove_by_uri (folder_uri);
if (account->parent_uid != NULL)
e_account_list_remove (account_list, account);
@@ -94,8 +91,7 @@ action_mail_create_search_folder_cb (GtkAction *action,
static void
action_mail_download_foreach_cb (CamelService *service)
{
- if (CAMEL_IS_DISCO_STORE (service) ||
- CAMEL_IS_OFFLINE_STORE (service))
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
mail_store_prepare_offline (CAMEL_STORE (service));
}
@@ -103,13 +99,7 @@ static void
action_mail_download_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EMailShellBackend *mail_shell_backend;
-
- mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
-
- e_mail_shell_backend_stores_foreach (
- mail_shell_backend, (GHFunc)
- action_mail_download_foreach_cb, NULL);
+ e_mail_store_foreach ((GHFunc) action_mail_download_foreach_cb, NULL);
}
static void
@@ -139,7 +129,6 @@ action_mail_folder_copy_cb (GtkAction *action,
EMailShellSidebar *mail_shell_sidebar;
CamelFolderInfo *folder_info;
EMFolderTree *folder_tree;
- EMFolderTreeModel *model;
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -147,8 +136,7 @@ action_mail_folder_copy_cb (GtkAction *action,
g_return_if_fail (folder_info != NULL);
/* XXX Leaking folder_info? */
- model = em_folder_tree_get_model (folder_tree);
- em_folder_utils_copy_folder (model, folder_info, FALSE);
+ em_folder_utils_copy_folder (folder_info, FALSE);
}
static void
@@ -236,7 +224,6 @@ action_mail_folder_move_cb (GtkAction *action,
EMailShellSidebar *mail_shell_sidebar;
CamelFolderInfo *folder_info;
EMFolderTree *folder_tree;
- EMFolderTreeModel *model;
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -244,8 +231,7 @@ action_mail_folder_move_cb (GtkAction *action,
g_return_if_fail (folder_info != NULL);
/* XXX Leaking folder_info? */
- model = em_folder_tree_get_model (folder_tree);
- em_folder_utils_copy_folder (model, folder_info, TRUE);
+ em_folder_utils_copy_folder (folder_info, TRUE);
}
static void
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
index d4fd3c7564..f3b3b5a513 100644
--- a/mail/e-mail-shell-view-private.c
+++ b/mail/e-mail-shell-view-private.c
@@ -755,7 +755,6 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
void
e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
{
- EMailShellBackend *mail_shell_backend;
EMailShellContent *mail_shell_content;
EShellSidebar *shell_sidebar;
EShellView *shell_view;
@@ -777,7 +776,6 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
- mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
mail_shell_content = mail_shell_view->priv->mail_shell_content;
shell_view = E_SHELL_VIEW (mail_shell_view);
@@ -788,7 +786,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
folder_uri = message_list->folder_uri;
folder = message_list->folder;
- local_store = e_mail_shell_backend_get_local_store (mail_shell_backend);
+ local_store = e_mail_local_get_store ();
/* If no folder is selected, reset the sidebar banners
* to their default values and stop. */
diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h
index f6646cabc2..988d494219 100644
--- a/mail/e-mail-shell-view-private.h
+++ b/mail/e-mail-shell-view-private.h
@@ -41,7 +41,9 @@
#include "e-mail-label-dialog.h"
#include "e-mail-label-list-store.h"
+#include "e-mail-local.h"
#include "e-mail-reader.h"
+#include "e-mail-store.h"
#include "em-composer-utils.h"
#include "em-folder-properties.h"
#include "em-folder-selector.h"
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 5179815609..4ae929513e 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -58,6 +58,7 @@
#include "e-util/e-signature-utils.h"
#include "e-util/e-util-private.h"
+#include "e-mail-local.h"
#include "em-config.h"
#include "em-folder-selection-button.h"
#include "em-account-editor.h"
@@ -70,8 +71,6 @@
#include "mail-ops.h"
#include "mail-mt.h"
-#include "e-mail-shell-backend.h"
-
#if defined (HAVE_NSS)
#include "smime/gui/e-cert-selector.h"
#endif
@@ -469,13 +468,11 @@ default_folders_clicked (GtkButton *button, gpointer user_data)
EMAccountEditor *emae = user_data;
const gchar *uri;
- uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS);
em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->drafts_folder_button, uri);
emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->drafts_folder_button, emae);
- uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_SENT);
em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->sent_folder_button, uri);
emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->sent_folder_button, emae);
}
@@ -486,10 +483,8 @@ GtkWidget *em_account_editor_folder_selector_button_new (gchar *widget_name, gch
GtkWidget *
em_account_editor_folder_selector_button_new (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2)
{
- EMFolderTreeModel *model;
-
- model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
- return (GtkWidget *)em_folder_selection_button_new(model, string1 ? string1 : _("Select Folder"), NULL);
+ return (GtkWidget *)em_folder_selection_button_new (
+ string1 ? string1 : _("Select Folder"), NULL);
}
GtkWidget *em_account_editor_dropdown_new(gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2);
@@ -497,7 +492,7 @@ GtkWidget *em_account_editor_dropdown_new(gchar *widget_name, gchar *string1, gc
GtkWidget *
em_account_editor_dropdown_new(gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2)
{
- return (GtkWidget *)gtk_combo_box_new();
+ return gtk_combo_box_new ();
}
GtkWidget *em_account_editor_ssl_selector_new(gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2);
@@ -927,8 +922,7 @@ emae_account_folder(EMAccountEditor *emae, const gchar *name, gint item, gint de
} else {
const gchar *uri;
- uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, deffolder);
+ uri = e_mail_local_get_folder_uri (deffolder);
em_folder_selection_button_set_selection(folder, uri);
}
@@ -3018,21 +3012,17 @@ em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account
emae->do_signature = TRUE;
} else {
- const gchar *uri;
-
/* TODO: have a get_default_account thing?? */
emae->account = e_account_new();
emae->account->enabled = TRUE;
- uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
e_account_set_string (
- emae->account, E_ACCOUNT_DRAFTS_FOLDER_URI, uri);
+ emae->account, E_ACCOUNT_DRAFTS_FOLDER_URI,
+ e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS));
- uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
e_account_set_string (
- emae->account, E_ACCOUNT_SENT_FOLDER_URI, uri);
+ emae->account, E_ACCOUNT_SENT_FOLDER_URI,
+ e_mail_local_get_folder_uri (E_MAIL_FOLDER_SENT));
}
/* sort the providers, remote first */
diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c
index 82342de3c9..f2c646d5ed 100644
--- a/mail/em-account-prefs.c
+++ b/mail/em-account-prefs.c
@@ -36,9 +36,9 @@
#include "e-util/e-error.h"
+#include "e-mail-store.h"
#include "em-config.h"
#include "em-account-editor.h"
-#include "e-mail-shell-backend.h"
#define EM_ACCOUNT_PREFS_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -59,9 +59,7 @@ account_prefs_enable_account_cb (EAccountTreeView *tree_view)
account = e_account_tree_view_get_selected (tree_view);
g_return_if_fail (account != NULL);
- e_mail_shell_backend_load_store_by_uri (
- global_mail_shell_backend,
- account->source->url, account->name);
+ e_mail_store_add_by_uri (account->source->url, account->name);
}
static void
@@ -94,8 +92,7 @@ account_prefs_disable_account_cb (EAccountTreeView *tree_view)
e_account_list_remove_account_proxies (account_list, account);
- e_mail_shell_backend_remove_store_by_uri (
- global_mail_shell_backend, account->source->url);
+ e_mail_store_remove_by_uri (account->source->url);
}
static void
@@ -216,8 +213,7 @@ account_prefs_delete_account (EAccountManager *manager)
/* Remove the account from the folder tree. */
if (account->enabled && account->source && account->source->url)
- e_mail_shell_backend_remove_store_by_uri (
- global_mail_shell_backend, account->source->url);
+ e_mail_store_remove_by_uri (account->source->url);
/* Remove all the proxies the account has created. */
if (has_proxies)
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index ebef6cf78b..23dcd94bbe 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -41,6 +41,7 @@
#include "e-util/e-error.h"
#include "e-util/e-account-utils.h"
+#include "e-mail-local.h"
#include "em-utils.h"
#include "em-composer-utils.h"
#include "composer/e-msg-composer.h"
@@ -60,8 +61,6 @@
#include <camel/camel-nntp-address.h>
#include <camel/camel-vee-folder.h>
-#include "e-mail-shell-backend.h"
-
#ifdef G_OS_WIN32
/* Undef the similar macro from pthread.h, it doesn't check if
* gmtime() returns NULL.
@@ -448,7 +447,7 @@ em_utils_composer_send_cb (EMsgComposer *composer)
CamelMimeMessage *message;
CamelMessageInfo *info;
struct _send_data *send;
- CamelFolder *mail_folder;
+ CamelFolder *folder;
EAccount *account;
table = e_msg_composer_get_header_table (composer);
@@ -463,9 +462,8 @@ em_utils_composer_send_cb (EMsgComposer *composer)
if ((message = composer_get_message (composer, FALSE)) == NULL)
return;
- mail_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- camel_object_ref (mail_folder);
+ folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ camel_object_ref (folder);
/* mail the message */
info = camel_message_info_new (NULL);
@@ -482,9 +480,9 @@ em_utils_composer_send_cb (EMsgComposer *composer)
e_msg_composer_set_enable_autosave (composer, FALSE);
mail_append_mail (
- mail_folder, message, info, composer_send_queued_cb, send);
+ folder, message, info, composer_send_queued_cb, send);
- camel_object_unref (mail_folder);
+ camel_object_unref (folder);
camel_object_unref (message);
}
@@ -594,11 +592,10 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer)
* get destroyed while we're in mail_msg_wait() a little lower
* down, waiting for the folder to open */
- local_drafts_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
-
- local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_drafts_folder =
+ e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS);
+ local_drafts_folder_uri =
+ e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS);
g_object_ref (composer);
msg = e_msg_composer_get_message_draft (composer);
@@ -1521,9 +1518,8 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
}
/* Send the receipt */
- out_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
info = camel_message_info_new (NULL);
+ out_folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
mail_append_mail (out_folder, receipt, info, em_utils_receipt_done, NULL);
}
@@ -1618,9 +1614,8 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co
g_free (subject);
/* and send it */
- out_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
info = camel_message_info_new (NULL);
+ out_folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
mail_append_mail (out_folder, forward, info, emu_forward_raw_done, NULL);
}
@@ -2397,17 +2392,14 @@ em_utils_reply_to_message(CamelFolder *folder, const gchar *uid, CamelMimeMessag
}
static void
-post_header_clicked_cb (EComposerPostHeader *header,
- EMailShellBackend *mail_shell_backend)
+post_header_clicked_cb (EComposerPostHeader *header)
{
- EMFolderTreeModel *model;
GtkTreeSelection *selection;
GtkWidget *folder_tree;
GtkWidget *dialog;
GList *list;
- model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend);
- folder_tree = em_folder_tree_new_with_model (model);
+ folder_tree = em_folder_tree_new ();
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -2498,6 +2490,5 @@ em_configure_new_composer (EMsgComposer *composer)
* the folder selector dialog. See the handler function. */
g_signal_connect (
header, "clicked",
- G_CALLBACK (post_header_clicked_cb),
- global_mail_shell_backend);
+ G_CALLBACK (post_header_clicked_cb), NULL);
}
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index 145240dfbb..7b64ef9aa6 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -37,8 +37,6 @@
#include "libedataserver/e-sexp.h"
#include "e-util/e-error.h"
-#include "e-mail-shell-backend.h"
-
#define d(x)
static gboolean validate(FilterElement *fe);
@@ -249,7 +247,6 @@ static GtkWidget *
get_widget(FilterElement *fe)
{
EMFilterFolderElement *ff = (EMFilterFolderElement *)fe;
- EMFolderTreeModel *model;
GtkWidget *button;
gchar *uri;
@@ -257,9 +254,11 @@ get_widget(FilterElement *fe)
uri = ff->uri;
else
uri = em_uri_to_camel (ff->uri);
- model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
- button = em_folder_selection_button_new (model, _("Select Folder"), NULL);
- em_folder_selection_button_set_selection(EM_FOLDER_SELECTION_BUTTON(button), uri);
+
+ button = em_folder_selection_button_new (_("Select Folder"), NULL);
+
+ em_folder_selection_button_set_selection(
+ EM_FOLDER_SELECTION_BUTTON (button), uri);
if (!ff->store_camel_uri)
g_free(uri);
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index 1c07f4f5a2..a7236e66dd 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -39,13 +39,12 @@
#include "em-folder-properties.h"
#include "em-config.h"
+#include "e-mail-local.h"
#include "mail-ops.h"
#include "mail-mt.h"
#include "mail-vfolder.h"
#include "mail-config.h"
-#include "e-mail-shell-backend.h"
-
struct _prop_data {
gpointer object;
CamelArgV *argv;
@@ -299,7 +298,6 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
gint32 count, i,deleted;
EMConfig *ec;
EMConfigTargetFolder *target;
- EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
CamelArgGetV *arggetv;
@@ -315,11 +313,9 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
store = folder->parent_store;
shell_view = E_SHELL_VIEW (data);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- local_store = e_mail_shell_backend_get_local_store (
- E_MAIL_SHELL_BACKEND (shell_backend));
+ local_store = e_mail_local_get_store ();
prop_data = g_malloc0 (sizeof (*prop_data));
prop_data->object = folder;
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index cff76adcee..ec818221b4 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -40,8 +40,6 @@
((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonPrivate))
struct _EMFolderSelectionButtonPrivate {
- gpointer model; /* weak pointer */
-
GtkWidget *icon;
GtkWidget *label;
@@ -57,7 +55,6 @@ struct _EMFolderSelectionButtonPrivate {
enum {
PROP_0,
PROP_CAPTION,
- PROP_MODEL,
PROP_MULTISELECT,
PROP_TITLE
};
@@ -114,18 +111,6 @@ folder_selection_button_set_contents (EMFolderSelectionButton *button)
}
static void
-folder_selection_button_set_model (EMFolderSelectionButton *button,
- EMFolderTreeModel *model)
-{
- g_return_if_fail (button->priv->model == NULL);
-
- button->priv->model = model;
-
- g_object_add_weak_pointer (
- G_OBJECT (model), &button->priv->model);
-}
-
-static void
folder_selection_button_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -138,12 +123,6 @@ folder_selection_button_set_property (GObject *object,
g_value_get_string (value));
return;
- case PROP_MODEL:
- folder_selection_button_set_model (
- EM_FOLDER_SELECTION_BUTTON (object),
- g_value_get_object (value));
- return;
-
case PROP_MULTISELECT:
em_folder_selection_button_set_multiselect (
EM_FOLDER_SELECTION_BUTTON (object),
@@ -174,13 +153,6 @@ folder_selection_button_get_property (GObject *object,
EM_FOLDER_SELECTION_BUTTON (object)));
return;
- case PROP_MODEL:
- g_value_set_object (
- value,
- em_folder_selection_button_get_model (
- EM_FOLDER_SELECTION_BUTTON (object)));
- return;
-
case PROP_MULTISELECT:
g_value_set_boolean (
value,
@@ -200,23 +172,6 @@ folder_selection_button_get_property (GObject *object,
}
static void
-folder_selection_button_dispose (GObject *object)
-{
- EMFolderSelectionButtonPrivate *priv;
-
- priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object);
-
- if (priv->model != NULL) {
- g_object_remove_weak_pointer (
- G_OBJECT (priv->model), &priv->model);
- priv->model = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
folder_selection_button_finalize (GObject *object)
{
EMFolderSelectionButtonPrivate *priv;
@@ -256,7 +211,7 @@ folder_selection_button_clicked (GtkButton *button)
priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (button);
- emft = (EMFolderTree *) em_folder_tree_new_with_model (priv->model);
+ emft = (EMFolderTree *) em_folder_tree_new ();
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (emft));
if (priv->multiple_select)
@@ -318,7 +273,6 @@ folder_selection_button_class_init (EMFolderSelectionButtonClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = folder_selection_button_set_property;
object_class->get_property = folder_selection_button_get_property;
- object_class->dispose = folder_selection_button_dispose;
object_class->finalize = folder_selection_button_finalize;
gtk_object_class = GTK_OBJECT_CLASS (class);
@@ -340,17 +294,6 @@ folder_selection_button_class_init (EMFolderSelectionButtonClass *class)
g_object_class_install_property (
object_class,
- PROP_MODEL,
- g_param_spec_object (
- "model",
- NULL,
- NULL,
- EM_TYPE_FOLDER_TREE_MODEL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (
- object_class,
PROP_MULTISELECT,
g_param_spec_boolean (
"multiselect",
@@ -436,24 +379,12 @@ em_folder_selection_button_get_type (void)
}
GtkWidget *
-em_folder_selection_button_new (EMFolderTreeModel *model,
- const gchar *title,
+em_folder_selection_button_new (const gchar *title,
const gchar *caption)
{
- g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
-
return g_object_new (
EM_TYPE_FOLDER_SELECTION_BUTTON,
- "model", model, "title", title,
- "caption", caption, NULL);
-}
-
-EMFolderTreeModel *
-em_folder_selection_button_get_model (EMFolderSelectionButton *button)
-{
- g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
-
- return button->priv->model;
+ "title", title, "caption", caption, NULL);
}
const gchar *
diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h
index 391b6b1dbd..cc75fac1dd 100644
--- a/mail/em-folder-selection-button.h
+++ b/mail/em-folder-selection-button.h
@@ -26,8 +26,6 @@
#include <gtk/gtk.h>
-#include <mail/em-folder-tree-model.h>
-
/* Standard GObject macros */
#define EM_TYPE_FOLDER_SELECTION_BUTTON \
(em_folder_selection_button_get_type ())
@@ -68,12 +66,8 @@ struct _EMFolderSelectionButtonClass {
GType em_folder_selection_button_get_type (void);
GtkWidget * em_folder_selection_button_new
- (EMFolderTreeModel *model,
- const gchar *title,
+ (const gchar *title,
const gchar *caption);
-EMFolderTreeModel *
- em_folder_selection_button_get_model
- (EMFolderSelectionButton *button);
const gchar * em_folder_selection_button_get_caption
(EMFolderSelectionButton *button);
void em_folder_selection_button_set_caption
diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c
index 5997eb6ca6..1e77525c9b 100644
--- a/mail/em-folder-selection.c
+++ b/mail/em-folder-selection.c
@@ -36,8 +36,7 @@
/* TODO: rmeove this file, it could just go on em-folder-selection or em-utils */
void
-em_select_folder (EMFolderTreeModel *model,
- const gchar *title,
+em_select_folder (const gchar *title,
const gchar *oklabel,
const gchar *default_uri,
EMFTExcludeFunc exclude,
@@ -47,11 +46,10 @@ em_select_folder (EMFolderTreeModel *model,
GtkWidget *dialog;
EMFolderTree *emft;
- g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
g_return_if_fail (done != NULL);
/* XXX Do we leak this reference? */
- emft = (EMFolderTree *) em_folder_tree_new_with_model (model);
+ emft = (EMFolderTree *) em_folder_tree_new ();
if (exclude)
em_folder_tree_set_excluded_func (emft, exclude, user_data);
diff --git a/mail/em-folder-selection.h b/mail/em-folder-selection.h
index 96d14cbc19..3f6b4b3a3b 100644
--- a/mail/em-folder-selection.h
+++ b/mail/em-folder-selection.h
@@ -24,12 +24,11 @@
#ifndef EM_FOLDER_SELECTION_H
#define EM_FOLDER_SELECTION_H
-#include <mail/em-folder-tree-model.h>
+#include <glib.h>
G_BEGIN_DECLS
-void em_select_folder (EMFolderTreeModel *model,
- const gchar *title,
+void em_select_folder (const gchar *title,
const gchar *oklabel,
const gchar *default_uri,
EMFTExcludeFunc exclude,
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index c9c001f0cd..03970bbc05 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -56,10 +56,10 @@ static void
folder_selector_destroy (GtkObject *object)
{
EMFolderSelector *emfs = EM_FOLDER_SELECTOR (object);
- EMFolderTreeModel *model;
+ GtkTreeModel *model;
if (emfs->created_id != 0) {
- model = em_folder_tree_get_model (emfs->emft);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emfs->emft));
g_signal_handler_disconnect (model, emfs->created_id);
emfs->created_id = 0;
}
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 9c3ef60397..6049626f16 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -52,7 +52,7 @@
#include <camel/camel-folder.h>
#include <camel/camel-vee-store.h>
-#include "e-mail-shell-backend.h"
+#include "e-mail-local.h"
#define d(x)
@@ -61,8 +61,6 @@
((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelPrivate))
struct _EMFolderTreeModelPrivate {
- gpointer shell_backend; /* weak pointer */
-
/* This is set by EMailShellSidebar. It allows new EMFolderTree
* instances to initialize their selection and expanded states to
* mimic the sidebar. */
@@ -85,7 +83,6 @@ struct _EMFolderTreeModelPrivate {
enum {
PROP_0,
- PROP_SHELL_BACKEND,
PROP_SELECTION
};
@@ -244,31 +241,12 @@ folder_tree_model_selection_finalized_cb (EMFolderTreeModel *model)
}
static void
-folder_tree_model_set_shell_backend (EMFolderTreeModel *model,
- EShellBackend *shell_backend)
-{
- g_return_if_fail (model->priv->shell_backend == NULL);
-
- model->priv->shell_backend = shell_backend;
-
- g_object_add_weak_pointer (
- G_OBJECT (shell_backend),
- &model->priv->shell_backend);
-}
-
-static void
folder_tree_model_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SHELL_BACKEND:
- folder_tree_model_set_shell_backend (
- EM_FOLDER_TREE_MODEL (object),
- g_value_get_object (value));
- return;
-
case PROP_SELECTION:
em_folder_tree_model_set_selection (
EM_FOLDER_TREE_MODEL (object),
@@ -286,13 +264,6 @@ folder_tree_model_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SHELL_BACKEND:
- g_value_set_object (
- value,
- em_folder_tree_model_get_mail_shell_backend (
- EM_FOLDER_TREE_MODEL (object)));
- return;
-
case PROP_SELECTION:
g_value_set_object (
value,
@@ -311,12 +282,6 @@ folder_tree_model_dispose (GObject *object)
priv = EM_FOLDER_TREE_MODEL_GET_PRIVATE (object);
- if (priv->shell_backend != NULL) {
- g_object_remove_weak_pointer (
- G_OBJECT (priv->shell_backend), &priv->shell_backend);
- priv->shell_backend = NULL;
- }
-
if (priv->selection != NULL) {
g_object_weak_unref (
G_OBJECT (priv->selection), (GWeakNotify)
@@ -364,17 +329,6 @@ folder_tree_model_class_init (EMFolderTreeModelClass *class)
g_object_class_install_property (
object_class,
- PROP_SHELL_BACKEND,
- g_param_spec_object (
- "shell-backend",
- _("Shell Backend"),
- NULL,
- E_TYPE_SHELL_BACKEND,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (
- object_class,
PROP_SELECTION,
g_param_spec_object (
"selection",
@@ -500,22 +454,20 @@ em_folder_tree_model_get_type (void)
}
EMFolderTreeModel *
-em_folder_tree_model_new (EMailShellBackend *mail_shell_backend)
+em_folder_tree_model_new (void)
{
- g_return_val_if_fail (
- E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
-
- return g_object_new (
- EM_TYPE_FOLDER_TREE_MODEL,
- "shell-backend", mail_shell_backend, NULL);
+ return g_object_new (EM_TYPE_FOLDER_TREE_MODEL, NULL);
}
-EMailShellBackend *
-em_folder_tree_model_get_mail_shell_backend (EMFolderTreeModel *model)
+EMFolderTreeModel *
+em_folder_tree_model_get_default (void)
{
- g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
+ static EMFolderTreeModel *default_folder_tree_model;
+
+ if (G_UNLIKELY (default_folder_tree_model == NULL))
+ default_folder_tree_model = em_folder_tree_model_new ();
- return model->priv->shell_backend;
+ return default_folder_tree_model;
}
GtkTreeSelection *
@@ -559,8 +511,6 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
CamelFolderInfo *fi,
gint fully_loaded)
{
- EShellBackend *shell_backend;
- EMailShellBackend *mail_shell_backend;
GtkTreeRowReference *uri_row, *path_row;
GtkTreeStore *tree_store;
guint unread;
@@ -581,8 +531,6 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
return;
tree_store = GTK_TREE_STORE (model);
- shell_backend = model->priv->shell_backend;
- mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
if (!fully_loaded)
load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -605,10 +553,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
CamelFolder *local_drafts;
CamelFolder *local_outbox;
- local_drafts = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
- local_outbox = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
if (folder == local_outbox) {
gint total;
@@ -641,7 +587,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
/* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */
flags = fi->flags;
name = fi->name;
- if (si->store == e_mail_shell_backend_get_local_store (mail_shell_backend)) {
+ if (si->store == e_mail_local_get_store ()) {
if (!strcmp(fi->full_name, "Drafts")) {
name = _("Drafts");
is_drafts = TRUE;
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index 899a6ee1d8..d75e57c0b4 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -26,7 +26,6 @@
#include <gtk/gtk.h>
#include <camel/camel-store.h>
#include <libedataserver/e-account-list.h>
-#include <mail/e-mail-shell-backend.h>
/* Standard GObject macros */
#define EM_TYPE_FOLDER_TREE_MODEL \
@@ -111,10 +110,9 @@ struct _EMFolderTreeModelClass {
GType em_folder_tree_model_get_type (void);
EMFolderTreeModel *
- em_folder_tree_model_new(EMailShellBackend *mail_shell_backend);
-EMailShellBackend *
- em_folder_tree_model_get_mail_shell_backend
- (EMFolderTreeModel *model);
+ em_folder_tree_model_new (void);
+EMFolderTreeModel *
+ em_folder_tree_model_get_default(void);
GtkTreeSelection *
em_folder_tree_model_get_selection
(EMFolderTreeModel *model);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index d5291e0c01..d10b88d645 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -73,7 +73,7 @@
#include "em-folder-properties.h"
#include "em-event.h"
-#include "e-mail-shell-backend.h"
+#include "e-mail-local.h"
#define d(x)
@@ -89,8 +89,6 @@ struct _selected_uri {
};
struct _EMFolderTreePrivate {
- EMFolderTreeModel *model;
-
GSList *select_uris; /* selected_uri structures of each path pending selection. */
GHashTable *select_uris_table; /*Removed as they're encountered, so use this to find uri's not presnet but selected */
@@ -200,12 +198,11 @@ emft_get_folder_info__exec (struct _EMFolderTreeGetFolderInfo *m)
static void
emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
{
- EMFolderTreePrivate *priv = m->emft->priv;
struct _EMFolderTreeModelStoreInfo *si;
GtkTreeIter root, iter, titer;
CamelFolderInfo *fi;
GtkTreeView *tree_view;
- GtkTreeStore *model;
+ GtkTreeModel *model;
GtkTreePath *path;
gboolean is_store;
@@ -216,21 +213,24 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
if (!gtk_tree_row_reference_valid (m->root))
return;
- si = em_folder_tree_model_lookup_store_info (priv->model, m->store);
+ tree_view = GTK_TREE_VIEW (m->emft);
+ model = gtk_tree_view_get_model (tree_view);
+
+ si = em_folder_tree_model_lookup_store_info (
+ EM_FOLDER_TREE_MODEL (model), m->store);
if (si == NULL) {
/* store has been removed in the interim - do nothing */
return;
}
- tree_view = GTK_TREE_VIEW (m->emft);
- model = (GtkTreeStore *) gtk_tree_view_get_model (tree_view);
-
path = gtk_tree_row_reference_get_path (m->root);
- gtk_tree_model_get_iter ((GtkTreeModel *) model, &root, path);
+ gtk_tree_model_get_iter (model, &root, path);
/* if we had an error, then we need to re-set the load subdirs state and collapse the node */
if (!m->fi && camel_exception_is_set(&m->base.ex)) {
- gtk_tree_store_set(model, &root, COL_BOOL_LOAD_SUBDIRS, TRUE, -1);
+ gtk_tree_store_set(
+ GTK_TREE_STORE (model), &root,
+ COL_BOOL_LOAD_SUBDIRS, TRUE, -1);
gtk_tree_view_collapse_row (tree_view, path);
gtk_tree_path_free (path);
return;
@@ -239,16 +239,14 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
gtk_tree_path_free (path);
/* make sure we still need to load the tree subfolders... */
- gtk_tree_model_get ((GtkTreeModel *) model, &root,
- COL_BOOL_IS_STORE, &is_store,
- -1);
+ gtk_tree_model_get (model, &root, COL_BOOL_IS_STORE, &is_store, -1);
/* get the first child (which will be a dummy node) */
- gtk_tree_model_iter_children ((GtkTreeModel *) model, &iter, &root);
+ gtk_tree_model_iter_children (model, &iter, &root);
/* Traverse to the last valid iter */
titer = iter;
- while (gtk_tree_model_iter_next((GtkTreeModel *) model, &iter))
+ while (gtk_tree_model_iter_next (model, &iter))
titer = iter; /* Preserve the last valid iter */
iter = titer;
@@ -264,10 +262,10 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
if (fi == NULL) {
/* no children afterall... remove the "Loading..." placeholder node */
- gtk_tree_store_remove (model, &iter);
+ gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
if (is_store) {
- path = gtk_tree_model_get_path ((GtkTreeModel *) model, &root);
+ path = gtk_tree_model_get_path (model, &root);
gtk_tree_view_collapse_row (tree_view, path);
gtk_tree_path_free (path);
return;
@@ -279,14 +277,18 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
gboolean known = g_hash_table_lookup (si->full_hash, fi->full_name) != NULL;
if (!known)
- em_folder_tree_model_set_folder_info (priv->model, &iter, si, fi, fully_loaded);
+ em_folder_tree_model_set_folder_info (
+ EM_FOLDER_TREE_MODEL (model),
+ &iter, si, fi, fully_loaded);
if ((fi = fi->next) != NULL && !known)
- gtk_tree_store_append (model, &iter, &root);
+ gtk_tree_store_append (GTK_TREE_STORE (model), &iter, &root);
} while (fi != NULL);
}
- gtk_tree_store_set (model, &root, COL_BOOL_LOAD_SUBDIRS, FALSE, -1);
+ gtk_tree_store_set (
+ GTK_TREE_STORE (model), &root,
+ COL_BOOL_LOAD_SUBDIRS, FALSE, -1);
}
static void
@@ -447,11 +449,14 @@ static void
em_folder_tree_destroy (GtkObject *object)
{
EMFolderTreePrivate *priv;
+ GtkTreeModel *model;
priv = EM_FOLDER_TREE_GET_PRIVATE (object);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (object));
+
if (priv->loaded_row_id != 0) {
- g_signal_handler_disconnect (priv->model, priv->loaded_row_id);
+ g_signal_handler_disconnect (model, priv->loaded_row_id);
priv->loaded_row_id = 0;
}
@@ -468,8 +473,6 @@ em_folder_tree_destroy (GtkObject *object)
priv->autoexpand_id = 0;
}
- priv->model = NULL;
-
/* Chain up to parent's destroy() method. */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@ -720,12 +723,16 @@ folder_tree_init (EMFolderTree *emft)
{
GtkTreeSelection *selection;
GHashTable *select_uris_table;
+ EMFolderTreeModel *model;
select_uris_table = g_hash_table_new (g_str_hash, g_str_equal);
emft->priv = EM_FOLDER_TREE_GET_PRIVATE (emft);
emft->priv->select_uris_table = select_uris_table;
+ model = em_folder_tree_model_get_default ();
+ gtk_tree_view_set_model (GTK_TREE_VIEW (emft), GTK_TREE_MODEL (model));
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (emft));
g_signal_connect_swapped (
@@ -878,7 +885,7 @@ render_icon (GtkTreeViewColumn *column,
}
static GtkTreeView *
-folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model)
+folder_tree_new (EMFolderTree *emft)
{
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
@@ -892,8 +899,6 @@ folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model)
/* FIXME[KILL-BONOBO] Gross hack */
tree = GTK_WIDGET (emft);
- gtk_tree_view_set_model (
- GTK_TREE_VIEW (tree), GTK_TREE_MODEL (model));
GTK_WIDGET_SET_FLAGS(tree, GTK_CAN_FOCUS);
column = gtk_tree_view_column_new ();
@@ -950,18 +955,20 @@ folder_tree_copy_selection_cb (GtkTreeModel *model,
}
static void
-folder_tree_copy_state (EMFolderTree *emft,
- EMFolderTreeModel *model)
+folder_tree_copy_state (EMFolderTree *emft)
{
GtkTreeSelection *selection;
GtkTreeView *tree_view;
+ GtkTreeModel *model;
+
+ tree_view = GTK_TREE_VIEW (emft);
+ model = gtk_tree_view_get_model (tree_view);
- selection = em_folder_tree_model_get_selection (model);
+ selection = em_folder_tree_model_get_selection (
+ EM_FOLDER_TREE_MODEL (model));
if (selection == NULL)
return;
- tree_view = gtk_tree_selection_get_tree_view (selection);
-
gtk_tree_view_map_expanded_rows (
tree_view, (GtkTreeViewMappingFunc)
folder_tree_copy_expanded_cb, emft);
@@ -972,13 +979,10 @@ folder_tree_copy_state (EMFolderTree *emft,
}
static void
-em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model)
+em_folder_tree_construct (EMFolderTree *emft)
{
- EMFolderTreePrivate *priv = emft->priv;
-
- priv->model = model;
- folder_tree_new (emft, model);
- folder_tree_copy_state (emft, model);
+ folder_tree_new (emft);
+ folder_tree_copy_state (emft);
gtk_widget_show (GTK_WIDGET (emft));
}
@@ -1004,13 +1008,12 @@ emft_select_uri(EMFolderTree *emft, GtkTreePath *path, struct _selected_uri *u)
}
static void
-emft_expand_node (EMFolderTreeModel *model, const gchar *key, EMFolderTree *emft)
+emft_expand_node (const gchar *key, EMFolderTree *emft)
{
- EMFolderTreePrivate *priv = emft->priv;
struct _EMFolderTreeModelStoreInfo *si;
- EMailShellBackend *mail_shell_backend;
GtkTreeRowReference *row;
GtkTreeView *tree_view;
+ GtkTreeModel *model;
GtkTreePath *path;
EAccount *account;
CamelStore *store;
@@ -1029,7 +1032,7 @@ emft_expand_node (EMFolderTreeModel *model, const gchar *key, EMFolderTree *emft
uid[n] = '\0';
tree_view = GTK_TREE_VIEW (emft);
- mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (model);
+ model = gtk_tree_view_get_model (tree_view);
if ((account = e_get_account_by_uid (uid)) && account->enabled) {
CamelException ex;
@@ -1046,7 +1049,7 @@ emft_expand_node (EMFolderTreeModel *model, const gchar *key, EMFolderTree *emft
camel_object_ref (store);
} else if (!strcmp (uid, "local")) {
- if (!(store = e_mail_shell_backend_get_local_store (mail_shell_backend)))
+ if (!(store = e_mail_local_get_store ()))
return;
camel_object_ref (store);
@@ -1054,7 +1057,8 @@ emft_expand_node (EMFolderTreeModel *model, const gchar *key, EMFolderTree *emft
return;
}
- si = em_folder_tree_model_lookup_store_info (priv->model, store);
+ si = em_folder_tree_model_lookup_store_info (
+ EM_FOLDER_TREE_MODEL (model), store);
if (si == NULL) {
camel_object_unref (store);
return;
@@ -1115,7 +1119,7 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
gchar *c = strrchr (key, '/');
*c = '\0';
- emft_expand_node (model, key, emft);
+ emft_expand_node (key, emft);
emft_select_uri(emft, tree_path, u);
}
@@ -1125,17 +1129,23 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
}
GtkWidget *
-em_folder_tree_new_with_model (EMFolderTreeModel *model)
+em_folder_tree_new (void)
{
EMFolderTree *emft;
+ GtkTreeModel *model;
AtkObject *a11y;
emft = g_object_new (EM_TYPE_FOLDER_TREE, NULL);
- em_folder_tree_construct (emft, model);
- g_object_ref (model);
+ em_folder_tree_construct (emft);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emft));
- emft->priv->loading_row_id = g_signal_connect (model, "loading-row", G_CALLBACK (emft_maybe_expand_row), emft);
- emft->priv->loaded_row_id = g_signal_connect (model, "loaded-row", G_CALLBACK (emft_maybe_expand_row), emft);
+ emft->priv->loading_row_id = g_signal_connect (
+ model, "loading-row",
+ G_CALLBACK (emft_maybe_expand_row), emft);
+ emft->priv->loaded_row_id = g_signal_connect (
+ model, "loaded-row",
+ G_CALLBACK (emft_maybe_expand_row), emft);
a11y = gtk_widget_get_accessible (GTK_WIDGET (emft));
atk_object_set_name (a11y, _("Mail Folder Tree"));
@@ -1168,6 +1178,7 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree *
{
EMFolderTreePrivate *priv = emft->priv;
gchar *full_name = NULL;
+ GtkTreeModel *model;
GtkTreePath *src_path;
gboolean is_store;
CamelStore *store;
@@ -1177,13 +1188,16 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree *
if (!priv->drag_row || (src_path = gtk_tree_row_reference_get_path (priv->drag_row)))
return;
- if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, src_path))
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emft));
+
+ if (!gtk_tree_model_get_iter (model, &iter, src_path))
goto fail;
- gtk_tree_model_get((GtkTreeModel *)priv->model, &iter,
- COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_FULL_NAME, &full_name,
- COL_BOOL_IS_STORE, &is_store, -1);
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_STRING_FULL_NAME, &full_name,
+ COL_BOOL_IS_STORE, &is_store, -1);
if (is_store)
goto fail;
@@ -1202,6 +1216,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
{
EMFolderTreePrivate *priv = emft->priv;
gchar *full_name = NULL, *uri = NULL;
+ GtkTreeModel *model;
GtkTreePath *src_path;
CamelFolder *folder;
CamelStore *store;
@@ -1211,13 +1226,16 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
if (!priv->drag_row || !(src_path = gtk_tree_row_reference_get_path(priv->drag_row)))
return;
- if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, src_path))
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emft));
+
+ if (!gtk_tree_model_get_iter (model, &iter, src_path))
goto fail;
- gtk_tree_model_get((GtkTreeModel *)priv->model, &iter,
- COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_FULL_NAME, &full_name,
- COL_STRING_URI, &uri, -1);
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_STRING_FULL_NAME, &full_name,
+ COL_STRING_URI, &uri, -1);
/* make sure user isn't trying to drag on a placeholder row */
if (full_name == NULL)
@@ -1417,8 +1435,8 @@ emft_drop_popup_free(EPopup *ep, GSList *items, gpointer data)
static void
tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection, guint info, guint time, EMFolderTree *emft)
{
- EMFolderTreePrivate *priv = emft->priv;
GtkTreeViewDropPosition pos;
+ GtkTreeModel *model;
GtkTreeView *tree_view;
GtkTreePath *dest_path;
struct _DragDataReceivedAsync *m;
@@ -1429,6 +1447,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
gint i;
tree_view = GTK_TREE_VIEW (emft);
+ model = gtk_tree_view_get_model (tree_view);
if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &dest_path, &pos))
return;
@@ -1439,15 +1458,16 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
return;
}
- if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, dest_path)) {
+ if (!gtk_tree_model_get_iter (model, &iter, dest_path)) {
gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME);
return;
}
- gtk_tree_model_get((GtkTreeModel *)priv->model, &iter,
- COL_POINTER_CAMEL_STORE, &store,
- COL_BOOL_IS_STORE, &is_store,
- COL_STRING_FULL_NAME, &full_name, -1);
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_BOOL_IS_STORE, &is_store,
+ COL_STRING_FULL_NAME, &full_name, -1);
/* make sure user isn't try to drop on a placeholder row */
if (full_name == NULL && !is_store) {
@@ -1508,26 +1528,29 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path)
EMFolderTreePrivate *p = emft->priv;
gchar *full_name = NULL, *uri = NULL, *src_uri = NULL;
CamelStore *local, *sstore, *dstore;
- EMailShellBackend *mail_shell_backend;
GdkAtom atom = GDK_NONE;
gboolean is_store;
+ GtkTreeModel *model;
GtkTreeIter iter;
GList *targets;
guint32 flags = 0;
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emft));
+
/* This is a bit of a mess, but should handle all the cases properly */
- if (!gtk_tree_model_get_iter((GtkTreeModel *)p->model, &iter, path))
+ if (!gtk_tree_model_get_iter (model, &iter, path))
return GDK_NONE;
- gtk_tree_model_get((GtkTreeModel *)p->model, &iter, COL_BOOL_IS_STORE, &is_store,
- COL_STRING_FULL_NAME, &full_name,
- COL_UINT_FLAGS, &flags,
- COL_POINTER_CAMEL_STORE, &dstore,
- COL_STRING_URI, &uri, -1);
+ gtk_tree_model_get (
+ model, &iter,
+ COL_BOOL_IS_STORE, &is_store,
+ COL_STRING_FULL_NAME, &full_name,
+ COL_UINT_FLAGS, &flags,
+ COL_POINTER_CAMEL_STORE, &dstore,
+ COL_STRING_URI, &uri, -1);
- mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (p->model);
- local = e_mail_shell_backend_get_local_store (mail_shell_backend);
+ local = e_mail_local_get_store ();
targets = context->targets;
@@ -1569,10 +1592,11 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path)
GtkTreePath *src_path = gtk_tree_row_reference_get_path(p->drag_row);
if (src_path) {
- if (gtk_tree_model_get_iter((GtkTreeModel *)p->model, &iter, src_path))
- gtk_tree_model_get((GtkTreeModel *)p->model, &iter,
- COL_POINTER_CAMEL_STORE, &sstore,
- COL_STRING_URI, &src_uri, -1);
+ if (gtk_tree_model_get_iter (model, &iter, src_path))
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &sstore,
+ COL_STRING_URI, &src_uri, -1);
/* can't dnd onto itself or below itself - bad things happen,
no point dragging to where we were either */
@@ -1831,9 +1855,9 @@ static gboolean
tree_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, EMFolderTree *emft)
{
EMFolderTreePrivate *priv = emft->priv;
- GtkTreeModel *model = (GtkTreeModel *) priv->model;
GtkTreeViewDropPosition pos;
GtkTreeView *tree_view;
+ GtkTreeModel *model;
GdkDragAction action = 0;
GtkTreePath *path;
GtkTreeIter iter;
@@ -1841,6 +1865,7 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, gu
gint i;
tree_view = GTK_TREE_VIEW (emft);
+ model = gtk_tree_view_get_model (tree_view);
if (!gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &path, &pos))
return FALSE;
@@ -2076,7 +2101,7 @@ em_folder_tree_set_selected_list (EMFolderTree *emft, GList *list, gboolean expa
end = strrchr(expand_key, '/');
do {
- emft_expand_node(priv->model, expand_key, emft);
+ emft_expand_node(expand_key, emft);
*end = 0;
end = strrchr(expand_key, '/');
} while (end);
@@ -2392,14 +2417,6 @@ em_folder_tree_get_selected_folder_info (EMFolderTree *emft)
return fi;
}
-EMFolderTreeModel *
-em_folder_tree_get_model (EMFolderTree *emft)
-{
- g_return_val_if_fail (EM_IS_FOLDER_TREE (emft), NULL);
-
- return emft->priv->model;
-}
-
void
em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip)
{
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index 41e02a58aa..b92c0a2f4c 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -82,8 +82,8 @@ struct _EMFolderTreeClass {
void (*popup_event) (EMFolderTree *emft);
};
-GType em_folder_tree_get_type (void);
-GtkWidget *em_folder_tree_new_with_model (EMFolderTreeModel *model);
+GType em_folder_tree_get_type (void);
+GtkWidget * em_folder_tree_new (void);
void em_folder_tree_enable_drag_and_drop (EMFolderTree *emft);
@@ -102,8 +102,6 @@ gchar *em_folder_tree_get_selected_path (EMFolderTree *emft);
CamelFolder *em_folder_tree_get_selected_folder (EMFolderTree *emft);
CamelFolderInfo *em_folder_tree_get_selected_folder_info (EMFolderTree *emft);
-EMFolderTreeModel *em_folder_tree_get_model (EMFolderTree *emft);
-
gboolean em_folder_tree_create_folder (EMFolderTree *emft, const gchar *full_name, const gchar *uri);
void em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip);
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index bdf67ecfa0..8890e48cbd 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -69,7 +69,8 @@
#include "em-folder-selection.h"
#include "em-folder-properties.h"
-#include "e-mail-shell-backend.h"
+#include "e-mail-local.h"
+#include "e-mail-store.h"
#define d(x)
@@ -281,7 +282,7 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
camel_exception_init (&ex);
- local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
+ local_store = e_mail_local_get_store ();
if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
e_error_run(NULL,
@@ -355,13 +356,11 @@ emfu_copy_folder_exclude(EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *i
/* FIXME: this interface references the folderinfo without copying it */
/* FIXME: these functions must be documented */
void
-em_folder_utils_copy_folder (EMFolderTreeModel *model,
- CamelFolderInfo *folderinfo,
+em_folder_utils_copy_folder (CamelFolderInfo *folderinfo,
gint delete)
{
struct _copy_folder_data *cfd;
- g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
g_return_if_fail (folderinfo != NULL);
cfd = g_malloc (sizeof (*cfd));
@@ -369,7 +368,7 @@ em_folder_utils_copy_folder (EMFolderTreeModel *model,
cfd->delete = delete;
em_select_folder (
- model, _("Select folder"),
+ _("Select folder"),
delete ? _("_Move") : _("C_opy"),
NULL, emfu_copy_folder_exclude,
emfu_copy_folder_selected, cfd);
@@ -412,7 +411,7 @@ em_folder_utils_delete_folder (CamelFolder *folder)
GtkWidget *dialog;
gint flags = 0;
- local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
+ local_store = e_mail_local_get_store ();
if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) {
dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL);
@@ -447,7 +446,7 @@ em_folder_utils_rename_folder (CamelFolder *folder)
gboolean done = FALSE;
gsize base_len;
- local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
+ local_store = e_mail_local_get_store ();
/* don't allow user to rename one of the special local folders */
if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) {
@@ -639,7 +638,7 @@ static void
emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer data)
{
EMFolderTreeModelStoreInfo *si;
- EMFolderTreeModel *model;
+ GtkTreeModel *model;
const gchar *uri, *path;
CamelException ex;
CamelStore *store;
@@ -663,8 +662,9 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
return;
}
- model = em_folder_tree_get_model (emfs->emft);
- si = em_folder_tree_model_lookup_store_info (model, store);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (emfs->emft));
+ si = em_folder_tree_model_lookup_store_info (
+ EM_FOLDER_TREE_MODEL (model), store);
if (si == NULL) {
camel_object_unref (store);
g_return_if_reached();
@@ -701,11 +701,9 @@ void
em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, GtkWindow *parent)
{
EMFolderTree *folder_tree;
- EMFolderTreeModel *model;
GtkWidget *dialog;
- model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
- folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model);
+ folder_tree = (EMFolderTree *) em_folder_tree_new ();
dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:"));
if (folderinfo != NULL)
diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h
index 5d1333e9d0..86d58ef9f3 100644
--- a/mail/em-folder-utils.h
+++ b/mail/em-folder-utils.h
@@ -40,8 +40,7 @@ gint em_folder_utils_copy_folders (CamelStore *fromstore,
/* FIXME These API's are really busted. There is no consistency and
* most rely on the wrong data. */
-void em_folder_utils_copy_folder (EMFolderTreeModel *model,
- CamelFolderInfo *folderinfo,
+void em_folder_utils_copy_folder (CamelFolderInfo *folderinfo,
gboolean delete);
void em_folder_utils_delete_folder (CamelFolder *folder);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 1c3c6be40e..dffa11b132 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -72,13 +72,14 @@
#include "e-util/e-dialog-utils.h"
#include "e-util/e-error.h"
#include "widgets/misc/e-alert-activity.h"
+#include "widgets/misc/e-attachment.h"
#include "em-utils.h"
#include "em-composer-utils.h"
#include "em-format-quote.h"
#include "em-account-editor.h"
-#include "e-attachment.h"
+#include "e-mail-local.h"
#include "e-mail-shell-backend.h"
static void emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data);
@@ -1382,8 +1383,8 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
gint is = FALSE;
gchar *templates_uri;
- local_templates_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_TEMPLATES);
+ local_templates_folder =
+ e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES);
if (folder == local_templates_folder)
return TRUE;
@@ -1433,8 +1434,8 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri)
gint is = FALSE;
gchar *drafts_uri;
- local_drafts_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_drafts_folder =
+ e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS);
if (folder == local_drafts_folder)
return TRUE;
@@ -1484,8 +1485,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri)
gint is = FALSE;
gchar *sent_uri;
- local_sent_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ local_sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
if (folder == local_sent_folder)
return TRUE;
@@ -1530,8 +1530,8 @@ em_utils_folder_is_outbox(CamelFolder *folder, const gchar *uri)
{
CamelFolder *local_outbox_folder;
- local_outbox_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_outbox_folder =
+ e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
/* <Highlander>There can be only one.</Highlander> */
return folder == local_outbox_folder;
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index 183a4a80aa..2dfac64eb1 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -34,14 +34,13 @@
#include "camel/camel-url.h"
#include "em-vfolder-context.h"
#include "em-vfolder-rule.h"
+#include "mail/e-mail-store.h"
#include "mail/em-utils.h"
#include "mail/em-folder-tree.h"
#include "mail/em-folder-selector.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
-#include "e-mail-shell-backend.h"
-
#define d(x)
static gint validate(FilterRule *);
@@ -506,12 +505,10 @@ static void
source_add(GtkWidget *widget, struct _source_data *data)
{
EMFolderTree *emft;
- EMFolderTreeModel *model;
GtkWidget *dialog;
- model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
- emft =(EMFolderTree *)em_folder_tree_new_with_model (model);
- em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT);
+ emft =(EMFolderTree *) em_folder_tree_new ();
+ em_folder_tree_set_excluded (emft, EMFT_EXCLUDE_NOSELECT);
dialog = em_folder_selector_new(emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("_Add"));
gtk_window_set_transient_for((GtkWindow *)dialog, (GtkWindow *)gtk_widget_get_toplevel(widget));
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index 882ce64b25..e44cf57fef 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -40,8 +40,11 @@
#include <camel/camel-exception.h>
+#include "mail/e-mail-local.h"
+#include "mail/e-mail-store.h"
#include "mail/e-mail-shell-backend.h"
#include "mail/em-folder-selection-button.h"
+#include "mail/em-folder-tree-model.h"
#include "mail/mail-mt.h"
#include "mail-importer.h"
@@ -72,21 +75,18 @@ static GtkWidget *
mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
{
GtkWidget *hbox, *w;
- EMFolderTreeModel *model;
- const gchar *local_inbox_folder_uri;
+ const gchar *local_inbox_uri;
- local_inbox_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_INBOX);
- model = e_mail_shell_backend_get_folder_tree_model (
- global_mail_shell_backend);
+ local_inbox_uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_INBOX);
hbox = gtk_hbox_new(FALSE, 0);
w = gtk_label_new(_("Destination folder:"));
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6);
- w = em_folder_selection_button_new(model, _("Select folder"), _("Select folder to import into"));
- em_folder_selection_button_set_selection((EMFolderSelectionButton *)w, local_inbox_folder_uri);
+ w = em_folder_selection_button_new(
+ _("Select folder"), _("Select folder to import into"));
+ em_folder_selection_button_set_selection((EMFolderSelectionButton *)w, local_inbox_uri);
g_signal_connect(w, "selected", G_CALLBACK(folder_selected), target);
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6);
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index a9e6b59038..1e1f423316 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -48,6 +48,8 @@
#include "mail/mail-mt.h"
#include "mail/mail-tools.h"
+
+#include "mail/e-mail-local.h"
#include "mail/e-mail-shell-backend.h"
#include "mail-importer.h"
@@ -202,8 +204,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
}
if (m->uri == NULL || m->uri[0] == 0)
- folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_INBOX);
+ folder = e_mail_local_get_folder (E_MAIL_FOLDER_INBOX);
else
folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 916db9c59f..09763920eb 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -64,6 +64,7 @@
#include "mail-mt.h"
#include "mail-tools.h"
+#include "e-mail-local.h"
#include "e-mail-shell-backend.h"
typedef struct {
@@ -857,10 +858,10 @@ mail_config_uri_deleted (GCompareFunc uri_cmp, const gchar *uri)
const gchar *local_sent_folder_uri;
/* assumes these can't be removed ... */
- local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
- local_sent_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ local_drafts_folder_uri =
+ e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS);
+ local_sent_folder_uri =
+ e_mail_local_get_folder_uri (E_MAIL_FOLDER_SENT);
account_list = e_get_account_list ();
iter = e_list_get_iterator ((EList *) account_list);
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 9125e94a14..faa80b2629 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -65,6 +65,9 @@
#include "em-event.h"
+#include "e-mail-local.h"
+#include "e-mail-store.h"
+
#define w(x)
#define d(x)
@@ -109,8 +112,6 @@ struct _folder_update {
};
struct _store_info {
- EMailShellBackend *mail_shell_backend;
-
GHashTable *folders; /* by full_name */
GHashTable *folders_uri; /* by uri */
@@ -151,14 +152,14 @@ free_update(struct _folder_update *up)
}
static void
-real_flush_updates (EMailShellBackend *mail_shell_backend)
+real_flush_updates (void)
{
EShell *shell;
- struct _EMFolderTreeModel *model;
+ EMFolderTreeModel *default_model;
struct _folder_update *up;
- shell = e_shell_backend_get_shell (E_SHELL_BACKEND (mail_shell_backend));
- model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend);
+ shell = e_shell_get_default ();
+ default_model = em_folder_tree_model_get_default ();
LOCK(info_lock);
while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) {
@@ -187,14 +188,17 @@ real_flush_updates (EMailShellBackend *mail_shell_backend)
}
/* update unread counts */
- em_folder_tree_model_set_unread_count (model, up->store, up->full_name, up->unread);
+ em_folder_tree_model_set_unread_count (
+ default_model, up->store, up->full_name, up->unread);
if (up->uri) {
EMEvent *e = em_event_peek();
EMEventTargetFolder *t = em_event_target_new_folder(e, up->uri, up->new);
- t->is_inbox = em_folder_tree_model_is_type_inbox (model, up->store, up->full_name);
- t->name = em_folder_tree_model_get_folder_name (model, up->store, up->full_name);
+ t->is_inbox = em_folder_tree_model_is_type_inbox (
+ default_model, up->store, up->full_name);
+ t->name = em_folder_tree_model_get_folder_name (
+ default_model, up->store, up->full_name);
if (t->new > 0)
e_shell_event (
@@ -233,13 +237,13 @@ real_flush_updates (EMailShellBackend *mail_shell_backend)
}
static void
-flush_updates (EMailShellBackend *shell_backend)
+flush_updates (void)
{
if (update_id == -1 && !e_dlist_empty(&updates))
update_id = mail_async_event_emit (
mail_async_event, MAIL_ASYNC_GUI,
(MailAsyncFunc) real_flush_updates,
- shell_backend, NULL, NULL);
+ NULL, NULL, NULL);
}
static void
@@ -252,7 +256,7 @@ unset_folder_info(struct _folder_info *mfi, gint delete, gint unsub)
if (mfi->folder) {
CamelFolder *folder = mfi->folder;
- camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi->store_info->mail_shell_backend);
+ camel_object_unhook_event(folder, "folder_changed", folder_changed, NULL);
camel_object_unhook_event(folder, "renamed", folder_renamed, NULL);
camel_object_unhook_event(folder, "finalize", folder_finalised, NULL);
}
@@ -269,7 +273,7 @@ unset_folder_info(struct _folder_info *mfi, gint delete, gint unsub)
up->uri = g_strdup(mfi->uri);
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates(mfi->store_info->mail_shell_backend);
+ flush_updates();
}
}
@@ -307,7 +311,6 @@ static void
update_1folder(struct _folder_info *mfi, gint new, CamelFolderInfo *info)
{
struct _folder_update *up;
- EMailShellBackend *mail_shell_backend;
CamelFolder *folder;
CamelFolder *local_drafts;
CamelFolder *local_outbox;
@@ -315,13 +318,9 @@ update_1folder(struct _folder_info *mfi, gint new, CamelFolderInfo *info)
gint unread = -1;
gint deleted;
- mail_shell_backend = mfi->store_info->mail_shell_backend;
- local_drafts = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
- local_outbox = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- local_sent = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_SENT);
+ local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ local_sent = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
folder = mfi->folder;
if (folder) {
@@ -366,7 +365,7 @@ update_1folder(struct _folder_info *mfi, gint new, CamelFolderInfo *info)
up->uri = g_strdup(mfi->uri);
camel_object_ref(up->store);
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates(mail_shell_backend);
+ flush_updates();
}
static void
@@ -400,7 +399,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si)
up->add = TRUE;
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates(si->mail_shell_backend);
+ flush_updates();
}
}
@@ -423,7 +422,6 @@ static void
folder_changed (CamelObject *o, gpointer event_data, gpointer user_data)
{
static time_t last_newmail = 0;
- EMailShellBackend *mail_shell_backend = user_data;
CamelFolderChangeInfo *changes = event_data;
CamelFolder *folder = (CamelFolder *)o;
CamelFolder *local_drafts;
@@ -439,12 +437,9 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data)
d(printf("folder '%s' changed\n", folder->full_name));
- local_drafts = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
- local_outbox = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- local_sent = e_mail_shell_backend_get_folder (
- mail_shell_backend, E_MAIL_FOLDER_SENT);
+ local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ local_sent = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
if (!CAMEL_IS_VEE_FOLDER(folder)
&& folder != local_drafts
@@ -541,7 +536,7 @@ void mail_note_folder(CamelFolder *folder)
UNLOCK(info_lock);
- camel_object_hook_event(folder, "folder_changed", folder_changed, si->mail_shell_backend);
+ camel_object_hook_event(folder, "folder_changed", folder_changed, NULL);
camel_object_hook_event(folder, "renamed", folder_renamed, NULL);
camel_object_hook_event(folder, "finalize", folder_finalised, NULL);
}
@@ -685,7 +680,7 @@ rename_folders(struct _store_info *si, const gchar *oldbase, const gchar *newbas
up->add = TRUE;
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates(si->mail_shell_backend);
+ flush_updates();
#if 0
if (fi->sibling)
rename_folders(si, oldbase, newbase, fi->sibling, folders);
@@ -694,7 +689,7 @@ rename_folders(struct _store_info *si, const gchar *oldbase, const gchar *newbas
#endif
/* rename the meta-data we maintain ourselves */
- shell_backend = E_SHELL_BACKEND (si->mail_shell_backend);
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
config_dir = e_shell_backend_get_config_dir (shell_backend);
olduri = folder_to_url(si->store, old);
e_filename_make_safe(olduri);
@@ -810,8 +805,6 @@ mail_note_store_remove(CamelStore *store)
if (si) {
g_hash_table_remove(stores, store);
- g_object_unref(si->mail_shell_backend);
-
camel_object_unhook_event(store, "folder_opened", store_folder_opened, NULL);
camel_object_unhook_event(store, "folder_created", store_folder_created, NULL);
camel_object_unhook_event(store, "folder_deleted", store_folder_deleted, NULL);
@@ -964,7 +957,7 @@ store_online_cb (CamelStore *store, gpointer data)
}
void
-mail_note_store(EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op,
+mail_note_store(CamelStore *store, CamelOperation *op,
gboolean (*done)(CamelStore *store, CamelFolderInfo *info, gpointer data), gpointer data)
{
struct _store_info *si;
@@ -973,7 +966,6 @@ mail_note_store(EMailShellBackend *mail_shell_backend, CamelStore *store, CamelO
guint timeout;
gint hook = 0;
- g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
g_return_if_fail (CAMEL_IS_STORE(store));
g_return_if_fail (mail_in_main_thread());
@@ -993,7 +985,6 @@ mail_note_store(EMailShellBackend *mail_shell_backend, CamelStore *store, CamelO
d(printf("Noting a new store: %p: %s\n", store, camel_url_to_string(((CamelService *)store)->url, 0)));
si = g_malloc0(sizeof(*si));
- si->mail_shell_backend = g_object_ref (mail_shell_backend);
si->folders = g_hash_table_new(g_str_hash, g_str_equal);
si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name,
CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name);
diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h
index 32d5016f53..41f36ac0cf 100644
--- a/mail/mail-folder-cache.h
+++ b/mail/mail-folder-cache.h
@@ -28,14 +28,12 @@
#include <camel/camel-store.h>
-#include "e-mail-shell-backend.h"
-
/* Add a store whose folders should appear in the shell
The folders are scanned from the store, and/or added at
runtime via the folder_created event.
The 'done' function returns if we can free folder info. */
void
-mail_note_store (EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op,
+mail_note_store (CamelStore *store, CamelOperation *op,
gboolean (*done) (CamelStore *store, CamelFolderInfo *info, gpointer data),
gpointer data);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 230cd6c508..a88a55e6c2 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -69,6 +69,7 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-local.h"
#include "e-mail-shell-backend.h"
#define w(x)
@@ -280,8 +281,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
if (m->cancel)
camel_operation_register (m->cancel);
- fm->destination = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX);
+ fm->destination = e_mail_local_get_folder (E_MAIL_FOLDER_LOCAL_INBOX);
if (fm->destination == NULL)
goto fail;
camel_object_ref (fm->destination);
@@ -586,8 +586,7 @@ mail_send_message(CamelFolder *queue, const gchar *uid, const gchar *destination
}
if (!folder) {
- folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
camel_object_ref(folder);
}
@@ -600,8 +599,7 @@ mail_send_message(CamelFolder *queue, const gchar *uid, const gchar *destination
if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
goto exit;
- sent_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
if (folder != sent_folder) {
const gchar *name;
@@ -703,8 +701,7 @@ send_queue_exec (struct _send_queue_msg *m)
d(printf("sending queue\n"));
- sent_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
if (!(uids = camel_folder_get_uids (m->queue)))
return;
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 03775c74d1..2f9cd77de6 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -50,6 +50,7 @@
#include "e-util/e-account-utils.h"
#include "e-util/gconf-bridge.h"
+#include "e-mail-local.h"
#include "e-mail-shell-backend.h"
#define d(x)
@@ -164,8 +165,8 @@ setup_send_data(void)
g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) free_folder_info);
- data->inbox = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX);
+ data->inbox = e_mail_local_get_folder (
+ E_MAIL_FOLDER_LOCAL_INBOX);
camel_object_ref(data->inbox);
data->active = g_hash_table_new_full (
g_str_hash, g_str_equal,
@@ -690,13 +691,12 @@ receive_done (const gchar *uri, gpointer data)
/* if we've been called to run again - run again */
if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) {
- CamelFolder *local_outbox_folder;
+ CamelFolder *local_outbox;
- local_outbox_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
info->again = 0;
- mail_send_queue (local_outbox_folder,
+ mail_send_queue (local_outbox,
info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
@@ -908,7 +908,9 @@ receive_update_got_store (gchar *uri, CamelStore *store, gpointer data)
struct _send_info *info = data;
if (store) {
- mail_note_store(global_mail_shell_backend, store, info->cancel, receive_update_got_folderinfo, info);
+ mail_note_store(
+ store, info->cancel,
+ receive_update_got_folderinfo, info);
} else {
receive_done("", info);
}
@@ -917,7 +919,7 @@ receive_update_got_store (gchar *uri, CamelStore *store, gpointer data)
GtkWidget *
mail_send_receive (GtkWindow *parent)
{
- CamelFolder *outbox_folder;
+ CamelFolder *local_outbox;
struct _send_data *data;
EAccountList *accounts;
EAccount *account;
@@ -940,10 +942,9 @@ mail_send_receive (GtkWindow *parent)
accounts = e_get_account_list ();
- outbox_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
data = build_dialog (
- parent, accounts, outbox_folder, account->transport->url);
+ parent, accounts, local_outbox, account->transport->url);
scan = data->infos;
while (scan) {
struct _send_info *info = scan->data;
@@ -959,7 +960,7 @@ mail_send_receive (GtkWindow *parent)
break;
case SEND_SEND:
/* todo, store the folder in info? */
- mail_send_queue(outbox_folder, info->uri,
+ mail_send_queue(local_outbox, info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
receive_get_folder, info,
@@ -1129,7 +1130,7 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server)
{
struct _send_info *info;
struct _send_data *data;
- CamelFolder *outbox_folder;
+ CamelFolder *local_outbox;
send_info_t type;
data = setup_send_data();
@@ -1174,9 +1175,8 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server)
break;
case SEND_SEND:
/* todo, store the folder in info? */
- outbox_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- mail_send_queue (outbox_folder, info->uri,
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ mail_send_queue (local_outbox, info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
receive_get_folder, info,
@@ -1194,7 +1194,7 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server)
void
mail_send (void)
{
- CamelFolder *outbox_folder;
+ CamelFolder *local_outbox;
EAccountService *transport;
struct _send_info *info;
struct _send_data *data;
@@ -1237,9 +1237,8 @@ mail_send (void)
g_hash_table_insert (data->active, (gpointer) SEND_URI_KEY, info);
/* todo, store the folder in info? */
- outbox_folder = e_mail_shell_backend_get_folder (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- mail_send_queue (outbox_folder, info->uri,
+ local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ mail_send_queue (local_outbox, info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
receive_get_folder, info,
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index c018b9eea9..5a5f7324ed 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -50,6 +50,8 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-local.h"
+#include "e-mail-store.h"
#include "e-mail-shell-backend.h"
#define d(x) /* (printf("%s:%s: ", G_STRLOC, G_STRFUNC), (x))*/
@@ -339,26 +341,23 @@ uri_is_ignore(CamelStore *store, const gchar *uri)
EAccountList *accounts;
EAccount *account;
EIterator *iter;
- const gchar *local_drafts_folder_uri;
- const gchar *local_outbox_folder_uri;
- const gchar *local_sent_folder_uri;
+ const gchar *local_drafts_uri;
+ const gchar *local_outbox_uri;
+ const gchar *local_sent_uri;
gint found = FALSE;
- local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
- local_outbox_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
- local_sent_folder_uri = e_mail_shell_backend_get_folder_uri (
- global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ local_drafts_uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS);
+ local_outbox_uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_OUTBOX);
+ local_sent_uri = e_mail_local_get_folder_uri (E_MAIL_FOLDER_SENT);
d(printf("checking '%s' against:\n %s\n %s\n %s\n", uri,
- local_outbox_folder_uri,
- local_sent_folder_uri,
- local_drafts_folder_uri));
+ local_outbox_uri,
+ local_sent_uri,
+ local_drafts_uri));
- found = camel_store_folder_uri_equal(store, local_outbox_folder_uri, uri)
- || camel_store_folder_uri_equal(store, local_sent_folder_uri, uri)
- || camel_store_folder_uri_equal(store, local_drafts_folder_uri, uri);
+ found = camel_store_folder_uri_equal(store, local_outbox_uri, uri)
+ || camel_store_folder_uri_equal(store, local_sent_uri, uri)
+ || camel_store_folder_uri_equal(store, local_drafts_uri, uri);
if (found)
return found;
@@ -987,8 +986,7 @@ vfolder_load_storage(void)
g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context);
/* load store to mail component */
- e_mail_shell_backend_load_store_by_uri (
- global_mail_shell_backend, storeuri, _("Search Folders"));
+ e_mail_store_add_by_uri (storeuri, _("Search Folders"));
/* and setup the rules we have */
rule = NULL;