aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capplet/settings/mail-account-view.c1
-rw-r--r--capplet/settings/mail-settings-view.c1
-rw-r--r--configure.ac2
-rw-r--r--doc/reference/shell/eshell-sections.txt4
-rw-r--r--doc/reference/shell/tmpl/e-account-utils.sgml36
-rw-r--r--e-util/e-account-utils.c176
-rw-r--r--e-util/e-account-utils.h5
-rw-r--r--mail/e-mail-migrate.c1
-rw-r--r--mail/e-mail-reader-utils.c1
-rw-r--r--mail/e-mail-reader.c1
-rw-r--r--mail/e-mail-session.c7
-rw-r--r--mail/em-account-editor.c1
-rw-r--r--mail/em-composer-utils.c5
-rw-r--r--mail/em-folder-properties.c1
-rw-r--r--mail/em-folder-selection-button.c4
-rw-r--r--mail/em-folder-tree-model.c3
-rw-r--r--mail/em-folder-tree.c3
-rw-r--r--mail/em-folder-utils.c1
-rw-r--r--mail/em-format-html-display.c2
-rw-r--r--mail/em-utils.c7
-rw-r--r--mail/mail-config.c113
-rw-r--r--mail/mail-config.h9
-rw-r--r--mail/mail-send-recv.c3
-rw-r--r--mail/mail-vfolder.c1
-rw-r--r--mail/message-list.c3
-rw-r--r--modules/mail/e-mail-shell-content.c1
-rw-r--r--modules/mail/e-mail-shell-view-actions.c4
-rw-r--r--modules/mail/e-mail-shell-view-private.h1
-rw-r--r--modules/mail/e-mail-shell-view.c2
-rw-r--r--modules/mail/em-composer-prefs.c1
-rw-r--r--modules/mail/em-mailer-prefs.c1
-rw-r--r--modules/mail/em-network-prefs.c1
-rw-r--r--plugins/external-editor/external-editor.c1
-rw-r--r--plugins/groupwise-features/install-shared.c4
-rw-r--r--plugins/groupwise-features/proxy-login.c5
-rw-r--r--plugins/groupwise-features/share-folder-common.c4
-rw-r--r--plugins/imap-features/imap-headers.c3
-rw-r--r--plugins/mail-notification/mail-notification.c3
-rw-r--r--plugins/mail-to-task/mail-to-task.c1
-rw-r--r--plugins/mailing-list-actions/mailing-list-actions.c4
40 files changed, 251 insertions, 176 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index 8001e8ffce..1f53007b33 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -32,7 +32,6 @@
#include <libedataserver/e-account-list.h>
#include "mail-view.h"
#include "e-util/e-config.h"
-#include "mail/mail-config.h"
#include "mail/e-mail-session.h"
#include "mail-guess-servers.h"
diff --git a/capplet/settings/mail-settings-view.c b/capplet/settings/mail-settings-view.c
index 2c3d56d0e1..793ee545f5 100644
--- a/capplet/settings/mail-settings-view.c
+++ b/capplet/settings/mail-settings-view.c
@@ -28,7 +28,6 @@
#include "mail-settings-view.h"
#include <libedataserver/e-account-list.h>
#include "mail-view.h"
-#include "mail/mail-config.h"
#include <e-util/e-account-utils.h>
struct _MailSettingsViewPrivate {
diff --git a/configure.ac b/configure.ac
index cf71456d2b..d6fdd83685 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1284,7 +1284,7 @@ AC_SUBST(CERT_UI_LIBS)
dnl ************
dnl E_UTIL Flags
dnl ************
-EVO_SET_COMPILE_FLAGS(E_UTIL, $LIBEDATASERVERUI camel-1.2 $mozilla_nspr, $MANUAL_NSPR_CFLAGS $MANUAL_NSPR_LIBS)
+EVO_SET_COMPILE_FLAGS(E_UTIL, $LIBEDATASERVERUI camel-provider-1.2 $mozilla_nspr, $MANUAL_NSPR_CFLAGS $MANUAL_NSPR_LIBS)
AC_SUBST(E_UTIL_CFLAGS)
AC_SUBST(E_UTIL_LIBS)
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index 577a98d481..f5163458c9 100644
--- a/doc/reference/shell/eshell-sections.txt
+++ b/doc/reference/shell/eshell-sections.txt
@@ -435,6 +435,10 @@ e_get_default_account
e_set_default_account
e_get_account_by_name
e_get_account_by_uid
+e_get_account_by_source_url
+e_get_account_by_transport_url
+e_get_any_enabled_account
+e_get_default_transport
</SECTION>
<SECTION>
diff --git a/doc/reference/shell/tmpl/e-account-utils.sgml b/doc/reference/shell/tmpl/e-account-utils.sgml
index c0bdd3aebf..afce2e742f 100644
--- a/doc/reference/shell/tmpl/e-account-utils.sgml
+++ b/doc/reference/shell/tmpl/e-account-utils.sgml
@@ -64,3 +64,39 @@ Mail Accounts
@Returns:
+<!-- ##### FUNCTION e_get_account_by_source_url ##### -->
+<para>
+
+</para>
+
+@source_url:
+@Returns:
+
+
+<!-- ##### FUNCTION e_get_account_by_transport_url ##### -->
+<para>
+
+</para>
+
+@transport_url:
+@Returns:
+
+
+<!-- ##### FUNCTION e_get_any_enabled_account ##### -->
+<para>
+
+</para>
+
+@void:
+@Returns:
+
+
+<!-- ##### FUNCTION e_get_default_transport ##### -->
+<para>
+
+</para>
+
+@void:
+@Returns:
+
+
diff --git a/e-util/e-account-utils.c b/e-util/e-account-utils.c
index 66242408ac..1590c98bfb 100644
--- a/e-util/e-account-utils.c
+++ b/e-util/e-account-utils.c
@@ -22,10 +22,31 @@
#include "e-account-utils.h"
+#include <camel/camel.h>
#include <gconf/gconf-client.h>
static EAccountList *global_account_list;
+static gboolean
+account_has_source_url (EAccount *account)
+{
+ return (account != NULL) &&
+ (account->enabled) &&
+ (account->source != NULL) &&
+ (account->source->url != NULL) &&
+ (account->source->url[0] != '\0');
+}
+
+static gboolean
+account_has_transport_url (EAccount *account)
+{
+ return (account != NULL) &&
+ (account->enabled) &&
+ (account->transport != NULL) &&
+ (account->transport->url != NULL) &&
+ (account->transport->url[0] != '\0');
+}
+
/**
* e_get_account_list:
*
@@ -139,6 +160,122 @@ e_get_account_by_uid (const gchar *uid)
}
/**
+ * e_get_account_by_source_url:
+ * @source_url: a source URL
+ *
+ * Returns the #EAccount with the given source URL, or %NULL if no such
+ * account exists.
+ *
+ * Returns: an #EAccount having the given source URL, or %NULL
+ **/
+EAccount *
+e_get_account_by_source_url (const gchar *source_url)
+{
+ EAccountList *account_list;
+ EAccount *account = NULL;
+ EIterator *iterator;
+ CamelProvider *provider;
+ CamelURL *source_curl;
+
+ g_return_val_if_fail (source_url != NULL, NULL);
+
+ source_curl = camel_url_new (source_url, NULL);
+ g_return_val_if_fail (source_curl != NULL, NULL);
+
+ provider = camel_provider_get (source_url, NULL);
+ g_return_val_if_fail (provider != NULL, NULL);
+ g_return_val_if_fail (provider->url_equal != NULL, NULL);
+
+ account_list = e_get_account_list ();
+ iterator = e_list_get_iterator (E_LIST (account_list));
+
+ while (account == NULL && e_iterator_is_valid (iterator)) {
+ EAccount *candidate;
+ CamelURL *curl;
+
+ /* XXX EIterator misuses const. */
+ candidate = (EAccount *) e_iterator_get (iterator);
+
+ e_iterator_next (iterator);
+
+ if (!account_has_source_url (candidate))
+ continue;
+
+ curl = camel_url_new (candidate->source->url, NULL);
+ if (curl == NULL)
+ continue;
+
+ if (provider->url_equal (curl, source_curl))
+ account = candidate;
+
+ camel_url_free (curl);
+ }
+
+ g_object_unref (iterator);
+ camel_url_free (source_curl);
+
+ return account;
+}
+
+/**
+ * e_get_account_by_transport_url:
+ * @transport_url: a transport URL
+ *
+ * Returns the #EAccount with the given transport URL, or %NULL if no
+ * such account exists.
+ *
+ * Returns: an #EAccount having the given transport URL, or %NULL
+ **/
+EAccount *
+e_get_account_by_transport_url (const gchar *transport_url)
+{
+ EAccountList *account_list;
+ EAccount *account = NULL;
+ EIterator *iterator;
+ CamelProvider *provider;
+ CamelURL *transport_curl;
+
+ g_return_val_if_fail (transport_url != NULL, NULL);
+
+ transport_curl = camel_url_new (transport_url, NULL);
+ g_return_val_if_fail (transport_curl != NULL, NULL);
+
+ provider = camel_provider_get (transport_url, NULL);
+ g_return_val_if_fail (provider != NULL, NULL);
+ g_return_val_if_fail (provider->url_equal != NULL, NULL);
+
+ account_list = e_get_account_list ();
+ iterator = e_list_get_iterator (E_LIST (account_list));
+
+ while (account == NULL && e_iterator_is_valid (iterator)) {
+ EAccount *candidate;
+ CamelURL *curl;
+
+ /* XXX EIterator misuses const. */
+ candidate = (EAccount *) e_iterator_get (iterator);
+
+ e_iterator_next (iterator);
+
+ if (!account_has_transport_url (candidate))
+ continue;
+
+ curl = camel_url_new (candidate->transport->url, NULL);
+ if (curl == NULL)
+ continue;
+
+ if (provider->url_equal (curl, transport_curl))
+ account = candidate;
+
+ camel_url_free (curl);
+ }
+
+ g_object_unref (iterator);
+ camel_url_free (transport_curl);
+
+ return account;
+}
+
+/**
* e_get_any_enabled_account:
*
* Returns the default mail account if it's enabled, otherwise the first
@@ -179,3 +316,42 @@ e_get_any_enabled_account (void)
return account;
}
+
+/**
+ * e_get_default_transport:
+ *
+ * Returns transport information for the default account if it's enabled and
+ * has transport information, or else from the first enabled mail account in
+ * the global #EAccountList that has transport information, or finally %NULL
+ * if no transport information could be found.
+ *
+ * Returns: an #EAccountService with transport info, or %NULL
+ **/
+EAccountService *
+e_get_default_transport (void)
+{
+ EAccountList *account_list;
+ EAccount *account;
+ EIterator *iterator;
+
+ account = e_get_default_account ();
+ if (account_has_transport_url (account))
+ return account->transport;
+
+ account_list = e_get_account_list ();
+ iterator = e_list_get_iterator (E_LIST (account_list));
+
+ while (e_iterator_is_valid (iterator)) {
+ /* XXX EIterator misuses const. */
+ account = (EAccount *) e_iterator_get (iterator);
+ if (account_has_transport_url (account)) {
+ g_object_unref (iterator);
+ return account->transport;
+ }
+ e_iterator_next (iterator);
+ }
+
+ g_object_unref (iterator);
+
+ return NULL;
+}
diff --git a/e-util/e-account-utils.h b/e-util/e-account-utils.h
index f8c5c968a4..0f3fbcbe21 100644
--- a/e-util/e-account-utils.h
+++ b/e-util/e-account-utils.h
@@ -18,7 +18,6 @@
#ifndef E_ACCOUNT_UTILS_H
#define E_ACCOUNT_UTILS_H
-#include <glib.h>
#include <libedataserver/e-account.h>
#include <libedataserver/e-account-list.h>
@@ -29,7 +28,11 @@ 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);
+EAccount * e_get_account_by_source_url (const gchar *source_url);
+EAccount * e_get_account_by_transport_url (const gchar *transport_url);
EAccount * e_get_any_enabled_account (void);
+EAccountService *
+ e_get_default_transport (void);
G_END_DECLS
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index ff3b70476c..0956ccdde7 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -61,7 +61,6 @@
#include "e-mail-store.h"
#include "e-mail-backend.h"
-#include "mail-config.h"
#include "em-utils.h"
#define d(x) x
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 794b25af83..84fdfd8c16 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -38,7 +38,6 @@
#include "mail/em-format-html-print.h"
#include "mail/em-utils.h"
#include "mail/mail-autofilter.h"
-#include "mail/mail-config.h"
#include "mail/mail-ops.h"
#include "mail/mail-tools.h"
#include "mail/mail-vfolder.h"
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 76ec3c5bd6..2cd4969b15 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -47,7 +47,6 @@
#include "mail/em-folder-tree.h"
#include "mail/em-utils.h"
#include "mail/mail-autofilter.h"
-#include "mail/mail-config.h"
#include "mail/mail-ops.h"
#include "mail/mail-mt.h"
#include "mail/mail-vfolder.h"
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index f443007502..481dca8a53 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -47,6 +47,7 @@
#include <libedataserver/e-flag.h>
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util-private.h"
@@ -602,7 +603,7 @@ mail_session_get_password (CamelSession *session,
if (!strcmp(item, "popb4smtp_uri")) {
/* not 100% mt safe, but should be ok */
if (url
- && (account = mail_config_get_account_by_transport_url (url)))
+ && (account = e_get_account_by_transport_url (url)))
ret = g_strdup (account->source->url);
else
ret = g_strdup (url);
@@ -618,9 +619,9 @@ mail_session_get_password (CamelSession *session,
gboolean remember;
if (url) {
- if ((account = mail_config_get_account_by_source_url (url)))
+ if ((account = e_get_account_by_source_url (url)))
config_service = account->source;
- else if ((account = mail_config_get_account_by_transport_url (url)))
+ else if ((account = e_get_account_by_transport_url (url)))
config_service = account->transport;
}
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 85a350747f..0cec4159a8 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -64,7 +64,6 @@
#include "em-account-editor.h"
#include "mail-send-recv.h"
#include "em-utils.h"
-#include "mail-config.h"
#include "mail-ops.h"
#include "mail-mt.h"
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 0dcfa9b14f..9f6e107af4 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -35,7 +35,6 @@
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
-#include "mail-config.h"
#include "mail-send-recv.h"
#include "e-util/e-account-utils.h"
@@ -816,7 +815,7 @@ create_new_composer (EShell *shell,
if (from_uri != NULL) {
GList *list;
- account = mail_config_get_account_by_source_url (from_uri);
+ account = e_get_account_by_source_url (from_uri);
list = g_list_prepend (NULL, (gpointer) from_uri);
e_composer_header_table_set_post_to_list (table, list);
@@ -881,7 +880,7 @@ em_utils_compose_new_message_with_mailto (EShell *shell,
table = e_msg_composer_get_header_table (composer);
if (from_uri
- && (account = mail_config_get_account_by_source_url (from_uri)))
+ && (account = e_get_account_by_source_url (from_uri)))
e_composer_header_table_set_account_name (table, account->name);
composer_set_no_change (composer);
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index dbec0963f5..8679fd1dc1 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -39,7 +39,6 @@
#include "mail-ops.h"
#include "mail-mt.h"
#include "mail-vfolder.h"
-#include "mail-config.h"
struct _prop_data {
gpointer object;
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index d6bcd34a29..fd9e63dc8f 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -27,8 +27,8 @@
#include <string.h>
#include <glib/gi18n.h>
#include <e-util/e-util.h>
+#include <e-util/e-account-utils.h>
-#include "mail-config.h"
#include "em-folder-tree.h"
#include "em-folder-selector.h"
#include "em-utils.h"
@@ -100,7 +100,7 @@ folder_selection_button_set_contents (EMFolderSelectionButton *button)
return;
}
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
if (account != NULL) {
gchar *tmp = folder_name;
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 9da5711cf0..ac147c43fd 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
-#include "mail-config.h"
#include "mail-tools.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -1073,7 +1072,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model,
uri = camel_url_to_string (
((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
/* Add the store to the tree. */
gtk_tree_store_append (tree_store, &iter, NULL);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 1f4500cc86..46f08e06fa 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -52,7 +52,6 @@
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
-#include "mail-config.h"
#include "mail-send-recv.h"
#include "mail-vfolder.h"
@@ -2548,7 +2547,7 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree,
/* This makes sure all our parents up to the root are
* expanded. FIXME: Why does the expanded state store
* this made up path rather than the euri? */
- if ((account = mail_config_get_account_by_source_url (u->uri)))
+ if ((account = e_get_account_by_source_url (u->uri)))
expand_key = g_strdup_printf ("%s/%s", account->uid, path);
else if (CAMEL_IS_VEE_STORE (u->store))
expand_key = g_strdup_printf ("vfolder/%s", path);
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index cae91af14f..82f3de6fcf 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -48,7 +48,6 @@
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
-#include "mail-config.h"
#include "mail-vfolder.h"
#include "mail-folder-cache.h"
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index e2f6e90a92..24f8aa5638 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -55,8 +55,6 @@
#include "e-cert-db.h"
#endif
-#include "mail-config.h"
-
#include "e-mail-display.h"
#include "e-mail-attachment-bar.h"
#include "em-format-html-display.h"
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 3fcc530c51..9e96abbec4 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -53,7 +53,6 @@
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
-#include "mail-config.h"
#include "e-mail-tag-editor.h"
#include <libedataserver/e-data-server-util.h>
@@ -1398,7 +1397,7 @@ gchar *em_uri_from_camel (const gchar *curi)
if (strcmp(curl->protocol, "vfolder") == 0)
uid = "vfolder@local";
- else if ((account = mail_config_get_account_by_source_url (curi)) == NULL)
+ else if ((account = e_get_account_by_source_url (curi)) == NULL)
uid = "local@local";
else
uid = account->uid;
@@ -2081,7 +2080,7 @@ guess_account_from_folder (CamelFolder *folder)
service = CAMEL_SERVICE (parent_store);
source_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL);
- account = mail_config_get_account_by_source_url (source_url);
+ account = e_get_account_by_source_url (source_url);
g_free (source_url);
return account;
@@ -2096,7 +2095,7 @@ guess_account_from_message (CamelMimeMessage *message)
if (source_url == NULL)
return NULL;
- return mail_config_get_account_by_source_url (source_url);
+ return e_get_account_by_source_url (source_url);
}
GHashTable *
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 31630836b0..1789a17423 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -283,119 +283,6 @@ mail_config_get_sync_timeout (void)
return res;
}
-static EAccount *
-mc_get_account_by (const gchar *given_url, const gchar * (get_url_string)(EAccount *account))
-{
- EAccountList *account_list;
- EAccount *account = NULL;
- EIterator *iter;
- CamelURL *url;
- CamelProvider *provider;
-
- g_return_val_if_fail (given_url != NULL, NULL);
- g_return_val_if_fail (get_url_string != NULL, NULL);
-
- url = camel_url_new (given_url, NULL);
- g_return_val_if_fail (url != NULL, NULL);
-
- provider = camel_provider_get (given_url, NULL);
- g_return_val_if_fail (provider != NULL && provider->url_equal != NULL, NULL);
-
- 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;
- const gchar *account_url_string;
-
- account = (EAccount *) e_iterator_get (iter);
-
- e_iterator_next (iter);
-
- account_url_string = get_url_string (account);
-
- if ( !account_url_string || !*account_url_string) {
- account = NULL;
- continue;
- }
-
- account_url = camel_url_new (account_url_string, NULL);
- if (account_url == NULL) {
- account = NULL;
- continue;
- }
-
- if (!provider->url_equal (url, account_url))
- account = NULL; /* not a match */
-
- camel_url_free (account_url);
- }
-
- g_object_unref (iter);
- camel_url_free (url);
-
- return account;
-}
-
-static const gchar *
-get_source_url_string (EAccount *account)
-{
- if (account && account->source && account->source->url && *account->source->url)
- return account->source->url;
- return NULL;
-}
-
-static const gchar *
-get_transport_url_string (EAccount *account)
-{
- if (account && account->transport && account->transport->url && *account->transport->url)
- return account->transport->url;
- return NULL;
-}
-
-EAccount *
-mail_config_get_account_by_source_url (const gchar *source_url)
-{
- return mc_get_account_by (source_url, get_source_url_string);
-}
-
-EAccount *
-mail_config_get_account_by_transport_url (const gchar *transport_url)
-{
- return mc_get_account_by (transport_url, get_transport_url_string);
-}
-
-EAccountService *
-mail_config_get_default_transport (void)
-{
- EAccountList *account_list;
- EAccount *account;
- EIterator *iter;
-
- 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 *) account_list);
- while (e_iterator_is_valid (iter)) {
- account = (EAccount *) e_iterator_get (iter);
-
- if (account->enabled && account->transport && account->transport->url && account->transport->url[0]) {
- g_object_unref (iter);
-
- return account->transport;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
- return NULL;
-}
-
static gchar *
uri_to_evname (const gchar *uri, const gchar *prefix)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 6285fe0da7..51ed266f4a 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -68,17 +68,8 @@ void mail_config_write (void);
/* General Accessor functions */
-/* accounts */
-EAccount * mail_config_get_account_by_source_url
- (const gchar *url);
-EAccount * mail_config_get_account_by_transport_url
- (const gchar *url);
-
gint mail_config_get_address_count (void);
-EAccountService *
- mail_config_get_default_transport (void);
-
/* static utility functions */
gchar * mail_config_folder_to_cachename (CamelFolder *folder,
const gchar *prefix);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index e2c70861b6..88993d7b8d 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -39,7 +39,6 @@
#include "e-mail-session.h"
#include "em-event.h"
#include "em-filter-rule.h"
-#include "mail-config.h"
#include "mail-folder-cache.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -1337,7 +1336,7 @@ mail_send (EMailSession *session)
struct _send_data *data;
send_info_t type;
- transport = mail_config_get_default_transport ();
+ transport = e_get_default_transport ();
if (!transport || !transport->url)
return;
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 90f6209c90..a47b422f46 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -41,7 +41,6 @@
#include "em-vfolder-editor.h"
#include "em-vfolder-rule.h"
#include "mail-autofilter.h"
-#include "mail-config.h"
#include "mail-folder-cache.h"
#include "mail-mt.h"
#include "mail-ops.h"
diff --git a/mail/message-list.c b/mail/message-list.c
index 137215fe2e..31a3221d23 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -36,6 +36,7 @@
#include <gconf/gconf-client.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-icon-factory.h"
#include "e-util/e-poolv.h"
#include "e-util/e-profile-event.h"
@@ -1658,7 +1659,7 @@ ml_tree_value_at_ex (ETreeModel *etm,
uri = camel_folder_get_uri (folder);
euri = em_uri_from_camel (uri);
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
if (account) {
curl = camel_url_new (uri, NULL);
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 31f60834e5..b28b02eee0 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -33,7 +33,6 @@
#include "widgets/misc/e-search-bar.h"
#include "em-utils.h"
-#include "mail-config.h"
#include "mail-ops.h"
#include "message-list.h"
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 7548b5e54a..74af7904da 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -72,7 +72,7 @@ action_mail_account_disable_cb (GtkAction *action,
g_return_if_fail (folder_uri != NULL);
account_list = e_get_account_list ();
- account = mail_config_get_account_by_source_url (folder_uri);
+ account = e_get_account_by_source_url (folder_uri);
g_return_if_fail (account != NULL);
if (e_account_list_account_has_proxies (account_list, account))
@@ -1066,7 +1066,7 @@ action_mail_tools_subscriptions_cb (GtkAction *action,
uri = em_folder_tree_get_selected_uri (folder_tree);
if (uri != NULL) {
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
g_free (uri);
}
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index bb56a9e27e..92f00d4eb9 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -53,7 +53,6 @@
#include "em-subscription-editor.h"
#include "em-utils.h"
#include "mail-autofilter.h"
-#include "mail-config.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
#include "mail-tools.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index cdfdd59c5c..557d206c36 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -910,7 +910,7 @@ mail_shell_view_update_actions (EShellView *shell_view)
folder_tree_and_message_list_agree =
(g_strcmp0 (uri, folder_uri) == 0);
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
/* FIXME This belongs in a GroupWise plugin. */
account_is_groupwise =
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 2ae67cb955..843cfff5e6 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -50,7 +50,6 @@
#include "widgets/misc/e-signature-manager.h"
#include "widgets/misc/e-signature-preview.h"
-#include "mail-config.h"
#include "em-config.h"
#include "em-folder-selection-button.h"
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index f0f8e42a35..522138a134 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -46,7 +46,6 @@
#include "e-mail-backend.h"
#include "e-mail-label-manager.h"
#include "e-mail-reader-utils.h"
-#include "mail-config.h"
#include "em-folder-selection-button.h"
#include "em-junk.h"
#include "em-config.h"
diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c
index 9d4ff9618e..f216d81c28 100644
--- a/modules/mail/em-network-prefs.c
+++ b/modules/mail/em-network-prefs.c
@@ -40,7 +40,6 @@
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
-#include "mail-config.h"
#include "em-config.h"
#include "em-folder-selection-button.h"
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c
index 5e0de2f285..97ddc5b8a2 100644
--- a/plugins/external-editor/external-editor.c
+++ b/plugins/external-editor/external-editor.c
@@ -28,7 +28,6 @@
#include <mail/em-config.h>
#include <mail/em-composer-utils.h>
-#include <mail/mail-config.h>
#include <e-util/e-alert-dialog.h>
#include <e-msg-composer.h>
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index b216d49085..0a7cd1ace5 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -30,12 +30,12 @@
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include <e-util/e-config.h>
+#include <e-util/e-account-utils.h>
#include <shell/e-shell.h>
#include <mail/e-mail-backend.h>
#include <mail/em-config.h>
#include <mail/em-event.h>
#include <mail/em-folder-tree.h>
-#include <mail/mail-config.h>
#include <mail/em-folder-selector.h>
#include <e-gw-connection.h>
#include <share-folder.h>
@@ -118,7 +118,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
camel_folder_summary_touch (folder->summary);
/* camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", changes); */
uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
uri = account->source->url;
em_folder_tree_model_remove_store (model, store);
provider = camel_provider_get (uri, NULL);
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index 74b67f0ef5..e40771295b 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -32,7 +32,6 @@
#include <mail/em-folder-tree.h>
#include <mail/e-mail-backend.h>
#include <mail/e-mail-store.h>
-#include <mail/mail-config.h>
#include <mail/em-folder-selector.h>
#include <mail/em-account-editor.h>
#include <mail/mail-ops.h>
@@ -524,7 +523,7 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
}
/* This pops-up the password dialog in case the User has forgot-passwords explicitly */
- cnc = proxy_login_get_cnc (mail_config_get_account_by_source_url (uri), NULL);
+ cnc = proxy_login_get_cnc (e_get_account_by_source_url (uri), NULL);
if (cnc)
g_object_unref (cnc);
@@ -535,7 +534,7 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
e_load_ui_builder_definition (priv->builder, "proxy-login-dialog.ui");
priv->main = e_builder_get_widget (priv->builder, "proxy_login_dialog");
- pld->account = mail_config_get_account_by_source_url (uri);
+ pld->account = e_get_account_by_source_url (uri);
priv->tree = GTK_TREE_VIEW (e_builder_get_widget (priv->builder, "proxy_login_treeview"));
priv->store = gtk_tree_store_new (2,
GDK_TYPE_PIXBUF,
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 10b0c4c622..61cace9565 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -29,13 +29,13 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <e-util/e-config.h>
+#include <e-util/e-account-utils.h>
#include <mail/e-mail-backend.h>
#include <mail/em-config.h>
#include <mail/em-folder-properties.h>
#include <mail/em-folder-tree.h>
#include <mail/em-folder-selector.h>
#include <mail/mail-mt.h>
-#include <mail/mail-config.h>
#include <mail/mail-vfolder.h>
#include <mail/em-utils.h>
#include <mail/em-vfolder-rule.h>
@@ -71,7 +71,7 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
CamelProvider *provider;
uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
- account = mail_config_get_account_by_source_url (uri);
+ account = e_get_account_by_source_url (uri);
if (!account) {
return;
}
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index ad2757f683..9ec5fb923e 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -27,7 +27,6 @@
#include <string.h>
#include <mail/em-config.h>
-#include <mail/mail-config.h>
#include <gtk/gtk.h>
@@ -95,7 +94,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
str = g_string_new("");
- temp = mail_config_get_account_by_source_url (account->source->url);
+ temp = e_get_account_by_source_url (account->source->url);
url = camel_url_new (e_account_get_string (account, E_ACCOUNT_SOURCE_URL), NULL);
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index b83a1bf272..f8fd766cb1 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -38,6 +38,7 @@
#include <time.h>
#include <e-util/e-config.h>
+#include <e-util/e-account-utils.h>
#include <e-util/gconf-bridge.h>
#include <mail/em-utils.h>
#include <mail/em-event.h>
@@ -490,7 +491,7 @@ new_notify_status (EMEventTargetFolder *t)
EAccount *account;
gchar *name = t->name;
- account = mail_config_get_account_by_source_url (t->uri);
+ account = e_get_account_by_source_url (t->uri);
if (account != NULL) {
name = g_strdup_printf (
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 7f2ee1ea04..794badc969 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -41,7 +41,6 @@
#include <mail/e-mail-browser.h>
#include <mail/em-utils.h>
#include <mail/em-format-html.h>
-#include <mail/mail-config.h>
#include <mail/message-list.h>
#include <e-util/e-account-utils.h>
#include <e-util/e-dialog-utils.h>
diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c
index 8b123e7d02..fd3ae6c0fa 100644
--- a/plugins/mailing-list-actions/mailing-list-actions.c
+++ b/plugins/mailing-list-actions/mailing-list-actions.c
@@ -39,9 +39,9 @@
#include "mail/em-utils.h"
#include "mail/mail-ops.h"
#include "mail/mail-mt.h"
-#include "mail/mail-config.h"
#include "mail/message-list.h"
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "shell/e-shell-view.h"
#include "shell/e-shell-window.h"
@@ -181,7 +181,7 @@ emla_list_action_do (CamelFolder *folder,
if (send_message_response == GTK_RESPONSE_YES) {
/* directly send message */
composer = e_msg_composer_new_from_url (shell, url);
- if ((account = mail_config_get_account_by_source_url (action_data->uri)))
+ if ((account = e_get_account_by_source_url (action_data->uri)))
e_composer_header_table_set_account (
e_msg_composer_get_header_table (composer),
account);