aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/e-msg-composer.c33
-rw-r--r--e-util/Makefile.am4
-rw-r--r--e-util/e-account-utils.c96
-rw-r--r--e-util/e-account-utils.h35
-rw-r--r--e-util/e-signature-utils.c72
-rw-r--r--e-util/e-signature-utils.h33
-rw-r--r--mail/e-mail-shell-module-migrate.c18
-rw-r--r--mail/e-mail-shell-module-settings.c37
-rw-r--r--mail/e-mail-shell-module.c3
-rw-r--r--mail/e-mail-shell-view-actions.c10
-rw-r--r--mail/e-mail-shell-view-private.h1
-rw-r--r--mail/em-account-editor.c17
-rw-r--r--mail/em-account-prefs.c44
-rw-r--r--mail/em-composer-prefs.c25
-rw-r--r--mail/em-composer-utils.c7
-rw-r--r--mail/em-folder-tree-model.c3
-rw-r--r--mail/em-folder-tree.c7
-rw-r--r--mail/em-subscribe-editor.c5
-rw-r--r--mail/em-utils.c26
-rw-r--r--mail/mail-component.c5
-rw-r--r--mail/mail-config.c233
-rw-r--r--mail/mail-config.h26
-rw-r--r--mail/mail-ops.c5
-rw-r--r--mail/mail-send-recv.c12
-rw-r--r--mail/mail-signature-editor.c10
-rw-r--r--mail/mail-vfolder.c5
-rw-r--r--plugins/groupwise-features/proxy-login.c3
-rw-r--r--plugins/imap-features/imap-headers.c5
-rw-r--r--shell/e-shell-settings.h6
29 files changed, 471 insertions, 315 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index eba55d53b2..1e219badee 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -23,17 +23,6 @@
*
*/
-/*
-
- TODO
-
- - Somehow users should be able to see if any file (s) are attached even when
- the attachment bar is not shown.
-
- Should use EventSources to keep track of global changes made to configuration
- values. Right now it ignores the problem olympically. Miguel.
-*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,6 +54,8 @@
#include "e-util/e-mktemp.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-util-private.h"
+#include "e-util/e-account-utils.h"
+#include "e-util/e-signature-utils.h"
#include "e-signature-combo-box.h"
#include "shell/e-shell.h"
@@ -1683,7 +1674,7 @@ msg_composer_account_changed_cb (EMsgComposer *composer)
bcc_addrs = account->bcc_addrs;
uid = account->id->sig_uid;
- signature = uid ? mail_config_get_signature_by_uid (uid) : NULL;
+ signature = uid ? e_get_signature_by_uid (uid) : NULL;
e_composer_header_table_set_signature (table, signature);
/* XXX This should be done more generically. The composer
@@ -2776,9 +2767,9 @@ msg_composer_init (EMsgComposer *composer)
/* Configure Headers */
e_composer_header_table_set_account_list (
- table, mail_config_get_accounts ());
+ table, e_get_account_list ());
e_composer_header_table_set_signature_list (
- table, mail_config_get_signatures ());
+ table, e_get_signature_list ());
g_signal_connect_swapped (
table, "notify::account",
@@ -3364,11 +3355,11 @@ set_signature_gui (EMsgComposer *composer)
data = gtkhtml_editor_get_paragraph_data (editor, "signature_name");
if (g_str_has_prefix (data, "uid:")) {
decoded = decode_signature_name (data + 4);
- signature = mail_config_get_signature_by_uid (decoded);
+ signature = e_get_signature_by_uid (decoded);
g_free (decoded);
} else if (g_str_has_prefix (data, "name:")) {
decoded = decode_signature_name (data + 5);
- signature = mail_config_get_signature_by_name (decoded);
+ signature = e_get_signature_by_name (decoded);
g_free (decoded);
}
@@ -3437,10 +3428,12 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
account_name = g_strdup (account_name);
g_strstrip (account_name);
- if ((account = mail_config_get_account_by_uid (account_name)) == NULL)
- /* 'old' setting */
- account = mail_config_get_account_by_name (account_name);
- if (account) {
+ account = e_get_account_by_uid (account_name);
+ if (account == NULL)
+ /* XXX Backwards compatibility */
+ account = e_get_account_by_name (account_name);
+
+ if (account != NULL) {
g_free (account_name);
account_name = g_strdup (account->name);
}
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 834466bbc9..389694fb46 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -40,6 +40,7 @@ INCLUDES = \
privsolib_LTLIBRARIES = libeutil.la libeconduit.la
eutilinclude_HEADERS = \
+ e-account-utils.h \
e-bconf-map.h \
e-binding.h \
e-categories-config.h \
@@ -70,6 +71,7 @@ eutilinclude_HEADERS = \
e-request.h \
e-signature.h \
e-signature-list.h \
+ e-signature-utils.h \
e-bit-array.h \
e-sorter.h \
e-sorter-array.h \
@@ -82,6 +84,7 @@ eutilinclude_HEADERS = \
libeutil_la_SOURCES = \
$(eutilinclude_HEADERS) \
+ e-account-utils.c \
e-bconf-map.c \
e-binding.c \
e-categories-config.c \
@@ -112,6 +115,7 @@ libeutil_la_SOURCES = \
e-request.c \
e-signature.c \
e-signature-list.c \
+ e-signature-utils.c \
e-bit-array.c \
e-sorter.c \
e-sorter-array.c \
diff --git a/e-util/e-account-utils.c b/e-util/e-account-utils.c
new file mode 100644
index 0000000000..d98a378b48
--- /dev/null
+++ b/e-util/e-account-utils.c
@@ -0,0 +1,96 @@
+/*
+ * 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)
+ */
+
+#include "e-account-utils.h"
+
+#include <gconf/gconf-client.h>
+
+static EAccountList *global_account_list;
+
+EAccountList *
+e_get_account_list (void)
+{
+ if (G_UNLIKELY (global_account_list == NULL)) {
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ global_account_list = e_account_list_new (client);
+ g_object_unref (client);
+ }
+
+ g_return_val_if_fail (global_account_list != NULL, NULL);
+
+ return global_account_list;
+}
+
+EAccount *
+e_get_default_account (void)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+
+ account_list = e_get_account_list ();
+ account = e_account_list_get_default (account_list);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
+
+void
+e_set_default_account (EAccount *account)
+{
+ EAccountList *account_list;
+
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
+ account_list = e_get_account_list ();
+ e_account_list_set_default (account_list, account);
+}
+
+EAccount *
+e_get_account_by_name (const gchar *name)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+ e_account_find_t find;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ find = E_ACCOUNT_FIND_NAME;
+ account_list = e_get_account_list ();
+ account = e_account_list_find (account_list, find, name);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
+
+EAccount *
+e_get_account_by_uid (const gchar *uid)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+ e_account_find_t find;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ find = E_ACCOUNT_FIND_UID;
+ account_list = e_get_account_list ();
+ account = e_account_list_find (account_list, find, uid);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
diff --git a/e-util/e-account-utils.h b/e-util/e-account-utils.h
new file mode 100644
index 0000000000..24262349d2
--- /dev/null
+++ b/e-util/e-account-utils.h
@@ -0,0 +1,35 @@
+/*
+ * 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)
+ */
+
+#ifndef E_ACCOUNT_UTILS_H
+#define E_ACCOUNT_UTILS_H
+
+#include <glib.h>
+#include <libedataserver/e-account.h>
+#include <libedataserver/e-account-list.h>
+
+G_BEGIN_DECLS
+
+EAccountList * e_get_account_list (void);
+EAccount * e_get_default_account (void);
+void e_set_default_account (EAccount *account);
+EAccount * e_get_account_by_name (const gchar *name);
+EAccount * e_get_account_by_uid (const gchar *uid);
+
+G_END_DECLS
+
+#endif /* E_ACCOUNT_UTILS_H */
diff --git a/e-util/e-signature-utils.c b/e-util/e-signature-utils.c
new file mode 100644
index 0000000000..2a21a25b25
--- /dev/null
+++ b/e-util/e-signature-utils.c
@@ -0,0 +1,72 @@
+/*
+ * 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)
+ */
+
+#include "e-signature-utils.h"
+
+#include <gconf/gconf-client.h>
+
+static ESignatureList *global_signature_list;
+
+ESignatureList *
+e_get_signature_list (void)
+{
+ if (G_UNLIKELY (global_signature_list == NULL)) {
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ global_signature_list = e_signature_list_new (client);
+ g_object_unref (client);
+ }
+
+ g_return_val_if_fail (global_signature_list != NULL, NULL);
+
+ return global_signature_list;
+}
+
+ESignature *
+e_get_signature_by_name (const gchar *name)
+{
+ ESignatureList *signature_list;
+ const ESignature *signature;
+ e_signature_find_t find;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ find = E_SIGNATURE_FIND_NAME;
+ signature_list = e_get_signature_list ();
+ signature = e_signature_list_find (signature_list, find, name);
+
+ /* XXX ESignatureList misuses const. */
+ return (ESignature *) signature;
+}
+
+ESignature *
+e_get_signature_by_uid (const gchar *uid)
+{
+ ESignatureList *signature_list;
+ const ESignature *signature;
+ e_signature_find_t find;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ find = E_SIGNATURE_FIND_UID;
+ signature_list = e_get_signature_list ();
+ signature = e_signature_list_find (signature_list, find, uid);
+
+ /* XXX ESignatureList misuses const. */
+ return (ESignature *) signature;
+}
diff --git a/e-util/e-signature-utils.h b/e-util/e-signature-utils.h
new file mode 100644
index 0000000000..961a6a6d26
--- /dev/null
+++ b/e-util/e-signature-utils.h
@@ -0,0 +1,33 @@
+/*
+ * 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)
+ */
+
+#ifndef E_SIGNATURE_UTILS_H
+#define E_SIGNATURE_UTILS_H
+
+#include <glib.h>
+#include <e-util/e-signature.h>
+#include <e-util/e-signature-list.h>
+
+G_BEGIN_DECLS
+
+ESignatureList *e_get_signature_list (void);
+ESignature * e_get_signature_by_name (const gchar *name);
+ESignature * e_get_signature_by_uid (const gchar *uid);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_UTILS_H */
diff --git a/mail/e-mail-shell-module-migrate.c b/mail/e-mail-shell-module-migrate.c
index a0ce1624cb..e318dee267 100644
--- a/mail/e-mail-shell-module-migrate.c
+++ b/mail/e-mail-shell-module-migrate.c
@@ -56,12 +56,12 @@
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-xml-utils.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-bconf-map.h"
-#include "libedataserver/e-account-list.h"
-#include "e-util/e-signature-list.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "e-util/e-plugin.h"
+#include "e-util/e-signature-utils.h"
#include "e-mail-shell-module.h"
#include "shell/e-shell-migrate.h"
@@ -1999,7 +1999,7 @@ get_nth_sig (int id)
char *uid = NULL;
int i = 0;
- list = mail_config_get_signatures ();
+ list = e_get_signature_list ();
iter = e_list_get_iterator ((EList *) list);
while (e_iterator_is_valid (iter) && i < id) {
@@ -2023,7 +2023,7 @@ em_upgrade_accounts_1_4 (void)
EAccountList *accounts;
EIterator *iter;
- if (!(accounts = mail_config_get_accounts ()))
+ if (!(accounts = e_get_account_list ()))
return;
iter = e_list_get_iterator ((EList *) accounts);
@@ -2056,7 +2056,7 @@ em_upgrade_accounts_1_4 (void)
g_object_unref (iter);
- mail_config_save_accounts ();
+ e_account_list_save (accounts);
}
static gboolean
@@ -2475,7 +2475,7 @@ em_migrate_imap_cmeta_1_4(const char *data_dir, GError **error)
EAccountList *accounts;
const EAccount *account;
- if (!(accounts = mail_config_get_accounts()))
+ if (!(accounts = e_get_account_list ()))
return TRUE;
gconf = gconf_client_get_default();
@@ -2671,7 +2671,7 @@ em_update_accounts_2_11 (void)
EIterator *iter;
gboolean changed = FALSE;
- if (!(accounts = mail_config_get_accounts ()))
+ if (!(accounts = e_get_account_list ()))
return;
iter = e_list_get_iterator ((EList *) accounts);
@@ -2694,7 +2694,7 @@ em_update_accounts_2_11 (void)
g_object_unref (iter);
if (changed)
- mail_config_save_accounts ();
+ e_account_list_save (accounts);
}
#endif /* !G_OS_WIN32 */
@@ -2913,7 +2913,7 @@ migrate_to_db (EShellModule *shell_module)
CamelFolderInfo *info;
const gchar *data_dir;
- if (!(accounts = mail_config_get_accounts ()))
+ if (!(accounts = e_get_account_list ()))
return;
iter = e_list_get_iterator ((EList *) accounts);
diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c
index 0bd72c27bc..4acce23ad2 100644
--- a/mail/e-mail-shell-module-settings.c
+++ b/mail/e-mail-shell-module-settings.c
@@ -21,11 +21,19 @@
#include "e-mail-shell-module-settings.h"
+#include <gconf/gconf-client.h>
+#include <libedataserver/e-account-list.h>
+
+#include "e-util/e-signature-list.h"
+
void
e_mail_shell_module_init_settings (EShell *shell)
{
+ GConfClient *client;
EShellSettings *shell_settings;
+ gpointer object;
+ client = gconf_client_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
/* XXX Default values should match the GConf schema.
@@ -425,4 +433,33 @@ e_mail_shell_module_init_settings (EShell *shell)
e_shell_settings_bind_to_gconf (
shell_settings, "composer-top-signature",
"/apps/evolution/mail/composer/top_signature");
+
+ /* These properties are not bound directly to GConf keys.
+ * XXX Nor should they be stored in GConf to begin with. */
+
+ e_shell_settings_install_property (
+ g_param_spec_object (
+ "accounts",
+ NULL,
+ NULL,
+ E_TYPE_ACCOUNT_LIST,
+ G_PARAM_READWRITE));
+
+ object = e_account_list_new (client);
+ e_shell_settings_set_object (shell_settings, "accounts", object);
+ g_object_unref (object);
+
+ e_shell_settings_install_property (
+ g_param_spec_object (
+ "signatures",
+ NULL,
+ NULL,
+ E_TYPE_SIGNATURE_LIST,
+ G_PARAM_READWRITE));
+
+ object = e_signature_list_new (client);
+ e_shell_settings_set_object (shell_settings, "signatures", object);
+ g_object_unref (object);
+
+ g_object_unref (client);
}
diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c
index e8893bbbdc..680c994aec 100644
--- a/mail/e-mail-shell-module.c
+++ b/mail/e-mail-shell-module.c
@@ -25,6 +25,7 @@
#include <camel/camel-session.h>
#include <camel/camel-url.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-import.h"
#include "e-util/e-util.h"
#include "shell/e-shell.h"
@@ -353,7 +354,7 @@ mail_shell_module_load_accounts (EShellModule *shell_module)
EAccountList *account_list;
EIterator *iter;
- account_list = mail_config_get_accounts ();
+ account_list = e_get_account_list ();
for (iter = e_list_get_iterator ((EList *) account_list);
e_iterator_is_valid (iter); e_iterator_next (iter)) {
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
index 5e923724a9..c0e08f4270 100644
--- a/mail/e-mail-shell-view-actions.c
+++ b/mail/e-mail-shell-view-actions.c
@@ -41,21 +41,21 @@ action_mail_account_disable_cb (GtkAction *action,
folder_uri = em_folder_tree_get_selected_uri (folder_tree);
g_return_if_fail (folder_uri != NULL);
+ account_list = e_get_account_list ();
account = mail_config_get_account_by_source_url (folder_uri);
g_return_if_fail (account != NULL);
- if (mail_config_has_proxies (account))
- mail_config_remove_account_proxies (account);
+ if (e_account_list_account_has_proxies (account_list, account))
+ e_account_list_remove_account_proxies (account_list, account);
account->enabled = !account->enabled;
- account_list = mail_config_get_accounts ();
e_account_list_change (account_list, account);
e_mail_shell_module_remove_store_by_uri (shell_module, folder_uri);
if (account->parent_uid != NULL)
- mail_config_remove_account (account);
+ e_account_list_remove (account_list, account);
- mail_config_save_accounts ();
+ e_account_list_save (account_list);
g_free (folder_uri);
}
diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h
index 0641fe5d5c..a6f493216b 100644
--- a/mail/e-mail-shell-view-private.h
+++ b/mail/e-mail-shell-view-private.h
@@ -31,6 +31,7 @@
#include "e-util/e-util.h"
#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
+#include "e-util/e-account-utils.h"
#include "widgets/misc/e-popup-action.h"
#include "widgets/menus/gal-view-instance.h"
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 965d4807c6..0103242112 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -51,10 +51,11 @@
#include <libgnomeui/gnome-druid.h>
#include <libgnomeui/gnome-druid-page-standard.h>
-#include <libedataserver/e-account-list.h>
#include <e-util/e-signature-list.h>
#include "e-util/e-error.h"
+#include "e-util/e-account-utils.h"
+#include "e-util/e-signature-utils.h"
#include "e-util/e-util-private.h"
#include "em-config.h"
@@ -210,7 +211,7 @@ emae_finalise(GObject *o)
EMAccountEditorPrivate *p = emae->priv;
if (p->sig_added_id) {
- ESignatureList *signatures = mail_config_get_signatures();
+ ESignatureList *signatures = e_get_signature_list ();
g_signal_handler_disconnect(signatures, p->sig_added_id);
g_signal_handler_disconnect(signatures, p->sig_removed_id);
@@ -698,7 +699,7 @@ emae_setup_signatures(EMAccountEditor *emae, GladeXML *xml)
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, _("None"), 1, NULL, -1);
- signatures = mail_config_get_signatures ();
+ signatures = e_get_signature_list ();
if (p->sig_added_id == 0) {
p->sig_added_id = g_signal_connect(signatures, "signature-added", G_CALLBACK(emae_signature_added), emae);
@@ -1791,8 +1792,8 @@ emae_identity_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st
gui->management_frame = glade_xml_get_widget(xml, "management_frame");
gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (xml, "management_default"));
- if (!mail_config_get_default_account ()
- || (account == mail_config_get_default_account ())
+ if (!e_get_default_account ()
+ || (account == e_get_default_account ())
|| (GPOINTER_TO_INT(g_object_get_data (G_OBJECT (emae->account), "default_flagged"))) )
gtk_toggle_button_set_active (gui->default_account, TRUE);
@@ -2729,7 +2730,7 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data)
len = strlen(tmp);
template = alloca(len + 14);
strcpy(template, tmp);
- while (mail_config_get_account_by_name(template))
+ while (e_get_account_by_name (template))
sprintf(template + len, " (%d)", i++);
gtk_entry_set_text(emae->priv->identity_entries[0], template);
@@ -2773,7 +2774,7 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data)
if (ok && (pageid == NULL || !strcmp(pageid, "40.management"))) {
ok = (tmp = e_account_get_string(emae->account, E_ACCOUNT_NAME))
&& tmp[0]
- && ((ea = mail_config_get_account_by_name(tmp)) == NULL
+ && ((ea = e_get_account_by_name (tmp)) == NULL
|| ea == emae->original);
if (!ok)
d(printf("management page incomplete\n"));
@@ -2801,7 +2802,7 @@ static void
emae_commit(EConfig *ec, GSList *items, void *data)
{
EMAccountEditor *emae = data;
- EAccountList *accounts = mail_config_get_accounts();
+ EAccountList *accounts = e_get_account_list ();
EAccount *account;
/* the mail-config*acconts* api needs a lot of work */
diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c
index e27c7d3ee3..2b6e3343f6 100644
--- a/mail/em-account-prefs.c
+++ b/mail/em-account-prefs.c
@@ -32,7 +32,7 @@
#include "mail-ops.h"
#include "mail-send-recv.h"
-#include "libedataserver/e-account-list.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
@@ -174,6 +174,9 @@ static void
account_edit_clicked (GtkButton *button, gpointer user_data)
{
EMAccountPrefs *prefs = (EMAccountPrefs *) user_data;
+ EAccountList *account_list;
+
+ account_list = e_get_account_list ();
if (prefs->editor == NULL) {
GtkTreeSelection *selection;
@@ -185,7 +188,7 @@ account_edit_clicked (GtkButton *button, gpointer user_data)
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, 3, &account, -1);
- if (account && !account->parent_uid && !mail_config_has_proxies (account)) {
+ if (account && !account->parent_uid && !e_account_list_account_has_proxies (account_list, account)) {
EMAccountEditor *emae;
/** @HookPoint-EMConfig: Mail Account Editor
@@ -222,6 +225,8 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
int ans;
gboolean has_proxies = FALSE;
+ accounts = e_get_account_list ();
+
selection = gtk_tree_view_get_selection (prefs->table);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, 3, &account, -1);
@@ -230,7 +235,7 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
if (account == NULL || prefs->editor != NULL)
return;
- has_proxies = mail_config_has_proxies (account);
+ has_proxies = e_account_list_account_has_proxies (accounts, account);
ans = e_error_run(PREFS_WINDOW(prefs), has_proxies?"mail:ask-delete-account-with-proxies":"mail:ask-delete-account",NULL);
if (ans == GTK_RESPONSE_YES) {
@@ -243,11 +248,10 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
/* remove all the proxies account has created*/
if (has_proxies)
- mail_config_remove_account_proxies (account);
+ e_account_list_remove_account_proxies (accounts, account);
/* remove it from the config file */
- mail_config_remove_account (account);
- accounts = mail_config_get_accounts ();
+ e_account_list_remove (accounts, account);
mail_config_write ();
@@ -281,7 +285,7 @@ account_default_clicked (GtkButton *button, gpointer user_data)
gtk_tree_model_get (model, &iter, 3, &account, -1);
if (account) {
- mail_config_set_default_account (account);
+ e_set_default_account (account);
mail_config_write ();
@@ -312,11 +316,14 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user
{
EMAccountPrefs *prefs = user_data;
GtkTreeSelection *selection;
+ EAccountList *account_list;
EAccount *account = NULL;
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
+ account_list = e_get_account_list ();
+
path = gtk_tree_path_new_from_string (arg1);
model = gtk_tree_view_get_model (prefs->table);
selection = gtk_tree_view_get_selection (prefs->table);
@@ -324,7 +331,7 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user
if (gtk_tree_model_get_iter (model, &iter, path)) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
- if (mail_config_has_proxies (account)) {
+ if (e_account_list_account_has_proxies (account_list, account)) {
int ans;
ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-proxy-accounts",NULL);
@@ -334,12 +341,12 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user
return;
}
- mail_config_remove_account_proxies (account);
+ e_account_list_remove_account_proxies (account_list, account);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1);
}
account->enabled = !account->enabled;
- e_account_list_change(mail_config_get_accounts(), account);
+ e_account_list_change(e_get_account_list (), account);
account_able_changed (account);
gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
@@ -359,13 +366,16 @@ account_double_click (GtkTreeView *treeview, GtkTreePath *path,
static void
account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
{
+ EAccountList *account_list;
EAccount *account = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
const char *url = NULL;
int state;
EAccount *default_account;
- default_account = mail_config_get_default_account ();
+
+ account_list = e_get_account_list ();
+ default_account = e_get_default_account ();
state = gconf_client_key_is_writable(mail_config_get_gconf_client(), "/apps/evolution/mail/accounts", NULL);
if (state) {
@@ -381,8 +391,12 @@ account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
gtk_widget_set_sensitive (GTK_WIDGET (prefs), FALSE);
}
- if( url != NULL )
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), !mail_config_has_proxies(account));
+ if (url != NULL) {
+ gboolean has_proxies;
+
+ has_proxies = e_account_list_account_has_proxies (account_list, account);
+ gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), !has_proxies);
+ }
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), state);
@@ -407,9 +421,9 @@ mail_accounts_load (EMAccountPrefs *prefs)
model = (GtkListStore *) gtk_tree_view_get_model (prefs->table);
gtk_list_store_clear (model);
- default_account = mail_config_get_default_account ();
+ default_account = e_get_default_account ();
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
node = e_list_get_iterator ((EList *) accounts);
selection = gtk_tree_view_get_selection(prefs->table);
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 52bbd98479..2609e46835 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -31,8 +31,7 @@
#include <fcntl.h>
#include "e-util/e-binding.h"
-#include "e-util/e-signature.h"
-#include "e-util/e-signature-list.h"
+#include "e-util/e-signature-utils.h"
#include "e-util/gconf-bridge.h"
#include "em-composer-prefs.h"
@@ -97,7 +96,7 @@ composer_prefs_dispose (GObject *object)
EMComposerPrefs *prefs = (EMComposerPrefs *) object;
ESignatureList *signature_list;
- signature_list = mail_config_get_signatures ();
+ signature_list = e_get_signature_list ();
if (prefs->sig_added_id != 0) {
g_signal_handler_disconnect (
@@ -380,12 +379,19 @@ sig_delete_cb (GtkWidget *widget, EMComposerPrefs *prefs)
GtkTreeModel *model;
GtkTreeIter iter;
ESignature *signature;
+ ESignatureList *signature_list;
+ signature_list = e_get_signature_list ();
selection = gtk_tree_view_get_selection (prefs->sig_list);
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_tree_model_get (model, &iter, 1, &signature, -1);
- mail_config_remove_signature (signature);
+
+ if (signature->filename && !signature->script)
+ g_unlink (signature->filename);
+
+ e_signature_list_remove (signature_list, signature);
+ e_signature_list_save (signature_list);
}
gtk_widget_grab_focus ((GtkWidget *)prefs->sig_list);
}
@@ -425,24 +431,27 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs)
struct stat st;
if (g_stat (argv[0], &st) == 0 && S_ISREG (st.st_mode) && g_access (argv[0], X_OK) == 0) {
+ ESignatureList *signature_list;
ESignature *signature;
+ signature_list = e_get_signature_list ();
+
if ((signature = g_object_get_data ((GObject *) entry, "sig"))) {
/* we're just editing an existing signature script */
g_free (signature->name);
signature->name = g_strdup (name);
g_free(signature->filename);
signature->filename = g_strdup(script);
- e_signature_list_change (mail_config_get_signatures (), signature);
+ e_signature_list_change (signature_list, signature);
} else {
signature = mail_config_signature_new (script, TRUE, TRUE);
signature->name = g_strdup (name);
- e_signature_list_add (mail_config_get_signatures (), signature);
+ e_signature_list_add (signature_list, signature);
g_object_unref (signature);
}
- mail_config_save_signatures();
+ e_signature_list_save (signature_list);
gtk_widget_hide (prefs->sig_script_dialog);
g_strfreev (argv);
@@ -505,7 +514,7 @@ sig_fill_list (EMComposerPrefs *prefs)
model = gtk_tree_view_get_model (prefs->sig_list);
gtk_list_store_clear (GTK_LIST_STORE (model));
- signature_list = mail_config_get_signatures ();
+ signature_list = e_get_signature_list ();
iterator = e_list_get_iterator ((EList *) signature_list);
while (e_iterator_is_valid (iterator)) {
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index bf94aed15a..205a894d37 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -39,6 +39,7 @@
#include "mail-send-recv.h"
#include "e-util/e-error.h"
+#include "e-util/e-account-utils.h"
#include "em-utils.h"
#include "em-composer-utils.h"
@@ -48,8 +49,6 @@
#include "em-format-quote.h"
#include "em-event.h"
-#include "libedataserver/e-account-list.h"
-
#include <camel/camel-folder.h>
#include <camel/camel-multipart.h>
#include <camel/camel-string-utils.h>
@@ -1663,10 +1662,10 @@ generate_account_hash (void)
EAccountList *accounts;
EIterator *iter;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
account_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
- def = mail_config_get_default_account ();
+ def = e_get_default_account ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 5ddd8876e6..e774760ee3 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -37,6 +37,7 @@
#include "e-util/e-util.h"
#include "e-util/e-mktemp.h"
+#include "e-util/e-account-utils.h"
#include <glib/gi18n.h>
@@ -386,7 +387,7 @@ folder_tree_model_init (EMFolderTreeModel *model)
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
- model->accounts = mail_config_get_accounts ();
+ model->accounts = e_get_account_list ();
model->account_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
model->account_changed_id = g_signal_connect (
model->accounts, "account-changed",
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index ecfe5d29ad..bd8a2436fb 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -48,6 +48,7 @@
#include <camel/camel-file-utils.h>
#include <camel/camel-stream-fs.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-mktemp.h"
#include "e-util/e-request.h"
#include "e-util/e-icon-factory.h"
@@ -565,7 +566,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft)
tree_view = GTK_TREE_VIEW (emft);
shell_module = em_folder_tree_model_get_shell_module (model);
- if ((account = mail_config_get_account_by_uid (uid)) && account->enabled) {
+ if ((account = e_get_account_by_uid (uid)) && account->enabled) {
CamelException ex;
camel_exception_init (&ex);
@@ -634,7 +635,7 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
-1);
si = g_hash_table_lookup (model->store_hash, store);
- if ((account = mail_config_get_account_by_name (si->display_name))) {
+ if ((account = e_get_account_by_name (si->display_name))) {
key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : "");
} else if (CAMEL_IS_VEE_STORE (store)) {
/* vfolder store */
@@ -1831,7 +1832,7 @@ emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter
-1);
si = g_hash_table_lookup (priv->model->store_hash, store);
- if ((account = mail_config_get_account_by_name (si->display_name))) {
+ if ((account = e_get_account_by_name (si->display_name))) {
key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : "");
} else if (CAMEL_IS_VEE_STORE (store)) {
/* vfolder store */
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 8146b66bb6..8abd89bca8 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -35,8 +35,9 @@
#include "camel/camel-exception.h"
#include "camel/camel-store.h"
#include "camel/camel-session.h"
-#include "libedataserver/e-account-list.h"
#include "libedataserver/e-msgport.h"
+
+#include "e-util/e-account-utils.h"
#include "e-util/e-util-private.h"
#include "em-subscribe-editor.h"
@@ -862,7 +863,7 @@ em_subscribe_editor_new(void)
gtk_widget_show(w);
gtk_menu_shell_append ((GtkMenuShell *)menu, w);
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
for (iter = e_list_get_iterator ((EList *) accounts);
e_iterator_is_valid (iter);
e_iterator_next (iter)) {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index af53b3df69..d3b9b1f9c3 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -67,7 +67,7 @@
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
#include "e-util/e-mktemp.h"
-#include "libedataserver/e-account-list.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-error.h"
@@ -194,6 +194,7 @@ gboolean
em_utils_configure_account (GtkWindow *parent)
{
EMAccountEditor *emae;
+ EAccountList *account_list;
g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
@@ -205,7 +206,9 @@ em_utils_configure_account (GtkWindow *parent)
gtk_grab_add(emae->editor);
gtk_main();
- return mail_config_is_configured();
+ account_list = e_get_account_list ();
+
+ return (e_list_length ((EList *) account_list) > 0);
}
/**
@@ -224,14 +227,17 @@ em_utils_configure_account (GtkWindow *parent)
gboolean
em_utils_check_user_can_send_mail (GtkWindow *parent)
{
+ EAccountList *account_list;
EAccount *account;
- if (!mail_config_is_configured ()) {
+ account_list = e_get_account_list ();
+
+ if (e_list_length ((EList *) account_list) > 0) {
if (!em_utils_configure_account (parent))
return FALSE;
}
- if (!(account = mail_config_get_default_account ()))
+ if (!(account = e_get_default_account ()))
return FALSE;
/* Check for a transport */
@@ -1396,7 +1402,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const char *uri)
if (uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *)accounts);
while (e_iterator_is_valid (iter)) {
account = (EAccount *)e_iterator_get (iter);
@@ -1447,7 +1453,7 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
if (uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
@@ -1498,7 +1504,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
if (uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
@@ -1805,7 +1811,7 @@ em_utils_empty_trash (GtkWidget *parent)
camel_exception_init (&ex);
/* expunge all remote stores */
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1974,7 +1980,7 @@ char *em_uri_to_camel(const char *euri)
uid = g_strdup(eurl->host);
}
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
account = e_account_list_find(accounts, E_ACCOUNT_FIND_UID, uid);
g_free(uid);
@@ -2417,7 +2423,7 @@ em_utils_clear_get_password_canceled_accounts_flag (void)
{
EAccountList *accounts;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
if (accounts) {
EIterator *iter;
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 867b16b7ec..dfd487d5f8 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -484,11 +484,14 @@ static CORBA_boolean
impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
{
MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant));
+ EAccountList *account_list;
if (mc->priv->quit_state == -1)
mc->priv->quit_state = MC_QUIT_START;
- mail_config_prune_proxies ();
+ account_list = e_get_account_list ();
+ e_account_list_prune_proxies (account_list);
+
switch (mc->priv->quit_state) {
case MC_QUIT_START: {
extern int camel_application_is_exiting;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index cb36ee6d60..fc97d3d953 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -53,10 +53,13 @@
#include <e-util/e-util.h>
#include <misc/e-gui-utils.h>
#include "e-util/e-util-labels.h"
+#include "e-util/e-account-utils.h"
-#include <libedataserver/e-account-list.h>
#include <e-util/e-signature-list.h>
+#include "shell/e-shell.h"
+#include "shell/e-shell-settings.h"
+
#include <camel/camel-service.h>
#include <camel/camel-stream-mem.h>
#include <camel/camel-stream-fs.h>
@@ -74,14 +77,12 @@
typedef struct {
GConfClient *gconf;
+ EShellSettings *shell_settings;
gboolean corrupt;
char *gtkrc;
- EAccountList *accounts;
- ESignatureList *signatures;
-
GSList *labels;
gboolean address_compress;
@@ -105,18 +106,6 @@ static MailConfig *config = NULL;
static guint config_write_timeout = 0;
-void
-mail_config_save_accounts (void)
-{
- e_account_list_save (config->accounts);
-}
-
-void
-mail_config_save_signatures (void)
-{
- e_signature_list_save (config->signatures);
-}
-
static void
config_clear_mime_types (void)
{
@@ -351,13 +340,21 @@ void
mail_config_init (void)
{
GConfClientNotifyFunc func;
+ EShellSettings *shell_settings;
+ EShell *shell;
const gchar *key;
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+
if (config)
return;
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
config = g_new0 (MailConfig, 1);
config->gconf = gconf_client_get_default ();
+ config->shell_settings = g_object_ref (shell_settings);
config->mime_types = g_ptr_array_new ();
config->gtkrc = g_build_filename (
e_get_user_data_dir (), "mail",
@@ -365,9 +362,6 @@ mail_config_init (void)
mail_config_clear ();
- config->accounts = e_account_list_new (config->gconf);
- config->signatures = e_signature_list_new (config->gconf);
-
gtk_rc_parse (config->gtkrc);
/* Composer Configuration */
@@ -546,16 +540,6 @@ mail_config_clear (void)
if (!config)
return;
- if (config->accounts) {
- g_object_unref (config->accounts);
- config->accounts = NULL;
- }
-
- if (config->signatures) {
- g_object_unref (config->signatures);
- config->signatures = NULL;
- }
-
config_clear_labels ();
config_clear_mime_types ();
}
@@ -564,18 +548,30 @@ mail_config_clear (void)
void
mail_config_write (void)
{
+ EAccountList *account_list;
+ ESignatureList *signature_list;
+
if (!config)
return;
- e_account_list_save (config->accounts);
- e_signature_list_save (config->signatures);
+ account_list = e_shell_settings_get_object (
+ config->shell_settings, "accounts");
+ signature_list = e_shell_settings_get_object (
+ config->shell_settings, "signatures");
+
+ e_account_list_save (account_list);
+ e_signature_list_save (signature_list);
gconf_client_suggest_sync (config->gconf, NULL);
+
+ g_object_unref (account_list);
+ g_object_unref (signature_list);
}
void
mail_config_write_on_exit (void)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
@@ -589,7 +585,8 @@ mail_config_write_on_exit (void)
/* then we make sure the ones we want to remember are in the
session cache */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
char *passwd;
@@ -618,7 +615,7 @@ mail_config_write_on_exit (void)
e_passwords_clear_passwords ("Mail");
/* then we remember them */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -653,12 +650,6 @@ mail_config_get_gconf_client (void)
}
gboolean
-mail_config_is_configured (void)
-{
- return e_list_length ((EList *) config->accounts) > 0;
-}
-
-gboolean
mail_config_is_corrupt (void)
{
return config->corrupt;
@@ -749,53 +740,6 @@ mail_config_get_allowable_mime_types (void)
return (const char **) config->mime_types->pdata;
}
-gboolean
-mail_config_find_account (EAccount *account)
-{
- EAccount *acnt;
- EIterator *iter;
-
- iter = e_list_get_iterator ((EList *) config->accounts);
- while (e_iterator_is_valid (iter)) {
- acnt = (EAccount *) e_iterator_get (iter);
- if (acnt == account) {
- g_object_unref (iter);
- return TRUE;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
- return FALSE;
-}
-
-EAccount *
-mail_config_get_default_account (void)
-{
- if (config == NULL)
- mail_config_init ();
-
- if (!config->accounts)
- return NULL;
-
- /* should probably return const */
- return (EAccount *)e_account_list_get_default(config->accounts);
-}
-
-EAccount *
-mail_config_get_account_by_name (const char *account_name)
-{
- return (EAccount *)e_account_list_find(config->accounts, E_ACCOUNT_FIND_NAME, account_name);
-}
-
-EAccount *
-mail_config_get_account_by_uid (const char *uid)
-{
- return (EAccount *) e_account_list_find (config->accounts, E_ACCOUNT_FIND_UID, uid);
-}
-
static gboolean
mail_config_account_url_equal (const CamelURL *u1,
const CamelURL *u2)
@@ -818,6 +762,7 @@ mail_config_account_url_equal (const CamelURL *u1,
EAccount *
mail_config_get_account_by_source_url (const char *source_url)
{
+ EAccountList *account_list;
EAccount *account = NULL;
EIterator *iter;
CamelURL *url;
@@ -827,7 +772,8 @@ mail_config_get_account_by_source_url (const char *source_url)
url = camel_url_new (source_url, NULL);
g_return_val_if_fail (url != NULL, NULL);
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (account == NULL && e_iterator_is_valid (iter)) {
CamelURL *account_url;
@@ -862,6 +808,7 @@ mail_config_get_account_by_source_url (const char *source_url)
EAccount *
mail_config_get_account_by_transport_url (const char *transport_url)
{
+ EAccountList *account_list;
EAccount *account = NULL;
EIterator *iter;
CamelURL *url;
@@ -871,7 +818,8 @@ mail_config_get_account_by_transport_url (const char *transport_url)
url = camel_url_new (transport_url, NULL);
g_return_val_if_fail (url != NULL, NULL);
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (account == NULL && e_iterator_is_valid (iter)) {
CamelURL *account_url;
@@ -903,77 +851,21 @@ mail_config_get_account_by_transport_url (const char *transport_url)
return account;
}
-int
-mail_config_has_proxies (EAccount *account)
-{
- return e_account_list_account_has_proxies (config->accounts, account);
-}
-
-void
-mail_config_remove_account_proxies (EAccount *account)
-{
- e_account_list_remove_account_proxies (config->accounts, account);
-}
-
-void
-mail_config_prune_proxies (void)
-{
- e_account_list_prune_proxies (config->accounts);
-}
-
-EAccountList *
-mail_config_get_accounts (void)
-{
- if (config == NULL)
- mail_config_init ();
-
- return config->accounts;
-}
-
-void
-mail_config_add_account (EAccount *account)
-{
- e_account_list_add(config->accounts, account);
- mail_config_save_accounts ();
-}
-
-void
-mail_config_remove_account (EAccount *account)
-{
- e_account_list_remove(config->accounts, account);
- mail_config_save_accounts ();
-}
-
-void
-mail_config_set_default_account (EAccount *account)
-{
- e_account_list_set_default(config->accounts, account);
-}
-
-EAccountIdentity *
-mail_config_get_default_identity (void)
-{
- EAccount *account;
-
- account = mail_config_get_default_account ();
- if (account)
- return account->id;
- else
- return NULL;
-}
-
EAccountService *
mail_config_get_default_transport (void)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
- account = mail_config_get_default_account ();
+ account_list = e_get_account_list ();
+ account = e_get_default_account ();
+
if (account && account->enabled && account->transport && account->transport->url && account->transport->url[0])
return account->transport;
/* return the first account with a transport? */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1014,6 +906,7 @@ uri_to_evname (const char *uri, const char *prefix)
void
mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
int i, work = 0;
@@ -1025,7 +918,8 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
"*views/custom_view-",
NULL };
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1066,6 +960,7 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
void
mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
int work = 0;
@@ -1078,7 +973,8 @@ mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri)
local_sent_folder_uri = e_mail_shell_module_get_folder_uri (
mail_shell_module, E_MAIL_FOLDER_SENT);
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1136,12 +1032,6 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
return filename;
}
-ESignatureList *
-mail_config_get_signatures (void)
-{
- return config->signatures;
-}
-
static char *
get_new_signature_filename (void)
{
@@ -1202,35 +1092,6 @@ mail_config_signature_new (const char *filename, gboolean script, gboolean html)
return sig;
}
-ESignature *
-mail_config_get_signature_by_uid (const char *uid)
-{
- return (ESignature *) e_signature_list_find (config->signatures, E_SIGNATURE_FIND_UID, uid);
-}
-
-ESignature *
-mail_config_get_signature_by_name (const char *name)
-{
- return (ESignature *) e_signature_list_find (config->signatures, E_SIGNATURE_FIND_NAME, name);
-}
-
-void
-mail_config_add_signature (ESignature *signature)
-{
- e_signature_list_add (config->signatures, signature);
- mail_config_save_signatures ();
-}
-
-void
-mail_config_remove_signature (ESignature *signature)
-{
- if (signature->filename && !signature->script)
- g_unlink (signature->filename);
-
- e_signature_list_remove (config->signatures, signature);
- mail_config_save_signatures ();
-}
-
void
mail_config_reload_junk_headers (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 81f245170e..e085a1be37 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -26,7 +26,7 @@
#include <glib.h>
#include <glib-object.h>
-#include "camel/camel-provider.h" /* can't forward-declare enums, bah */
+#include <camel/camel-provider.h>
struct _EAccount;
struct _EAccountList;
@@ -96,7 +96,6 @@ void mail_config_write_on_exit (void);
struct _GConfClient *mail_config_get_gconf_client (void);
/* General Accessor functions */
-gboolean mail_config_is_configured (void);
gboolean mail_config_is_corrupt (void);
GSList *mail_config_get_labels (void);
@@ -106,40 +105,17 @@ const char **mail_config_get_allowable_mime_types (void);
void mail_config_service_set_save_passwd (struct _EAccountService *service, gboolean save_passwd);
/* accounts */
-gboolean mail_config_find_account (struct _EAccount *account);
-struct _EAccount *mail_config_get_default_account (void);
-struct _EAccount *mail_config_get_account_by_name (const char *account_name);
-struct _EAccount *mail_config_get_account_by_uid (const char *uid);
struct _EAccount *mail_config_get_account_by_source_url (const char *url);
struct _EAccount *mail_config_get_account_by_transport_url (const char *url);
-struct _EAccountList *mail_config_get_accounts (void);
-void mail_config_add_account (struct _EAccount *account);
-void mail_config_remove_account (struct _EAccount *account);
-void mail_config_set_default_account (struct _EAccount *account);
int mail_config_get_address_count (void);
int mail_config_get_message_limit (void);
gboolean mail_config_get_enable_magic_spacebar (void);
-void mail_config_remove_account_proxies (struct _EAccount *account);
-void mail_config_prune_proxies (void);
-int mail_config_has_proxies (struct _EAccount *account);
-
-struct _EAccountIdentity *mail_config_get_default_identity (void);
struct _EAccountService *mail_config_get_default_transport (void);
-void mail_config_save_accounts (void);
-
/* signatures */
struct _ESignature *mail_config_signature_new (const char *filename, gboolean script, gboolean html);
-struct _ESignature *mail_config_get_signature_by_uid (const char *uid);
-struct _ESignature *mail_config_get_signature_by_name (const char *name);
-
-struct _ESignatureList *mail_config_get_signatures (void);
-void mail_config_add_signature (struct _ESignature *signature);
-void mail_config_remove_signature (struct _ESignature *signature);
-
-void mail_config_save_signatures (void);
char *mail_config_signature_run_script (const char *script);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 402afea97d..a031999714 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -58,6 +58,7 @@
#include <libedataserver/e-data-server-util.h>
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-util-private.h"
#include "em-filter-rule.h"
@@ -475,9 +476,9 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
char *name;
name = g_strstrip(g_strdup(tmp));
- if ((account = mail_config_get_account_by_uid(name))
+ if ((account = e_get_account_by_uid (name))
/* 'old' x-evolution-account stored the name, how silly */
- || (account = mail_config_get_account_by_name(name))) {
+ || (account = e_get_account_by_name (name))) {
if (account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 1a8fb02017..6e2ace004b 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -45,7 +45,9 @@
#include "mail-send-recv.h"
#include "mail-folder-cache.h"
#include "em-event.h"
-#include <e-util/gconf-bridge.h>
+
+#include "e-util/e-account-utils.h"
+#include "e-util/gconf-bridge.h"
#include "e-mail-shell-module.h"
@@ -931,11 +933,11 @@ mail_send_receive (GtkWindow *parent)
if (!camel_session_is_online (session))
return send_recv_dialog;
- account = mail_config_get_default_account ();
+ account = e_get_default_account ();
if (!account || !account->transport->url)
return send_recv_dialog;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
outbox_folder = e_mail_shell_module_get_folder (
mail_shell_module, E_MAIL_FOLDER_OUTBOX);
@@ -1076,7 +1078,7 @@ auto_online(CamelObject *o, void *ed, void *d)
if (!GPOINTER_TO_INT(ed))
return;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) {
info = g_object_get_data((GObject *)e_iterator_get(iter), "mail-autoreceive");
if (info && info->timeout_id)
@@ -1095,7 +1097,7 @@ mail_autoreceive_init (CamelSession *session)
if (auto_active)
return;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
auto_active = g_hash_table_new(g_str_hash, g_str_equal);
g_signal_connect(accounts, "account-added", G_CALLBACK(auto_account_added), NULL);
diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c
index 912182f5ac..511942ca77 100644
--- a/mail/mail-signature-editor.c
+++ b/mail/mail-signature-editor.c
@@ -27,7 +27,7 @@
#include <glib/gi18n.h>
#include <e-util/e-error.h>
-#include <e-util/e-signature-list.h>
+#include <e-util/e-signature-utils.h>
#include <composer/e-msg-composer.h>
#include "mail-config.h"
@@ -147,7 +147,7 @@ action_save_and_close_cb (GtkAction *action,
return;
}
- signature_list = mail_config_get_signatures ();
+ signature_list = e_get_signature_list ();
signature_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
g_strstrip (signature_name);
@@ -181,8 +181,10 @@ action_save_and_close_cb (GtkAction *action,
if (editor->priv->signature != NULL)
e_signature_list_change (signature_list, signature);
- else
- mail_config_add_signature (signature);
+ else {
+ e_signature_list_add (signature_list, signature);
+ e_signature_list_save (signature_list);
+ }
gtk_widget_destroy (GTK_WIDGET (editor));
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 19d3f23061..817b647dd7 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -35,6 +35,7 @@
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
+#include "e-util/e-account-utils.h"
#include "em-folder-tree-model.h"
#include "em-utils.h"
@@ -231,7 +232,7 @@ vfolder_adduri_desc (struct _adduri_msg *m)
else
uid = g_strdup_printf("%s@%s", url->user, url->host);
- account = e_account_list_find(mail_config_get_accounts(), E_ACCOUNT_FIND_UID, uid);
+ account = e_get_account_by_uid (uid);
g_free(uid);
if (account != NULL)
loc = account->name;
@@ -373,7 +374,7 @@ uri_is_ignore(CamelStore *store, const char *uri)
if (found)
return found;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
char *curi;
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index 46210d0956..64653a073a 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -43,6 +43,7 @@
#include <e-util/e-error.h>
#include <e-util/e-icon-factory.h>
#include <e-util/e-util-private.h>
+#include <e-util/e-account-utils.h>
#include <e-gw-container.h>
#include <e-gw-connection.h>
@@ -302,7 +303,7 @@ proxy_login_cb (GtkDialog *dialog, gint state)
static void
proxy_soap_login (char *email)
{
- EAccountList *accounts = mail_config_get_accounts();
+ EAccountList *accounts = e_get_account_list ();
EAccount *srcAccount;
EAccount *dstAccount;
EGwConnection *proxy_cnc, *cnc;
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index e3d20334b9..f3fb94967d 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -31,8 +31,7 @@
#include <gtk/gtk.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
+#include "e-util/e-account-utils.h"
#include <camel/camel-url.h>
#include <camel/camel-exception.h>
@@ -84,7 +83,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
if (g_str_has_prefix (account->source->url, "imap://") ||
(use_imap && g_str_has_prefix (account->source->url, "groupwise://"))) {
EAccount *temp = NULL;
- EAccountList *accounts = mail_config_get_accounts ();
+ EAccountList *accounts = e_get_account_list ();
CamelURL *url = NULL;
CamelException ex;
GtkTreeModel *model;
diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h
index 6c9bfabeb6..41d9d94ec5 100644
--- a/shell/e-shell-settings.h
+++ b/shell/e-shell-settings.h
@@ -78,6 +78,7 @@ void e_shell_settings_bind_to_gconf (EShellSettings *shell_settings,
const gchar *gconf_key);
/* Getters and setters for common EShellSettings property types.
+ * These are more convenient than g_object_get() / g_object_set().
* Add more types as needed. If GObject ever adds similar functions,
* kill these. */
@@ -96,6 +97,11 @@ gchar * e_shell_settings_get_string (EShellSettings *shell_settings,
void e_shell_settings_set_string (EShellSettings *shell_settings,
const gchar *property_name,
const gchar *v_string);
+gpointer e_shell_settings_get_object (EShellSettings *shell_settings,
+ const gchar *property_name);
+void e_shell_settings_set_object (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gpointer v_object);
G_END_DECLS