[evolution-ews/gnome-2-28: 1/6] Ews Plugin 2.28 Backport



commit 7bd4ecce2291fcc7c507bee73668d5726a02b38d
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Thu Aug 11 07:00:17 2011 +0530

    Ews Plugin 2.28 Backport

 configure.ac                                       |    9 +-
 src/account-setup-eplugin/Makefile.am              |    6 +-
 src/account-setup-eplugin/ews-plugin-compat.c      |   65 ++++
 src/account-setup-eplugin/ews-plugin-compat.h      |   31 ++
 .../exchange-ews-account-listener.c                |   22 +-
 .../exchange-ews-account-setup.c                   |    6 +-
 src/addressbook/e-book-backend-ews-gal.c           |  135 ++++----
 src/addressbook/e-book-backend-ews-utils.c         |    7 +-
 src/addressbook/e-book-backend-ews.c               |  170 +++++----
 src/addressbook/e-book-backend-sqlitedb.c          |    4 +-
 src/addressbook/ews-oab-decoder.c                  |    1 +
 src/calendar/e-cal-backend-ews.c                   |  350 ++++++++++---------
 src/camel/camel-ews-folder.c                       |  262 ++++++++++----
 src/camel/camel-ews-folder.h                       |   27 +-
 src/camel/camel-ews-store-summary.c                |   27 +-
 src/camel/camel-ews-store-summary.h                |    4 +-
 src/camel/camel-ews-store.c                        |  200 +++++++++--
 src/camel/camel-ews-store.h                        |   27 +--
 src/camel/camel-ews-summary.c                      |   73 ++---
 src/camel/camel-ews-summary.h                      |   27 +-
 src/camel/camel-ews-transport.c                    |   36 ++-
 src/camel/camel-ews-transport.h                    |   25 +-
 src/camel/camel-ews-utils.c                        |    8 +-
 src/server/Makefile.am                             |    4 +-
 src/server/e-ews-connection.c                      |    1 +
 src/server/e-soap-message.c                        |    1 +
 src/server/tests/Makefile.am                       |    1 -
 src/server/tests/test-autocompletion.c             |    1 -
 src/server/tests/test-createfolder.c               |    1 -
 src/server/tests/test-cuditem.c                    |    1 -
 src/server/tests/test-deletefolder.c               |    1 -
 src/server/tests/test-libews.c                     |    5 +-
 src/server/tests/test-syncfolder.c                 |    1 -
 src/utils/Makefile.am                              |    2 +
 src/utils/ews-camel-common.c                       |    9 +-
 src/utils/ews-camel-compat.c                       |  373 ++++++++++++++++++++
 src/utils/ews-camel-compat.h                       |  168 +++++++++
 37 files changed, 1489 insertions(+), 602 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 32f6b61..d556d5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,11 +23,11 @@ EDS_PACKAGE=1.2
 dnl *******************
 dnl Required Packages
 dnl *******************
-m4_define([eds_minimum_version], [2.31.1])
-m4_define([evo_minimum_version], [2.31.1])
+m4_define([eds_minimum_version], [2.28.2])
+m4_define([evo_minimum_version], [2.28.2])
 m4_define([glib_minimum_version], [2.16.1])
 m4_define([gconf_minimum_version], [2.0.0])
-m4_define([libsoup_minimum_version], [2.30])
+m4_define([libsoup_minimum_version], [2.28])
 
 
 dnl ***********************************
@@ -93,6 +93,7 @@ AS_COMPILER_FLAGS(WARNING_FLAGS,
 	-Wmissing-declarations -Wmissing-include-dirs
 	-Wmissing-noreturn -Wnested-externs -Wpointer-arith
 	-Wundef -Wwrite-strings -Werror")
+
 AC_SUBST(WARNING_FLAGS)
 
 dnl Other useful compiler warnings for test builds only.
@@ -156,7 +157,7 @@ else
 	EVO_PLUGIN_PACKAGE="evolution-plugin"
 	EVO_SHELL_PACKAGE="evolution-shell"
 	EDS_UI_PACKAGE="libedataserverui-$EDS_PACKAGE"
-	gtk_minimum_version="2.20.0"
+	gtk_minimum_version="2.18.0"
 
 	extensiondir=`$PKG_CONFIG --variable=extensiondir evolution-data-server-$EDS_PACKAGE`
 	AC_SUBST(extensiondir)
diff --git a/src/account-setup-eplugin/Makefile.am b/src/account-setup-eplugin/Makefile.am
index 2e529a6..3926217 100644
--- a/src/account-setup-eplugin/Makefile.am
+++ b/src/account-setup-eplugin/Makefile.am
@@ -26,8 +26,10 @@ plugin_DATA = org-gnome-exchange-ews.eplug
 plugin_LTLIBRARIES = liborg-gnome-exchange-ews.la
 
 liborg_gnome_exchange_ews_la_SOURCES = 		\
-	exchange-ews-account-setup.c			\
-	exchange-ews-account-setup.h			\
+	ews-plugin-compat.c			\
+	ews-plugin-compat.h			\
+	exchange-ews-account-setup.c		\
+	exchange-ews-account-setup.h		\
 	exchange-ews-account-listener.c		\
 	exchange-ews-account-listener.h
 
diff --git a/src/account-setup-eplugin/ews-plugin-compat.c b/src/account-setup-eplugin/ews-plugin-compat.c
new file mode 100644
index 0000000..0106b51
--- /dev/null
+++ b/src/account-setup-eplugin/ews-plugin-compat.c
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *
+ * Copyright (C) 1999-2011 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#include <libedataserver/eds-version.h>
+#include "ews-plugin-compat.h"
+
+#if EDS_CHECK_VERSION(2,33,0)
+#include <mail/e-mail-session.h>
+#else
+#include <mail/mail-session.h>
+#endif
+
+#if EDS_CHECK_VERSION(2,29,0)
+#include <mail/e-mail-backend.h>
+#include <shell/e-shell.h>
+#endif
+
+CamelSession *
+ews_plugin_get_default_camel_session ()
+{
+#if EDS_CHECK_VERSION(2,33,0)
+	EShell *shell;
+	EShellBackend *shell_backend;
+	CamelSession *session;
+
+	shell = e_shell_get_default ();
+	shell_backend = e_shell_get_backend_by_name (shell, "mail");
+	session = (CamelSession *) e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
+
+	return session;
+#else	
+	return session;
+#endif	
+}
+
+
+gboolean
+ews_plugin_get_online_status (void)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	EShell *shell;
+	shell = e_shell_get_default ();
+	
+	return e_shell_get_online (shell);
+#else
+	return TRUE;
+#endif	
+}
diff --git a/src/account-setup-eplugin/ews-plugin-compat.h b/src/account-setup-eplugin/ews-plugin-compat.h
new file mode 100644
index 0000000..8d57464
--- /dev/null
+++ b/src/account-setup-eplugin/ews-plugin-compat.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *
+ * Copyright (C) 1999-2011 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+#ifndef EWS_PLUGIN_COMPAT_H
+#define EWS_PLUGIN_COMPAT_H
+
+#include <camel/camel.h>
+
+CamelSession *
+ews_plugin_get_default_camel_session (void);
+
+gboolean
+ews_plugin_get_online_status (void);
+
+#endif
diff --git a/src/account-setup-eplugin/exchange-ews-account-listener.c b/src/account-setup-eplugin/exchange-ews-account-listener.c
index 2924856..b2726a1 100644
--- a/src/account-setup-eplugin/exchange-ews-account-listener.c
+++ b/src/account-setup-eplugin/exchange-ews-account-listener.c
@@ -22,18 +22,11 @@
 #endif
 
 #include "e-ews-compat.h"
+#include "ews-plugin-compat.h"
 
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
-#include <shell/e-shell.h>
-#if EDS_CHECK_VERSION(2,33,0)
-#include <mail/e-mail-session.h>
-#else
-#include <mail/mail-session.h>
-#endif
-#include <mail/e-mail-backend.h>
-
 #include <camel/camel.h>
 #include <libedataserver/e-account.h>
 #include <libedataserver/e-account-list.h>
@@ -122,13 +115,10 @@ EVO2 (CamelSession *session;)
 static void
 ews_account_removed (EAccountList *account_listener, EAccount *account)
 {
-	EVO3(EShell *shell;)
-	EVO3(EShellBackend *shell_backend;)
-	EVO3(CamelSession *session;)
 	EwsAccountInfo *info = NULL;
 	CamelService *service;
 	gchar *summary_file, *storage_path;
-	
+	CamelSession *l_session;
 
 	if (!is_ews_account (account))
 		return;
@@ -140,13 +130,11 @@ ews_account_removed (EAccountList *account_listener, EAccount *account)
 	ews_esource_utils_remove_groups (account->id->address);
 	ews_accounts = g_list_remove (ews_accounts, info);
 
-	EVO3(shell = e_shell_get_default ();)
-	EVO3(shell_backend = e_shell_get_backend_by_name (shell, "mail");)
-	EVO3 (session = (CamelSession *) e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));)
-	service = camel_session_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, NULL);
+	l_session = ews_plugin_get_default_camel_session ();
+	service = camel_session_get_service (l_session, account->source->url, CAMEL_PROVIDER_STORE, NULL);
 
 	/* FIXME  Use this until CamelStore gets camel_store_remove_storage API which would be available eds 3.2 onwards */
-	storage_path = camel_session_get_storage_path (session, service, NULL);
+	storage_path = camel_session_get_storage_path (l_session, service, NULL);
 	summary_file = g_build_filename (storage_path, "folder-tree-v2", NULL);
 	g_unlink (summary_file);
 	
diff --git a/src/account-setup-eplugin/exchange-ews-account-setup.c b/src/account-setup-eplugin/exchange-ews-account-setup.c
index ca1b298..f56027e 100644
--- a/src/account-setup-eplugin/exchange-ews-account-setup.c
+++ b/src/account-setup-eplugin/exchange-ews-account-setup.c
@@ -33,13 +33,13 @@
 #include <e-util/e-dialog-utils.h>
 #include "mail/em-config.h"
 #include "exchange-ews-account-setup.h"
+#include "ews-plugin-compat.h"
 #include <addressbook/gui/widgets/eab-config.h>
 #include <calendar/gui/e-cal-config.h>
 
 #include <camel-ews-folder.h>
 #include <e-ews-connection.h>
 #include <camel-ews-utils.h>
-#include <shell/e-shell.h>
 
 #define d(x) x
 
@@ -617,7 +617,6 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
 		GtkWidget *label;
 		GtkWidget *hbox, *oal_combo, *fetch_button;
 		gint row = 0;
-		EShell *shell;
 		struct _oab_setting_data *cbdata;
 
 		/* Add cache check box */
@@ -645,8 +644,7 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
 		row++;
 
 		/* If evolution is offline, dsensitize and return */
-		shell = e_shell_get_default ();
-		if (!e_shell_get_online (shell)) {
+		if (!ews_plugin_get_online_status ()) {
 			gtk_widget_set_sensitive (check, FALSE);
 			gtk_widget_set_sensitive (hbox, FALSE);
 			camel_url_free (url);
diff --git a/src/addressbook/e-book-backend-ews-gal.c b/src/addressbook/e-book-backend-ews-gal.c
index bf3a076..e738e43 100644
--- a/src/addressbook/e-book-backend-ews-gal.c
+++ b/src/addressbook/e-book-backend-ews-gal.c
@@ -57,9 +57,7 @@
 
 #define d(x) x
 
-#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
-#define EDB_ERROR_EX(_code,_msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
-#define EDB_ERROR_FAILED_STATUS(_code, _status) e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_ ## _code, "Failed with status 0x%x", _status)
+#define EDB_ERROR(_code) GNOME_Evolution_Addressbook_##_code
 
 G_DEFINE_TYPE (EBookBackendEwsGal, e_book_backend_ews_gal, E_TYPE_BOOK_BACKEND)
 
@@ -112,7 +110,7 @@ e_book_backend_ews_gal_create_contact	(EBookBackend *backend,
 					 guint32 opid,
 					 const gchar *vcard )
 {
-	e_data_book_respond_create (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+	e_data_book_respond_create (book, opid, EDB_ERROR (PermissionDenied), NULL);
 }
 
 static void
@@ -121,7 +119,7 @@ e_book_backend_ews_gal_remove_contacts	(EBookBackend *backend,
 					 guint32 opid,
 					 GList *id_list)
 {
-	e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+	e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PermissionDenied), NULL);
 }
 
 
@@ -131,7 +129,7 @@ e_book_backend_ews_gal_modify_contact	(EBookBackend *backend,
 					 guint32       opid,
 					 const gchar   *vcard)
 {
-	e_data_book_respond_modify (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+	e_data_book_respond_modify (book, opid, EDB_ERROR (PermissionDenied), NULL);
 }
 
 static void
@@ -146,16 +144,16 @@ e_book_backend_ews_gal_get_contact	(EBookBackend *backend,
 
 	switch (gwb->priv->mode) {
 
-	case E_DATA_BOOK_MODE_LOCAL :
-		e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
+		e_data_book_respond_get_contact (book, opid, EDB_ERROR (ContactNotFound), "");
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE :
+	case GNOME_Evolution_Addressbook_MODE_REMOTE :
 		if (gwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Not connected"), NULL);
+			e_data_book_respond_get_contact (book, opid, EDB_ERROR(OtherError), NULL);
 			return;
 		}
-		e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
+		e_data_book_respond_get_contact (book, opid, EDB_ERROR (ContactNotFound), "");
 		return;
 	default :
 		break;
@@ -176,19 +174,19 @@ e_book_backend_ews_gal_get_contact_list	(EBookBackend *backend,
 
 	switch (egwb->priv->mode) {
 
-	case E_DATA_BOOK_MODE_LOCAL :
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
 
-		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (Success), vcard_list);
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 
 		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AuthenticationRequired), NULL);
 			return;
 		}
 
-		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (Success), vcard_list);
 		return;
 	default :
 		break;
@@ -219,19 +217,38 @@ exit:
 }
 
 static gchar *
+ews_get_cache_dir (EBookBackend *backend, ESource *source)
+{
+        gchar *filename, *mangled_uri;
+
+        mangled_uri = g_strdelimit (e_source_get_uri (source), ":/", '_');
+
+        filename = g_build_filename (
+                g_get_home_dir (), ".evolution", "addressbook", "cache", mangled_uri, NULL);
+
+        g_free (mangled_uri);
+
+        return filename;
+}
+
+static gchar *
 ews_download_full_gal (EBookBackendEwsGal *cbews, EwsOALDetails *full, GCancellable *cancellable, GError **error)
 {
 	EBookBackendEwsGalPrivate *priv = cbews->priv;
 	EEwsConnection *oab_cnc;
 	gchar *full_url, *oab_url, *cache_file = NULL;
-	const gchar *cache_dir;
+	gchar *cache_dir;
 	gchar *comp_cache_file = NULL, *uncompress_file = NULL;
+	ESource *source;
 
 	/* oab url with oab.xml removed from the suffix */
 	oab_url = g_strndup (priv->oab_url, strlen (priv->oab_url) - 7);
 	full_url = g_strconcat (oab_url, full->filename, NULL);
-	cache_dir = e_book_backend_get_cache_dir (E_BOOK_BACKEND (cbews));
+	
+	source = e_book_backend_get_source (E_BOOK_BACKEND (cbews));
+	cache_dir = ews_get_cache_dir (E_BOOK_BACKEND (cbews), source);
 	comp_cache_file = g_build_filename (cache_dir, full->filename, NULL);
+	g_free (cache_dir);
 
 	oab_cnc = e_ews_connection_new (full_url, priv->username, priv->password, NULL, NULL, NULL);
 	if (!e_ews_connection_download_oal_file (oab_cnc, comp_cache_file, NULL, NULL, cancellable, error))
@@ -510,7 +527,7 @@ ebews_start_refreshing (EBookBackendEwsGal *ebews)
 
 	PRIV_LOCK (priv);
 
-	if	(priv->mode == E_DATA_BOOK_MODE_REMOTE &&
+	if	(priv->mode == GNOME_Evolution_Addressbook_MODE_REMOTE &&
 		 priv->cnc && priv->marked_for_offline)
 				fetch_deltas (ebews);
 
@@ -538,7 +555,7 @@ fetch_from_offline (EBookBackendEwsGal *ews, EDataBookView *book_view, const gch
 
 	if (contacts)
 		g_slist_free (contacts);
-	e_data_book_view_notify_complete (book_view, error);
+	e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 	e_data_book_view_unref (book_view);
 }
 
@@ -562,7 +579,7 @@ func_not (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	return r;
 }
@@ -573,7 +590,7 @@ func_and_or (ESExp *f, gint argc, ESExpResult **argv, gpointer and)
 	ESExpResult *r;
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	return r;
 }
@@ -593,7 +610,7 @@ func_is (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -614,7 +631,7 @@ func_endswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -636,7 +653,7 @@ func_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -670,7 +687,7 @@ func_beginswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpoint
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 	return r;
 }
 
@@ -746,23 +763,19 @@ e_book_backend_ews_gal_start_book_view (EBookBackend  *backend,
 	e_data_book_view_notify_status_message (book_view, _("Searching..."));
 
 	switch (priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL:
+	case GNOME_Evolution_Addressbook_MODE_LOCAL:
 		if (priv->marked_for_offline && e_book_backend_sqlitedb_get_is_populated (priv->ebsdb, priv->oal_id, NULL)) {
 			fetch_from_offline (ebews, book_view, query, error);
 			return;
 		}
 
-		error = EDB_ERROR (OFFLINE_UNAVAILABLE);
-		e_data_book_view_notify_complete (book_view, error);
-		g_error_free (error);
+		e_data_book_view_notify_complete (book_view, EDB_ERROR (OfflineUnavailable));
 		return;
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 		if (!priv->cnc) {
-			error = EDB_ERROR (AUTHENTICATION_REQUIRED);
 			e_book_backend_notify_auth_required (backend);
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, EDB_ERROR (AuthenticationRequired));
 			e_data_book_view_unref (book_view);
-			g_error_free (error);
 			return;
 		}
 
@@ -781,7 +794,7 @@ e_book_backend_ews_gal_start_book_view (EBookBackend  *backend,
 			   Until then only auto-completion works */
 
 			g_free (auto_comp_str);
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 			e_data_book_view_unref (book_view);
 			return;
 		}
@@ -797,7 +810,7 @@ e_book_backend_ews_gal_start_book_view (EBookBackend  *backend,
 		g_free (auto_comp_str);
 		g_hash_table_remove (priv->ops, book_view);
 		if (error != NULL) {
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 			e_data_book_view_unref (book_view);
 			g_clear_error (&error);
 			return;
@@ -823,7 +836,7 @@ e_book_backend_ews_gal_start_book_view (EBookBackend  *backend,
 		}
 
 		g_slist_free (mailboxes);
-		e_data_book_view_notify_complete (book_view, error);
+		e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 		e_data_book_view_unref (book_view);
 	default:
 		break;
@@ -871,13 +884,13 @@ e_book_backend_ews_gal_authenticate_user (EBookBackend *backend,
 	priv = ebgw->priv;
 
 	switch (ebgw->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL:
-		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 		if (priv->cnc) {
-			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 			return;
 		}
 
@@ -891,7 +904,7 @@ e_book_backend_ews_gal_authenticate_user (EBookBackend *backend,
 
 		/* FIXME: Do some dummy request to ensure that the password is actually
 		   correct; don't just blindly return success */
-		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 		e_book_backend_notify_writable (backend, FALSE);
 		return;
 	default :
@@ -907,8 +920,8 @@ e_book_backend_ews_gal_get_required_fields (EBookBackend *backend,
 	GList *fields = NULL;
 
 	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
-	e_data_book_respond_get_supported_fields (book, opid,
-						  EDB_ERROR (SUCCESS),
+	e_data_book_respond_get_required_fields (book, opid,
+						  EDB_ERROR (Success),
 						  fields);
 	g_list_free (fields);
 
@@ -921,14 +934,14 @@ e_book_backend_ews_gal_get_supported_fields (EBookBackend *backend,
 {
 	e_data_book_respond_get_supported_fields (book,
 						  opid,
-						  NULL,
+						  0,
 						  supported_fields);
 }
 
-static void
-e_book_backend_ews_gal_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+static GNOME_Evolution_Addressbook_CallStatus
+e_book_backend_ews_gal_cancel_operation (EBookBackend *backend, EDataBook *book)
 {
-
+	return EDB_ERROR (CouldNotCancel);
 }
 
 static gboolean
@@ -959,11 +972,10 @@ ews_remove_attachments (const gchar *attachment_dir)
 	return TRUE;
 }
 
-static void
+static GNOME_Evolution_Addressbook_CallStatus 
 e_book_backend_ews_gal_load_source 	(EBookBackend *backend,
 				 	 ESource *source,
-					 gboolean only_if_exists,
-					 GError **perror)
+					 gboolean only_if_exists)
 {
 	EBookBackendEwsGal *cbews;
 	EBookBackendEwsGalPrivate *priv;
@@ -976,9 +988,10 @@ e_book_backend_ews_gal_load_source 	(EBookBackend *backend,
 
 	/* If oal_id is present it means the GAL is marked for offline usage, we do not check for offline_sync property */
 	if (priv->oal_id) {
-		const gchar *cache_dir, *email;
+		const gchar *email;
+		gchar *cache_dir;
 		
-		cache_dir = e_book_backend_get_cache_dir (backend);
+		cache_dir = ews_get_cache_dir (backend, source);
 		email = e_source_get_property (source, "email");
 
 		priv->folder_name = g_strdup (e_source_peek_name (source));
@@ -989,14 +1002,16 @@ e_book_backend_ews_gal_load_source 	(EBookBackend *backend,
 		g_mkdir_with_parents (priv->attachment_dir, 0777);
 
 		priv->ebsdb = e_book_backend_sqlitedb_new (cache_dir, email, priv->oal_id, priv->folder_name, FALSE, &err);
+		g_free (cache_dir);
 		if (err) {
-			g_propagate_error (perror, err);
-			return;
+			g_clear_error (&err);
+			return EDB_ERROR (OtherError);
 		}
 		priv->marked_for_offline = TRUE;
 	}
 
 	e_book_backend_set_is_loaded (backend, TRUE);
+	return EDB_ERROR (Success);
 }
 
 static void
@@ -1004,7 +1019,7 @@ e_book_backend_ews_gal_remove	(EBookBackend *backend,
 				 EDataBook        *book,
 				 guint32           opid)
 {
-	e_data_book_respond_remove (book,  opid, EDB_ERROR (SUCCESS));
+	e_data_book_respond_remove (book,  opid, EDB_ERROR (Success));
 }
 
 static gchar *
@@ -1027,7 +1042,7 @@ e_book_backend_ews_gal_get_supported_auth_methods (EBookBackend *backend, EDataB
 	auth_methods = g_list_append (auth_methods, auth_method);
 	e_data_book_respond_get_supported_auth_methods (book,
 							opid,
-							EDB_ERROR (SUCCESS),
+							EDB_ERROR (Success),
 							auth_methods);
 	g_free (auth_method);
 	g_list_free (auth_methods);
@@ -1035,7 +1050,7 @@ e_book_backend_ews_gal_get_supported_auth_methods (EBookBackend *backend, EDataB
 
 static void
 e_book_backend_ews_gal_set_mode (EBookBackend *backend,
-                                   EDataBookMode mode)
+                                   gint mode)
 {
 	EBookBackendEwsGal *ebews;
 	EBookBackendEwsGalPrivate *priv;
@@ -1045,7 +1060,7 @@ e_book_backend_ews_gal_set_mode (EBookBackend *backend,
 	priv->mode = mode;
 
 	if (e_book_backend_is_loaded (backend)) {
-		if (mode == E_DATA_BOOK_MODE_LOCAL) {
+		if (mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
 			e_book_backend_notify_writable (backend, FALSE);
 			e_book_backend_notify_connection_status (backend, FALSE);
 			
@@ -1062,7 +1077,7 @@ e_book_backend_ews_gal_set_mode (EBookBackend *backend,
 				priv->cnc=NULL;
 			}
 		}
-		else if (mode == E_DATA_BOOK_MODE_REMOTE) {
+		else if (mode == GNOME_Evolution_Addressbook_MODE_REMOTE) {
 			e_book_backend_notify_writable (backend, FALSE);
 			e_book_backend_notify_connection_status (backend, TRUE);
 			e_book_backend_notify_auth_required (backend);
diff --git a/src/addressbook/e-book-backend-ews-utils.c b/src/addressbook/e-book-backend-ews-utils.c
index 6b90443..77a7964 100644
--- a/src/addressbook/e-book-backend-ews-utils.c
+++ b/src/addressbook/e-book-backend-ews-utils.c
@@ -35,10 +35,11 @@
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
+#include <libedata-book/e-book-backend-sexp.h>
+#include <libedata-book/e-book-backend.h>
+#include <libedata-book/e-data-book.h>
+#include <libedata-book/e-data-book-view.h>
 #include "e-book-backend-ews-utils.h"
-#include "libedata-book/e-book-backend-sexp.h"
-#include "libedata-book/e-data-book.h"
-#include "libedata-book/e-data-book-view.h"
 
 
 /**
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index abd5071..c6735bc 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -52,9 +52,7 @@
 #include "e-ews-connection.h"
 #include "e-ews-item.h"
 
-#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
-#define EDB_ERROR_EX(_code,_msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
-#define EDB_ERROR_FAILED_STATUS(_code, _status) e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_ ## _code, "Failed with status 0x%x", _status)
+#define EDB_ERROR(_code) GNOME_Evolution_Addressbook_##_code
 
 G_DEFINE_TYPE (EBookBackendEws, e_book_backend_ews, E_TYPE_BOOK_BACKEND)
 
@@ -489,7 +487,7 @@ ews_create_contact_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 		e_book_backend_sqlitedb_add_contact (ebews->priv->ebsdb, ebews->priv->folder_id, create_contact->contact, FALSE, &error);
 
 		if (error == NULL)
-			e_data_book_respond_create (create_contact->book, create_contact->opid, EDB_ERROR (SUCCESS), create_contact->contact);
+			e_data_book_respond_create (create_contact->book, create_contact->opid, EDB_ERROR (Success), create_contact->contact);
 
 		g_object_unref (item);
 		g_slist_free (items);
@@ -497,7 +495,7 @@ ews_create_contact_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 	
 	if (error) {
 		g_warning("Error while Creating contact: %s", error->message);
-		e_data_book_respond_create (create_contact->book, create_contact->opid, EDB_ERROR_EX (OTHER_ERROR, error->message), create_contact->contact);
+		e_data_book_respond_create (create_contact->book, create_contact->opid, EDB_ERROR (OtherError), create_contact->contact);
 	}
 
 	/* free memory allocated for create_contact & unref contained objects */
@@ -523,19 +521,19 @@ e_book_backend_ews_create_contact	(EBookBackend *backend,
 	priv = ebews->priv;
 
 	switch (ebews->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL :
-		e_data_book_respond_create (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
+		e_data_book_respond_create (book, opid, EDB_ERROR (RepositoryOffline), NULL);
 		return;
 
-	case  E_DATA_BOOK_MODE_REMOTE :
+	case  GNOME_Evolution_Addressbook_MODE_REMOTE :
 
 		if (ebews->priv->cnc == NULL) {
-			e_data_book_respond_create (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+			e_data_book_respond_create (book, opid, EDB_ERROR (AuthenticationRequired), NULL);
 			return;
 		}
 
 		if (!ebews->priv->is_writable) {
-			e_data_book_respond_create (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+			e_data_book_respond_create (book, opid, EDB_ERROR (PermissionDenied), NULL);
 			return;
 		}
 
@@ -543,7 +541,7 @@ e_book_backend_ews_create_contact	(EBookBackend *backend,
 		
 		if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
 			g_object_unref (contact);
-			e_data_book_respond_create (book, opid, EDB_ERROR (NOT_SUPPORTED), NULL);
+			e_data_book_respond_create (book, opid, EDB_ERROR (OtherError), NULL);
 			return;
 		}
 
@@ -599,10 +597,10 @@ ews_book_remove_contact_cb (GObject *object, GAsyncResult *res, gpointer user_da
 		for (l = remove_contact->sl_ids; l != NULL; l = g_slist_next (l))
 			dl_ids = g_list_prepend (dl_ids, l->data);
 
-		e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR (SUCCESS),  dl_ids);
+		e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR (Success),  dl_ids);
 		g_list_free (dl_ids);
 	} else {
-		e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR_EX (OTHER_ERROR, error->message), NULL);
+		e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR (OtherError), NULL);
 		
 		g_warning ("\nError removing contact %s \n", error->message);
 	}
@@ -633,18 +631,18 @@ e_book_backend_ews_remove_contacts	(EBookBackend *backend,
 	priv = ebews->priv;
 
 	switch (ebews->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL :
-		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
+		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (RepositoryOffline), NULL);
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE :
+	case GNOME_Evolution_Addressbook_MODE_REMOTE :
 		if (ebews->priv->cnc == NULL) {
-			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (AuthenticationRequired), NULL);
 			return;
 		}
 
 		if (!ebews->priv->is_writable) {
-			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PermissionDenied), NULL);
 			return;
 		}
 
@@ -681,18 +679,18 @@ e_book_backend_ews_modify_contact	(EBookBackend *backend,
 
 	switch (egwb->priv->mode) {
 
-	case E_DATA_BOOK_MODE_LOCAL :
-		e_data_book_respond_modify (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
+		e_data_book_respond_modify (book, opid, EDB_ERROR (RepositoryOffline), NULL);
 		return;
-	case E_DATA_BOOK_MODE_REMOTE :
+	case GNOME_Evolution_Addressbook_MODE_REMOTE :
 
 		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+			e_data_book_respond_modify (book, opid, EDB_ERROR (AuthenticationRequired), NULL);
 			return;
 		}
 		
 		if (!egwb->priv->is_writable) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+			e_data_book_respond_modify (book, opid, EDB_ERROR (PermissionDenied), NULL);
 			return;
 		}
 		
@@ -700,13 +698,13 @@ e_book_backend_ews_modify_contact	(EBookBackend *backend,
 
 		if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
 			g_object_unref (contact);
-			e_data_book_respond_create (book, opid, EDB_ERROR (NOT_SUPPORTED), NULL);
+			e_data_book_respond_create (book, opid, EDB_ERROR (OtherError), NULL);
 			return;
 		}
 
 		/* TODO implement */
 		g_object_unref (contact);
-		e_data_book_respond_create (book, opid, EDB_ERROR (NOT_SUPPORTED), NULL);
+		e_data_book_respond_create (book, opid, EDB_ERROR (OtherError), NULL);
 		return;
 	default :
 		break;
@@ -725,16 +723,16 @@ e_book_backend_ews_get_contact	(EBookBackend *backend,
 
 	switch (gwb->priv->mode) {
 
-	case E_DATA_BOOK_MODE_LOCAL :
-		e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
+		e_data_book_respond_get_contact (book, opid, EDB_ERROR (ContactNotFound), "");
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE :
+	case GNOME_Evolution_Addressbook_MODE_REMOTE :
 		if (gwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Not connected"), NULL);
+			e_data_book_respond_get_contact (book, opid, EDB_ERROR (OtherError), NULL);
 			return;
 		}
-		e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
+		e_data_book_respond_get_contact (book, opid, EDB_ERROR (ContactNotFound), "");
 		return;
 	default :
 		break;
@@ -755,19 +753,19 @@ e_book_backend_ews_get_contact_list	(EBookBackend *backend,
 
 	switch (egwb->priv->mode) {
 
-	case E_DATA_BOOK_MODE_LOCAL :
+	case GNOME_Evolution_Addressbook_MODE_LOCAL :
 
-		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (Success), vcard_list);
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 
 		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AuthenticationRequired), NULL);
 			return;
 		}
 
-		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (Success), vcard_list);
 		return;
 	default :
 		break;
@@ -795,7 +793,7 @@ func_not (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	return r;
 }
@@ -806,7 +804,7 @@ func_and_or (ESExp *f, gint argc, ESExpResult **argv, gpointer and)
 	ESExpResult *r;
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	return r;
 }
@@ -826,7 +824,7 @@ func_is (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -847,7 +845,7 @@ func_endswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -869,7 +867,7 @@ func_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 
 	sdata->is_query_handled = FALSE;
 	return r;
@@ -903,7 +901,7 @@ func_beginswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpoint
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = FALSE;
+	r->value.bool = FALSE;
 	return r;
 }
 
@@ -1246,7 +1244,7 @@ ebews_start_sync	(gpointer data)
 	} while (!error && !includes_last_item);
 
 	if (book_view) {
-		e_data_book_view_notify_complete (book_view, error);
+		e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 		e_data_book_view_unref (book_view);
 	}
 
@@ -1333,7 +1331,7 @@ ebews_start_refreshing (EBookBackendEws *ebews)
 
 	PRIV_LOCK (priv);
 
-	if	(priv->mode == E_DATA_BOOK_MODE_REMOTE &&
+	if	(priv->mode == GNOME_Evolution_Addressbook_MODE_REMOTE &&
 		 priv->cnc && priv->marked_for_offline)
 				fetch_deltas (ebews);
 
@@ -1360,8 +1358,9 @@ fetch_from_offline (EBookBackendEws *ews, EDataBookView *book_view, const gchar
 	}
 
 	g_slist_free (contacts);
-	e_data_book_view_notify_complete (book_view, error);
+	e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 	e_data_book_view_unref (book_view);
+	g_clear_error (&error);
 }
 
 static void
@@ -1376,9 +1375,9 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 	GCancellable *cancellable;
 	GSList *ids = NULL, *mailboxes = NULL, *l;
 	EwsFolderId *fid;
-	GError *error = NULL;
 	gboolean includes_last_item;
 	ESource *source;
+	GError *error = NULL;
 
 	ebews = E_BOOK_BACKEND_EWS (backend);
 	priv = ebews->priv;
@@ -1388,23 +1387,19 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 	e_data_book_view_notify_status_message (book_view, _("Searching..."));
 
 	switch (priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL:
+	case GNOME_Evolution_Addressbook_MODE_LOCAL:
 		if (e_book_backend_sqlitedb_get_is_populated (priv->ebsdb, priv->folder_id, NULL)) {
 			fetch_from_offline (ebews, book_view, query, error);
 			return;
 		}
 
-		error = EDB_ERROR (OFFLINE_UNAVAILABLE);
-		e_data_book_view_notify_complete (book_view, error);
-		g_error_free (error);
+		e_data_book_view_notify_complete (book_view, EDB_ERROR (OfflineUnavailable));
 		return;
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 		if (!priv->cnc) {
-			error = EDB_ERROR (AUTHENTICATION_REQUIRED);
 			e_book_backend_notify_auth_required (backend);
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, EDB_ERROR (AuthenticationRequired));
 			e_data_book_view_unref (book_view);
-			g_error_free (error);
 			return;
 		}
 
@@ -1418,8 +1413,9 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 		e_book_backend_ews_build_restriction (query, &is_autocompletion, &auto_comp_str);
 		if (!is_autocompletion || !auto_comp_str) {
 			g_free (auto_comp_str);
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, error ? EDB_ERROR (OtherError) : 0);
 			e_data_book_view_unref (book_view);
+			g_clear_error (&error);
 			return;
 		}
 
@@ -1445,7 +1441,7 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 		g_hash_table_remove (priv->ops, book_view);
 		e_ews_folder_free_fid (fid);
 		if (error != NULL) {
-			e_data_book_view_notify_complete (book_view, error);
+			e_data_book_view_notify_complete (book_view, EDB_ERROR (OtherError));
 			e_data_book_view_unref (book_view);
 			g_clear_error (&error);
 			return;
@@ -1471,8 +1467,9 @@ e_book_backend_ews_start_book_view (EBookBackend  *backend,
 		}
 
 		g_slist_free (mailboxes);
-		e_data_book_view_notify_complete (book_view, error);
+		e_data_book_view_notify_complete (book_view, EDB_ERROR (OtherError));
 		e_data_book_view_unref (book_view);
+		g_clear_error (&error);
 	default:
 		break;
 	}
@@ -1520,13 +1517,13 @@ e_book_backend_ews_authenticate_user (EBookBackend *backend,
 	priv = ebgw->priv;
 
 	switch (ebgw->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL:
-		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 		return;
 
-	case E_DATA_BOOK_MODE_REMOTE:
+	case GNOME_Evolution_Addressbook_MODE_REMOTE:
 		if (priv->cnc) {
-			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 			return;
 		}
 
@@ -1544,7 +1541,7 @@ e_book_backend_ews_authenticate_user (EBookBackend *backend,
 
 		/* FIXME: Do some dummy request to ensure that the password is actually
 		   correct; don't just blindly return success */
-		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (Success));
 		e_book_backend_notify_writable (backend, priv->is_writable);
 		return;
 	default :
@@ -1561,7 +1558,7 @@ e_book_backend_ews_get_required_fields (EBookBackend *backend,
 
 	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
 	e_data_book_respond_get_supported_fields (book, opid,
-						  EDB_ERROR (SUCCESS),
+						  EDB_ERROR (Success),
 						  fields);
 	g_list_free (fields);
 
@@ -1592,42 +1589,60 @@ e_book_backend_ews_get_supported_fields (EBookBackend *backend,
 	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_OTHER)));
 	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_BIRTH_DATE)));
 	e_data_book_respond_get_supported_fields (book, opid,
-						  EDB_ERROR (SUCCESS),
+						  EDB_ERROR (Success),
 						  fields);
 	g_list_free (fields);
 }
 
-static void
-e_book_backend_ews_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+static GNOME_Evolution_Addressbook_CallStatus
+e_book_backend_ews_cancel_operation (EBookBackend *backend, EDataBook *book)
 {
 
+	return EDB_ERROR (CouldNotCancel);
 }
 
-static void
+
+static gchar *
+ews_get_cache_dir (EBookBackend *backend, ESource *source)
+{
+	gchar *filename, *mangled_uri;
+
+	mangled_uri = g_strdelimit (e_source_get_uri (source), ":/", '_');
+
+	filename = g_build_filename (
+		g_get_home_dir (), ".evolution", "addressbook", "cache", mangled_uri, NULL);
+
+	g_free (mangled_uri);
+
+	return filename;
+}
+
+static GNOME_Evolution_Addressbook_CallStatus
 e_book_backend_ews_load_source 	(EBookBackend           *backend,
 				 ESource                *source,
-				 gboolean                only_if_exists,
-				 GError                **perror)
+				 gboolean                only_if_exists)
 {
 	EBookBackendEws *cbews;
 	EBookBackendEwsPrivate *priv;
-	const gchar *cache_dir, *email;
+	const gchar *email;
 	const gchar *folder_name;
 	const gchar *offline;
+	gchar *cache_dir;
 	GError *err = NULL;
 
 	cbews = E_BOOK_BACKEND_EWS (backend);
 	priv = cbews->priv;
 
-	cache_dir = e_book_backend_get_cache_dir (backend);
+	cache_dir = ews_get_cache_dir (backend, source);
 	email = e_source_get_property (source, "email");
 	priv->folder_id = e_source_get_duped_property (source, "folder-id");
 	folder_name = e_source_peek_name (source);
 
 	priv->ebsdb = e_book_backend_sqlitedb_new (cache_dir, email, priv->folder_id, folder_name, TRUE, &err);
+	g_free (cache_dir);
 	if (err) {
-		g_propagate_error (perror, err);
-		return;
+		g_clear_error (&err);
+		return EDB_ERROR (OtherError);
 	}
 
 	offline = e_source_get_property (source, "offline_sync");
@@ -1635,6 +1650,7 @@ e_book_backend_ews_load_source 	(EBookBackend           *backend,
 		priv->marked_for_offline = TRUE;
 	
 	e_book_backend_set_is_loaded (backend, TRUE);
+	return EDB_ERROR (Success);
 }
 
 static void
@@ -1642,7 +1658,7 @@ e_book_backend_ews_remove	(EBookBackend *backend,
 				 EDataBook        *book,
 				 guint32           opid)
 {
-	e_data_book_respond_remove (book,  opid, EDB_ERROR (SUCCESS));
+	e_data_book_respond_remove (book,  opid, EDB_ERROR (Success));
 }
 
 static gchar *
@@ -1665,7 +1681,7 @@ e_book_backend_ews_get_supported_auth_methods (EBookBackend *backend, EDataBook
 	auth_methods = g_list_append (auth_methods, auth_method);
 	e_data_book_respond_get_supported_auth_methods (book,
 							opid,
-							EDB_ERROR (SUCCESS),
+							EDB_ERROR (Success),
 							auth_methods);
 	g_free (auth_method);
 	g_list_free (auth_methods);
@@ -1673,7 +1689,7 @@ e_book_backend_ews_get_supported_auth_methods (EBookBackend *backend, EDataBook
 
 static void
 e_book_backend_ews_set_mode (EBookBackend *backend,
-                                   EDataBookMode mode)
+                                   gint mode)
 {
 	EBookBackendEws *ebews;
 	EBookBackendEwsPrivate *priv;
@@ -1683,7 +1699,7 @@ e_book_backend_ews_set_mode (EBookBackend *backend,
 	priv->mode = mode;
 
 	if (e_book_backend_is_loaded (backend)) {
-		if (mode == E_DATA_BOOK_MODE_LOCAL) {
+		if (mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
 			e_book_backend_notify_writable (backend, FALSE);
 			e_book_backend_notify_connection_status (backend, FALSE);
 			
@@ -1700,7 +1716,7 @@ e_book_backend_ews_set_mode (EBookBackend *backend,
 				priv->cnc=NULL;
 			}
 		}
-		else if (mode == E_DATA_BOOK_MODE_REMOTE) {
+		else if (mode == GNOME_Evolution_Addressbook_MODE_REMOTE) {
 			if (ebews->priv->is_writable)
 				e_book_backend_notify_writable (backend, TRUE);
 			else
diff --git a/src/addressbook/e-book-backend-sqlitedb.c b/src/addressbook/e-book-backend-sqlitedb.c
index 800ff1b..347e3d3 100644
--- a/src/addressbook/e-book-backend-sqlitedb.c
+++ b/src/addressbook/e-book-backend-sqlitedb.c
@@ -848,7 +848,7 @@ func_check (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer da
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.boolean = truth;
+	r->value.bool = truth;
 
 	return r;
 }
@@ -897,7 +897,7 @@ book_backend_sqlitedb_is_summary_query (const gchar *query)
 
 	r = e_sexp_eval (sexp);
 
-	retval = (r && r->type == ESEXP_RES_BOOL && r->value.boolean);
+	retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool);
 
 	e_sexp_result_free (sexp, r);
 
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index 77f855e..a9528d2 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -22,6 +22,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <glib/gstdio.h>
 
 #include <libebook/e-vcard.h>
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index ca0343c..ca9b236 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -63,6 +63,9 @@
 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
 #endif
 
+/*FIXME introduced during backporting */
+#define CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED "refresh"
+
 G_DEFINE_TYPE (ECalBackendEws, e_cal_backend_ews, E_TYPE_CAL_BACKEND)
 
 /* Private part of the CalBackendEws structure */
@@ -71,9 +74,9 @@ struct _ECalBackendEwsPrivate {
 	EEwsConnection *cnc;
 	gchar *folder_id;
 	gchar *user_email;
+	gchar *cache_dir;
 
 	EDataCal *opening_cal;
-	EServerMethodContext opening_ctx;
 
 	CalMode mode;
 	ECalBackendStore *store;
@@ -87,11 +90,49 @@ struct _ECalBackendEwsPrivate {
 	GHashTable *item_id_hash;
 };
 
+static GQuark
+ews_cal_error_quark (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "ews-cal-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
+static GError *
+ews_cal_create_error (GNOME_Evolution_Calendar_CallStatus status, const gchar *custom_msg)
+{
+	if (status == GNOME_Evolution_Calendar_Success)
+		return NULL;
+
+	return g_error_new_literal (ews_cal_error_quark(), status, custom_msg ? custom_msg : e_cal_backend_status_to_string (status));
+}
+
+static GNOME_Evolution_Calendar_CallStatus
+get_error_code (GError *error)
+{
+	guint code;
+	
+	if (!error)
+		return 0;
+
+	code =	error->code;
+	g_clear_error (&error);
+
+	return code;
+}
+
 #define PRIV_LOCK(p)   (g_static_rec_mutex_lock (&(p)->rec_mutex))
 #define PRIV_UNLOCK(p) (g_static_rec_mutex_unlock (&(p)->rec_mutex))
 
-#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
-#define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
+#define EDC_ERROR(_code) ews_cal_create_error (GNOME_Evolution_Calendar_##_code, NULL)
+#define EDC_ERROR_EX(_code, _msg) ews_cal_create_error (GNOME_Evolution_Calendar_##_code, _msg)
+#define EDC_CODE(_code) GNOME_Evolution_Calendar_##_code
+#define EDC_ER_CODE(error) get_error_code (error)
 
 #define SYNC_KEY "sync-state"
 #define EWS_MAX_FETCH_COUNT 100
@@ -105,7 +146,7 @@ struct _ECalBackendEwsPrivate {
 				G_LOG_LEVEL_CRITICAL,				\
 				"file %s: line %d (%s): assertion `%s' failed",	\
 				__FILE__, __LINE__, G_STRFUNC, #expr);		\
-			g_set_error (&error, E_DATA_CAL_ERROR, (_code),		\
+			g_set_error (&error, ews_cal_error_quark (), (GNOME_Evolution_Calendar_##_code), \
 				"file %s: line %d (%s): assertion `%s' failed",	\
 				__FILE__, __LINE__, G_STRFUNC, #expr);		\
 			goto exit;						\
@@ -145,11 +186,11 @@ e_cal_backend_ews_is_read_only (ECalBackend *backend, EDataCal *cal)
 
 	cbews = E_CAL_BACKEND_EWS (backend);
 
-	e_data_cal_notify_read_only (cal, NULL, cbews->priv->read_only);
+	e_data_cal_notify_read_only (cal, 0, cbews->priv->read_only);
 }
 
 static void
-e_cal_backend_ews_get_cal_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_ews_get_cal_address (ECalBackend *backend, EDataCal *cal)
 {
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
@@ -157,11 +198,11 @@ e_cal_backend_ews_get_cal_address (ECalBackend *backend, EDataCal *cal, EServerM
 	cbews = E_CAL_BACKEND_EWS (backend);
 	priv = cbews->priv;
 
-	e_data_cal_notify_cal_address (cal, context, NULL, priv->user_email);
+	e_data_cal_notify_cal_address (cal, 0, priv->user_email);
 }
 
 static void
-e_cal_backend_ews_get_static_capabilities (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_ews_get_static_capabilities (ECalBackend *backend, EDataCal *cal)
 {
 	const gchar *capabilities;
 
@@ -175,7 +216,7 @@ e_cal_backend_ews_get_static_capabilities (ECalBackend *backend, EDataCal *cal,
 			 CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR ","
 			 CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
 
-	e_data_cal_notify_static_capabilities (cal, context, NULL, capabilities);
+	e_data_cal_notify_static_capabilities (cal, 0, capabilities);
 }
 
 static gboolean
@@ -219,7 +260,7 @@ e_cal_backend_ews_set_mode (ECalBackend *backend, CalMode mode)
 	priv = cbews->priv;
 
 	if (priv->mode == mode) {
-		e_cal_backend_notify_mode (backend, ModeSet,
+		e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET,
 					   cal_mode_to_corba (mode));
 		return;
 	}
@@ -230,7 +271,8 @@ e_cal_backend_ews_set_mode (ECalBackend *backend, CalMode mode)
 	case CAL_MODE_REMOTE :/* go online */
 		priv->mode = CAL_MODE_REMOTE;
 		priv->read_only = FALSE;
-		e_cal_backend_notify_mode (backend, ModeSet, Remote);
+		e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET,
+						GNOME_Evolution_Calendar_MODE_REMOTE);
 		e_cal_backend_notify_readonly (backend, priv->read_only);
 		if (e_cal_backend_ews_is_loaded (backend))
 			      e_cal_backend_notify_auth_required (backend);
@@ -240,11 +282,12 @@ e_cal_backend_ews_set_mode (ECalBackend *backend, CalMode mode)
 		priv->mode = CAL_MODE_LOCAL;
 		switch_offline (cbews);
 		e_cal_backend_notify_readonly (backend, priv->read_only);
-		e_cal_backend_notify_mode (backend, ModeSet, Local);
+		e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET, 
+						GNOME_Evolution_Calendar_MODE_LOCAL);
 
 		break;
 	default :
-		e_cal_backend_notify_mode (backend, ModeNotSupported,
+		e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_NOT_SUPPORTED,
 					   cal_mode_to_corba (mode));
 	}
 
@@ -252,7 +295,7 @@ e_cal_backend_ews_set_mode (ECalBackend *backend, CalMode mode)
 }
 
 static void
-e_cal_backend_ews_set_default_zone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj)
+e_cal_backend_ews_set_default_zone (ECalBackend *backend, EDataCal *cal, const gchar *tzobj)
 {
 	icalcomponent *tz_comp;
 	ECalBackendEws *cbews;
@@ -262,8 +305,8 @@ e_cal_backend_ews_set_default_zone (ECalBackend *backend, EDataCal *cal, EServer
 
 	cbews = (ECalBackendEws *) backend;
 
-	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), InvalidArg);
-	e_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
+	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), OtherError);
+	e_data_cal_error_if_fail (tzobj != NULL, OtherError);
 
 	priv = cbews->priv;
 
@@ -287,7 +330,7 @@ e_cal_backend_ews_set_default_zone (ECalBackend *backend, EDataCal *cal, EServer
 	PRIV_UNLOCK (priv);
 
 exit:
-	e_data_cal_notify_default_timezone_set (cal, context, error);
+	e_data_cal_notify_default_timezone_set (cal, EDC_ER_CODE(error));
 }
 
 static icaltimezone *
@@ -310,7 +353,7 @@ e_cal_backend_ews_internal_get_timezone (ECalBackend *backend, const gchar *tzid
 }
 
 static void
-e_cal_backend_ews_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj)
+e_cal_backend_ews_add_timezone (ECalBackend *backend, EDataCal *cal, const gchar *tzobj)
 {
 	icalcomponent *tz_comp;
 	ECalBackendEws *cbews;
@@ -319,8 +362,8 @@ e_cal_backend_ews_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMeth
 
 	cbews = (ECalBackendEws *) backend;
 
-	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), InvalidArg);
-	e_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
+	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), OtherError);
+	e_data_cal_error_if_fail (tzobj != NULL, OtherError);
 
 	priv = cbews->priv;
 
@@ -344,18 +387,17 @@ e_cal_backend_ews_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMeth
 	}
 
 exit:
-	e_data_cal_notify_timezone_added (cal, context, error, tzobj);
+	e_data_cal_notify_timezone_added (cal, EDC_ER_CODE(error), tzobj);
 }
 
-static void e_cal_backend_ews_get_ldap_attribute (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+static void e_cal_backend_ews_get_ldap_attribute (ECalBackend *backend, EDataCal *cal)
 {
-	e_data_cal_notify_ldap_attribute (cal, context, NULL, NULL);
+	e_data_cal_notify_ldap_attribute (cal, 0, NULL);
 }
 
 typedef struct {
 	ECalBackendEws *cbews;
 	EDataCal *cal;
-	EServerMethodContext *context;
 	gchar *itemid;
 	gchar *changekey;
 	gboolean is_occurrence;
@@ -395,10 +437,10 @@ ews_cal_discard_alarm_cb (GObject *object, GAsyncResult *res, gpointer user_data
 	if (!e_ews_connection_update_items_finish (cnc, res, NULL, &error)) {
 		/* The calendar UI doesn't *display* errors unless they have
 		   the OtherError code */
-		error->code = OtherError;
+		error->code = EDC_CODE(OtherError);
 	}
 
-	e_data_cal_notify_alarm_discarded (edad->cal, edad->context, error);
+	e_data_cal_notify_alarm_discarded (edad->cal, EDC_ER_CODE(error));
 
 	g_free(edad->itemid);
 	g_free(edad->changekey);
@@ -408,7 +450,7 @@ ews_cal_discard_alarm_cb (GObject *object, GAsyncResult *res, gpointer user_data
 }
 
 static void
-e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *auid)
+e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, const gchar *uid, const gchar *auid)
 {
 	ECalBackendEws *cbews = (ECalBackendEws *) backend;
 	ECalBackendEwsPrivate *priv;
@@ -421,8 +463,7 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMet
 
 	comp = e_cal_backend_store_get_component (priv->store, uid, NULL);
 	if (!comp) {
-		e_data_cal_notify_alarm_discarded (cal, context,
-						   EDC_ERROR(ObjectNotFound));
+		e_data_cal_notify_alarm_discarded (cal, EDC_CODE(ObjectNotFound));
 		return;
 	}
 
@@ -433,7 +474,6 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMet
 	edad = g_new0 (EwsDiscardAlarmData, 1);
 	edad->cbews = g_object_ref (cbews);
 	edad->cal = g_object_ref (cal);
-	edad->context = context;
 
 	if (e_cal_component_has_recurrences (comp)) {
 		gint *index;
@@ -467,7 +507,7 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMet
 }
 
 static void
-e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzid)
+e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, const gchar *tzid)
 {
 	icalcomponent *icalcomp;
 	icaltimezone *zone;
@@ -479,7 +519,7 @@ e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMeth
 		icalcomp = icaltimezone_get_component (zone);
 
 		if (!icalcomp)
-			g_propagate_error (&error, e_data_cal_create_error (InvalidObject, NULL));
+			g_propagate_error (&error, EDC_ERROR_EX(InvalidObject, NULL));
 		else
 			object = icalcomponent_as_ical_string_r (icalcomp);
 	} else {
@@ -523,14 +563,13 @@ e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMeth
 		}
 	}
 
-	e_data_cal_notify_timezone_requested (cal, context, error, object);
+	e_data_cal_notify_timezone_requested (cal, EDC_ER_CODE(error), object);
 	g_free (object);
-
 }
 
 
 static void
-e_cal_backend_ews_get_default_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_ews_get_default_object (ECalBackend *backend, EDataCal *cal)
 {
 
 	ECalComponent *comp;
@@ -556,7 +595,8 @@ e_cal_backend_ews_get_default_object (ECalBackend *backend, EDataCal *cal, EServ
 	g_object_unref (comp);
 
 exit:
-	e_data_cal_notify_default_object (cal, context, error, object);
+	e_data_cal_notify_default_object (cal, EDC_ER_CODE(error), object);
+	g_clear_error (&error);
 	g_free (object);
 }
 
@@ -654,23 +694,54 @@ add_comps_to_item_id_hash (ECalBackendEws *cbews)
 
 	g_slist_free (comps);
 }
+
+static ECalSourceType
+source_type_from_kind (icalcomponent_kind kind)
+{
+	ECalSourceType source_type;
+
+	switch (kind) {
+		case ICAL_VEVENT_COMPONENT:
+			source_type = E_CAL_SOURCE_TYPE_EVENT;
+			break;
+		case ICAL_VTODO_COMPONENT:
+			source_type = E_CAL_SOURCE_TYPE_TODO;
+			break;
+		case ICAL_VJOURNAL_COMPONENT:
+			source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+			break;
+		default:
+			source_type = E_CAL_SOURCE_TYPE_EVENT;
+	}
+	
+	return source_type;
+}
+
 static void
-e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, 
 			gboolean only_if_exists, const gchar *username, const gchar *password)
 {
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
-	const gchar *cache_dir;
 	GError *error = NULL;
 
 	cbews = (ECalBackendEws *) backend;
 	priv = cbews->priv;
 
-	cache_dir = e_cal_backend_get_cache_dir (backend);
 
 	PRIV_LOCK (priv);
 	if (!priv->store) {
-		priv->store = e_cal_backend_file_store_new (cache_dir);
+		const gchar *uri;
+		icalcomponent_kind kind;
+		ECalSourceType source_type;
+
+		kind = e_cal_backend_get_kind (backend);
+		source_type = source_type_from_kind (kind);
+		uri = e_cal_backend_get_uri (backend);
+		
+		priv->store = (ECalBackendStore *) e_cal_backend_file_store_new (uri, source_type);
+		priv->cache_dir = g_strdup (e_cal_backend_store_get_path (priv->store));
+
 		e_cal_backend_store_load (priv->store);
 		add_comps_to_item_id_hash (cbews);
 		e_cal_backend_store_set_default_timezone (priv->store, priv->default_zone);
@@ -682,7 +753,7 @@ e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, EServerMethodContex
 
 		/* If we can be called a second time while the first is still
 		   "outstanding", we need a bit of a rethink... */
-		g_assert (!priv->opening_ctx && !priv->opening_cal);
+		g_assert (!priv->opening_cal);
 
 		esource = e_cal_backend_get_source (E_CAL_BACKEND (cbews));
 
@@ -692,7 +763,6 @@ e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, EServerMethodContex
 		host_url = e_source_get_property (esource, "hosturl");
 
 		priv->opening_cal = cal;
-		priv->opening_ctx = context;
 
 		priv->cnc = e_ews_connection_new (host_url, username, password,
 						  NULL, NULL, &error);
@@ -706,11 +776,11 @@ e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, EServerMethodContex
 	}
 
 	PRIV_UNLOCK (priv);
-	e_data_cal_notify_open (cal, context, error);
+	e_data_cal_notify_open (cal, EDC_ER_CODE(error));
 }
 
 static void
-e_cal_backend_ews_remove (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_ews_remove (ECalBackend *backend, EDataCal *cal)
 {
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
@@ -726,11 +796,11 @@ e_cal_backend_ews_remove (ECalBackend *backend, EDataCal *cal, EServerMethodCont
 
 	PRIV_UNLOCK (priv);
 
-	e_data_cal_notify_remove (cal, context, NULL);
+	e_data_cal_notify_remove (cal, 0);
 }
 
 static void
-e_cal_backend_ews_get_object	(ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_get_object	(ECalBackend *backend, EDataCal *cal,
 	 			 const gchar *uid, const gchar *rid)
 {
 	ECalComponent *comp;
@@ -739,7 +809,7 @@ e_cal_backend_ews_get_object	(ECalBackend *backend, EDataCal *cal, EServerMethod
 	gchar *object = NULL;
 	GError *error = NULL;
 
-	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), InvalidArg);
+	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), OtherError);
 
 	priv = cbews->priv;
 
@@ -768,7 +838,7 @@ e_cal_backend_ews_get_object	(ECalBackend *backend, EDataCal *cal, EServerMethod
 	g_propagate_error (&error, EDC_ERROR (ObjectNotFound));
 
 exit:
-	e_data_cal_notify_object (cal, context, error, object);
+	e_data_cal_notify_object (cal, EDC_ER_CODE(error), object);
 	g_free (object);
 }
 
@@ -780,8 +850,6 @@ cal_backend_ews_get_object_list (ECalBackend *backend, const gchar *sexp, GList
 	GSList *components, *l;
 	ECalBackendSExp *cbsexp;
 	gboolean search_needed = TRUE;
-	time_t occur_start = -1, occur_end = -1;
-	gboolean prunning_by_time;
 
 	cbews = E_CAL_BACKEND_EWS (backend);
 	priv = cbews->priv;
@@ -796,14 +864,7 @@ cal_backend_ews_get_object_list (ECalBackend *backend, const gchar *sexp, GList
 	}
 
 	*objects = NULL;
-
-	prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (cbsexp,
-									    &occur_start,
-									    &occur_end);
-	components = prunning_by_time ?
-		e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
-		: e_cal_backend_store_get_components (priv->store);
-
+	components = e_cal_backend_store_get_components (priv->store);
 	for (l = components; l != NULL; l = l->next) {
 		ECalComponent *comp = E_CAL_COMPONENT (l->data);
 
@@ -822,14 +883,14 @@ cal_backend_ews_get_object_list (ECalBackend *backend, const gchar *sexp, GList
 }
 
 static void
-e_cal_backend_ews_get_object_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *sexp)
+e_cal_backend_ews_get_object_list (ECalBackend *backend, EDataCal *cal, const gchar *sexp)
 {
 	GList *objects = NULL, *l;
 	GError *error = NULL;
 
 	cal_backend_ews_get_object_list (backend, sexp, &objects, &error);
 
-	e_data_cal_notify_object_list (cal, context, error, objects);
+	e_data_cal_notify_object_list (cal, EDC_ER_CODE(error), objects);
 	if (objects) {
 		for (l = objects; l != NULL; l = l->next)
 			g_free (l->data);
@@ -863,7 +924,6 @@ typedef struct {
 	ECalBackendEws *cbews;
 	EDataCal *cal;
 	ECalComponent *comp;
-	EServerMethodContext context;
 	EwsId item_id;
 	guint index;
 } EwsRemoveData;
@@ -889,12 +949,14 @@ ews_cal_remove_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
 			/*probably we are not in sync, let's sync with server*/
 			ews_start_sync (remove_data->cbews);
 		} else
-			error->code = OtherError;
+			error->code = EDC_CODE(OtherError);
 	}
 
-	if (remove_data->context) {
+	if (remove_data->cal) {
 		if (!error && remove_data->index != 0) ews_start_sync (remove_data->cbews);
-		e_data_cal_notify_remove (remove_data->cal, remove_data->context, error);
+		/* FIXME BUG */
+		if (remove_data->cal)
+			e_data_cal_notify_remove (remove_data->cal, EDC_ER_CODE(error));
 	} else if (error) {
 		g_warning ("Remove object error :  %s\n", error->message);
 		g_clear_error (&error);
@@ -935,7 +997,7 @@ e_cal_rid_to_index (const char *rid, icalcomponent *comp, GError **error)
 }
 
 static void
-e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal,
 				 const gchar *uid, const gchar *rid, CalObjModType mod)
 {
 	EwsRemoveData *remove_data;
@@ -946,7 +1008,7 @@ e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, EServerMet
 	EwsId item_id;
 	guint index = 0;
 
-	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), InvalidArg);
+	e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (cbews), OtherError);
 	/*We have to run sync before some write operations, in some cases we may need a new change key for our items */
 	ews_start_sync (cbews);
 
@@ -986,8 +1048,8 @@ e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, EServerMet
 	remove_data = g_new0 (EwsRemoveData, 1);
 	remove_data->cbews = g_object_ref(cbews);
 	remove_data->comp = comp;
-	remove_data->cal = g_object_ref(cal);
-	remove_data->context = context;
+	if (cal)
+		remove_data->cal = g_object_ref(cal);
 	remove_data->index = index;
 	remove_data->item_id.id = item_id.id;
 	remove_data->item_id.change_key = item_id.change_key;
@@ -999,22 +1061,21 @@ e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, EServerMet
 	return;
 
 exit:
-	if (context)
-		e_data_cal_notify_remove (cal, context, error);
-	else if (error) {
+	/* FIXME BUG */
+	if (cal)
+		e_data_cal_notify_remove (cal, EDC_ER_CODE(error));
+	if (error) {
 		g_warning ("Remove object error :  %s\n", error->message);
 		g_clear_error (&error);
 	}
 }
 
-static icaltimezone * resolve_tzid (const gchar *tzid, gpointer user_data);
 static void put_component_to_store (ECalBackendEws *cbews,ECalComponent *comp);
 
 typedef struct {
 	ECalBackendEws *cbews;
 	EDataCal *cal;
 	ECalComponent *comp;
-	EServerMethodContext context;
 } EwsCreateData;
 
 static void add_attendees_list_to_message(ESoapMessage *msg, const gchar *listname, GSList *list) {
@@ -1188,7 +1249,7 @@ convert_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
 }
 
 static void
-e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal,
 				 const gchar *uid, const gchar *rid, CalObjModType mod);
 /*I will unate both type, they are same now*/
 typedef struct {
@@ -1196,7 +1257,6 @@ typedef struct {
 	ECalComponent *comp;
 	int cb_type; /* 0 - nothing, 1 - create, 2 - update */
 	EDataCal *cal;
-	EServerMethodContext context;
 	ECalComponent *oldcomp;
 	gchar *itemid;
 	gchar *changekey;
@@ -1208,13 +1268,12 @@ typedef struct {
 	EDataCal *cal;
 	ECalComponent *comp;
 	ECalComponent *oldcomp;
-	EServerMethodContext context;
 	gchar *itemid;
 	gchar *changekey;
 } EwsModifyData;
 
 static void
-e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal,
 				 const gchar *calobj, CalObjModType mod);
 
 static void convert_component_to_updatexml (ESoapMessage *msg, gpointer user_data);
@@ -1278,9 +1337,9 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
 		* this is the only way to pass attachments in meeting invite mail*/
 		if (e_cal_component_has_attendees (create_data->comp)) {
 			icalcomponent *icalcomp = e_cal_component_get_icalcomponent (create_data->comp);
-			e_cal_backend_ews_modify_object ((ECalBackend *) create_data->cbews, create_data->cal, NULL, icalcomponent_as_ical_string (icalcomp), CALOBJ_MOD_ALL);
+			e_cal_backend_ews_modify_object ((ECalBackend *) create_data->cbews, NULL, icalcomponent_as_ical_string (icalcomp), CALOBJ_MOD_ALL);
 		}
-		e_data_cal_notify_object_created (create_data->cal, create_data->context, error, comp_uid, e_cal_component_get_as_string(create_data->comp));
+		e_data_cal_notify_object_created (create_data->cal, EDC_ER_CODE(error), comp_uid, e_cal_component_get_as_string(create_data->comp));
 	} else if (create_data->cb_type == 2) {
 		EwsModifyData* modify_data;
 		modify_data = g_new0 (EwsModifyData, 1);
@@ -1288,7 +1347,6 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
 		modify_data->comp = create_data->comp;
 		modify_data->oldcomp = create_data->oldcomp;
 		modify_data->cal = g_object_ref (create_data->cal);
-		modify_data->context = create_data->context;
 		modify_data->itemid = create_data->itemid;
 		modify_data->changekey = create_data->changekey;
 		e_ews_connection_update_items_start (priv->cnc, EWS_PRIORITY_MEDIUM,
@@ -1310,6 +1368,7 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
 	g_object_unref (create_data->comp);
 	if (create_data->oldcomp) g_object_unref (create_data->oldcomp);
 	g_free (create_data);
+	g_clear_error (&error);
 }
 
 static void
@@ -1334,7 +1393,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 
 	/* make sure there was no error */
 	if (error != NULL) {
-		e_data_cal_notify_object_created(create_data->cal, create_data->context, error, NULL, NULL);
+		e_data_cal_notify_object_created(create_data->cal, EDC_ER_CODE(error), NULL, NULL);
 		return;
 	}
 
@@ -1357,7 +1416,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 		if (!res && error != NULL) {
 			if (items_req)
 				g_slist_free (items_req);
-			e_data_cal_notify_object_created (create_data->cal, create_data->context, error, NULL, NULL);
+			e_data_cal_notify_object_created (create_data->cal, EDC_ER_CODE(error), NULL, NULL);
 			return;
 		}
 
@@ -1376,7 +1435,6 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 		attach_data->cbews = g_object_ref (create_data->cbews);
 		attach_data->comp = g_object_ref (create_data->comp);
 		attach_data->cal = create_data->cal;
-		attach_data->context = create_data->context;
 		attach_data->cb_type = 1;
 
 		e_cal_component_get_attachment_list (create_data->comp, &attachments);
@@ -1411,12 +1469,10 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 	e_cal_component_commit_sequence(create_data->comp);
 	put_component_to_store (create_data->cbews, create_data->comp);
 
-	/* notify the backend and the application that a new object was created */
-	e_cal_backend_notify_object_created (E_CAL_BACKEND(create_data->cbews), create_data->context);
-	
+	/* notify the backend and the application that a new object was created. FIXME - check if its works fine - backport issue */
 	e_cal_component_get_uid(create_data->comp, &comp_uid);
 	if (n_attach == 0)
-		e_data_cal_notify_object_created (create_data->cal, create_data->context, error, comp_uid, e_cal_component_get_as_string(create_data->comp));
+		e_data_cal_notify_object_created (create_data->cal, EDC_ER_CODE(error), comp_uid, e_cal_component_get_as_string(create_data->comp));
 
 	/* place new component in our cache */
 	PRIV_LOCK (priv);
@@ -1435,7 +1491,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 		}
 
 		for (i = exceptions; i; i = i->next) {
-			e_cal_backend_ews_remove_object (E_CAL_BACKEND (create_data->cbews), create_data->cal, NULL,
+			e_cal_backend_ews_remove_object (E_CAL_BACKEND (create_data->cbews), NULL,
 							 comp_uid, i->data, CALOBJ_MOD_THIS);
 		}
 
@@ -1450,6 +1506,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
 	g_object_unref(create_data->cbews);
 	g_object_unref(create_data->cal);
 	g_free(create_data);
+	g_clear_error (&error);
 }
 
 struct TzidCbData {
@@ -1480,7 +1537,7 @@ static void tzid_cb(icalparameter *param, void *data)
 }
 
 static void
-e_cal_backend_ews_create_object(ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_ews_create_object(ECalBackend *backend, EDataCal *cal, const gchar *calobj)
 {
 	EwsCreateData *create_data;
 	ECalBackendEws *cbews;
@@ -1495,8 +1552,8 @@ e_cal_backend_ews_create_object(ECalBackend *backend, EDataCal *cal, EServerMeth
 	struct TzidCbData cbd;
 
 	/* sanity check */
-	e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), InvalidArg);
-	e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', InvalidArg);
+	e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), OtherError);
+	e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', OtherError);
 
 	cbews = E_CAL_BACKEND_EWS(backend);
 	priv = cbews->priv;
@@ -1545,7 +1602,6 @@ e_cal_backend_ews_create_object(ECalBackend *backend, EDataCal *cal, EServerMeth
 	create_data->cbews = g_object_ref(cbews);
 	create_data->comp = comp;
 	create_data->cal = g_object_ref(cal);
-	create_data->context = context;
 
 
 
@@ -1576,7 +1632,7 @@ e_cal_backend_ews_create_object(ECalBackend *backend, EDataCal *cal, EServerMeth
 	return;
 
 exit:
-	e_data_cal_notify_object_created(cal, context, error, NULL, NULL);
+	e_data_cal_notify_object_created(cal, EDC_ER_CODE(error), NULL, NULL);
 }
 
 static void
@@ -1598,7 +1654,7 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
 	if (!e_ews_connection_update_items_finish (cnc, res, &ids, &error)) {
 		/* The calendar UI doesn't *display* errors unless they have
 		   the OtherError code */
-		error->code = OtherError;
+		error->code = EDC_CODE (OtherError);
 		return;
 	}
 
@@ -1629,11 +1685,12 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
 	comp_str = e_cal_component_get_as_string (modify_data->comp);
 	comp_str_old = e_cal_component_get_as_string (modify_data->oldcomp);
 
-	if (modify_data->context) {
+	if (modify_data->cal) {
 		e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbews), comp_str_old, comp_str);
-		e_data_cal_notify_object_modified (modify_data->cal, modify_data->context, error, comp_str_old, comp_str);
+		e_data_cal_notify_object_modified (modify_data->cal, EDC_ER_CODE(error), comp_str_old, comp_str);
 	}
-	else if (error) {
+	
+	if (error) {
 		g_warning ("Modify object error :  %s\n", error->message);
 		g_clear_error (&error);
 	}
@@ -1921,7 +1978,7 @@ convert_component_to_updatexml (ESoapMessage *msg, gpointer user_data)
 }
 
 static void
-e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context,
+e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal,
 				 const gchar *calobj, CalObjModType mod)
 {
 	EwsModifyData *modify_data;
@@ -1938,8 +1995,8 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMet
 	EwsAttachmentsData *attach_data;
 	struct TzidCbData cbd;
 
-	e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), InvalidArg);
-	e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', InvalidArg);
+	e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), OtherError);
+	e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', OtherError);
 
 	cbews = E_CAL_BACKEND_EWS(backend);
 	priv = cbews->priv;
@@ -2036,7 +2093,6 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMet
 		attach_data->cb_type = 2;
 		attach_data->oldcomp = g_object_ref (oldcomp);
 		attach_data->cal = g_object_ref (cal);
-		attach_data->context = context;
 		attach_data->itemid = itemid;
 		attach_data->changekey = changekey;
 
@@ -2054,7 +2110,6 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMet
 		modify_data->comp = g_object_ref (comp);
 		modify_data->oldcomp = g_object_ref (oldcomp);
 		modify_data->cal = g_object_ref (cal);
-		modify_data->context = context;
 		modify_data->itemid = itemid;
 		modify_data->changekey = changekey;
 
@@ -2072,9 +2127,9 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, EServerMet
 	return;
 
 exit:
-	if (context)
-		e_data_cal_notify_object_modified (cal, context, error, NULL, NULL);
-	else if (error) {
+	if (cal)
+		e_data_cal_notify_object_modified (cal, EDC_ER_CODE(error), NULL, NULL);
+	if (error) {
 		g_warning ("Modify object error :  %s\n", error->message);
 		g_clear_error (&error);
 	}
@@ -2199,7 +2254,7 @@ prepare_set_free_busy_status (ESoapMessage *msg, gpointer user_data)
 }
 
 static void
-e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, const gchar *calobj)
 {
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
@@ -2276,7 +2331,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 				if (error)
 					/* The calendar UI doesn't *display* errors unless they have
 					 * the OtherError code */
-					error->code = OtherError;
+					error->code = EDC_CODE (OtherError);
 			else {
 				transp = icalcomponent_get_first_property (subcomp, ICAL_TRANSP_PROPERTY);
 				if (!g_strcmp0 (icalproperty_get_value_as_string (transp), "TRANSPARENT") &&
@@ -2302,7 +2357,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 								       cancellable,
 								       &error);
 					if (error)
-						error->code = OtherError;
+						error->code = EDC_CODE (OtherError);
 				}
 			}
 				g_free (item_id);
@@ -2313,7 +2368,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 				break;
 			case ICAL_METHOD_CANCEL:
 				recurrence_id = icalcomponent_get_first_property (subcomp, ICAL_RECURRENCEID_PROPERTY);
-				e_cal_backend_ews_remove_object (backend, cal, NULL, item_id, icalproperty_get_value_as_string (recurrence_id), CALOBJ_MOD_ALL);
+				e_cal_backend_ews_remove_object (backend, NULL, item_id, icalproperty_get_value_as_string (recurrence_id), CALOBJ_MOD_ALL);
 				break;
 			case ICAL_METHOD_COUNTER:
 				/*this is a new time proposal mail from one of the attendees
@@ -2326,7 +2381,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 					icalproperty_set_value_from_string (summary, split_subject[1] , "NO");
 					g_strfreev (split_subject);
 
-					e_cal_backend_ews_modify_object (backend, cal, NULL, icalcomponent_as_ical_string(subcomp), CALOBJ_MOD_ALL);
+					e_cal_backend_ews_modify_object (backend, NULL, icalcomponent_as_ical_string(subcomp), CALOBJ_MOD_ALL);
 				}
 				break;
 			default:
@@ -2339,7 +2394,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 	icalcomponent_free (icalcomp);
 
 exit:
-	e_data_cal_notify_objects_received (cal, context, error);
+	e_data_cal_notify_objects_received (cal, EDC_ER_CODE(error));
 }
 
 static const char *
@@ -2409,8 +2464,7 @@ ewscal_send_cancellation_email (EEwsConnection *cnc, CamelAddress *from, CamelIn
 	camel_mime_message_set_from (message, CAMEL_INTERNET_ADDRESS (from));
 	camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_TO, recipient);
 
-	camel_medium_set_content ((CamelMedium *)message, (CamelDataWrapper *)multi);
-	g_object_unref (multi);
+	((CamelMedium *)message)->content = (CamelDataWrapper *) multi;
 
 	camel_ews_utils_create_mime_message (cnc, "SendOnly", NULL, message, 0, from, NULL, NULL, NULL, &error);
 
@@ -2424,7 +2478,7 @@ ewscal_send_cancellation_email (EEwsConnection *cnc, CamelAddress *from, CamelIn
 }
 
 static void
-e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, const gchar *calobj)
 {
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
@@ -2511,39 +2565,18 @@ e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, EServerMeth
 	icalcomponent_free (icalcomp);
 
 exit:
-	e_data_cal_notify_objects_sent (cal,context,error,NULL,calobj);
-}
-
-/* TODO Do not replicate this in every backend */
-static icaltimezone *
-resolve_tzid (const gchar *tzid, gpointer user_data)
-{
-	icaltimezone *zone;
-
-	zone = (!strcmp (tzid, "UTC"))
-		? icaltimezone_get_utc_timezone ()
-		: icaltimezone_get_builtin_timezone_from_tzid (tzid);
-
-	if (!zone)
-		zone = e_cal_backend_internal_get_timezone (E_CAL_BACKEND (user_data), tzid);
-
-	return zone;
+	e_data_cal_notify_objects_sent (cal, EDC_ER_CODE(error), NULL, calobj);
 }
 
 static void
 put_component_to_store (ECalBackendEws *cbews,
 			ECalComponent *comp)
 {
-	time_t time_start, time_end;
 	ECalBackendEwsPrivate *priv;
 
 	priv = cbews->priv;
 
-	e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-				   resolve_tzid, cbews, priv->default_zone,
-				   e_cal_backend_get_kind (E_CAL_BACKEND (cbews)));
-
-	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
+	e_cal_backend_store_put_component (priv->store, comp);
 }
 
 typedef struct {
@@ -2570,7 +2603,7 @@ ews_get_attachments_ready_callback (GObject *object, GAsyncResult *res, gpointer
 	ids = e_ews_connection_get_attachments_finish	(cnc, res, &uris, &error);
 
 	if (error != NULL) {
-		error->code = OtherError;
+		g_clear_error (&error);
 		return;
 	}
 
@@ -2642,7 +2675,7 @@ ews_get_attachments (ECalBackendEws *cbews, EEwsItem *item)
 							EWS_PRIORITY_MEDIUM,
 							uid,
 							attachment_ids,
-							e_cal_backend_get_cache_dir(E_CAL_BACKEND(cbews)),
+							cbews->priv->cache_dir,
 							TRUE,
 							ews_get_attachments_ready_callback,
 							NULL, NULL,
@@ -3072,19 +3105,16 @@ ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data
 
 	PRIV_LOCK (priv);
 
-	if (priv->opening_ctx) {
+	if (priv->opening_cal) {
 		/* Report success/failure for calendar open if pending,
 		   translating an authentication failure into something that
 		   will be recognised and handled appropriately */
 		if (error && error->domain == EWS_CONNECTION_ERROR &&
 		    error->code == EWS_CONNECTION_ERROR_AUTHENTICATION_FAILED) {
-			e_data_cal_notify_open(priv->opening_cal, priv->opening_ctx,
-					       EDC_ERROR(AuthenticationFailed));
+			e_data_cal_notify_open(priv->opening_cal, EDC_CODE(AuthenticationFailed));
 		} else {
-			e_data_cal_notify_open(priv->opening_cal, priv->opening_ctx,
-					       error?g_error_copy (error):NULL);
+			e_data_cal_notify_open(priv->opening_cal, EDC_ER_CODE(error));
 		}
-		priv->opening_ctx = NULL;
 		priv->opening_cal = NULL;
 		if (error) {
 			priv->cnc = NULL;
@@ -3262,8 +3292,7 @@ e_cal_backend_ews_start_query (ECalBackend *backend, EDataCalView *query)
 	cal_backend_ews_get_object_list (backend, e_data_cal_view_get_text (query),
 					 &objects, &err);
 	if (err) {
-		e_data_cal_view_notify_done (query, err);
-		g_error_free (err);
+		e_data_cal_view_notify_done (query, EDC_ER_CODE(err));
 		return;
 	}
 
@@ -3276,11 +3305,12 @@ e_cal_backend_ews_start_query (ECalBackend *backend, EDataCalView *query)
 		g_list_free (objects);
 	}
 
-	e_data_cal_view_notify_done (query, NULL);
+	e_data_cal_view_notify_done (query, 0);
 }
 
-static void
-e_cal_backend_ews_refresh(ECalBackend *backend, EDataCal *cal, EServerMethodContext context) {
+/*static void
+e_cal_backend_ews_refresh(ECalBackend *backend, EDataCal *cal) 
+{
 	ECalBackendEws *cbews;
 	ECalBackendEwsPrivate *priv;
 	GError *error = NULL;
@@ -3292,13 +3322,12 @@ e_cal_backend_ews_refresh(ECalBackend *backend, EDataCal *cal, EServerMethodCont
 	ews_start_sync(cbews);
 	PRIV_UNLOCK(priv);
 
-	e_data_cal_notify_refresh(cal, context, error);
-}
+	g_clear_error (&error);
+}*/
 
 typedef struct {
 	ECalBackendEws *cbews;
 	EDataCal *cal;
-	EServerMethodContext context;
 	GList *users;
 	time_t start;
 	time_t end;
@@ -3356,7 +3385,7 @@ ews_cal_get_free_busy_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
 	GError *error = NULL;
 
 	if (!e_ews_connection_get_free_busy_finish (cnc, res, &free_busy_sl, &error)) {
-		error->code = OtherError;
+		error->code = EDC_CODE (OtherError);
 		goto done;
 	}
 	
@@ -3369,7 +3398,7 @@ ews_cal_get_free_busy_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
 	g_slist_free (free_busy_sl);
 
 done:
-	e_data_cal_notify_free_busy (free_busy_data->cal, free_busy_data->context, error, free_busy);
+	e_data_cal_notify_free_busy (free_busy_data->cal, EDC_ER_CODE(error), free_busy);
 
 	g_list_foreach (free_busy_data->users, (GFunc)free, NULL);
 	g_list_free (free_busy_data->users);
@@ -3380,7 +3409,7 @@ done:
 
 static void
 e_cal_backend_ews_get_free_busy (ECalBackend *backend, EDataCal *cal,
-				 EServerMethodContext context, GList *users,
+				 GList *users,
 				 time_t start, time_t end)
 {
 	ECalBackendEws *cbews = E_CAL_BACKEND_EWS (backend);
@@ -3411,7 +3440,6 @@ e_cal_backend_ews_get_free_busy (ECalBackend *backend, EDataCal *cal,
 	free_busy_data = g_new0 (EwsFreeBusyData, 1);
 	free_busy_data->cbews = g_object_ref (cbews);
 	free_busy_data->cal = g_object_ref (cal);
-	free_busy_data->context = context;
 	free_busy_data->users = users_copy;
 	free_busy_data->start = start;
 	free_busy_data->end = end;
@@ -3428,7 +3456,7 @@ e_cal_backend_ews_get_free_busy (ECalBackend *backend, EDataCal *cal,
 	return;
 
 exit:
-	e_data_cal_notify_free_busy (cal, context, error, NULL);
+	e_data_cal_notify_free_busy (cal, EDC_ER_CODE(error), NULL);
 }
 
 static void
@@ -3475,6 +3503,11 @@ e_cal_backend_ews_finalize (GObject *object)
 		priv->user_email = NULL;
 	}
 
+	if (priv->cache_dir) {
+		g_free (priv->cache_dir);
+		priv->cache_dir = NULL;
+	}
+
 	if (priv->default_zone) {
 		icaltimezone_free (priv->default_zone, 1);
 		priv->default_zone = NULL;
@@ -3546,7 +3579,6 @@ e_cal_backend_ews_class_init (ECalBackendEwsClass *class)
 	backend_class->internal_get_timezone = e_cal_backend_ews_internal_get_timezone;
 
 	backend_class->open = e_cal_backend_ews_open;
-	backend_class->refresh = e_cal_backend_ews_refresh;
 	backend_class->get_object = e_cal_backend_ews_get_object;
 	backend_class->get_object_list = e_cal_backend_ews_get_object_list;
 	backend_class->remove = e_cal_backend_ews_remove;
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index 02d57b7..53f0895 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -54,6 +54,7 @@ which needs to be better organized via functions */
 #include "camel-ews-store.h"
 #include "camel-ews-summary.h"
 #include "camel-ews-utils.h"
+#include "ews-camel-compat.h"
 #include <ews-camel-common.h>
 
 #define EWS_MAX_FETCH_COUNT 100
@@ -71,9 +72,8 @@ which needs to be better organized via functions */
 		   SUMMARY_MESSAGE_FLAGS
 
 
-#define CAMEL_EWS_FOLDER_GET_PRIVATE(obj) \
-	(G_TYPE_INSTANCE_GET_PRIVATE \
-	((obj), CAMEL_TYPE_EWS_FOLDER, CamelEwsFolderPrivate))
+#define CAMEL_EWS_FOLDER_GET_PRIVATE(obj) obj->priv 
+static CamelOfflineFolderClass *parent_class = NULL;
 
 struct _CamelEwsFolderPrivate {
 	GMutex *search_lock;	/* for locking the search object */
@@ -89,34 +89,21 @@ struct _CamelEwsFolderPrivate {
 
 extern gint camel_application_is_exiting;
 
+static void
+ews_folder_constructed (CamelEwsFolder *object);
 static gboolean
 ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expunge, GCancellable *cancellable, GError **error);
 
 #define d(x)
 
-G_DEFINE_TYPE (CamelEwsFolder, camel_ews_folder, CAMEL_TYPE_OFFLINE_FOLDER)
-
 static gchar *
 ews_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
 {
 	CamelEwsFolder *ews_folder = CAMEL_EWS_FOLDER(folder);
 
-	return camel_data_cache_get_filename (ews_folder->cache, "cache", uid, error);
-}
-
-#if ! EDS_CHECK_VERSION(2,33,0)
-static gboolean camel_data_wrapper_construct_from_stream_sync(CamelDataWrapper *data_wrapper,
-							     CamelStream *stream,
-							     GCancellable *cancellable,
-							     GError **error)
-{
-	/* In 2.32 this returns an int, which is zero for success */
-	return !camel_data_wrapper_construct_from_stream(data_wrapper, stream, error);
+	return camel_data_cache_get_filename_compat (ews_folder->cache, "cache", uid, error);
 }
 
-#endif
-
-
 static CamelMimeMessage *
 camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder, const gchar *uid, GCancellable *cancellable, GError **error)
 {
@@ -127,7 +114,7 @@ camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder, const gchar
 	priv = ews_folder->priv;
 
 	g_static_rec_mutex_lock (&priv->cache_lock);
-	stream = camel_data_cache_get (ews_folder->cache, "cur", uid, error);
+	stream = camel_data_cache_get_compat (ews_folder->cache, "cur", uid, error);
 	if (!stream) {
 			g_static_rec_mutex_unlock (&priv->cache_lock);
 		return NULL;
@@ -207,8 +194,8 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
 	}
 
 	msg = camel_mime_message_new ();
-	if (EVO3_sync(camel_mime_part_construct_from_parser) (CAMEL_MIME_PART(msg),
-							      mimeparser, EVO3(NULL,) error) == -1) {
+	if (camel_mime_part_construct_from_parser_sync (CAMEL_MIME_PART(msg),
+							mimeparser, NULL, error) == -1) {
 		g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			     _("Unable to parse meeting request mimecontent!"));
 		goto exit_msg;
@@ -228,8 +215,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
 
 		dw = camel_medium_get_content (CAMEL_MEDIUM (mimepart));
 		tmpstream = camel_stream_mem_new ();
-		if (EVO3_sync(camel_data_wrapper_decode_to_stream) (dw,
-								    tmpstream, EVO3(NULL,) error) == -1) {
+		if (camel_data_wrapper_decode_to_stream_sync (dw, tmpstream, NULL, error) == -1) {
 			g_object_unref (tmpstream);
 			goto exit_msg;
 		}
@@ -271,12 +257,11 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
 			goto exit_save;
 		}
 		newstream = camel_stream_fs_new_with_fd (fd);
-		if (EVO3_sync(camel_data_wrapper_write_to_stream) (CAMEL_DATA_WRAPPER (msg),
-								   newstream, EVO3(NULL,) error) == -1)
+		if (camel_data_wrapper_write_to_stream_sync (CAMEL_DATA_WRAPPER (msg), newstream, NULL, error) == -1)
 			goto exit_save;
-		if (camel_stream_flush (newstream, EVO3(NULL,) error) == -1)
+		if (camel_stream_flush_compat (newstream, NULL, error) == -1)
 			goto exit_save;
-		if (camel_stream_close (newstream, EVO3(NULL,) error) == -1)
+		if (camel_stream_close_compat (newstream, NULL, error) == -1)
 			goto exit_save;
 		g_remove (mime_fname);
 		success = TRUE;
@@ -429,8 +414,8 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
 		}
 	}
 
-	cache_file = camel_data_cache_get_filename  (ews_folder->cache, "cur",
-						     uid, error);
+	cache_file = camel_data_cache_get_filename_compat  (ews_folder->cache, "cur",
+						    	    uid, error);
 	temp = g_strrstr (cache_file, "/");
 	dir = g_strndup (cache_file, temp - cache_file);
 
@@ -481,10 +466,9 @@ exit:
 
 /* Get the message from cache if available otherwise get it from server */
 static CamelMimeMessage *
-ews_folder_get_message_sync (CamelFolder *folder, const gchar *uid, EVO3(GCancellable *cancellable,) GError **error )
+ews_folder_get_message_sync (CamelFolder *folder, const gchar *uid, GCancellable *cancellable, GError **error )
 {
 	CamelMimeMessage *message;
-	EVO2(GCancellable *cancellable = NULL);
 
 	message = camel_ews_folder_get_message_from_cache ((CamelEwsFolder *)folder, uid, cancellable, NULL);
 	if (!message)
@@ -506,7 +490,7 @@ ews_folder_search_by_expression (CamelFolder *folder, const gchar *expression, G
 	g_mutex_lock (priv->search_lock);
 
 	camel_folder_search_set_folder (ews_folder->search, folder);
-	matches = camel_folder_search_search (ews_folder->search, expression, NULL, error);
+	matches = camel_folder_search_search_compat (ews_folder->search, expression, NULL, error);
 
 	g_mutex_unlock (priv->search_lock);
 
@@ -526,7 +510,7 @@ ews_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GE
 	g_mutex_lock (priv->search_lock);
 
 	camel_folder_search_set_folder (ews_folder->search, folder);
-	matches = camel_folder_search_count (ews_folder->search, expression, error);
+	matches = camel_folder_search_count_compat (ews_folder->search, expression, error);
 
 	g_mutex_unlock (priv->search_lock);
 
@@ -549,7 +533,7 @@ ews_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArra
 	g_mutex_lock (priv->search_lock);
 
 	camel_folder_search_set_folder (ews_folder->search, folder);
-	matches = camel_folder_search_search (ews_folder->search, expression, uids, error);
+	matches = camel_folder_search_search_compat (ews_folder->search, expression, uids, error);
 
 	g_mutex_unlock (priv->search_lock);
 
@@ -700,8 +684,9 @@ ews_sync_mi_flags (CamelFolder *folder, GSList *mi_list, GCancellable *cancellab
 					      msg_update_flags, mi_list, NULL,
 					      cancellable, error);
 }
+
 static gboolean
-ews_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *cancellable,) GError **error)
+ews_synchronize_sync (CamelFolder *folder, gboolean expunge, GCancellable *cancellable, GError **error)
 {
 	CamelEwsStore *ews_store;
 	GPtrArray *uids;
@@ -709,7 +694,6 @@ ews_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *
 	int mi_list_len = 0;
 	gboolean success = TRUE;
 	int i;
-	EVO2(GCancellable *cancellable = NULL);
 
 	ews_store = (CamelEwsStore *) camel_folder_get_parent_store (folder);
 
@@ -775,12 +759,11 @@ camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
 	else
 		short_name++;
 
-	folder = g_object_new (
-		CAMEL_TYPE_EWS_FOLDER,
-		"name", short_name, "full-name", folder_name,
-		"parent_store", store, NULL);
-
+	folder = CAMEL_FOLDER (camel_object_new(camel_ews_folder_get_type ()) );
+	
 	ews_folder = CAMEL_EWS_FOLDER(folder);
+	camel_folder_construct (folder, store, folder_name, short_name);
+	ews_folder_constructed (ews_folder);
 
 	summary_file = g_build_filename (folder_dir, "summary", NULL);
 	folder->summary = camel_ews_summary_new (folder, summary_file);
@@ -800,7 +783,7 @@ camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
 	camel_object_state_read (CAMEL_OBJECT (folder));
 	g_free(state_file);
 
-	ews_folder->cache = camel_data_cache_new (folder_dir, error);
+	ews_folder->cache = camel_data_cache_new_compat (folder_dir, error);
 	if (!ews_folder->cache) {
 		g_object_unref (folder);
 		return NULL;
@@ -958,7 +941,7 @@ exit:
 }
 
 static gboolean
-ews_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GError **error)
+ews_refresh_info_sync (CamelFolder *folder, GCancellable *cancellable, GError **error)
 {
 	CamelEwsFolder *ews_folder;
 	CamelEwsFolderPrivate *priv;
@@ -969,7 +952,6 @@ ews_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
 	gchar *sync_state;
 	gboolean includes_last_item = FALSE;
 	GError *rerror = NULL;
-	EVO2(GCancellable *cancellable = NULL);
 
 	full_name = camel_folder_get_full_name (folder);
 	ews_store = (CamelEwsStore *) camel_folder_get_parent_store (folder);
@@ -1070,11 +1052,10 @@ ews_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
 
 static gboolean
 ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
-	 		 EVO2(const) CamelMessageInfo *info,
+	 		 CamelMessageInfo *info,
 			 gchar **appended_uid,
-	 		 EVO3(GCancellable *cancellable,) GError **error)
+	 		 GCancellable *cancellable, GError **error)
 {
-	EVO2(GCancellable *cancellable = NULL;)
 	gchar *itemid, *changekey;
 	const gchar *folder_name;
 	gchar *folder_id;
@@ -1129,10 +1110,9 @@ static gboolean
 ews_transfer_messages_to_sync	(CamelFolder *source,
 				 GPtrArray *uids,
 				 CamelFolder *destination,
-				 EVO2(GPtrArray **transferred_uids,)
 				 gboolean delete_originals,
-				 EVO3(GPtrArray **transferred_uids,)
-				 EVO3(GCancellable *cancellable,)
+				 GPtrArray **transferred_uids,
+				 GCancellable *cancellable,
 				 GError **error)
 {
 	EEwsConnection *cnc;
@@ -1143,7 +1123,6 @@ ews_transfer_messages_to_sync	(CamelFolder *source,
 	GError *rerror = NULL;
 	GSList *ids = NULL, *ret_items = NULL;
 	gint i = 0;
-	EVO2(GCancellable *cancellable = NULL);
 
 	dst_full_name = camel_folder_get_full_name (destination);
 	dst_ews_store = (CamelEwsStore *) camel_folder_get_parent_store (destination);
@@ -1175,8 +1154,8 @@ ews_transfer_messages_to_sync	(CamelFolder *source,
 		}
 
 		/*update the store about the content of the source and destination folders*/
-		ews_refresh_info_sync (source, EVO3(cancellable,) NULL);
-		ews_refresh_info_sync (destination, EVO3(cancellable,) NULL);
+		ews_refresh_info_sync (source, cancellable, NULL);
+		ews_refresh_info_sync (destination, cancellable, NULL);
 	}
 	g_free (dst_id);
 
@@ -1225,7 +1204,7 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
 			   trigger folder info refresh and then go on to clear the
 			   cache of the deleted items anyway. */
 			g_clear_error(&rerror);
-			status = ews_refresh_info_sync (folder, EVO3(cancellable,) &rerror);
+			status = ews_refresh_info_sync (folder, cancellable, &rerror);
 		}
 
 		if (status) {
@@ -1255,14 +1234,13 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
 }
 
 static gboolean
-ews_expunge_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GError **error)
+ews_expunge_sync (CamelFolder *folder, GCancellable *cancellable, GError **error)
 {
 	CamelEwsStore *ews_store;
 	CamelEwsMessageInfo *ews_info;
 	CamelMessageInfo *info;
 	CamelStore *parent_store;
 	GSList *deleted_items = NULL;
-	EVO2(GCancellable *cancellable = NULL;)
 	gint i, count;
 
 	parent_store = camel_folder_get_parent_store (folder);
@@ -1298,7 +1276,7 @@ ews_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
 }
 
 static void
-ews_folder_dispose (GObject *object)
+ews_folder_dispose (CamelObject *object)
 {
 	CamelEwsFolder *ews_folder = CAMEL_EWS_FOLDER (object);
 
@@ -1316,12 +1294,11 @@ ews_folder_dispose (GObject *object)
 	g_hash_table_destroy (ews_folder->priv->uid_eflags);
 	g_cond_free (ews_folder->priv->fetch_cond);
 
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (camel_ews_folder_parent_class)->dispose (object);
+	g_free (ews_folder->priv);
 }
 
 static void
-ews_folder_constructed (GObject *object)
+ews_folder_constructed (CamelEwsFolder *object)
 {
 	CamelFolder *folder;
 	CamelStore *parent_store;
@@ -1340,32 +1317,137 @@ ews_folder_constructed (GObject *object)
 	g_free (description);
 }
 
+#if ! EDS_CHECK_VERSION (2,29,0)
+/* Compatibility with 2.28 */
+
+static GPtrArray *
+ews_folder_search_by_expression_compat (CamelFolder *folder, const gchar *expression, CamelException *ex)
+{
+	GError *error = NULL;
+	GPtrArray *ret;
+
+	ret = ews_folder_search_by_expression (folder, expression, &error);
+
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static guint32
+ews_folder_count_by_expression_compat (CamelFolder *folder, const gchar *expression, CamelException *ex)
+{
+	GError *error = NULL;
+	guint32 ret;
+
+	ret = ews_folder_count_by_expression (folder, expression, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static GPtrArray *
+ews_folder_search_by_uids_compat (CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
+{
+	GError *error = NULL;
+	GPtrArray *ret;
+
+	ret = ews_folder_search_by_uids (folder, expression, uids, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static gchar *
+ews_get_filename_compat (CamelFolder *folder, const gchar *uid, CamelException *ex)
+{
+	GError *error = NULL;
+	gchar *ret;
+
+	ret = ews_get_filename (folder, uid, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static CamelMimeMessage *
+ews_folder_get_message_compat (CamelFolder *folder, const gchar *uid, CamelException *ex)
+{
+	GError *error = NULL;
+	CamelMimeMessage *ret;
+
+	ret = ews_folder_get_message_sync (folder, uid, NULL, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static void
+ews_append_message_compat (CamelFolder *folder, CamelMimeMessage *message,
+	 		   const CamelMessageInfo *info,
+			   gchar **appended_uid,
+	 		   CamelException *ex)
+{
+	GError *error = NULL;
+	ews_append_message_sync (folder, message, (CamelMessageInfo *) info, appended_uid, NULL, &error);	
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static void
+ews_refresh_info_compat (CamelFolder *folder, CamelException *ex)
+{
+	GError *error = NULL;
+	ews_refresh_info_sync (folder, NULL, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static void
+ews_synchronize_compat (CamelFolder *folder, gboolean expunge, CamelException *ex)
+{
+	GError *error = NULL;
+	ews_synchronize_sync (folder, expunge, NULL, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static void 
+ews_expunge_compat (CamelFolder *folder, CamelException *ex)
+{
+	GError *error = NULL;
+	ews_expunge_sync (folder, NULL, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static void 
+ews_transfer_messages_to_compat	(CamelFolder *source,
+				 GPtrArray *uids,
+				 CamelFolder *destination,
+				 GPtrArray **transferred_uids,
+				 gboolean delete_originals,
+				 CamelException *ex)
+{
+	GError *error = NULL;
+	ews_transfer_messages_to_sync	(source, uids, destination, delete_originals, 
+					 transferred_uids, NULL, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+#endif /* compat */
+
 static void
 camel_ews_folder_class_init (CamelEwsFolderClass *class)
 {
-	GObjectClass *object_class;
 	CamelFolderClass *folder_class;
 
-	g_type_class_add_private (class, sizeof (CamelEwsFolderPrivate));
-
-	object_class = G_OBJECT_CLASS (class);
-	object_class->dispose = ews_folder_dispose;
-	object_class->constructed = ews_folder_constructed;
+	parent_class = CAMEL_OFFLINE_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_offline_folder_get_type ()));
 
 	folder_class = CAMEL_FOLDER_CLASS (class);
-	folder_class->EVO3_sync(get_message) = ews_folder_get_message_sync;
-	folder_class->search_by_expression = ews_folder_search_by_expression;
-	folder_class->count_by_expression = ews_folder_count_by_expression;
+	folder_class->EVO3_sync(get_message) = ews_folder_get_message_compat;
+	folder_class->search_by_expression = ews_folder_search_by_expression_compat;
+	folder_class->count_by_expression = ews_folder_count_by_expression_compat;
 	folder_class->cmp_uids = ews_cmp_uids;
-	folder_class->search_by_uids = ews_folder_search_by_uids;
+	folder_class->search_by_uids = ews_folder_search_by_uids_compat;
 	folder_class->search_free = ews_folder_search_free;
-	folder_class->EVO3_sync(append_message) = ews_append_message_sync;
-	folder_class->EVO3_sync(refresh_info) = ews_refresh_info_sync;
-	EVO3(folder_class->synchronize_sync = ews_synchronize_sync);
-	EVO2(folder_class->sync = ews_synchronize_sync);
-	folder_class->EVO3_sync(expunge) = ews_expunge_sync;
-	folder_class->EVO3_sync(transfer_messages_to) = ews_transfer_messages_to_sync;
-	folder_class->get_filename = ews_get_filename;
+	folder_class->EVO3_sync(append_message) = ews_append_message_compat;
+	folder_class->EVO3_sync(refresh_info) = ews_refresh_info_compat;
+	EVO3(folder_class->synchronize_sync = ews_synchronize_compat);
+	EVO2(folder_class->sync = ews_synchronize_compat);
+	folder_class->EVO3_sync(expunge) = ews_expunge_compat;
+	folder_class->EVO3_sync(transfer_messages_to) = ews_transfer_messages_to_compat;
+	folder_class->get_filename = ews_get_filename_compat;
 }
 
 static void
@@ -1373,7 +1455,7 @@ camel_ews_folder_init (CamelEwsFolder *ews_folder)
 {
 	CamelFolder *folder = CAMEL_FOLDER (ews_folder);
 
-	ews_folder->priv = CAMEL_EWS_FOLDER_GET_PRIVATE (ews_folder);
+	ews_folder->priv = g_new0 (CamelEwsFolderPrivate, 1);
 
 	folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED |
 		CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN |
@@ -1392,4 +1474,26 @@ camel_ews_folder_init (CamelEwsFolder *ews_folder)
 	camel_folder_set_lock_async (folder, TRUE);
 }
 
+/* CamelObject 2.28 */
+CamelType
+camel_ews_folder_get_type (void)
+{
+	static CamelType camel_ews_folder_type = CAMEL_INVALID_TYPE;
+
+	if (camel_ews_folder_type == CAMEL_INVALID_TYPE) {
+		camel_ews_folder_type =
+			camel_type_register (camel_offline_folder_get_type (),
+					"CamelEwsFolder",
+					sizeof (CamelEwsFolder),
+					sizeof (CamelEwsFolderClass),
+					(CamelObjectClassInitFunc) camel_ews_folder_class_init,
+					NULL,
+					(CamelObjectInitFunc) camel_ews_folder_init,
+					(CamelObjectFinalizeFunc) ews_folder_dispose);
+	}
+
+	return camel_ews_folder_type;
+}
+
+
 /** End **/
diff --git a/src/camel/camel-ews-folder.h b/src/camel/camel-ews-folder.h
index b4d1a4d..9b1f39d 100644
--- a/src/camel/camel-ews-folder.h
+++ b/src/camel/camel-ews-folder.h
@@ -28,27 +28,14 @@
 #define CAMEL_EWS_FOLDER_H
 
 #include <camel/camel.h>
-
+#include <gio/gio.h>
 #include "camel-ews-summary.h"
 
-/* Standard GObject macros */
-#define CAMEL_TYPE_EWS_FOLDER \
-	(camel_ews_folder_get_type ())
-#define CAMEL_EWS_FOLDER(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), CAMEL_TYPE_EWS_FOLDER, CamelEwsFolder))
-#define CAMEL_EWS_FOLDER_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_CAST \
-	((cls), CAMEL_TYPE_EWS_FOLDER, CamelEwsFolderClass))
-#define CAMEL_IS_EWS_FOLDER(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE \
-	((obj), CAMEL_TYPE_EWS_FOLDER))
-#define CAMEL_IS_EWS_FOLDER_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_TYPE \
-	((cls), CAMEL_TYPE_EWS_FOLDER))
-#define CAMEL_EWS_FOLDER_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS \
-	((obj), CAMEL_TYPE_EWS_FOLDER, CamelEwsFolderClass))
+/* Camel macros - gobject stuff replaced */
+#define CAMEL_EWS_FOLDER_TYPE     (camel_ews_folder_get_type ())
+#define CAMEL_EWS_FOLDER(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_EWS_FOLDER_TYPE, CamelEwsFolder))
+#define CAMEL_EWS_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EWS_FOLDER_TYPE, CamelEwsFolderClass))
+#define CAMEL_IS_EWS_FOLDER(o)    (CAMEL_CHECK_TYPE((o), CAMEL_EWS_FOLDER_TYPE))
 
 G_BEGIN_DECLS
 
@@ -68,7 +55,7 @@ struct _CamelEwsFolderClass {
 	CamelOfflineFolderClass parent_class;
 };
 
-GType camel_ews_folder_get_type (void);
+CamelType camel_ews_folder_get_type (void);
 
 /* implemented */
 CamelFolder * camel_ews_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, GCancellable *cancellable, GError **error);
diff --git a/src/camel/camel-ews-store-summary.c b/src/camel/camel-ews-store-summary.c
index 0b65a3c..85d6728 100644
--- a/src/camel/camel-ews-store-summary.c
+++ b/src/camel/camel-ews-store-summary.c
@@ -3,6 +3,7 @@
 #include <gio/gio.h>
 #include <string.h>
 #include "camel-ews-store-summary.h"
+#include "ews-camel-compat.h"
 
 #define S_LOCK(x) (g_static_rec_mutex_lock(&(x)->priv->s_lock))
 #define S_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->priv->s_lock))
@@ -23,7 +24,7 @@ struct _CamelEwsStoreSummaryPrivate {
 	GFileMonitor *monitor_delete;
 };
 
-G_DEFINE_TYPE (CamelEwsStoreSummary, camel_ews_store_summary, CAMEL_TYPE_OBJECT)
+G_DEFINE_TYPE (CamelEwsStoreSummary, camel_ews_store_summary, G_TYPE_OBJECT)
 
 static void
 ews_store_summary_finalize (GObject *object)
@@ -149,7 +150,7 @@ camel_ews_store_summary_new (const gchar *path)
 
 	ews_summary->priv->path = g_strdup (path);
 	file = g_file_new_for_path (path);
-	ews_summary->priv->monitor_delete = g_file_monitor_file (file, G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+	ews_summary->priv->monitor_delete = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error);
 
 	/* Remove this once we have camel_store_remove_storage api, which should be available from 3.2 */
 	if (!error)
@@ -343,11 +344,11 @@ camel_ews_store_summary_new_folder (CamelEwsStoreSummary *ews_summary,
 			       "ChangeKey", change_key);
 	g_key_file_set_string (ews_summary->priv->key_file, folder_id,
 			       "DisplayName", display_name);
-	g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer (ews_summary->priv->key_file, folder_id,
 			       "FolderType", folder_type);
-	g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer (ews_summary->priv->key_file, folder_id,
 			       "Flags", folder_flags);
-	g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer (ews_summary->priv->key_file, folder_id,
 			       "Total", total);
 
 	ews_ss_hash_replace (ews_summary, g_strdup (folder_id), NULL, FALSE);
@@ -414,7 +415,7 @@ camel_ews_store_summary_set_folder_flags (CamelEwsStoreSummary *ews_summary,
 {
 	S_LOCK(ews_summary);
 
-	g_key_file_set_uint64	(ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer	(ews_summary->priv->key_file, folder_id,
 				 "Flags", flags);
 	ews_summary->priv->dirty = TRUE;
 
@@ -428,7 +429,7 @@ camel_ews_store_summary_set_folder_unread (CamelEwsStoreSummary *ews_summary,
 {
 	S_LOCK(ews_summary);
 
-	g_key_file_set_uint64	(ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer	(ews_summary->priv->key_file, folder_id,
 				 "UnRead", unread);
 	ews_summary->priv->dirty = TRUE;
 
@@ -442,7 +443,7 @@ camel_ews_store_summary_set_folder_total (CamelEwsStoreSummary *ews_summary,
 {
 	S_LOCK(ews_summary);
 
-	g_key_file_set_uint64	(ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer	(ews_summary->priv->key_file, folder_id,
 				 "Total", total);
 	ews_summary->priv->dirty = TRUE;
 
@@ -456,7 +457,7 @@ camel_ews_store_summary_set_folder_type (CamelEwsStoreSummary *ews_summary,
 {
 	S_LOCK(ews_summary);
 
-	g_key_file_set_uint64	(ews_summary->priv->key_file, folder_id,
+	g_key_file_set_integer	(ews_summary->priv->key_file, folder_id,
 				 "FolderType", ews_folder_type);
 	ews_summary->priv->dirty = TRUE;
 
@@ -573,7 +574,7 @@ camel_ews_store_summary_get_folder_flags (CamelEwsStoreSummary *ews_summary,
 
 	S_LOCK(ews_summary);
 
-	ret = g_key_file_get_uint64	(ews_summary->priv->key_file, folder_id,
+	ret = g_key_file_get_integer	(ews_summary->priv->key_file, folder_id,
 					 "Flags", error);
 
 	S_UNLOCK(ews_summary);
@@ -591,7 +592,7 @@ camel_ews_store_summary_get_folder_unread (CamelEwsStoreSummary *ews_summary,
 
 	S_LOCK(ews_summary);
 
-	ret = g_key_file_get_uint64	(ews_summary->priv->key_file, folder_id,
+	ret = g_key_file_get_integer	(ews_summary->priv->key_file, folder_id,
 					 "UnRead", error);
 
 	S_UNLOCK(ews_summary);
@@ -608,7 +609,7 @@ camel_ews_store_summary_get_folder_total (CamelEwsStoreSummary *ews_summary,
 
 	S_LOCK(ews_summary);
 
-	ret = g_key_file_get_uint64	(ews_summary->priv->key_file, folder_id,
+	ret = g_key_file_get_integer	(ews_summary->priv->key_file, folder_id,
 					 "Total", error);
 
 	S_UNLOCK(ews_summary);
@@ -625,7 +626,7 @@ camel_ews_store_summary_get_folder_type (CamelEwsStoreSummary *ews_summary,
 
 	S_LOCK(ews_summary);
 
-	ret = g_key_file_get_uint64	(ews_summary->priv->key_file, folder_id,
+	ret = g_key_file_get_integer	(ews_summary->priv->key_file, folder_id,
 					 "FolderType", error);
 
 	S_UNLOCK(ews_summary);
diff --git a/src/camel/camel-ews-store-summary.h b/src/camel/camel-ews-store-summary.h
index e7df985..494df59 100644
--- a/src/camel/camel-ews-store-summary.h
+++ b/src/camel/camel-ews-store-summary.h
@@ -29,12 +29,12 @@ typedef struct _CamelEwsStoreSummaryClass CamelEwsStoreSummaryClass;
 typedef struct _CamelEwsStoreSummaryPrivate CamelEwsStoreSummaryPrivate;
 
 struct _CamelEwsStoreSummary {
-	CamelObject parent;
+	GObject parent;
 	CamelEwsStoreSummaryPrivate *priv;
 };
 
 struct _CamelEwsStoreSummaryClass {
-	CamelObjectClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType		camel_ews_store_summary_get_type	(void);
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index bdb8b85..27cf60e 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -46,6 +46,7 @@
 #include "camel-ews-summary.h"
 #include "camel-ews-utils.h"
 #include "ews-esource-utils.h"
+#include "ews-camel-compat.h"
 
 #ifdef G_OS_WIN32
 #include <winsock2.h>
@@ -69,6 +70,8 @@ struct _CamelEwsStorePrivate {
 	EEwsConnection *cnc;
 };
 
+static CamelOfflineStoreClass *parent_class = NULL;
+
 #if ! EDS_CHECK_VERSION(2,33,0)
 static inline void camel_offline_store_set_online_sync(CamelOfflineStore *store,
 						       gboolean online,
@@ -90,7 +93,9 @@ static inline gboolean camel_offline_store_get_online(CamelOfflineStore *store)
 
 extern CamelServiceAuthType camel_ews_password_authtype; /*for the query_auth_types function*/
 
+#if EDS_CHECK_VERSION(2,31,0)
 G_DEFINE_TYPE (CamelEwsStore, camel_ews_store, CAMEL_TYPE_OFFLINE_STORE)
+#endif
 
 static gboolean
 ews_store_construct	(CamelService *service, CamelSession *session,
@@ -101,21 +106,26 @@ ews_store_construct	(CamelService *service, CamelSession *session,
 	CamelEwsStore *ews_store;
 	CamelEwsStorePrivate *priv;
 	gchar *summary_file, *session_storage_path;
+	CamelException ex;
 
 	ews_store = (CamelEwsStore *) service;
 	priv = ews_store->priv;
 
 	/* Chain up to parent's construct() method. */
-	service_class = CAMEL_SERVICE_CLASS (camel_ews_store_parent_class);
-	if (!service_class->construct (service, session, provider, url, error))
+	service_class = CAMEL_SERVICE_CLASS (parent_class);
+	service_class->construct (service, session, provider, url, &ex);
+
+	if (camel_exception_is_set (&ex)) {
+		ews_compat_propagate_exception_to_gerror (&ex, error);
 		return FALSE;
+	}
 
 	/* Disable virtual trash and junk folders. Exchange has real
 	   folders for that */
 	((CamelStore *)ews_store)->flags &= ~(CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK);
 
 	/*storage path*/
-	session_storage_path = camel_session_get_storage_path (session, service, error);
+	session_storage_path = camel_session_get_storage_path_compat (session, service, error);
 	if (!session_storage_path) {
 		g_set_error (
 			error, CAMEL_STORE_ERROR,
@@ -177,7 +187,7 @@ ews_store_authenticate	(EEwsConnection *cnc,
 		prompt = camel_session_build_password_prompt ("Exchange Web Services",
 				      service->url->user, service->url->host);
 		service->url->passwd =
-		camel_session_get_password (session, service, "Exchange Web Services",
+		camel_session_get_password_compat (session, service, "Exchange Web Services",
 					    prompt, "password",
 					    CAMEL_SESSION_PASSWORD_SECRET,
 					    &error);
@@ -232,10 +242,13 @@ ews_disconnect_sync (CamelService *service, gboolean clean, EVO3(GCancellable *c
 {
 	CamelEwsStore *ews_store = (CamelEwsStore *) service;
 	CamelServiceClass *service_class;
+	CamelException ex;
 
-	service_class = CAMEL_SERVICE_CLASS (camel_ews_store_parent_class);
-	if (!service_class->EVO3_sync(disconnect) (service, clean, EVO3(cancellable,) error))
+	service_class = CAMEL_SERVICE_CLASS (parent_class);
+	if (!service_class->EVO3_sync(disconnect) (service, clean, EVO3(cancellable,) &ex)) {
+		ews_compat_propagate_exception_to_gerror (&ex, error);
 		return FALSE;
+	}
 
 	camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
@@ -444,7 +457,7 @@ ews_refresh_finfo (CamelSession *session, CamelSessionThreadMsg *msg)
 	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (ews_store)))
 		return;
 
-	if (!EVO3_sync(camel_service_connect) ((CamelService *) ews_store, &msg->error))
+	if (!camel_service_connect_compat ((CamelService *) ews_store, NULL))
 		return;
 
 	sync_state = camel_ews_store_summary_get_string_val (ews_store->summary, "sync_state", NULL);
@@ -491,7 +504,7 @@ ews_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, EV
 
 	g_mutex_lock (priv->get_finfo_lock);
 	if (!(camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
-	      && EVO3_sync(camel_service_connect) ((CamelService *)store, error))) {
+	      && camel_service_connect_compat ((CamelService *)store, error))) {
 		g_mutex_unlock (priv->get_finfo_lock);
 		goto offline;
 	}
@@ -600,7 +613,7 @@ ews_create_folder_sync (CamelStore *store,
 	fi = camel_ews_utils_build_folder_info (ews_store, folder_id->id);
 	e_ews_folder_free_fid (folder_id);
 
-	camel_store_folder_created (store, fi);
+	camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", fi);
 
 	g_free (full_name);
 	g_free (fid);
@@ -645,7 +658,7 @@ ews_delete_folder_sync	(CamelStore *store,
 	fi = camel_ews_utils_build_folder_info (ews_store, fid);
 	camel_ews_store_summary_remove_folder (ews_summary, fid, error);
 
-	camel_store_folder_deleted (store, fi);
+	camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi);
 	camel_folder_info_free (fi);
 
 	g_free (fid);
@@ -831,14 +844,18 @@ ews_get_trash_folder_sync (CamelStore *store, EVO3(GCancellable *cancellable,) G
 #endif
 
 static gboolean
-ews_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
+ews_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, CamelException *ex)
 {
+	gboolean ret;
+
 	/* Skip unselectable folders from automatic refresh */
 	if (info && (info->flags & CAMEL_FOLDER_NOSELECT) != 0) return FALSE;
 
 	/* Delegate decision to parent class */
-	return CAMEL_STORE_CLASS(camel_ews_store_parent_class)->can_refresh_folder (store, info, error) ||
+	ret = CAMEL_STORE_CLASS(parent_class)->can_refresh_folder (store, info, ex) ||
 			(camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
+
+	return ret;
 }
 
 gboolean
@@ -853,14 +870,14 @@ camel_ews_store_connected (CamelEwsStore *ews_store, GError **error)
 		return FALSE;
 	}
 
-	if (!EVO3_sync(camel_service_connect) ((CamelService *) ews_store, error))
+	if (!camel_service_connect_compat ((CamelService *) ews_store, error))
 		return FALSE;
 
 	return TRUE;
 }
 
 static void
-ews_store_dispose (GObject *object)
+ews_store_dispose (CamelObject *object)
 {
 	CamelEwsStore *ews_store;
 
@@ -877,53 +894,145 @@ ews_store_dispose (GObject *object)
 		ews_store->priv->cnc = NULL;
 	}
 
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (camel_ews_store_parent_class)->dispose (object);
 }
 
 static void
-ews_store_finalize (GObject *object)
+ews_store_finalize (CamelObject *object)
 {
 	CamelEwsStore *ews_store;
 
 	ews_store = CAMEL_EWS_STORE (object);
 
+	ews_store_dispose (object);
 	g_free (ews_store->storage_path);
 	g_free (ews_store->priv->host_url);
 	g_mutex_free (ews_store->priv->get_finfo_lock);
 
-	/* Chain up to parent's finalize() method. */
-	G_OBJECT_CLASS (camel_ews_store_parent_class)->finalize (object);
+	g_free (ews_store->priv);
+}
+
+#if ! EDS_CHECK_VERSION (2,29,0)
+/* Compatibility with 2.28. maybe good to remove EVO3's like we did in camel-ews-folder.c, later.. */
+static void
+ews_store_construct_compat	(CamelService *service, CamelSession *session,
+				 CamelProvider *provider, CamelURL *url,
+				 CamelException *ex)
+{
+	GError *error = NULL;
+	ews_store_construct (service, session, provider, url, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+static  GList*
+ews_store_query_auth_types_compat (CamelService *service, CamelException *ex)
+{
+	GError *error = NULL;
+	GList *ret;
+
+	ret = ews_store_query_auth_types_sync (service, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+static gboolean
+ews_connect_compat (CamelService *service, CamelException *ex)
+{
+	GError *error = NULL;
+	gboolean ret;
+
+	ret = ews_connect_sync (service, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static gboolean
+ews_disconnect_compat (CamelService *service, gboolean clean, CamelException *ex)
+{
+	GError *error = NULL;
+	gboolean ret;
+
+	ret = ews_disconnect_sync (service, clean, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static CamelFolder *
+ews_get_folder_compat (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex)
+{
+	GError *error = NULL;
+	CamelFolder *ret;
+
+	ret = ews_get_folder_sync (store, folder_name, flags, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static CamelFolderInfo*
+ews_create_folder_compat (CamelStore *store, const gchar *parent_name,
+			const gchar *folder_name, CamelException *ex)
+{
+	GError *error = NULL;
+	CamelFolderInfo *ret;
+
+	ret = ews_create_folder_sync (store, parent_name, folder_name, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
+}
+
+static void
+ews_delete_folder_compat (CamelStore *store, const gchar *folder_name,
+			  CamelException *ex)
+{
+	GError *error = NULL;
+
+	ews_delete_folder_sync (store, folder_name, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static void 
+ews_rename_folder_compat (CamelStore *store, const gchar *old_name,
+			  const gchar *new_name, CamelException *ex)
+{
+	GError *error = NULL;
+
+	ews_rename_folder_sync (store, old_name, new_name, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+}
+
+static CamelFolderInfo *
+ews_get_folder_info_compat (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
+{
+	GError *error = NULL;
+	CamelFolderInfo *ret;
+
+	ret = ews_get_folder_info_sync (store, top, flags, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
+	return ret;
 }
 
+#endif /* compat */
+
 static void
 camel_ews_store_class_init (CamelEwsStoreClass *class)
 {
-	GObjectClass *object_class;
 	CamelServiceClass *service_class;
 	CamelStoreClass *store_class;
 
-	g_type_class_add_private (class, sizeof (CamelEwsStorePrivate));
-
-	object_class = G_OBJECT_CLASS (class);
-	object_class->dispose = ews_store_dispose;
-	object_class->finalize = ews_store_finalize;
+	parent_class = CAMEL_OFFLINE_STORE_CLASS (camel_type_get_global_classfuncs (camel_offline_store_get_type ()));
 
 	service_class = CAMEL_SERVICE_CLASS (class);
-	service_class->construct = ews_store_construct;
-	service_class->EVO3_sync(query_auth_types) = ews_store_query_auth_types_sync;
+	service_class->construct = ews_store_construct_compat;
+	service_class->EVO3_sync(query_auth_types) = ews_store_query_auth_types_compat;
 	service_class->get_name = ews_get_name;
-	service_class->EVO3_sync(connect) = ews_connect_sync;
-	service_class->EVO3_sync(disconnect) = ews_disconnect_sync;
+	service_class->EVO3_sync(connect) = ews_connect_compat;
+	service_class->EVO3_sync(disconnect) = ews_disconnect_compat;
 
 	store_class = CAMEL_STORE_CLASS (class);
 	store_class->hash_folder_name = ews_hash_folder_name;
 	store_class->compare_folder_name = ews_compare_folder_name;
-	store_class->EVO3_sync(get_folder) = ews_get_folder_sync;
-	store_class->EVO3_sync(create_folder) = ews_create_folder_sync;
-	store_class->EVO3_sync(delete_folder) = ews_delete_folder_sync;
-	store_class->EVO3_sync(rename_folder) = ews_rename_folder_sync;
-	store_class->EVO3_sync(get_folder_info) = ews_get_folder_info_sync;
+	store_class->EVO3_sync(get_folder) = ews_get_folder_compat;
+	store_class->EVO3_sync(create_folder) = ews_create_folder_compat;
+	store_class->EVO3_sync(delete_folder) = ews_delete_folder_compat;
+	store_class->EVO3_sync(rename_folder) = ews_rename_folder_compat;
+	store_class->EVO3_sync(get_folder_info) = ews_get_folder_info_compat;
 	store_class->free_folder_info = camel_store_free_folder_info_full;
 
 	EVO3(store_class->get_trash_folder_sync = ews_get_trash_folder_sync;)
@@ -933,10 +1042,29 @@ camel_ews_store_class_init (CamelEwsStoreClass *class)
 static void
 camel_ews_store_init (CamelEwsStore *ews_store)
 {
-	ews_store->priv =
-		CAMEL_EWS_STORE_GET_PRIVATE (ews_store);
+	ews_store->priv = g_new0 (CamelEwsStorePrivate, 1);
 
 	ews_store->priv->cnc = NULL;
 	ews_store->priv->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
 	ews_store->priv->get_finfo_lock = g_mutex_new ();
 }
+
+CamelType
+camel_ews_store_get_type (void)
+{
+	static CamelType camel_ews_store_type = CAMEL_INVALID_TYPE;
+
+	if (camel_ews_store_type == CAMEL_INVALID_TYPE)	{
+		camel_ews_store_type =
+			camel_type_register (camel_offline_store_get_type (),
+					     "CamelEwsStore",
+					     sizeof (CamelEwsStore),
+					     sizeof (CamelEwsStoreClass),
+					     (CamelObjectClassInitFunc) camel_ews_store_class_init,
+					     NULL,
+					     (CamelObjectInitFunc) camel_ews_store_init,
+					     (CamelObjectFinalizeFunc) ews_store_finalize);
+	}
+
+	return camel_ews_store_type;
+}
diff --git a/src/camel/camel-ews-store.h b/src/camel/camel-ews-store.h
index 65497b1..f76ed00 100644
--- a/src/camel/camel-ews-store.h
+++ b/src/camel/camel-ews-store.h
@@ -29,26 +29,11 @@
 #include <e-ews-connection.h>
 #include "camel-ews-store-summary.h"
 
-/* Standard GObject macros */
-#define CAMEL_TYPE_EWS_STORE \
-	(camel_ews_store_get_type ())
-#define CAMEL_EWS_STORE(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), CAMEL_TYPE_EWS_STORE, CamelEwsStore))
-#define CAMEL_EWS_STORE_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_CAST \
-	((cls), CAMEL_TYPE_EWS_STORE, CamelEwsStoreClass))
-#define CAMEL_IS_EWS_STORE(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE \
-	((obj), CAMEL_TYPE_EWS_STORE))
-#define CAMEL_IS_EWS_STORE_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_TYPE \
-	((cls), CAMEL_TYPE_EWS_STORE))
-#define CAMEL_EWS_STORE_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS \
-	((obj), CAMEL_TYPE_EWS_STORE, CamelEwsStoreClass))
-
-#define GW_PARAM_FILTER_INBOX		(1 << 0)
+/* Standard Camel Object macros - added for 2.28 compatibility */
+#define CAMEL_EWS_STORE_TYPE     (camel_ews_store_get_type ())
+#define CAMEL_EWS_STORE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_EWS_STORE_TYPE, CamelEwsStore))
+#define CAMEL_EWS_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EWS_STORE_TYPE, CamelEwsStoreClass))
+#define CAMEL_IS_EWS_STORE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_EWS_STORE_TYPE))
 
 G_BEGIN_DECLS
 
@@ -68,7 +53,7 @@ struct _CamelEwsStoreClass {
 	CamelOfflineStoreClass parent_class;
 };
 
-GType camel_ews_store_get_type (void);
+CamelType camel_ews_store_get_type (void);
 gchar *		ews_get_name	(CamelService *service, gboolean brief);
 EEwsConnection *
 		camel_ews_store_get_connection	(CamelEwsStore *ews_store);
diff --git a/src/camel/camel-ews-summary.c b/src/camel/camel-ews-summary.c
index 8d55dde..6a38408 100644
--- a/src/camel/camel-ews-summary.c
+++ b/src/camel/camel-ews-summary.c
@@ -35,6 +35,7 @@
 
 #include "camel-ews-folder.h"
 #include "camel-ews-summary.h"
+#include "ews-camel-compat.h"
 
 #define CAMEL_EWS_SUMMARY_VERSION (1)
 
@@ -47,13 +48,10 @@
 static gint ews_summary_header_load (CamelFolderSummary *, FILE *);
 static gint ews_summary_header_save (CamelFolderSummary *, FILE *);
 
-static CamelMessageInfo *ews_message_info_migrate (CamelFolderSummary *s, FILE *in);
-
-static CamelMessageContentInfo * ews_content_info_migrate (CamelFolderSummary *s, FILE *in);
 static gboolean ews_info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set);
 
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
+static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, CamelException *ex);
 static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
 static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
 static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
@@ -61,7 +59,7 @@ static CamelMessageContentInfo * content_info_from_db (CamelFolderSummary *s, Ca
 
 /*End of Prototypes*/
 
-G_DEFINE_TYPE (CamelEwsSummary, camel_ews_summary, CAMEL_TYPE_FOLDER_SUMMARY)
+static CamelFolderSummaryClass *camel_ews_summary_parent_class;
 
 static CamelMessageInfo *
 ews_message_info_clone(CamelFolderSummary *s, const CamelMessageInfo *mi)
@@ -94,15 +92,13 @@ camel_ews_summary_class_init (CamelEwsSummaryClass *class)
 {
 	CamelFolderSummaryClass *folder_summary_class;
 
+	camel_ews_summary_parent_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs (camel_folder_summary_get_type()));
+	
 	folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-	folder_summary_class->message_info_size = sizeof (CamelEwsMessageInfo);
-	folder_summary_class->content_info_size = sizeof (CamelEwsMessageContentInfo);
 	folder_summary_class->message_info_clone = ews_message_info_clone;
 	folder_summary_class->message_info_free = ews_message_info_free;
 	folder_summary_class->summary_header_load = ews_summary_header_load;
 	folder_summary_class->summary_header_save = ews_summary_header_save;
-	folder_summary_class->message_info_migrate = ews_message_info_migrate;
-	folder_summary_class->content_info_migrate = ews_content_info_migrate;
 	folder_summary_class->info_set_flags = ews_info_set_flags;
 	folder_summary_class->summary_header_to_db = summary_header_to_db;
 	folder_summary_class->summary_header_from_db = summary_header_from_db;
@@ -116,6 +112,9 @@ static void
 camel_ews_summary_init (CamelEwsSummary *ews_summary)
 {
 	CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (ews_summary);
+	
+	summary->message_info_size = sizeof(CamelEwsMessageInfo);
+	summary->content_info_size = sizeof(CamelEwsMessageContentInfo);
 
 	/* Meta-summary - Overriding UID len */
 	summary->meta_summary->uid_len = 2048;
@@ -134,8 +133,9 @@ CamelFolderSummary *
 camel_ews_summary_new (struct _CamelFolder *folder, const gchar *filename)
 {
 	CamelFolderSummary *summary;
+	
+	summary = CAMEL_FOLDER_SUMMARY (camel_object_new (camel_ews_summary_get_type ()));
 
-	summary = g_object_new (CAMEL_TYPE_EWS_SUMMARY, NULL);
 	summary->folder = folder;
 	camel_folder_summary_set_build_content (summary, TRUE);
 	camel_folder_summary_set_filename (summary, filename);
@@ -145,6 +145,25 @@ camel_ews_summary_new (struct _CamelFolder *folder, const gchar *filename)
 	return summary;
 }
 
+CamelType
+camel_ews_summary_get_type (void)
+{
+	static CamelType type = CAMEL_INVALID_TYPE;
+
+	if (type == CAMEL_INVALID_TYPE) {
+		type = camel_type_register(
+				camel_folder_summary_get_type(), "CamelEwsSummary",
+				sizeof (CamelEwsSummary),
+				sizeof (CamelEwsSummaryClass),
+				(CamelObjectClassInitFunc) camel_ews_summary_class_init,
+				NULL,
+				(CamelObjectInitFunc) camel_ews_summary_init,
+				NULL);
+	}
+
+	return type;
+}
+
 static gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 {
@@ -183,12 +202,12 @@ ews_summary_header_load (CamelFolderSummary *s, FILE *in)
 }
 
 static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, GError **error)
+summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 {
 	CamelEwsSummary *ims = CAMEL_EWS_SUMMARY(s);
 	struct _CamelFIRecord *fir;
 
-	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->summary_header_to_db (s, error);
+	fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->summary_header_to_db (s, ex);
 	if (!fir)
 		return NULL;
 
@@ -234,25 +253,6 @@ message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
 	return info;
 }
 
-static CamelMessageInfo *
-ews_message_info_migrate (CamelFolderSummary *s, FILE *in)
-{
-	CamelMessageInfo *info;
-	CamelEwsMessageInfo *ews_info;
-
-	info = CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->message_info_migrate (s,in);
-	if (info) {
-		ews_info = (CamelEwsMessageInfo*) info;
-		if (camel_file_util_decode_uint32 (in, &ews_info->server_flags) == -1)
-			goto error;
-	}
-
-	return info;
-error:
-	camel_message_info_free (info);
-	return NULL;
-}
-
 static CamelMIRecord *
 message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 {
@@ -286,15 +286,6 @@ content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
 		return camel_folder_summary_content_info_new (s);
 }
 
-static CamelMessageContentInfo *
-ews_content_info_migrate (CamelFolderSummary *s, FILE *in)
-{
-	if (fgetc (in))
-		return CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->content_info_migrate (s, in);
-	else
-		return camel_folder_summary_content_info_new (s);
-}
-
 static gint
 content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
 {
@@ -385,7 +376,7 @@ camel_ews_summary_add_message	(CamelFolderSummary *summary,
 	info = camel_folder_summary_uid (summary, uid);
 
 	/* Create summary entry */
-	mi = (CamelEwsMessageInfo *)camel_folder_summary_info_new_from_message (summary, message, NULL);
+	mi = (CamelEwsMessageInfo *)camel_folder_summary_info_new_from_message (summary, message);
 
 	/* Copy flags 'n' tags */
 	mi->info.flags = camel_message_info_flags(info);
diff --git a/src/camel/camel-ews-summary.h b/src/camel/camel-ews-summary.h
index fab060d..0242887 100644
--- a/src/camel/camel-ews-summary.h
+++ b/src/camel/camel-ews-summary.h
@@ -23,25 +23,16 @@
 #define CAMEL_GW_SUMMARY_H
 
 #include <camel/camel.h>
+#include <camel/camel-folder-summary.h>
+#include <camel/camel-db.h>
+#include <camel/camel-exception.h>
+#include <camel/camel-store.h>
 
 /* Standard GObject macros */
-#define CAMEL_TYPE_EWS_SUMMARY \
-	(camel_ews_summary_get_type ())
-#define CAMEL_EWS_SUMMARY(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), CAMEL_TYPE_EWS_SUMMARY, CamelEwsSummary))
-#define CAMEL_EWS_SUMMARY_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_CAST \
-	((cls), CAMEL_TYPE_EWS_SUMMARY, CamelEwsSummaryClass))
-#define CAMEL_IS_EWS_SUMMARY(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE \
-	((obj), CAMEL_TYPE_EWS_SUMMARY))
-#define CAMEL_IS_EWS_SUMMARY_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_TYPE \
-	((cls), CAMEL_TYPE_EWS_SUMMARY))
-#define CAMEL_EWS_SUMMARY_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS \
-	((obj), CAMEL_TYPE_EWS_SUMMARY, CamelEwsSummaryClass))
+#define CAMEL_EWS_SUMMARY(obj)         CAMEL_CHECK_CAST (obj, camel_ews_summary_get_type (), CamelEwsSummary)
+#define CAMEL_EWS_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_ews_summary_get_type (), CamelEwsSummaryClass)
+#define CAMEL_IS_EWS_SUMMARY(obj)      CAMEL_CHECK_TYPE (obj, camel_ews_summary_get_type ())
+
 
 G_BEGIN_DECLS
 
@@ -79,7 +70,7 @@ struct _CamelEwsSummaryClass {
 	CamelFolderSummaryClass parent_class;
 } ;
 
-GType camel_ews_summary_get_type (void);
+CamelType camel_ews_summary_get_type (void);
 
 CamelFolderSummary *
 	camel_ews_summary_new		(struct _CamelFolder *folder,
diff --git a/src/camel/camel-ews-transport.c b/src/camel/camel-ews-transport.c
index 5746f9f..b5d7685 100644
--- a/src/camel/camel-ews-transport.c
+++ b/src/camel/camel-ews-transport.c
@@ -36,15 +36,12 @@
 #include "camel-ews-transport.h"
 #include "camel-ews-utils.h"
 #include <ews-camel-common.h>
-
-#define REPLY_VIEW "default message attachments threading"
-
-G_DEFINE_TYPE (CamelEwsTransport, camel_ews_transport, CAMEL_TYPE_TRANSPORT)
+#include "ews-camel-compat.h"
 
 static gboolean
 ews_transport_connect_sync (CamelService *service,
                             EVO3(GCancellable *cancellable,)
-			    GError **error)
+			    CamelException *ex)
 {
 	return TRUE;
 }
@@ -69,29 +66,32 @@ ews_send_to_sync (CamelTransport *transport,
 		  CamelAddress *from,
 		  CamelAddress *recipients,
 		  EVO3(GCancellable *cancellable,)
-		  GError **error)
+		  CamelException *ex)
 {
 	EVO2(GCancellable *cancellable = NULL;)
 	CamelService *service;
 	EEwsConnection *cnc;
 	const gchar *host_url;
 	gboolean res;
+	GError *error = NULL;
 
 	service = CAMEL_SERVICE (transport);
 	host_url = camel_url_get_param (service->url, "hosturl");
 
 	cnc = e_ews_connection_find (host_url, service->url->user);
 	if (!cnc) {
-		g_set_error (error, CAMEL_SERVICE_ERROR,
+		g_set_error (&error, CAMEL_SERVICE_ERROR,
 			     CAMEL_SERVICE_ERROR_NOT_CONNECTED,
 			     _("Service not connected"));
+		ews_compat_propagate_gerror_to_exception (error, ex);
 		return FALSE;
 	}
 
 	res = camel_ews_utils_create_mime_message (cnc, "SendOnly", NULL,
 						   message, 0, from,
 						   NULL, NULL,
-						   cancellable, error);
+						   cancellable, &error);
+	ews_compat_propagate_gerror_to_exception (error, ex);
 	g_object_unref (cnc);
 	return res;
 }
@@ -114,3 +114,23 @@ static void
 camel_ews_transport_init (CamelEwsTransport *ews_transport)
 {
 }
+
+CamelType
+camel_ews_transport_get_type (void)
+{
+	static CamelType camel_ews_transport_type = CAMEL_INVALID_TYPE;
+
+	if (camel_ews_transport_type == CAMEL_INVALID_TYPE) {
+		camel_ews_transport_type =
+			camel_type_register (CAMEL_TRANSPORT_TYPE,
+					     "CamelEwsTransport",
+					     sizeof (CamelEwsTransport),
+					     sizeof (CamelEwsTransportClass),
+					     (CamelObjectClassInitFunc) camel_ews_transport_class_init,
+					     NULL,
+					     (CamelObjectInitFunc) camel_ews_transport_init,
+					     NULL);
+	}
+
+	return camel_ews_transport_type;
+}
diff --git a/src/camel/camel-ews-transport.h b/src/camel/camel-ews-transport.h
index 12edb0b..2978ac2 100644
--- a/src/camel/camel-ews-transport.h
+++ b/src/camel/camel-ews-transport.h
@@ -26,24 +26,11 @@
 
 #include <camel/camel.h>
 
-/* Standard GObject macros */
-#define CAMEL_TYPE_EWS_TRANSPORT \
-	(camel_ews_transport_get_type ())
-#define CAMEL_EWS_TRANSPORT(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST \
-	((obj), CAMEL_TYPE_EWS_TRANSPORT, CamelEwsTransport))
-#define CAMEL_EWS_TRANSPORT_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_CAST \
-	((cls), CAMEL_TYPE_EWS_TRANSPORT, CamelEwsTransportClass))
-#define CAMEL_IS_EWS_TRANSPORT(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE \
-	((obj), CAMEL_TYPE_EWS_TRANSPORT))
-#define CAMEL_IS_EWS_TRANSPORT_CLASS(cls) \
-	(G_TYPE_CHECK_CLASS_TYPE \
-	((cls), CAMEL_TYPE_EWS_TRANSPORT))
-#define CAMEL_EWS_TRANSPORT_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS \
-	((obj), CAMEL_TYPE_EWS_TRANSPORT, CamelEwsTransportClass))
+/* Standard CamelObject macros - added for 2.28 compatibility */
+#define CAMEL_EWS_TRANSPORT_TYPE     (camel_ews_transport_get_type ())
+#define CAMEL_EWS_TRANSPORT(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_EWS_TRANSPORT_TYPE, CamelEwsTransport))
+#define CAMEL_EWS_TRANSPORT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EWS_TRANSPORT_TYPE, CamelEwsTransportClass))
+#define CAMEL_IS_EWS_TRANSPORT(o)    (CAMEL_CHECK_TYPE((o), CAMEL_EWS_TRANSPORT_TYPE))
 
 G_BEGIN_DECLS
 
@@ -59,7 +46,7 @@ struct _CamelEwsTransportClass {
 	CamelTransportClass parent_class;
 };
 
-GType camel_ews_transport_get_type (void);
+CamelType camel_ews_transport_get_type (void);
 
 G_END_DECLS
 
diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c
index 0efe344..4786088 100644
--- a/src/camel/camel-ews-utils.c
+++ b/src/camel/camel-ews-utils.c
@@ -34,6 +34,7 @@
 #include "ews-esource-utils.h"
 #include "e-ews-compat.h"
 #include "e-ews-message.h"
+#include "ews-camel-compat.h"
 
 #define SUBFOLDER_DIR_NAME     "subfolders"
 #define SUBFOLDER_DIR_NAME_LEN 10
@@ -366,7 +367,7 @@ sync_deleted_folders (CamelEwsStore *store, GSList *deleted_folders)
 			fi = camel_ews_utils_build_folder_info (store, fid);
 
 			camel_ews_store_summary_remove_folder (ews_summary, fid, &error);
-			camel_store_folder_deleted ((CamelStore *) store, fi);
+			camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi);
 
 			g_clear_error (&error);
 		} else {
@@ -399,7 +400,8 @@ static gboolean ews_utils_rename_folder (CamelEwsStore *store, EwsFolderType fty
 
 	if (ftype == EWS_FOLDER_TYPE_MAILBOX) {
 		fi = camel_ews_utils_build_folder_info (store, fid);
-		camel_store_folder_renamed ((CamelStore *) store, old_fname, fi);
+		/* FIXME for 2.28 */
+		//camel_store_folder_renamed ((CamelStore *) store, old_fname, fi);
 	}
 
 	return TRUE;
@@ -600,7 +602,7 @@ sync_created_folders (CamelEwsStore *ews_store, GSList *created_folders)
 
 		if (ftype == EWS_FOLDER_TYPE_MAILBOX) {
 			fi = camel_ews_utils_build_folder_info (ews_store, fid->id);
-			camel_store_folder_created ((CamelStore *) ews_store, fi);
+			camel_object_trigger_event (CAMEL_OBJECT (ews_store), "folder_created", fi);
 		}
 	}
 }
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 31f4ffa..14e9cb2 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -5,12 +5,12 @@ lib_LTLIBRARIES = libeews-1.2.la
 MARSHAL_GENERATED = ews-marshal.c ews-marshal.h
 
 ews-marshal.h: ews-marshal.list
-	$(AM_V_GEN) ( $(GLIB_GENMARSHAL) --prefix=ews_marshal $(srcdir)/ews-marshal.list --header > ews-marshal.tmp \
+	$(AM_V_GEN) ( glib-genmarshal --prefix=ews_marshal $(srcdir)/ews-marshal.list --header > ews-marshal.tmp \
 	&& mv ews-marshal.tmp ews-marshal.h ) \
 	|| ( rm -f ews-marshal.tmp && exit 1 )
 
 ews-marshal.c: ews-marshal.h
-	$(AM_V_GEN) ( (echo '#include "ews-marshal.h"'; $(GLIB_GENMARSHAL) --prefix=ews_marshal $(srcdir)/ews-marshal.list --body) > ews-marshal.tmp \
+	$(AM_V_GEN) ( (echo '#include "ews-marshal.h"'; glib-genmarshal --prefix=ews_marshal $(srcdir)/ews-marshal.list --body) > ews-marshal.tmp \
 	&& mv ews-marshal.tmp ews-marshal.c ) \
 	|| ( rm -f ews-marshal.tmp && exit 1 )
 
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index d3d4a8f..ea90f12 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <errno.h>
+#include <unistd.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 #include <libical/icalcomponent.h>
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index 107b170..72f9461 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <libsoup/soup.h>
+#include <unistd.h>
 #ifdef G_OS_WIN32
 #include <io.h>
 #endif
diff --git a/src/server/tests/Makefile.am b/src/server/tests/Makefile.am
index 3551727..38e9f4e 100644
--- a/src/server/tests/Makefile.am
+++ b/src/server/tests/Makefile.am
@@ -20,7 +20,6 @@ testews_SOURCES = 				\
 		test-connection.c		\
 		test-syncfolder.c		\
 		test-cuditem.c 			\
-		test-getattachment.c 		\
 		test-autocompletion.c		\
 		test-createfolder.c		\
 		test-deletefolder.c		\
diff --git a/src/server/tests/test-autocompletion.c b/src/server/tests/test-autocompletion.c
index 9783c20..25c0e72 100644
--- a/src/server/tests/test-autocompletion.c
+++ b/src/server/tests/test-autocompletion.c
@@ -108,7 +108,6 @@ autocompletion_tests_run ()
 	g_print ("Testing autocompletion... \n");
 
 	g_type_init ();
-	g_thread_init (NULL);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	g_idle_add ((GSourceFunc) idle_cb, NULL);
diff --git a/src/server/tests/test-createfolder.c b/src/server/tests/test-createfolder.c
index b828aca..8852a09 100644
--- a/src/server/tests/test-createfolder.c
+++ b/src/server/tests/test-createfolder.c
@@ -101,7 +101,6 @@ void
 createfolder_tests_run ()
 {
 	g_type_init ();
-	g_thread_init (NULL);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	g_idle_add ((GSourceFunc) idle_cb, NULL);
diff --git a/src/server/tests/test-cuditem.c b/src/server/tests/test-cuditem.c
index 320f94c..98a4985 100644
--- a/src/server/tests/test-cuditem.c
+++ b/src/server/tests/test-cuditem.c
@@ -130,7 +130,6 @@ idle_cb (gpointer data)
 void cuditem_tests_run ()
 {
 	g_type_init ();
-	g_thread_init (NULL);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	g_idle_add ((GSourceFunc) idle_cb, NULL);
diff --git a/src/server/tests/test-deletefolder.c b/src/server/tests/test-deletefolder.c
index 0a04f59..1555901 100644
--- a/src/server/tests/test-deletefolder.c
+++ b/src/server/tests/test-deletefolder.c
@@ -96,7 +96,6 @@ deletefolder_tests_run (gconstpointer data)
 	g_return_if_fail (*fid != NULL);
 
 	g_type_init ();
-	g_thread_init (NULL);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	g_idle_add ((GSourceFunc) idle_cb, fid);
diff --git a/src/server/tests/test-libews.c b/src/server/tests/test-libews.c
index bbcd26a..e18e27e 100644
--- a/src/server/tests/test-libews.c
+++ b/src/server/tests/test-libews.c
@@ -30,10 +30,12 @@ int main (int argc, char *argv[])
 
 	g_type_init ();
 	g_test_init (&argc, &argv, NULL);
+	g_thread_init (NULL);
+
 	/*Create test suites and use more features of g_test */
 
 	/*Register tests*/
-	g_test_add_func ("/libews/connections", connection_tests_run);
+//	g_test_add_func ("/libews/connections", connection_tests_run);
 	g_test_add_func ("/libews/autocompletion", autocompletion_tests_run);
 
 	g_test_add_func ("/libews/syncfolder", op_tests_run);
@@ -44,7 +46,6 @@ int main (int argc, char *argv[])
 
 	g_test_add_func ("/libews/cuditem", cuditem_tests_run);
 
-	g_test_add_func ("/libews/getattachment", get_attachments_tests_run);
 
 	ret = g_test_run ();
 	finalize_test_data ();
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index 870fe0f..e2dbf59 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -245,7 +245,6 @@ void op_tests_run ()
 	g_print ("Testing operations... \n");
 
 	g_type_init ();
-	g_thread_init (NULL);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	g_idle_add ((GSourceFunc) idle_cb, NULL);
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 0733e57..d827b16 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -12,6 +12,8 @@ libewsutils_la_CPPFLAGS = \
 	$(CAMEL_CFLAGS)
 
 libewsutils_la_SOURCES =				\
+	ews-camel-compat.c				\
+	ews-camel-compat.h				\
 	ews-esource-utils.h				\
 	ews-esource-utils.c				\
 	e-sqlite3-vfs.c					\
diff --git a/src/utils/ews-camel-common.c b/src/utils/ews-camel-common.c
index 2f478b1..a721b28 100644
--- a/src/utils/ews-camel-common.c
+++ b/src/utils/ews-camel-common.c
@@ -28,6 +28,7 @@
 #include "ews-camel-common.h"
 #include "e-ews-compat.h"
 #include "e-ews-message.h"
+#include "ews-camel-compat.h"
 
 struct _create_mime_msg_data {
 	CamelMimeMessage *message;
@@ -68,11 +69,11 @@ create_mime_message_cb (ESoapMessage *msg, gpointer user_data)
 	camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered), filter);
 	g_object_unref (filter);
 
-	EVO3_sync(camel_data_wrapper_write_to_stream)
+	camel_data_wrapper_write_to_stream_sync
 				(CAMEL_DATA_WRAPPER (create_data->message),
-				 filtered, EVO3(NULL,) NULL);
-	camel_stream_flush (filtered, EVO3(NULL,) NULL);
-	camel_stream_flush (mem, EVO3(NULL,) NULL);
+				 filtered, NULL, NULL);
+	camel_stream_flush_compat (filtered, NULL, NULL);
+	camel_stream_flush_compat (mem, NULL, NULL);
 	bytes = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (mem));
 
 	base64 = g_base64_encode (bytes->data, bytes->len);
diff --git a/src/utils/ews-camel-compat.c b/src/utils/ews-camel-compat.c
new file mode 100644
index 0000000..a63fbd0
--- /dev/null
+++ b/src/utils/ews-camel-compat.c
@@ -0,0 +1,373 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *
+ * Copyright (C) 1999-2011 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#include "ews-camel-compat.h"
+
+gint
+camel_stream_flush_compat (CamelStream *stream, GCancellable *cancellable, GError **error)
+{
+#if EDS_CHECK_VERSION(2,33,0)
+	return camel_stream_flush (stream, cancellable, error);
+#elif EDS_CHECK_VERSION(2,29,0)
+	return camel_stream_flush (stream, error);
+#else
+	return camel_stream_flush (stream);
+#endif
+}
+
+gint
+camel_stream_close_compat (CamelStream *stream, GCancellable *cancellable, GError **error)
+{
+#if EDS_CHECK_VERSION(2,33,0)
+	return camel_stream_close (stream, cancellable, error);
+#elif EDS_CHECK_VERSION(2,29,0)
+	return camel_stream_close (stream, error);
+#else
+	return camel_stream_close (stream);
+#endif
+}
+
+
+gchar *
+camel_data_cache_get_filename_compat	(CamelDataCache *cdc,
+	                               	 const gchar *path,
+	                       	         const gchar *key,
+        	                	 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_data_cache_get_filename (cdc, path, key, error);
+#else
+	CamelException ex;
+	gchar *ret;
+
+	ret = camel_data_cache_get_filename (cdc, path, key, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	
+	return ret;
+#endif
+}
+
+CamelDataCache *
+camel_data_cache_new_compat	(const gchar *path,
+		                 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_data_cache_new (path, error);
+#else
+	CamelException ex;
+	CamelDataCache *ret;
+
+	ret = camel_data_cache_new (path, 0, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	
+	return ret;
+#endif
+}
+
+CamelStream *
+camel_data_cache_get_compat	(CamelDataCache *cdc,
+				 const gchar *path,
+				 const gchar *key,
+				 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_data_cache_get (cdc, path, key, error);
+#else
+	CamelException ex;
+	CamelStream *ret;
+
+	ret = camel_data_cache_get (cdc, path, key, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	
+	return ret;
+#endif
+}
+
+GPtrArray *
+camel_folder_search_search_compat	(CamelFolderSearch *search,
+					 const gchar *expr,
+					 GPtrArray *uids,
+			 		 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_folder_search_search (search, expr, uids, error);
+#else
+	CamelException ex;
+	GPtrArray *ret;
+
+	ret = camel_folder_search_search (search, expr, uids, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	
+	return ret;
+#endif
+}
+
+guint32
+camel_folder_search_count_compat	(CamelFolderSearch *search,
+					 const gchar *expr,
+					 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_folder_search_count (search, expr, error);
+#else
+	CamelException ex;
+	guint32 ret;
+
+	ret = camel_folder_search_count (search, expr, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	
+	return ret;
+#endif
+}
+
+gchar *		
+camel_session_get_storage_path_compat	(CamelSession *session,
+					 CamelService *service,
+					 GError **error)
+
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_session_get_storage_path (session, service, error);
+#else	
+	CamelException ex;
+	gchar *ret;
+
+	ret = camel_session_get_storage_path (session, service, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	return ret;
+#endif	
+}
+
+gchar *             
+camel_session_get_password_compat	(CamelSession *session,
+					 CamelService *service,
+			 		 const gchar *domain,
+					 const gchar *prompt,
+					 const gchar *item,
+					 guint32 flags,
+					 GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_session_get_password (session, service, domain, prompt, item, flags, error);
+#else	
+	CamelException ex;
+	gchar *ret;
+
+	ret = camel_session_get_password (session, service, domain, prompt, item, flags, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	return ret;
+#endif	
+}
+
+gboolean            
+camel_service_connect_compat	(CamelService *service,
+				 GError **error)
+{
+#if EDS_CHECK_VERSION(2,33,0)
+	return camel_service_connect_sync (service, error);
+#elif EDS_CHECK_VERSION(2,29,0)
+	return camel_service_connect (service, error);
+#else	
+	CamelException ex;
+	gboolean ret;
+	
+	ret = camel_service_connect (service, &ex);
+	ews_compat_propagate_exception_to_gerror (&ex, error);
+	return ret;
+#endif	
+}
+
+#if ! EDS_CHECK_VERSION(2,33,0)
+gssize
+camel_data_wrapper_write_to_stream_sync (CamelDataWrapper *data_wrapper,
+                                         CamelStream *stream, 
+					 GCancellable *cancellable,
+                                         GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_data_wrapper_write_to_stream (data_wrapper, stream, error);
+#else
+	return camel_data_wrapper_write_to_stream (data_wrapper, stream);
+#endif	
+}
+
+gssize
+camel_data_wrapper_decode_to_stream_sync (CamelDataWrapper *data_wrapper,
+                                          CamelStream *stream,
+                                          GCancellable *cancellable,
+                                          GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_data_wrapper_decode_to_stream (data_wrapper, stream, error);
+#else
+	return camel_data_wrapper_decode_to_stream (data_wrapper, stream);
+#endif
+}
+
+gboolean 
+camel_data_wrapper_construct_from_stream_sync	(CamelDataWrapper *data_wrapper,
+						 CamelStream *stream,
+						 GCancellable *cancellable,
+						 GError **error)
+{
+	/* this returns an int, which is zero for success in earlier versions */
+#if EDS_CHECK_VERSION(2,29,0)
+	return !camel_data_wrapper_construct_from_stream(data_wrapper, stream, error);
+#else
+	return !camel_data_wrapper_construct_from_stream(data_wrapper, stream);
+#endif
+}
+
+gboolean
+camel_mime_part_construct_from_parser_sync (CamelMimePart *mime_part,
+                                            CamelMimeParser *parser,
+                                            GCancellable *cancellable,
+                                            GError **error)
+{
+#if EDS_CHECK_VERSION(2,29,0)
+	return camel_mime_part_construct_from_parser_sync (mime_part, parser, error);
+#else
+	return camel_mime_part_construct_from_parser (mime_part, parser);
+#endif
+}
+
+#endif /* missing apis in version < 3.0 */
+
+/* Missing apis in Evolution 2.28 */
+#if ! EDS_CHECK_VERSION(2,29,0)
+GQuark
+camel_error_quark_compat (void)
+{
+	static GQuark quark = 0;
+
+	if (G_UNLIKELY (quark == 0)) {
+		const gchar *string = "camel-error-quark";
+		quark = g_quark_from_static_string (string);
+	}
+
+	return quark;
+}
+
+GByteArray *
+camel_stream_mem_get_byte_array (CamelStreamMem *mem)
+{
+	return mem->buffer;
+}
+
+CamelDataWrapper *
+camel_medium_get_content (CamelMedium *medium)
+{
+	return medium->content;
+}
+
+const gchar *
+camel_data_cache_get_path (CamelDataCache *cdc)
+{
+	g_return_val_if_fail (CAMEL_IS_DATA_CACHE (cdc), NULL);
+
+	return cdc->path;
+}
+
+void
+camel_object_set_state_filename (CamelObject *object,
+                                 const gchar *state_filename)
+{
+	camel_object_set(object, NULL, CAMEL_OBJECT_STATE_FILE, state_filename, NULL);
+}
+
+
+void
+camel_folder_changed (CamelFolder *folder,
+                      CamelFolderChangeInfo *changes)
+{
+	camel_object_trigger_event (folder, "folder_changed", changes);
+}
+
+void
+camel_service_lock (CamelService *service,
+                    CamelServiceLock lock)
+{
+	/* dummy function. As this is present in camel-private.h we cannot implement a backward compatible
+	   API from an external backend. I think its not necessary to use a service lock while deleting messages,
+	   (ews _delete_messages)but since I have not investigated much on it, not removing it. */
+}
+
+void
+camel_service_unlock (CamelService *service,
+                    CamelServiceLock lock)
+{
+	/* dummy function */
+}
+
+void
+camel_folder_summary_lock (CamelFolderSummary *summary,
+                             CamelFolderSummaryLock lock)
+{
+	/* dummy function, same as service lock */
+}
+
+void
+camel_folder_summary_unlock (CamelFolderSummary *summary,
+                             CamelFolderSummaryLock lock)
+{
+	/* dummy function, same as service lock */
+}
+
+void
+camel_folder_set_description (CamelFolder *folder,
+                              const gchar *description)
+{
+	folder->description = g_strdup (description);
+}
+
+/* requires complete patch to be backported. isn't worth to backport it as 
+   cancellation is not possible with 2.28 */
+void
+camel_folder_set_lock_async (CamelFolder *folder,
+                             gboolean skip_folder_lock)
+{
+	/* dummy function */
+}
+
+CamelStream *
+camel_stream_filter_new (CamelStream *stream)
+{
+	return (CamelStream *) camel_stream_filter_new_with_stream (stream);
+}
+
+void
+ews_compat_propagate_exception_to_gerror (CamelException *ex, GError **error)
+{
+	if (error && camel_exception_is_set (ex)) {
+		g_set_error (error, CAMEL_ERROR, ex->id, "%s", ex->desc);
+	}
+	camel_exception_clear (ex);
+}
+
+void
+ews_compat_propagate_gerror_to_exception (GError *error, CamelException *ex)
+{
+	if (error && ex) {
+		camel_exception_set (ex, error->code, error->message);
+	}
+	g_clear_error (&error);
+}
+
+#endif
diff --git a/src/utils/ews-camel-compat.h b/src/utils/ews-camel-compat.h
new file mode 100644
index 0000000..9024235
--- /dev/null
+++ b/src/utils/ews-camel-compat.h
@@ -0,0 +1,168 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *
+ * Copyright (C) 1999-2011 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+#ifndef EWS_CAMEL_COMPAT_H
+#define EWS_CAMEL_COMPAT_H
+
+#include <camel/camel.h>
+#include <libedataserver/eds-version.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+/* APIs which have the same symbol name across versions but with arguments changed are suffixed with _compat.
+   Rest of the apis are maintained with the latest camel apis in master */
+gint		camel_stream_flush_compat 	(CamelStream *stream, 
+						 GCancellable *cancellable, 
+						 GError **error);
+gint		camel_stream_close_compat 	(CamelStream *stream, 
+						 GCancellable *cancellable, 
+						 GError **error);
+gchar *		camel_data_cache_get_filename_compat    
+						(CamelDataCache *cdc,
+	                                         const gchar *path,
+        	                                 const gchar *key,
+                	                         GError **error);
+CamelDataCache *camel_data_cache_new_compat     (const gchar *path,
+                		                 GError **error);
+CamelStream *	camel_data_cache_get_compat     (CamelDataCache *cdc,
+                		                 const gchar *path,
+                                		 const gchar *key,
+		                                 GError **error);
+GPtrArray *	camel_folder_search_search_compat       
+						(CamelFolderSearch *search,
+	                                         const gchar *expr,
+        	                                 GPtrArray *uids,
+                	                         GError **error);
+guint32		camel_folder_search_count_compat        
+						(CamelFolderSearch *search,
+	                                         const gchar *expr,
+        	                                 GError **error);
+gchar *		camel_session_get_storage_path_compat
+						(CamelSession *session,
+						 CamelService *service,
+						 GError **error);
+gchar *		camel_session_get_password_compat	
+						(CamelSession *session,
+						 CamelService *service,
+				 		 const gchar *domain,
+						 const gchar *prompt,
+						 const gchar *item,
+						 guint32 flags,
+						 GError **error);
+gboolean	camel_service_connect_compat	(CamelService *service,
+						 GError **error);
+
+
+/* Missing apis or renamed apis beyond 3.0 */
+#if ! EDS_CHECK_VERSION(2,33,0)
+gssize		camel_data_wrapper_write_to_stream_sync 
+						(CamelDataWrapper *data_wrapper, 
+						 CamelStream *stream, GCancellable *cancellable,
+						 GError **error);
+gssize		camel_data_wrapper_decode_to_stream_sync 
+						(CamelDataWrapper *data_wrapper,
+	                                         CamelStream *stream,
+        	                                 GCancellable *cancellable,
+                	                         GError **error);
+gboolean	camel_data_wrapper_construct_from_stream_sync   
+						(CamelDataWrapper *data_wrapper,
+                                                 CamelStream *stream,
+                                                 GCancellable *cancellable,
+                                                 GError **error);
+gboolean	camel_mime_part_construct_from_parser_sync 
+						(CamelMimePart *mime_part,
+						 CamelMimeParser *parser,
+						 GCancellable *cancellable,
+						 GError **error);
+#endif
+
+/* Missing api's and abi's in Evolution 2.28 */
+#if EDS_CHECK_VERSION(2,29,0)
+#else
+GQuark
+camel_error_quark_compat (void);
+
+/* Since 2.32 */
+#define CAMEL_ERROR \
+	(camel_error_quark_compat ())
+#define CAMEL_STORE_ERROR CAMEL_ERROR /* it doesn matter */
+#define CAMEL_SERVICE_ERROR CAMEL_ERROR /* it doesn matter */
+
+typedef enum {
+	CAMEL_ERROR_GENERIC		/* lazy fallback error */
+} CamelError;
+
+typedef enum {
+	CAMEL_STORE_ERROR_INVALID,
+	CAMEL_STORE_ERROR_NO_FOLDER
+} CamelStoreError;
+
+
+typedef enum {
+	CAMEL_SERVICE_ERROR_INVALID,
+	CAMEL_SERVICE_ERROR_URL_INVALID,
+	CAMEL_SERVICE_ERROR_UNAVAILABLE,
+	CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+	CAMEL_SERVICE_ERROR_NOT_CONNECTED
+} CamelServiceError;
+
+typedef enum _CamelFolderSummaryLock {
+	CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK,
+	CAMEL_FOLDER_SUMMARY_IO_LOCK,
+	CAMEL_FOLDER_SUMMARY_FILTER_LOCK,
+	CAMEL_FOLDER_SUMMARY_ALLOC_LOCK,
+	CAMEL_FOLDER_SUMMARY_REF_LOCK
+} CamelFolderSummaryLock;
+
+typedef enum {
+	CAMEL_SERVICE_REC_CONNECT_LOCK,
+	CAMEL_SERVICE_CONNECT_OP_LOCK
+} CamelServiceLock;
+
+GByteArray *		camel_stream_mem_get_byte_array (CamelStreamMem *mem);
+CamelDataWrapper *	camel_medium_get_content	(CamelMedium *medium);
+const gchar *		camel_data_cache_get_path	(CamelDataCache *cdc);
+void			camel_object_set_state_filename (CamelObject *object,
+                                 			 const gchar *state_filename);
+void			camel_folder_changed		(CamelFolder *folder,
+                      					 CamelFolderChangeInfo *changes);
+void			camel_service_lock		(CamelService *service,
+					                 CamelServiceLock lock);
+void			camel_service_unlock		(CamelService *service,
+							 CamelServiceLock lock);
+void			camel_folder_summary_lock	(CamelFolderSummary *summary,
+							 CamelFolderSummaryLock lock);
+void			camel_folder_summary_unlock	(CamelFolderSummary *summary,
+							 CamelFolderSummaryLock lock);
+void			camel_folder_set_description	(CamelFolder *folder,
+							 const gchar *description);
+void			camel_folder_set_lock_async	(CamelFolder *folder,
+							 gboolean skip_folder_lock);
+CamelStream *		camel_stream_filter_new 	(CamelStream *stream);
+void			ews_compat_propagate_exception_to_gerror 
+							(CamelException *ex, GError **error);
+void			ews_compat_propagate_gerror_to_exception 
+							(GError *error, 
+							 CamelException *ex);
+
+
+#endif /* 2.28 api adds */
+
+
+#endif /* EWS_CAMEL_COMPAT_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]