aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-local.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-09 23:34:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-12-11 10:34:19 +0800
commit7c0c40f83317228e0a725bfb5ca8854339d25588 (patch)
treedb1197dd9f336e175c590c3a41201dfa78ee303e /mail/e-mail-local.c
parent2f32e1cc68cd416f4530ecc3d2ff08b0e6498d45 (diff)
downloadgsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.gz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.bz2
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.lz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.xz
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.zst
gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.zip
Reorder accounts by drag-and-drop.
This implements https://bugzilla.gnome.org/show_bug.cgi?id=663527#c3. Account reordering is now done by drag-and-drop instead of up/down buttons. Turned out to be a wee bit more complicated than I initially thought. This scraps EAccountManager and EAccountTreeView and replaces them with new classes centered around EMailAccountStore, which EMailSession owns. EMailAccountStore is the model behind the account list in Preferences. The folder tree model now uses it to sort its own top-level rows using gtk_tree_path_compare(). It also broadcasts account operations through signals so we don't have to rely so heavily on EAccountList signals, since EAccountList is going away soon. Also as part of this work, the e-mail-local.h and e-mail-store.h APIs have been merged into EMailSession and MailFolderCache.
Diffstat (limited to 'mail/e-mail-local.c')
-rw-r--r--mail/e-mail-local.c154
1 files changed, 0 insertions, 154 deletions
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c
deleted file mode 100644
index 28d174e303..0000000000
--- a/mail/e-mail-local.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * e-mail-local.c
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-mail-local.h"
-
-#include <glib/gi18n.h>
-
-#include "e-mail-folder-utils.h"
-
-#define CHECK_LOCAL_FOLDER_TYPE(type) \
- ((type) < G_N_ELEMENTS (default_local_folders))
-
-/* The array elements correspond to EMailLocalFolder. */
-static struct {
- const gchar *display_name;
- CamelFolder *folder;
- gchar *folder_uri;
-} default_local_folders[] = {
- { N_("Inbox") },
- { N_("Drafts") },
- { N_("Outbox") },
- { N_("Sent") },
- { N_("Templates") },
- { "Inbox" } /* "always local" inbox */
-};
-
-static CamelStore *local_store;
-static gboolean mail_local_initialized = FALSE;
-
-void
-e_mail_local_init (EMailSession *session,
- const gchar *data_dir)
-{
- CamelSettings *settings;
- CamelService *service;
- gchar *path;
- gint ii;
- GError *error = NULL;
-
- if (mail_local_initialized)
- return;
-
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_return_if_fail (data_dir != NULL);
-
- mail_local_initialized = TRUE;
-
- service = camel_session_add_service (
- CAMEL_SESSION (session),
- "local", "maildir",
- CAMEL_PROVIDER_STORE, &error);
-
- camel_service_set_display_name (service, _("On This Computer"));
-
- settings = camel_service_get_settings (service);
-
- path = g_build_filename (data_dir, "local", NULL);
- g_object_set (settings, "path", path, NULL);
- g_free (path);
-
- /* Shouldn't need to worry about other mail applications
- * altering files in our local mail store. */
- g_object_set (service, "need-summary-check", FALSE, NULL);
-
- if (error != NULL)
- goto fail;
-
- /* Populate the rest of the default_local_folders array. */
- for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) {
- const gchar *display_name;
-
- display_name = default_local_folders[ii].display_name;
-
- default_local_folders[ii].folder_uri =
- e_mail_folder_uri_build (
- CAMEL_STORE (service), display_name);
-
- /* FIXME camel_store_get_folder() may block. */
- if (!strcmp (display_name, "Inbox"))
- default_local_folders[ii].folder =
- camel_store_get_inbox_folder_sync (
- CAMEL_STORE (service), NULL, &error);
- else
- default_local_folders[ii].folder =
- camel_store_get_folder_sync (
- CAMEL_STORE (service), display_name,
- CAMEL_STORE_FOLDER_CREATE, NULL, &error);
-
- if (error != NULL) {
- g_critical ("%s", error->message);
- g_clear_error (&error);
- }
- }
-
- local_store = g_object_ref (service);
-
- return;
-
-fail:
- g_critical (
- "Could not initialize local store/folder: %s",
- error->message);
-
- g_error_free (error);
-}
-
-CamelFolder *
-e_mail_local_get_folder (EMailLocalFolder type)
-{
- g_return_val_if_fail (mail_local_initialized, NULL);
- g_return_val_if_fail (CHECK_LOCAL_FOLDER_TYPE (type), NULL);
-
- return default_local_folders[type].folder;
-}
-
-const gchar *
-e_mail_local_get_folder_uri (EMailLocalFolder type)
-{
- g_return_val_if_fail (mail_local_initialized, NULL);
- g_return_val_if_fail (CHECK_LOCAL_FOLDER_TYPE (type), NULL);
-
- return default_local_folders[type].folder_uri;
-}
-
-CamelStore *
-e_mail_local_get_store (void)
-{
- g_return_val_if_fail (mail_local_initialized, NULL);
- g_return_val_if_fail (CAMEL_IS_STORE (local_store), NULL);
-
- return local_store;
-}