aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-15 22:18:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-08-15 23:56:26 +0800
commite656e749f05ed92c2d5ff73cd2da9e39f05ae1a0 (patch)
treecafc783279bfd7e54f22f29b374c7f3a40f9a58d /mail
parent91656b8edc871487fe0930675d3d4d733cfc38e0 (diff)
downloadgsoc2013-evolution-e656e749f05ed92c2d5ff73cd2da9e39f05ae1a0.tar.gz
gsoc2013-evolution-e656e749f05ed92c2d5ff73cd2da9e39f05ae1a0.tar.zst
gsoc2013-evolution-e656e749f05ed92c2d5ff73cd2da9e39f05ae1a0.zip
EMailSession: Configure settings when adding services.
Override CamelSession.add_service(). First chain up, then, if initialization was successful, call camel_settings_load_from_url() on the CamelSettings object in the new CamelService instance. Note that eventually we'll load CamelSettings values from a key file instead of from URL parameters. This is just a temporary measure.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-session.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index 8a3072447a..6c96eca4be 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -782,6 +782,34 @@ mail_session_constructed (GObject *object)
object, "junk-filter-name");
}
+static CamelService *
+mail_session_add_service (CamelSession *session,
+ const gchar *uid,
+ const gchar *url_string,
+ CamelProviderType type,
+ GError **error)
+{
+ CamelService *service;
+
+ /* Chain up to parents add_service() method. */
+ service = CAMEL_SESSION_CLASS (e_mail_session_parent_class)->
+ add_service (session, uid, url_string, type, error);
+
+ /* Initialize the CamelSettings object from CamelURL parameters.
+ * This is temporary; soon we'll read settings from key files. */
+
+ if (CAMEL_IS_SERVICE (service)) {
+ CamelSettings *settings;
+ CamelURL *url;
+
+ settings = camel_service_get_settings (service);
+ url = camel_service_get_camel_url (service);
+ camel_settings_load_from_url (settings, url);
+ }
+
+ return service;
+}
+
static gchar *
mail_session_get_password (CamelSession *session,
CamelService *service,
@@ -1112,6 +1140,7 @@ e_mail_session_class_init (EMailSessionClass *class)
object_class->constructed = mail_session_constructed;
session_class = CAMEL_SESSION_CLASS (class);
+ session_class->add_service = mail_session_add_service;
session_class->get_password = mail_session_get_password;
session_class->forget_password = mail_session_forget_password;
session_class->alert_user = mail_session_alert_user;