[evolution-data-server] Coding style and whitespace cleanup.



commit 4ed38cd3e56e0825f52916d86582b02eedab008c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Mar 1 11:11:06 2013 -0500

    Coding style and whitespace cleanup.

 .../file/e-book-backend-file-migrate-bdb.c         |   25 +-
 addressbook/backends/file/e-book-backend-file.c    |   70 +-
 addressbook/backends/ldap/e-book-backend-ldap.c    |  121 ++-
 .../backends/webdav/e-book-backend-webdav.c        |   13 +-
 .../libebook-contacts/e-book-contacts-types.h      |    2 -
 addressbook/libebook-contacts/e-book-query.c       |    4 +-
 addressbook/libebook/e-book-client-view.c          |   72 +-
 addressbook/libebook/e-book-client.c               |  161 +++--
 addressbook/libebook/e-book.c                      |   96 ++-
 addressbook/libebook/e-destination.h               |  121 ++--
 addressbook/libedata-book/e-book-backend-sexp.c    |  205 +++---
 addressbook/libedata-book/e-book-backend-sexp.h    |    2 +-
 .../libedata-book/e-book-backend-sqlitedb.c        |  244 +++---
 addressbook/libedata-book/e-book-backend.c         |   49 +-
 addressbook/libedata-book/e-book-backend.h         |    6 +-
 addressbook/libedata-book/e-data-book-direct.c     |   15 +-
 addressbook/libedata-book/e-data-book.c            |  333 +++++----
 calendar/backends/caldav/e-cal-backend-caldav.c    |   14 +-
 .../backends/contacts/e-cal-backend-contacts.c     |   79 ++-
 calendar/backends/http/e-cal-backend-http.c        |    6 +-
 calendar/backends/weather/e-cal-backend-weather.c  |   16 +-
 calendar/libecal/e-cal-client.c                    |  213 ++++--
 calendar/libecal/e-cal-component.c                 |    2 +-
 calendar/libecal/e-cal-system-timezone.c           |   61 +-
 calendar/libecal/e-cal-time-util.c                 |    9 +-
 calendar/libecal/e-cal-util.c                      |  161 +++--
 calendar/libecal/e-cal.c                           |   17 +-
 calendar/libedata-cal/e-cal-backend-intervaltree.c |  695 ++++++++---------
 calendar/libedata-cal/e-cal-backend-intervaltree.h |   66 +-
 calendar/libedata-cal/e-cal-backend-sexp.c         |  815 +++++++++-----------
 calendar/libedata-cal/e-cal-backend-sync.c         |    7 +-
 calendar/libedata-cal/e-cal-backend.c              |   46 +-
 camel/camel-cipher-context.c                       |   26 +-
 camel/camel-db.c                                   |  230 +++++-
 camel/camel-enums.h                                |    2 +-
 camel/camel-folder-search.c                        |   70 ++-
 camel/camel-imapx-server.c                         |   91 ++-
 camel/camel-imapx-utils.c                          |    5 +-
 camel/camel-mime-filter-basic.c                    |  115 +++-
 camel/camel-mime-filter-tohtml.c                   |    6 +-
 camel/camel-store.c                                |   58 ++-
 camel/camel-tcp-stream-ssl.c                       |    4 +-
 camel/camel-vee-data-cache.c                       |  157 +++--
 camel/camel-vee-store.c                            |   98 ++--
 camel/providers/local/camel-local-provider.c       |    8 +-
 camel/providers/local/camel-local-summary.c        |   44 +-
 camel/providers/local/camel-maildir-store.c        |   56 +-
 camel/providers/local/camel-maildir-summary.c      |   44 +-
 camel/providers/local/camel-mbox-summary.c         |   66 ++-
 camel/providers/local/camel-spool-summary.c        |   17 +-
 camel/providers/nntp/camel-nntp-store-summary.h    |   52 +-
 libebackend/e-authentication-mediator.c            |    9 +-
 libebackend/e-authentication-session.c             |    2 +-
 libebackend/e-backend.c                            |   36 +-
 libebackend/e-dbhash.c                             |    3 +-
 libebackend/e-dbus-server.c                        |    9 +-
 libebackend/e-file-cache.c                         |    3 +-
 libebackend/e-oauth2-support.c                     |    6 +-
 libebackend/e-server-side-source.c                 |    9 +-
 libebackend/e-source-registry-server.c             |    5 +-
 libebackend/e-user-prompter-server.c               |   94 ++-
 libedataserver/e-categories.c                      |    3 +-
 libedataserver/e-client.c                          |   39 +-
 libedataserver/e-gdbus-templates.c                 |    2 +-
 libedataserver/e-list.c                            |    3 +-
 libedataserver/e-proxy.c                           |   10 +-
 libedataserver/e-source-alarms.c                   |    4 +-
 libedataserver/e-source-goa.c                      |   10 +-
 libedataserver/e-source-revision-guards.c          |    2 +-
 libedataserver/e-source-webdav.c                   |   48 +-
 libedataserver/e-time-utils.c                      |   44 +-
 libedataserver/e-xml-hash-utils.c                  |    5 +-
 .../module-gnome-online-accounts.c                 |    5 +-
 modules/owncloud-backend/module-owncloud-backend.c |   16 +-
 modules/owncloud-backend/owncloud-utils.c          |  259 +++++--
 tests/libebook/client/test-client-custom-summary.c |  218 +++---
 tests/libebook/client/test-client-e164-param.c     |   11 +-
 tests/libebook/client/test-client-preserve-uid.c   |   14 +-
 tests/libebook/client/test-client-remove-contact.c |   22 +-
 .../libebook/client/test-client-view-operations.c  |   42 +-
 tests/libebook/client/test-client-write-write.c    |   85 ++-
 .../test-ebook-get-supported-auth-methods.c        |    2 +-
 tests/libebook/test-ebook-phone-number.c           |   63 +-
 tests/libebook/test-query.c                        |  213 +++---
 tests/libecal/client/test-client-get-free-busy.c   |    5 +-
 tests/libecal/test-ecal-get-free-busy.c            |    4 +-
 tests/libecal/test-ecal-get-ldap-attribute.c       |    9 +-
 tests/test-server-utils/e-test-server-utils.c      |   15 +-
 tests/test-server-utils/test-fixture.c             |   25 +-
 89 files changed, 3722 insertions(+), 2527 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file-migrate-bdb.c 
b/addressbook/backends/file/e-book-backend-file-migrate-bdb.c
index fe8c532..feec8dc 100644
--- a/addressbook/backends/file/e-book-backend-file-migrate-bdb.c
+++ b/addressbook/backends/file/e-book-backend-file-migrate-bdb.c
@@ -139,7 +139,14 @@ db_error_to_gerror (const gint db_error,
                g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
                return;
        default:
-               g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db 
error 0x%x (%s)", db_error, db_strerror (db_error) ? db_strerror (db_error) : _("Unknown error")));
+               g_propagate_error (
+                       perror,
+                       e_data_book_create_error_fmt (
+                               E_DATA_BOOK_STATUS_OTHER_ERROR,
+                               "db error 0x%x (%s)", db_error,
+                               db_strerror (db_error) ?
+                                       db_strerror (db_error) :
+                                       _("Unknown error")));
                return;
        }
 }
@@ -439,14 +446,17 @@ e_book_backend_file_migrate_bdb (EBookBackendSqliteDB *sqlitedb,
         *
         * DB_INIT_MPOOL enables the in-memory cache.
         *
-        * Note that historically we needed either DB_INIT_CDB or DB_INIT_LOCK, because we
-        * had multiple threads reading and writing concurrently without
-        * any locking above libdb. DB_INIT_LOCK was used because
+        * Note that historically we needed either DB_INIT_CDB or DB_INIT_LOCK,
+        * because we had multiple threads reading and writing concurrently
+        * without any locking above libdb. DB_INIT_LOCK was used because
         * DB_INIT_TXN conflicts with DB_INIT_CDB.
         *
         * Currently we leave this in place because it is known to work.
         */
-       db_error = (*db_env->open) (db_env, dirname, DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_CREATE | 
DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD, 0);
+       db_error = (*db_env->open) (
+               db_env, dirname,
+               DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_CREATE |
+               DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD, 0);
        if (db_error != 0) {
                g_warning ("db_env_open failed with %s", db_strerror (db_error));
                db_error_to_gerror (db_error, error);
@@ -460,8 +470,9 @@ e_book_backend_file_migrate_bdb (EBookBackendSqliteDB *sqlitedb,
                goto close_env;
        }
 
-       /* First try opening the DB... we want write permission because it's possible we need to update
-        * an out of date DB before actually migrating it to the SQLite DB */
+       /* First try opening the DB.  We want write permission because it's
+        * possible we need to update an out of date DB before actually
+        * migrating it to the SQLite DB. */
        db_error = (*db->open) (db, NULL, filename, NULL, DB_HASH, DB_THREAD | DB_AUTO_COMMIT, 0666);
 
        /* Was an old version,  lets upgrade the format ... */
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 4b530f3..2a6afa2 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -665,10 +665,9 @@ e_book_backend_file_load_revision (EBookBackendFile *bf)
        }
 }
 
-
 static void
 set_revision (EBookBackendFile *bf,
-             EContact *contact)
+              EContact *contact)
 {
        gchar *rev;
 
@@ -752,13 +751,14 @@ do_create (EBookBackendFile *bf,
                        if (g_error_matches (local_error,
                                             E_BOOK_SDB_ERROR,
                                             E_BOOK_SDB_ERROR_CONSTRAINT)) {
-                               g_set_error (perror, E_DATA_BOOK_ERROR,
-                                            E_DATA_BOOK_STATUS_CONTACTID_ALREADY_EXISTS,
-                                            _("Conflicting UIDs found in added contacts"));
+                               g_set_error (
+                                       perror, E_DATA_BOOK_ERROR,
+                                       E_DATA_BOOK_STATUS_CONTACTID_ALREADY_EXISTS,
+                                       _("Conflicting UIDs found in added contacts"));
                                g_clear_error (&local_error);
                        } else
                                g_propagate_error (perror, local_error);
- 
+
                        status = STATUS_ERROR;
                }
        }
@@ -838,9 +838,10 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
                        if (g_error_matches (local_error,
                                             E_BOOK_SDB_ERROR,
                                             E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND)) {
-                               g_set_error (perror, E_DATA_BOOK_ERROR,
-                                            E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
-                                            _("Contact '%s' not found"), id);
+                               g_set_error (
+                                       perror, E_DATA_BOOK_ERROR,
+                                       E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
+                                       _("Contact '%s' not found"), id);
                                g_error_free (local_error);
                        } else
                                g_propagate_error (perror, local_error);
@@ -933,10 +934,11 @@ e_book_backend_file_modify_contacts (EBookBackendSync *backend,
 
                        if (!contact_rev || !old_contact_rev ||
                            strcmp (contact_rev, old_contact_rev) != 0) {
-                               g_set_error (perror, E_DATA_BOOK_ERROR,
-                                            E_DATA_BOOK_STATUS_OUT_OF_SYNC,
-                                            _("Tried to modify contact '%s' with out of sync revision"),
-                                            (gchar *)e_contact_get_const (contact, E_CONTACT_UID));
+                               g_set_error (
+                                       perror, E_DATA_BOOK_ERROR,
+                                       E_DATA_BOOK_STATUS_OUT_OF_SYNC,
+                                       _("Tried to modify contact '%s' with out of sync revision"),
+                                       (gchar *) e_contact_get_const (contact, E_CONTACT_UID));
 
                                status = STATUS_ERROR;
 
@@ -1030,9 +1032,10 @@ e_book_backend_file_get_contact (EBookBackendSync *backend,
                if (g_error_matches (local_error,
                                     E_BOOK_SDB_ERROR,
                                     E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND)) {
-                       g_set_error (perror, E_DATA_BOOK_ERROR,
-                                    E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
-                                    _("Contact '%s' not found"), id);
+                       g_set_error (
+                               perror, E_DATA_BOOK_ERROR,
+                               E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
+                               _("Contact '%s' not found"), id);
                        g_error_free (local_error);
                } else
                        g_propagate_error (perror, local_error);
@@ -1080,17 +1083,19 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
                if (g_error_matches (local_error,
                                     E_BOOK_SDB_ERROR,
                                     E_BOOK_SDB_ERROR_NOT_SUPPORTED)) {
-                       g_set_error (perror, E_DATA_BOOK_ERROR,
-                                    E_DATA_BOOK_STATUS_NOT_SUPPORTED,
-                                    _("Query '%s' not supported"), query);
+                       g_set_error (
+                               perror, E_DATA_BOOK_ERROR,
+                               E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+                               _("Query '%s' not supported"), query);
                        g_error_free (local_error);
 
                } else if (g_error_matches (local_error,
                                     E_BOOK_SDB_ERROR,
                                     E_BOOK_SDB_ERROR_INVALID_QUERY)) {
-                       g_set_error (perror, E_DATA_BOOK_ERROR,
-                                    E_DATA_BOOK_STATUS_INVALID_QUERY,
-                                    _("Invalid Query '%s'"), query);
+                       g_set_error (
+                               perror, E_DATA_BOOK_ERROR,
+                               E_DATA_BOOK_STATUS_INVALID_QUERY,
+                               _("Invalid Query '%s'"), query);
                        g_error_free (local_error);
 
                } else {
@@ -1128,17 +1133,19 @@ e_book_backend_file_get_contact_list_uids (EBookBackendSync *backend,
                if (g_error_matches (local_error,
                                     E_BOOK_SDB_ERROR,
                                     E_BOOK_SDB_ERROR_NOT_SUPPORTED)) {
-                       g_set_error (perror, E_DATA_BOOK_ERROR,
-                                    E_DATA_BOOK_STATUS_NOT_SUPPORTED,
-                                    _("Query '%s' not supported"), query);
+                       g_set_error (
+                               perror, E_DATA_BOOK_ERROR,
+                               E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+                               _("Query '%s' not supported"), query);
                        g_error_free (local_error);
 
                } else if (g_error_matches (local_error,
                                     E_BOOK_SDB_ERROR,
                                     E_BOOK_SDB_ERROR_INVALID_QUERY)) {
-                       g_set_error (perror, E_DATA_BOOK_ERROR,
-                                    E_DATA_BOOK_STATUS_INVALID_QUERY,
-                                    _("Invalid Query '%s'"), query);
+                       g_set_error (
+                               perror, E_DATA_BOOK_ERROR,
+                               E_DATA_BOOK_STATUS_INVALID_QUERY,
+                               _("Invalid Query '%s'"), query);
                        g_error_free (local_error);
 
                } else {
@@ -1524,7 +1531,7 @@ book_backend_file_initable_init (GInitable *initable,
                dirname = g_strdup (priv->base_directory);
        else
                dirname = e_book_backend_file_extract_path_from_source (
-                       registry, source, GET_PATH_DB_DIR);
+                       registry, source, GET_PATH_DB_DIR);
 
        filename = g_build_filename (dirname, "addressbook.db", NULL);
        backup = g_build_filename (dirname, "addressbook.db.old", NULL);
@@ -1630,7 +1637,6 @@ exit:
        return success;
 }
 
-
 static EDataBookDirect *
 e_book_backend_file_get_direct_book (EBookBackend *backend)
 {
@@ -1640,7 +1646,7 @@ e_book_backend_file_get_direct_book (EBookBackend *backend)
        gchar *backend_path;
        gchar *dirname;
        const gchar *modules_env = NULL;
-       
+
        modules_env = g_getenv (EDS_ADDRESS_BOOK_MODULES);
 
        source = e_backend_get_source (E_BACKEND (backend));
@@ -1663,7 +1669,7 @@ e_book_backend_file_get_direct_book (EBookBackend *backend)
 
 static void
 e_book_backend_file_configure_direct (EBookBackend *backend,
-                                     const gchar  *config)
+                                      const gchar *config)
 {
        EBookBackendFilePrivate *priv;
 
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index 1392e1c..69f2354 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -154,16 +154,27 @@
 
 static gboolean enable_debug = FALSE;
 
-static const gchar *query_prop_to_ldap (gchar *query_prop);
-static gchar *e_book_backend_ldap_build_query (EBookBackendLDAP *bl, const gchar *query);
+static const gchar *
+               query_prop_to_ldap              (gchar *query_prop);
+static gchar * e_book_backend_ldap_build_query (EBookBackendLDAP *bl,
+                                                const gchar *query);
 
 typedef struct LDAPOp LDAPOp;
 
-#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)
-/* Translators: An error message shown to a user when trying to do an operation on the LDAP address book 
which is not connected to the server */
-#define EDB_ERROR_NOT_CONNECTED() e_data_book_create_error (E_DATA_BOOK_STATUS_OTHER_ERROR, _("Not 
connected"))
-#define EDB_ERROR_MSG_TYPE(_msg_type) e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_INVALID_ARG, 
"Incorrect msg type %d passed to %s", _msg_type, G_STRFUNC)
+#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))
+/* Translators: An error message shown to a user when trying to do an
+ * operation on the LDAP address book which is not connected to the server */
+#define EDB_ERROR_NOT_CONNECTED() \
+       (e_data_book_create_error ( \
+       E_DATA_BOOK_STATUS_OTHER_ERROR, _("Not connected")))
+#define EDB_ERROR_MSG_TYPE(_msg_type) \
+       (e_data_book_create_error_fmt ( \
+       E_DATA_BOOK_STATUS_INVALID_ARG, \
+       "Incorrect msg type %d passed to %s", \
+       _msg_type, G_STRFUNC))
 
 /* Forward Declarations */
 static void    e_book_backend_ldap_source_authenticator_init
@@ -507,26 +518,38 @@ add_to_supported_fields (EBookBackendLDAP *bl,
        for (i = 0; attrs[i]; i++) {
                gchar *query_prop = g_hash_table_lookup (attr_hash, attrs[i]);
 
-               if (query_prop) {
-                       bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup 
(query_prop));
-
-                       /* handle the list attributes here */
-                       if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_EMAIL))) {
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_EMAIL_4)));
-                       }
-                       else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_BUSINESS))) {
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS_2)));
-                       }
-                       else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_HOME))) {
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME_2)));
-                       }
-                       else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_CATEGORY_LIST) )) {
-                               bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, 
g_strdup (e_contact_field_name (E_CONTACT_CATEGORIES)));
-                       }
+               if (query_prop == NULL)
+                       continue;
 
+               bl->priv->supported_fields = g_slist_append (
+                       bl->priv->supported_fields, g_strdup (query_prop));
+
+               /* handle the list attributes here */
+               if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_EMAIL))) {
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_EMAIL_4)));
+               } else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_BUSINESS))) {
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS_2)));
+               } else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_HOME))) {
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME_2)));
+               } else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_CATEGORY_LIST) )) {
+                       bl->priv->supported_fields = g_slist_append (
+                               bl->priv->supported_fields,
+                               g_strdup (e_contact_field_name (E_CONTACT_CATEGORIES)));
                }
        }
 }
@@ -728,7 +751,12 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
                (gchar **) attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp);
        g_rec_mutex_unlock (&eds_ldap_handler_lock);
        if (ldap_error != LDAP_SUCCESS) {
-               g_warning ("could not perform query on Root DSE (ldap_error 0x%02x/%s)", ldap_error, 
ldap_err2string (ldap_error) ? ldap_err2string (ldap_error) : "Unknown error");
+               g_warning (
+                       "could not perform query on Root DSE "
+                       "(ldap_error 0x%02x/%s)", ldap_error,
+                       ldap_err2string (ldap_error) ?
+                               ldap_err2string (ldap_error) :
+                               "Unknown error");
                return ldap_error;
        }
 
@@ -1984,10 +2012,13 @@ modify_contact_search_handler (LDAPOp *op,
                g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
                if (!e) {
-                       e_data_book_respond_modify_contacts (op->book,
-                                                            op->opid,
-                                                            e_data_book_create_error_fmt 
(E_DATA_BOOK_STATUS_OTHER_ERROR, _("%s: NULL returned from ldap_first_entry"), G_STRFUNC),
-                                                            NULL);
+                       e_data_book_respond_modify_contacts (
+                               op->book, op->opid,
+                               e_data_book_create_error_fmt (
+                                       E_DATA_BOOK_STATUS_OTHER_ERROR,
+                                       _("%s: NULL returned from ldap_first_entry"),
+                                       G_STRFUNC),
+                               NULL);
                        ldap_op_finished (op);
                        return;
                }
@@ -2379,9 +2410,11 @@ get_contact_handler (LDAPOp *op,
 
                if (!e) {
                        e_data_book_respond_get_contact (
-                               op->book,
-                               op->opid,
-                               e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, _("%s: NULL 
returned from ldap_first_entry"), G_STRFUNC),
+                               op->book, op->opid,
+                               e_data_book_create_error_fmt (
+                                       E_DATA_BOOK_STATUS_OTHER_ERROR,
+                                       _("%s: NULL returned from ldap_first_entry"),
+                                       G_STRFUNC),
                                NULL);
                        ldap_op_finished (op);
                        return;
@@ -2865,13 +2898,25 @@ contact_list_uids_handler (LDAPOp *op,
                g_warning ("search returned %d\n", ldap_error);
 
                if (ldap_error == LDAP_TIMELIMIT_EXCEEDED)
-                       e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR 
(SEARCH_TIME_LIMIT_EXCEEDED), contact_list_uids_op->uids);
+                       e_data_book_respond_get_contact_list_uids (
+                               op->book, op->opid,
+                               EDB_ERROR (SEARCH_TIME_LIMIT_EXCEEDED),
+                               contact_list_uids_op->uids);
                else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED)
-                       e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR 
(SEARCH_SIZE_LIMIT_EXCEEDED), contact_list_uids_op->uids);
+                       e_data_book_respond_get_contact_list_uids (
+                               op->book, op->opid,
+                               EDB_ERROR (SEARCH_SIZE_LIMIT_EXCEEDED),
+                               contact_list_uids_op->uids);
                else if (ldap_error == LDAP_SUCCESS)
-                       e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR (SUCCESS), 
contact_list_uids_op->uids);
+                       e_data_book_respond_get_contact_list_uids (
+                               op->book, op->opid,
+                               EDB_ERROR (SUCCESS),
+                               contact_list_uids_op->uids);
                else
-                       e_data_book_respond_get_contact_list_uids (op->book, op->opid, ldap_error_to_response 
(ldap_error), contact_list_uids_op->uids);
+                       e_data_book_respond_get_contact_list_uids (
+                               op->book, op->opid,
+                               ldap_error_to_response (ldap_error),
+                               contact_list_uids_op->uids);
 
                ldap_op_finished (op);
                if (enable_debug) {
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c 
b/addressbook/backends/webdav/e-book-backend-webdav.c
index 5f04ae8..06ceee2 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -328,9 +328,16 @@ upload_contact (EBookBackendWebdav *webdav,
                e_contact_set (contact, E_CONTACT_UID, uri);
        }
 
-       if (reason) {
-               *reason = g_strdup (message->reason_phrase && *message->reason_phrase ? 
message->reason_phrase :
-                                   (soup_status_get_phrase (message->status_code) ? soup_status_get_phrase 
(message->status_code) : _("Unknown error")));
+       if (reason != NULL) {
+               const gchar *phrase;
+
+               phrase = message->reason_phrase;
+               if (phrase == NULL)
+                       phrase = soup_status_get_phrase (message->status_code);
+               if (phrase == NULL)
+                       phrase = _("Unknown error");
+
+               *reason = g_strdup (phrase);
        }
 
        g_object_unref (message);
diff --git a/addressbook/libebook-contacts/e-book-contacts-types.h 
b/addressbook/libebook-contacts/e-book-contacts-types.h
index eecddc0..7208b67 100644
--- a/addressbook/libebook-contacts/e-book-contacts-types.h
+++ b/addressbook/libebook-contacts/e-book-contacts-types.h
@@ -118,7 +118,6 @@ typedef struct {
        EContact        *contact;
 } EBookChange;
 
-
 /**
  * EBookIndexType:
  * @E_BOOK_INDEX_PREFIX: An index suitable for searching contacts with a prefix pattern
@@ -139,7 +138,6 @@ typedef enum {
 GQuark         e_book_client_error_quark       (void) G_GNUC_CONST;
 const gchar *  e_book_client_error_to_string   (EBookClientError code);
 
-
 #ifndef EDS_DISABLE_DEPRECATED
 GError *       e_book_client_error_create      (EBookClientError code,
                                                 const gchar *custom_msg);
diff --git a/addressbook/libebook-contacts/e-book-query.c b/addressbook/libebook-contacts/e-book-query.c
index 2eaa181..0ec2e6d 100644
--- a/addressbook/libebook-contacts/e-book-query.c
+++ b/addressbook/libebook-contacts/e-book-query.c
@@ -133,7 +133,7 @@ conjoinv (EBookQueryType type,
 /**
  * e_book_query_andv:
  * @q: first #EBookQuery
- * @...: #NULL terminated list of #EBookQuery pointers
+ * @...: %NULL terminated list of #EBookQuery pointers
  *
  * Creates a new #EBookQuery which is the logical AND of the queries specified.
  *
@@ -155,7 +155,7 @@ e_book_query_andv (EBookQuery *q, ...)
 /**
  * e_book_query_orv:
  * @q: first #EBookQuery
- * @...: #NULL terminated list of #EBookQuery pointers
+ * @...: %NULL terminated list of #EBookQuery pointers
  *
  * Creates a new #EBookQuery which is the logical OR of the queries specified.
  *
diff --git a/addressbook/libebook/e-book-client-view.c b/addressbook/libebook/e-book-client-view.c
index fee6d1a..38d33a9 100644
--- a/addressbook/libebook/e-book-client-view.c
+++ b/addressbook/libebook/e-book-client-view.c
@@ -70,8 +70,8 @@ enum {
        PROP_0,
        PROP_CLIENT,
        PROP_CONNECTION,
-       PROP_OBJECT_PATH,
-       PROP_DIRECT_BOOK
+       PROP_DIRECT_BOOK,
+       PROP_OBJECT_PATH
 };
 
 enum {
@@ -252,7 +252,7 @@ direct_contacts_query (const gchar * const *uids)
        gchar *sexp;
        gint i, len;
 
-       len = g_strv_length ((gchar **)uids);
+       len = g_strv_length ((gchar **) uids);
        qs = g_new0 (EBookQuery *, len);
 
        for (i = 0; uids[i] != NULL; i++) {
@@ -273,7 +273,7 @@ direct_contacts_ready (GObject *source_object,
                        GAsyncResult *result,
                        gpointer user_data)
 {
-       NotificationData *data = (NotificationData *)user_data;
+       NotificationData *data = (NotificationData *) user_data;
        GSList *contacts = NULL;
        GError *error = NULL;
 
@@ -567,25 +567,24 @@ book_client_view_set_connection (EBookClientView *view,
 }
 
 static void
-book_client_view_set_object_path (EBookClientView *view,
-                                  const gchar *object_path)
+book_client_view_set_direct_book (EBookClientView *view,
+                                  EDataBook *book)
 {
-       g_return_if_fail (object_path != NULL);
-       g_return_if_fail (view->priv->object_path == NULL);
+       g_return_if_fail (book == NULL || E_IS_DATA_BOOK (book));
+       g_return_if_fail (view->priv->direct_book == NULL);
 
-       view->priv->object_path = g_strdup (object_path);
+       if (book != NULL)
+               view->priv->direct_book = g_object_ref (book);
 }
 
 static void
-book_client_view_set_direct_book (EBookClientView *view,
-                                 EDataBook       *book)
+book_client_view_set_object_path (EBookClientView *view,
+                                  const gchar *object_path)
 {
-       g_return_if_fail (book == NULL ||
-                         E_IS_DATA_BOOK (book));
-       g_return_if_fail (view->priv->direct_book == NULL);
+       g_return_if_fail (object_path != NULL);
+       g_return_if_fail (view->priv->object_path == NULL);
 
-       if (book)
-               view->priv->direct_book = g_object_ref (book);
+       view->priv->object_path = g_strdup (object_path);
 }
 
 static void
@@ -607,17 +606,17 @@ book_client_view_set_property (GObject *object,
                                g_value_get_object (value));
                        return;
 
-               case PROP_OBJECT_PATH:
-                       book_client_view_set_object_path (
-                               E_BOOK_CLIENT_VIEW (object),
-                               g_value_get_string (value));
-                       return;
-
                case PROP_DIRECT_BOOK:
                        book_client_view_set_direct_book (
                                E_BOOK_CLIENT_VIEW (object),
                                g_value_get_object (value));
                        return;
+
+               case PROP_OBJECT_PATH:
+                       book_client_view_set_object_path (
+                               E_BOOK_CLIENT_VIEW (object),
+                               g_value_get_string (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -772,7 +771,8 @@ book_client_view_initable_init (GInitable *initable,
         * to fields-of-interest indicating we only want uids sent
         */
        if (priv->direct_book)
-               e_book_client_view_set_fields_of_interest (E_BOOK_CLIENT_VIEW (initable), NULL, NULL);
+               e_book_client_view_set_fields_of_interest (
+                       E_BOOK_CLIENT_VIEW (initable), NULL, NULL);
 
        return TRUE;
 }
@@ -817,19 +817,6 @@ e_book_client_view_class_init (EBookClientViewClass *class)
 
        g_object_class_install_property (
                object_class,
-               PROP_OBJECT_PATH,
-               g_param_spec_string (
-                       "object-path",
-                       "Object Path",
-                       "The object path used "
-                       "to create the D-Bus proxy",
-                       NULL,
-                       G_PARAM_READWRITE |
-                       G_PARAM_CONSTRUCT_ONLY |
-                       G_PARAM_STATIC_STRINGS));
-
-       g_object_class_install_property (
-               object_class,
                PROP_DIRECT_BOOK,
                g_param_spec_object (
                        "direct-book",
@@ -842,6 +829,19 @@ e_book_client_view_class_init (EBookClientViewClass *class)
                        G_PARAM_CONSTRUCT_ONLY |
                        G_PARAM_STATIC_STRINGS));
 
+       g_object_class_install_property (
+               object_class,
+               PROP_OBJECT_PATH,
+               g_param_spec_string (
+                       "object-path",
+                       "Object Path",
+                       "The object path used "
+                       "to create the D-Bus proxy",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY |
+                       G_PARAM_STATIC_STRINGS));
+
        signals[OBJECTS_ADDED] = g_signal_new (
                "objects-added",
                G_OBJECT_CLASS_TYPE (object_class),
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 69f6b40..07eceda 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -186,10 +186,10 @@ typedef struct {
 } PropagateReadyData;
 
 static PropagateReadyData *
-propagate_ready_data_new (EBookClient         *client,
-                         GAsyncReadyCallback  callback,
-                         gpointer             user_data,
-                         gpointer             source_tag)
+propagate_ready_data_new (EBookClient *client,
+                          GAsyncReadyCallback callback,
+                          gpointer user_data,
+                          gpointer source_tag)
 {
        PropagateReadyData *data = g_slice_new0 (PropagateReadyData);
 
@@ -212,16 +212,17 @@ propagate_ready_data_free (PropagateReadyData *data)
 
 static void
 propagate_direct_book_async_ready (GObject *source_object,
-                                  GAsyncResult *res,
-                                  gpointer user_data)
+                                   GAsyncResult *res,
+                                   gpointer user_data)
 {
        GSimpleAsyncResult *result;
-       PropagateReadyData *data = (PropagateReadyData *)user_data;
+       PropagateReadyData *data = (PropagateReadyData *) user_data;
 
-       result = g_simple_async_result_new (G_OBJECT (data->client),
-                                           data->callback,
-                                           data->user_data,
-                                           data->source_tag);
+       result = g_simple_async_result_new (
+               G_OBJECT (data->client),
+               data->callback,
+               data->user_data,
+               data->source_tag);
 
        g_object_ref (res);
        g_simple_async_result_set_op_res_gpointer (result, res, g_object_unref);
@@ -535,10 +536,8 @@ static void
 book_client_dispose (GObject *object)
 {
        EBookClientPrivate *priv;
-       EBookClient *book_client;
 
-       book_client = E_BOOK_CLIENT (object);
-       priv = book_client->priv;
+       priv = E_BOOK_CLIENT_GET_PRIVATE (object);
 
        if (priv->dbus_proxy_error_handler_id > 0) {
                g_signal_handler_disconnect (
@@ -564,10 +563,10 @@ book_client_dispose (GObject *object)
                priv->dbus_proxy = NULL;
        }
 
-       if (book_client->priv->direct_book) {
-               e_data_book_close_sync (book_client->priv->direct_book, NULL, NULL);
-               g_object_unref (book_client->priv->direct_book);
-               book_client->priv->direct_book = NULL;
+       if (priv->direct_book != NULL) {
+               e_data_book_close_sync (priv->direct_book, NULL, NULL);
+               g_object_unref (priv->direct_book);
+               priv->direct_book = NULL;
        }
 
        /* Chain up to parent's dispose() method. */
@@ -1225,9 +1224,9 @@ e_book_client_new (ESource *source,
  **/
 EClient *
 e_book_client_connect_direct_sync (ESourceRegistry *registry,
-                                  ESource *source,
-                                  GCancellable *cancellable,
-                                  GError **error)
+                                   ESource *source,
+                                   GCancellable *cancellable,
+                                   GError **error)
 {
        EClient *client;
        EBookClientPrivate *priv;
@@ -1243,7 +1242,7 @@ e_book_client_connect_direct_sync (ESourceRegistry *registry,
        priv = E_BOOK_CLIENT_GET_PRIVATE (client);
 
        direct_config = e_dbus_direct_book_proxy_new_sync (
-                g_dbus_proxy_get_connection (G_DBUS_PROXY (priv->dbus_proxy)),
+               g_dbus_proxy_get_connection (G_DBUS_PROXY (priv->dbus_proxy)),
                G_DBUS_PROXY_FLAGS_NONE,
                ADDRESS_BOOK_DBUS_SERVICE_NAME,
                g_dbus_proxy_get_object_path (G_DBUS_PROXY (priv->dbus_proxy)),
@@ -1255,20 +1254,25 @@ e_book_client_connect_direct_sync (ESourceRegistry *registry,
 
        if (backend_path && backend_path[0] &&
            backend_name && backend_name[0]) {
-               priv->direct_book =
-                       e_data_book_new_direct (registry, source,
-                                               backend_path,
-                                               backend_name,
-                                               config, &local_error);
+               priv->direct_book = e_data_book_new_direct (
+                       registry, source,
+                       backend_path,
+                       backend_name,
+                       config, &local_error);
                if (!priv->direct_book) {
-                       g_warning ("Failed to open addressbook in direct read access mode, "
-                                  "falling back to normal read access mode. Reason: %s",
-                                  local_error->message);
+                       g_warning (
+                               "Failed to open addressbook in direct read "
+                               "access mode, falling back to normal read "
+                               "access mode. Reason: %s",
+                               local_error->message);
                        g_error_free (local_error);
                }
 
-       } else
-               g_warning ("Direct read access mode not supported by the given backend, falling back to 
normal read access mode");
+       } else {
+               g_warning (
+                       "Direct read access mode not supported by the given "
+                       "backend, falling back to normal read access mode");
+       }
 
        g_object_unref (direct_config);
 
@@ -1278,7 +1282,9 @@ e_book_client_connect_direct_sync (ESourceRegistry *registry,
         */
        if (priv->direct_book &&
            !e_data_book_open_sync (priv->direct_book, cancellable, error)) {
-               g_warning ("Unable to open direct read access book, falling back to normal read access mode");
+               g_warning (
+                       "Unable to open direct read access book, "
+                       "falling back to normal read access mode");
                g_clear_object (&priv->direct_book);
        }
 
@@ -1437,10 +1443,13 @@ e_book_client_set_self (EBookClient *client,
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (contact != NULL, FALSE);
-       g_return_val_if_fail (e_contact_get_const (contact, E_CONTACT_UID) != NULL, FALSE);
+       g_return_val_if_fail (
+               e_contact_get_const (contact, E_CONTACT_UID) != NULL, FALSE);
 
        settings = g_settings_new (SELF_UID_PATH_ID);
-       g_settings_set_string (settings, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID));
+       g_settings_set_string (
+               settings, SELF_UID_KEY,
+               e_contact_get_const (contact, E_CONTACT_UID));
        g_object_unref (settings);
 
        return TRUE;
@@ -1461,6 +1470,7 @@ e_book_client_is_self (EContact *contact)
 {
        static GSettings *settings;
        static GMutex mutex;
+       const gchar *contact_uid;
        gchar *uid;
        gboolean is_self;
 
@@ -1477,7 +1487,8 @@ e_book_client_is_self (EContact *contact)
        uid = g_settings_get_string (settings, SELF_UID_KEY);
        g_mutex_unlock (&mutex);
 
-       is_self = uid && !g_strcmp0 (uid, e_contact_get_const (contact, E_CONTACT_UID));
+       contact_uid = e_contact_get_const (contact, E_CONTACT_UID);
+       is_self = (uid != NULL) && (g_strcmp0 (uid, contact_uid) == 0);
 
        g_free (uid);
 
@@ -2568,11 +2579,15 @@ e_book_client_get_contact (EBookClient *client,
        g_return_if_fail (uid != NULL);
 
        if (client->priv->direct_book) {
-               PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data,
-                                                                    e_book_client_get_contact);
+               PropagateReadyData *data;
 
-               e_data_book_get_contact (client->priv->direct_book, uid, cancellable,
-                                        propagate_direct_book_async_ready, data);
+               data = propagate_ready_data_new (
+                       client, callback, user_data,
+                       e_book_client_get_contact);
+
+               e_data_book_get_contact (
+                       client->priv->direct_book, uid, cancellable,
+                       propagate_direct_book_async_ready, data);
                return;
        }
 
@@ -2625,9 +2640,13 @@ e_book_client_get_contact_finish (EBookClient *client,
                e_book_client_get_contact), FALSE);
 
        if (client->priv->direct_book) {
-               GAsyncResult *res = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT 
(result));
+               GAsyncResult *res;
+
+               res = g_simple_async_result_get_op_res_gpointer (
+                       G_SIMPLE_ASYNC_RESULT (result));
 
-               return e_data_book_get_contact_finish (client->priv->direct_book, res, out_contact, error);
+               return e_data_book_get_contact_finish (
+                       client->priv->direct_book, res, out_contact, error);
        }
 
        simple = G_SIMPLE_ASYNC_RESULT (result);
@@ -2676,7 +2695,9 @@ e_book_client_get_contact_sync (EBookClient *client,
        g_return_val_if_fail (out_contact != NULL, FALSE);
 
        if (client->priv->direct_book)
-               return e_data_book_get_contact_sync (client->priv->direct_book, uid, out_contact, 
cancellable, error);
+               return e_data_book_get_contact_sync (
+                       client->priv->direct_book, uid,
+                       out_contact, cancellable, error);
 
        utf8_uid = e_util_utf8_make_valid (uid);
 
@@ -2752,11 +2773,15 @@ e_book_client_get_contacts (EBookClient *client,
        g_return_if_fail (sexp != NULL);
 
        if (client->priv->direct_book) {
-               PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data,
-                                                                    e_book_client_get_contacts);
+               PropagateReadyData *data;
+
+               data = propagate_ready_data_new (
+                       client, callback, user_data,
+                       e_book_client_get_contacts);
 
-               e_data_book_get_contacts (client->priv->direct_book, sexp, cancellable, 
-                                         propagate_direct_book_async_ready, data);
+               e_data_book_get_contacts (
+                       client->priv->direct_book, sexp, cancellable,
+                       propagate_direct_book_async_ready, data);
                return;
        }
 
@@ -2805,11 +2830,14 @@ e_book_client_get_contacts_finish (EBookClient *client,
        AsyncContext *async_context;
 
        if (client->priv->direct_book) {
-               GAsyncResult *direct_res =
-                       g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+               GAsyncResult *direct_res;
 
-               return e_data_book_get_contacts_finish (client->priv->direct_book,
-                                                       direct_res, out_contacts, error);
+               direct_res = g_simple_async_result_get_op_res_gpointer (
+                       G_SIMPLE_ASYNC_RESULT (result));
+
+               return e_data_book_get_contacts_finish (
+                       client->priv->direct_book,
+                       direct_res, out_contacts, error);
        }
 
        g_return_val_if_fail (
@@ -2867,8 +2895,9 @@ e_book_client_get_contacts_sync (EBookClient *client,
        g_return_val_if_fail (out_contacts != NULL, FALSE);
 
        if (client->priv->direct_book)
-               return e_data_book_get_contacts_sync (client->priv->direct_book,
-                                                     sexp, out_contacts, cancellable, error);
+               return e_data_book_get_contacts_sync (
+                       client->priv->direct_book,
+                       sexp, out_contacts, cancellable, error);
 
        utf8_sexp = e_util_utf8_make_valid (sexp);
 
@@ -2953,11 +2982,15 @@ e_book_client_get_contacts_uids (EBookClient *client,
        g_return_if_fail (sexp != NULL);
 
        if (client->priv->direct_book) {
-               PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data,
-                                                                    e_book_client_get_contacts_uids);
+               PropagateReadyData *data;
+
+               data = propagate_ready_data_new (
+                       client, callback, user_data,
+                       e_book_client_get_contacts_uids);
 
-               e_data_book_get_contacts_uids (client->priv->direct_book, sexp, cancellable, 
-                                              propagate_direct_book_async_ready, data);
+               e_data_book_get_contacts_uids (
+                       client->priv->direct_book, sexp, cancellable,
+                       propagate_direct_book_async_ready, data);
                return;
        }
 
@@ -3006,12 +3039,14 @@ e_book_client_get_contacts_uids_finish (EBookClient *client,
        AsyncContext *async_context;
 
        if (client->priv->direct_book) {
-               GAsyncResult *direct_res =
-                       g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+               GAsyncResult *direct_res;
+
+               direct_res = g_simple_async_result_get_op_res_gpointer (
+                       G_SIMPLE_ASYNC_RESULT (result));
 
                return e_data_book_get_contacts_uids_finish (
-                              client->priv->direct_book,
-                              direct_res, out_contact_uids, error);
+                       client->priv->direct_book,
+                       direct_res, out_contact_uids, error);
        }
 
        g_return_val_if_fail (
@@ -3070,8 +3105,8 @@ e_book_client_get_contacts_uids_sync (EBookClient *client,
 
        if (client->priv->direct_book)
                return e_data_book_get_contacts_uids_sync (
-                              client->priv->direct_book, sexp, 
-                              out_contact_uids, cancellable, error);
+                       client->priv->direct_book, sexp,
+                       out_contact_uids, cancellable, error);
 
        utf8_sexp = e_util_utf8_make_valid (sexp);
 
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index ed54972..3798942 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -417,7 +417,8 @@ e_book_async_add_contact (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_add_contact() and e_book_client_add_contact_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_add_contact() and
+ *                  e_book_client_add_contact_finish() instead.
  **/
 gboolean
 e_book_add_contact_async (EBook *book,
@@ -545,7 +546,8 @@ e_book_async_commit_contact (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_modify_contact() and e_book_client_modify_contact_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_modify_contact() and
+ *                  e_book_client_modify_contact_finish() instead.
  **/
 gboolean
 e_book_commit_contact_async (EBook *book,
@@ -573,7 +575,8 @@ e_book_commit_contact_async (EBook *book,
 /**
  * e_book_get_required_fields:
  * @book: an #EBook
- * @fields: (out) (transfer full) (element-type utf8): a #GList of fields to set on success
+ * @fields: (out) (transfer full) (element-type utf8): a #GList of fields
+ *          to set on success
  * @error: a #GError to set on failure
  *
  * Gets a list of fields that are required to be filled in for
@@ -727,8 +730,10 @@ e_book_async_get_required_fields (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_client_get_backend_property() and e_client_get_backend_property_finish()
- * on an #EBookClient object with #BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS instead.
+ * Deprecated: 3.2: Use e_client_get_backend_property() and
+ *                  e_client_get_backend_property_finish() on an
+ *                  #EBookClient object with
+ *                  #BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS instead.
  **/
 gboolean
 e_book_get_required_fields_async (EBook *book,
@@ -755,7 +760,8 @@ e_book_get_required_fields_async (EBook *book,
 /**
  * e_book_get_supported_fields:
  * @book: an #EBook
- * @fields: (out) (transfer full) (element-type utf8): a #GList of fields to set on success
+ * @fields: (out) (transfer full) (element-type utf8): a #GList of fields
+ *          to set on success
  * @error: a #GError to set on failure
  *
  * Gets a list of fields that can be stored for contacts
@@ -911,8 +917,10 @@ e_book_async_get_supported_fields (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_client_get_backend_property() and e_client_get_backend_property_finish()
- * on an #EBookClient object with #BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS instead.
+ * Deprecated: 3.2: Use e_client_get_backend_property() and
+ *                  e_client_get_backend_property_finish() on an
+ *                  #EBookClient object with
+ *                  #BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS instead.
  **/
 gboolean
 e_book_get_supported_fields_async (EBook *book,
@@ -939,7 +947,8 @@ e_book_get_supported_fields_async (EBook *book,
 /**
  * e_book_get_supported_auth_methods:
  * @book: an #EBook
- * @auth_methods: (out) (transfer full) (element-type utf8): a #GList of auth methods to set on success
+ * @auth_methods: (out) (transfer full) (element-type utf8): a #GList of
+ *                auth methods to set on success
  * @error: a #GError to set on failure
  *
  * Queries @book for the list of authentication methods it supports.
@@ -1133,7 +1142,8 @@ e_book_async_get_contact (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_get_contact() and e_book_client_get_contact_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_get_contact() and
+ *                  e_book_client_get_contact_finish() instead.
  **/
 gboolean
 e_book_get_contact_async (EBook *book,
@@ -1168,7 +1178,8 @@ e_book_get_contact_async (EBook *book,
  *
  * Returns: %TRUE if successful, %FALSE otherwise
  *
- * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid_sync() or e_book_client_remove_contact_sync() 
instead.
+ * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid_sync() or
+ *                  e_book_client_remove_contact_sync() instead.
  **/
 gboolean
 e_book_remove_contact (EBook *book,
@@ -1299,7 +1310,8 @@ e_book_async_remove_contact (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_remove_contact() and e_book_client_remove_contact_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_remove_contact() and
+ *                  e_book_client_remove_contact_finish() instead.
  **/
 gboolean
 e_book_remove_contact_async (EBook *book,
@@ -1400,7 +1412,8 @@ e_book_async_remove_contact_by_id (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid() and 
e_book_client_remove_contact_by_uid_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid() and
+ *                  e_book_client_remove_contact_by_uid_finish() instead.
  **/
 gboolean
 e_book_remove_contact_by_id_async (EBook *book,
@@ -1516,7 +1529,8 @@ e_book_async_remove_contacts (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_remove_contacts() and e_book_client_remove_contacts_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_remove_contacts() and
+ *                  e_book_client_remove_contacts_finish() instead.
  **/
 gboolean
 e_book_remove_contacts_async (EBook *book,
@@ -1554,8 +1568,8 @@ e_book_remove_contacts_async (EBook *book,
  * e_book_get_book_view:
  * @book: an #EBook
  * @query: an #EBookQuery
- * @requested_fields: (allow-none) (element-type utf8): a #GList containing the names of fields to
- * return, or NULL for all
+ * @requested_fields: (allow-none) (element-type utf8): a #GList containing
+ *                    the names of fields to return, or NULL for all
  * @max_results: the maximum number of contacts to show (or 0 for all)
  * @book_view: (out): A #EBookView pointer, will be set to the view
  * @error: a #GError to set on failure
@@ -1648,7 +1662,8 @@ get_book_view_reply (GObject *source_object,
  * e_book_async_get_book_view:
  * @book: an #EBook
  * @query: an #EBookQuery
- * @requested_fields: (element-type utf8): a #GList containing the names of fields to return, or NULL for all
+ * @requested_fields: (element-type utf8): a #GList containing the names of
+ *                    fields to return, or NULL for all
  * @max_results: the maximum number of contacts to show (or 0 for all)
  * @cb: (scope async): a function to call when the operation finishes
  * @closure: data to pass to callback function
@@ -1694,7 +1709,8 @@ e_book_async_get_book_view (EBook *book,
  * e_book_get_book_view_async:
  * @book: an #EBook
  * @query: an #EBookQuery
- * @requested_fields: (allow-none) (element-type utf8): a #GList containing the names of fields to
+ * @requested_fields: (allow-none) (element-type utf8): a #GList containing
+ *                    the names of fields to
  * return, or NULL for all
  * @max_results: the maximum number of contacts to show (or 0 for all)
  * @cb: (scope async): a function to call when the operation finishes
@@ -1707,7 +1723,8 @@ e_book_async_get_book_view (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_get_view() and e_book_client_get_view_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_get_view() and
+ *                  e_book_client_get_view_finish() instead.
  **/
 gboolean
 e_book_get_book_view_async (EBook *book,
@@ -1743,7 +1760,8 @@ e_book_get_book_view_async (EBook *book,
  * e_book_get_contacts:
  * @book: an #EBook
  * @query: an #EBookQuery
- * @contacts: (element-type utf8): a #GList pointer, will be set to the list of contacts
+ * @contacts: (element-type utf8): a #GList pointer, will be set to the
+ *            list of contacts
  * @error: a #GError to set on failure
  *
  * Query @book with @query, setting @contacts to the list of contacts which
@@ -1893,7 +1911,8 @@ e_book_async_get_contacts (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_book_client_get_contacts() and e_book_client_get_contacts_finish() instead.
+ * Deprecated: 3.2: Use e_book_client_get_contacts() and
+ *                  e_book_client_get_contacts_finish() instead.
  **/
 gboolean
 e_book_get_contacts_async (EBook *book,
@@ -2057,7 +2076,8 @@ e_book_free_change_list (GList *change_list)
  *
  * Returns: %TRUE on success, %FALSE otherwise
  *
- * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an #EBookClient object instead.
+ * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an
+ *                  #EBookClient object instead.
  **/
 gboolean
 e_book_cancel (EBook *book,
@@ -2078,7 +2098,8 @@ e_book_cancel (EBook *book,
  *
  * Since: 2.24
  *
- * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an #EBookClient object instead.
+ * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an
+ *                  #EBookClient object instead.
  **/
 gboolean
 e_book_cancel_async_op (EBook *book,
@@ -2094,7 +2115,8 @@ e_book_cancel_async_op (EBook *book,
 /**
  * e_book_open:
  * @book: an #EBook
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ *                  otherwise create it first
  * @error: a #GError to set on failure
  *
  * Opens the addressbook, making it ready for queries and other operations.
@@ -2144,8 +2166,10 @@ open_reply (GObject *source_object,
 /**
  * e_book_async_open:
  * @book: an #EBook
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
- * @open_response: (scope call) (closure closure): a function to call when the operation finishes
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ *                  otherwise create it first
+ * @open_response: (scope call) (closure closure): a function to call when
+ *                 the operation finishes
  * @closure: data to pass to callback function
  *
  * Opens the addressbook, making it ready for queries and other operations.
@@ -2180,7 +2204,8 @@ e_book_async_open (EBook *book,
 /**
  * e_book_open_async:
  * @book: an #EBook
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ *                  otherwise create it first
  * @open_response: (scope call): a function to call when the operation finishes
  * @closure: data to pass to callback function
  *
@@ -2191,7 +2216,8 @@ e_book_async_open (EBook *book,
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_client_open() and e_client_open_finish() on an #EBookClient object instead.
+ * Deprecated: 3.2: Use e_client_open() and e_client_open_finish() on an
+ *                  #EBookClient object instead.
  **/
 gboolean
 e_book_open_async (EBook *book,
@@ -2308,14 +2334,15 @@ e_book_async_remove (EBook *book,
  * @cb: (scope async): a function to call when the operation finishes
  * @closure: data to pass to callback function
  *
- * Remove the backing data for this #EBook. For example, with the file backend this
- * deletes the database file. You cannot get it back!
+ * Remove the backing data for this #EBook. For example, with the file
+ * backend this deletes the database file. You cannot get it back!
  *
  * Returns: %FALSE if successful, %TRUE otherwise.
  *
  * Since: 2.32
  *
- * Deprecated: 3.2: Use e_client_remove() and e_client_remove_finish() on an #EBookClient object instead.
+ * Deprecated: 3.2: Use e_client_remove() and e_client_remove_finish() on an
+ *                  #EBookClient object instead.
  **/
 gboolean
 e_book_remove_async (EBook *book,
@@ -2569,7 +2596,8 @@ e_book_get_self (ESourceRegistry *registry,
        if (uid) {
                gboolean got;
 
-               /* Don't care about errors because we'll create a new card on failure */
+               /* Don't care about errors because we'll create a
+                * new card on failure. */
                got = e_book_get_contact (*book, uid, contact, NULL);
                g_free (uid);
                if (got)
@@ -2617,7 +2645,9 @@ e_book_set_self (EBook *book,
        g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
 
        settings = g_settings_new (SELF_UID_PATH_ID);
-       g_settings_set_string (settings, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID));
+       g_settings_set_string (
+               settings, SELF_UID_KEY,
+               e_contact_get_const (contact, E_CONTACT_UID));
        g_object_unref (settings);
 
        return TRUE;
diff --git a/addressbook/libebook/e-destination.h b/addressbook/libebook/e-destination.h
index 7526037..d9d9caf 100644
--- a/addressbook/libebook/e-destination.h
+++ b/addressbook/libebook/e-destination.h
@@ -62,90 +62,109 @@ typedef struct _EDestination EDestination;
 typedef struct _EDestinationClass EDestinationClass;
 typedef struct _EDestinationPrivate EDestinationPrivate;
 
-struct _EDestinationPrivate;
-
 struct _EDestination {
        GObject object;
-
-       struct _EDestinationPrivate *priv;
+       EDestinationPrivate *priv;
 };
 
 struct _EDestinationClass {
        GObjectClass parent_class;
 
        /* Signals */
-       void (* changed) (EDestination *destination);
+       void            (*changed)              (EDestination *destination);
 
        /* Padding for future expansion */
-       void (*_ebook_reserved1) (void);
-       void (*_ebook_reserved2) (void);
-       void (*_ebook_reserved3) (void);
-       void (*_ebook_reserved4) (void);
+       void            (*_ebook_reserved1)     (void);
+       void            (*_ebook_reserved2)     (void);
+       void            (*_ebook_reserved3)     (void);
+       void            (*_ebook_reserved4)     (void);
 };
 
-GType e_destination_get_type (void);
+GType          e_destination_get_type          (void) G_GNUC_CONST;
 
-EDestination  *e_destination_new                (void);
-EDestination  *e_destination_copy               (const EDestination *dest);
+EDestination * e_destination_new               (void);
+EDestination * e_destination_copy              (const EDestination *dest);
 
-gboolean       e_destination_empty              (const EDestination *dest);
-gboolean       e_destination_equal              (const EDestination *a, const EDestination *b);
+gboolean       e_destination_empty             (const EDestination *dest);
+gboolean       e_destination_equal             (const EDestination *a,
+                                                const EDestination *b);
 
 /* for use with EDestinations that wrap a particular contact */
-void           e_destination_set_contact        (EDestination *dest, EContact *contact, gint email_num);
-void           e_destination_set_contact_uid    (EDestination *dest, const gchar *uid, gint email_num);
-void           e_destination_set_client        (EDestination *dest, EBookClient *client);
-EContact      *e_destination_get_contact        (const EDestination *dest);
-const gchar    *e_destination_get_source_uid     (const EDestination *dest);
-const gchar    *e_destination_get_contact_uid    (const EDestination *dest);
-gint            e_destination_get_email_num      (const EDestination *dest);
-
-/* for use with EDestinations built up from strings (not corresponding to contacts in a user's address 
books) */
-void           e_destination_set_name           (EDestination *dest, const gchar *name);
-void           e_destination_set_email          (EDestination *dest, const gchar *email);
-const gchar    *e_destination_get_name           (const EDestination *dest);  /* "Jane Smith" */
-const gchar    *e_destination_get_email          (const EDestination *dest);  /* "jane assbarn com" */
-const gchar    *e_destination_get_address        (const EDestination *dest);  /* "Jane Smith <jane assbarn 
com>" (or a comma-sep set of such for a list) */
-
-gboolean       e_destination_is_evolution_list   (const EDestination *dest);
-gboolean       e_destination_list_show_addresses (const EDestination *dest);
-const GList   *e_destination_list_get_dests      (const EDestination *dest);
-const GList   *e_destination_list_get_root_dests (const EDestination *dest);
-gboolean       e_destination_is_ignored         (const EDestination *dest);
-void           e_destination_set_ignored        (EDestination *dest, gboolean ignored);
+void           e_destination_set_contact       (EDestination *dest,
+                                                EContact *contact,
+                                                gint email_num);
+void           e_destination_set_contact_uid   (EDestination *dest,
+                                                const gchar *uid,
+                                                gint email_num);
+void           e_destination_set_client        (EDestination *dest,
+                                                EBookClient *client);
+EContact *     e_destination_get_contact       (const EDestination *dest);
+const gchar *  e_destination_get_source_uid    (const EDestination *dest);
+const gchar *  e_destination_get_contact_uid   (const EDestination *dest);
+gint           e_destination_get_email_num     (const EDestination *dest);
+
+/* for use with EDestinations built up from strings
+ * (not corresponding to contacts in a user's address books) */
+void           e_destination_set_name          (EDestination *dest,
+                                                const gchar *name);
+void           e_destination_set_email         (EDestination *dest,
+                                                const gchar *email);
+const gchar *  e_destination_get_name          (const EDestination *dest);
+const gchar *  e_destination_get_email         (const EDestination *dest);
+const gchar *  e_destination_get_address       (const EDestination *dest);
+
+gboolean       e_destination_is_evolution_list (const EDestination *dest);
+gboolean       e_destination_list_show_addresses
+                                               (const EDestination *dest);
+const GList *  e_destination_list_get_dests    (const EDestination *dest);
+const GList *  e_destination_list_get_root_dests
+                                               (const EDestination *dest);
+gboolean       e_destination_is_ignored        (const EDestination *dest);
+void           e_destination_set_ignored       (EDestination *dest,
+                                                gboolean ignored);
 
 /* If true, they want HTML mail. */
-void           e_destination_set_html_mail_pref (EDestination *dest, gboolean flag);
-gboolean       e_destination_get_html_mail_pref (const EDestination *dest);
+gboolean       e_destination_get_html_mail_pref
+                                               (const EDestination *dest);
+void           e_destination_set_html_mail_pref
+                                               (EDestination *dest,
+                                                gboolean flag);
 
 /* used by the evolution composer to manage automatic recipients
  *
  * XXX should probably be implemented using a more neutral/extensible
  * approach instead of a hardcoded evolution-only flag. */
-gboolean       e_destination_is_auto_recipient  (const EDestination *dest);
-void           e_destination_set_auto_recipient (EDestination *dest, gboolean value);
+gboolean       e_destination_is_auto_recipient (const EDestination *dest);
+void           e_destination_set_auto_recipient
+                                               (EDestination *dest,
+                                                gboolean value);
 
-/* parse out an EDestination (name/email, not contact) from a free form string. */
-void           e_destination_set_raw            (EDestination *dest, const gchar *raw);
+/* set an EDestination (name/email, not contact) from a free form string. */
+void           e_destination_set_raw           (EDestination *dest,
+                                                const gchar *raw);
 
-/* generate a plain-text representation of an EDestination* or EDestination** */
-const gchar    *e_destination_get_textrep        (const EDestination *dest, gboolean include_email);  /* 
"Jane Smith" or "jane assbarn com" */
-gchar          *e_destination_get_textrepv       (EDestination **destv);
+/* generate a plain-text representation of an EDestination */
+const gchar *  e_destination_get_textrep       (const EDestination *dest,
+                                                gboolean include_email);
+gchar *                e_destination_get_textrepv      (EDestination **destv);
 
 /* XML export/import routines. */
-gchar          *e_destination_export             (const EDestination *dest);
-gchar          *e_destination_exportv            (EDestination **destv);
-EDestination  *e_destination_import             (const gchar *str);
-EDestination **e_destination_importv            (const gchar *str);
+gchar *                e_destination_export            (const EDestination *dest);
+gchar *                e_destination_exportv           (EDestination **destv);
+EDestination * e_destination_import            (const gchar *str);
+EDestination **        e_destination_importv           (const gchar *str);
 
 /* EVCard "export" routines */
-void          e_destination_export_to_vcard_attribute   (EDestination *dest, EVCardAttribute *attr);
+void           e_destination_export_to_vcard_attribute
+                                               (EDestination *dest,
+                                                EVCardAttribute *attr);
 
-void           e_destination_freev              (EDestination **destv);
+void           e_destination_freev             (EDestination **destv);
 
 #ifndef EDS_DISABLE_DEPRECATED
 #ifndef __GI_SCANNER__
-void           e_destination_set_book           (EDestination *dest, EBook *book);
+void           e_destination_set_book          (EDestination *dest,
+                                                EBook *book);
 #endif /* __GI_SCANNER__ */
 #endif /* EDS_DISABLE_DEPRECATED */
 
diff --git a/addressbook/libedata-book/e-book-backend-sexp.c b/addressbook/libedata-book/e-book-backend-sexp.c
index f8712b2..9ca37a0 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.c
+++ b/addressbook/libedata-book/e-book-backend-sexp.c
@@ -965,12 +965,45 @@ func_exists_vcard (struct _ESExp *f,
        return r;
 }
 
+static void
+book_backend_sexp_finalize (GObject *object)
+{
+       EBookBackendSExpPrivate *priv;
+
+       priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (object);
+
+       e_sexp_unref (priv->search_sexp);
+       g_free (priv->text);
+       g_free (priv->search_context);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_book_backend_sexp_parent_class)->finalize (object);
+}
+
+static void
+e_book_backend_sexp_class_init (EBookBackendSExpClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (EBookBackendSExpPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = book_backend_sexp_finalize;
+}
+
+static void
+e_book_backend_sexp_init (EBookBackendSExp *sexp)
+{
+       sexp->priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (sexp);
+       sexp->priv->search_context = g_new (SearchContext, 1);
+}
+
 /* 'builtin' functions */
 static struct {
        const gchar *name;
        ESExpFunc *func;
-       gint type;              /* set to 1 if a function can perform shortcut evaluation, or
-                                  doesn't execute everything, 0 otherwise */
+       gint type;      /* 1 if a function can perform shortcut evaluation,
+                        * or doesn't execute everything, 0 otherwise */
 } symbols[] = {
        { "contains", func_contains, 0 },
        { "is", func_is, 0 },
@@ -984,101 +1017,47 @@ static struct {
 };
 
 /**
- * e_book_backend_sexp_match_contact:
- * @sexp: an #EBookBackendSExp
- * @contact: an #EContact
- *
- * Checks if @contact matches @sexp.
- *
- * Returns: %TRUE if the contact matches, %FALSE otherwise.
- **/
-gboolean
-e_book_backend_sexp_match_contact (EBookBackendSExp *sexp,
-                                   EContact *contact)
-{
-       ESExpResult *r;
-       gboolean retval;
-
-       if (!contact) {
-               g_warning ("null EContact passed to e_book_backend_sexp_match_contact");
-               return FALSE;
-       }
-
-       sexp->priv->search_context->contact = g_object_ref (contact);
-
-       r = e_sexp_eval (sexp->priv->search_sexp);
-
-       retval = (r && r->type == ESEXP_RES_BOOL && r->value.boolean);
-
-       g_object_unref (sexp->priv->search_context->contact);
-
-       e_sexp_result_free (sexp->priv->search_sexp, r);
-
-       return retval;
-}
-
-/**
- * e_book_backend_sexp_match_vcard:
- * @sexp: an #EBookBackendSExp
- * @vcard: a VCard string
- *
- * Checks if @vcard matches @sexp.
- *
- * Returns: %TRUE if the VCard matches, %FALSE otherwise.
- **/
-gboolean
-e_book_backend_sexp_match_vcard (EBookBackendSExp *sexp,
-                                 const gchar *vcard)
-{
-       EContact *contact;
-       gboolean retval;
-
-       contact = e_contact_new_from_vcard (vcard);
-
-       retval = e_book_backend_sexp_match_contact (sexp, contact);
-
-       g_object_unref (contact);
-
-       return retval;
-}
-
-
-
-/**
  * e_book_backend_sexp_new:
  * @text: an s-expression to parse
  *
  * Creates a new #EBookBackendSExp from @text.
  *
- * Returns: A new #EBookBackendSExp.
+ * Returns: a new #EBookBackendSExp
  **/
 EBookBackendSExp *
 e_book_backend_sexp_new (const gchar *text)
 {
-       EBookBackendSExp *sexp = g_object_new (E_TYPE_BOOK_BACKEND_SEXP, NULL);
-       gint esexp_error;
-       gint i;
+       EBookBackendSExp *sexp;
+       gint ii;
+
+       g_return_val_if_fail (text != NULL, NULL);
 
+       sexp = g_object_new (E_TYPE_BOOK_BACKEND_SEXP, NULL);
        sexp->priv->search_sexp = e_sexp_new ();
        sexp->priv->text = g_strdup (text);
 
-       for (i = 0; i < G_N_ELEMENTS (symbols); i++) {
-               if (symbols[i].type == 1) {
-                       e_sexp_add_ifunction (sexp->priv->search_sexp, 0, symbols[i].name,
-                                            (ESExpIFunc *) symbols[i].func, sexp->priv->search_context);
-               }
-               else {
+       for (ii = 0; ii < G_N_ELEMENTS (symbols); ii++) {
+               if (symbols[ii].type == 1) {
+                       e_sexp_add_ifunction (
+                               sexp->priv->search_sexp, 0,
+                               symbols[ii].name,
+                               (ESExpIFunc *) symbols[ii].func,
+                               sexp->priv->search_context);
+               } else {
                        e_sexp_add_function (
-                               sexp->priv->search_sexp, 0, symbols[i].name,
-                               symbols[i].func, sexp->priv->search_context);
+                               sexp->priv->search_sexp, 0,
+                               symbols[ii].name,
+                               symbols[ii].func,
+                               sexp->priv->search_context);
                }
        }
 
        e_sexp_input_text (sexp->priv->search_sexp, text, strlen (text));
-       esexp_error = e_sexp_parse (sexp->priv->search_sexp);
 
-       if (esexp_error == -1) {
-               g_warning ("%s: Error in parsing: %s", G_STRFUNC, sexp->priv->search_sexp->error);
+       if (e_sexp_parse (sexp->priv->search_sexp) == -1) {
+               g_warning (
+                       "%s: Error in parsing: %s",
+                       G_STRFUNC, sexp->priv->search_sexp->error);
                g_object_unref (sexp);
                sexp = NULL;
        }
@@ -1104,35 +1083,63 @@ e_book_backend_sexp_text (EBookBackendSExp *sexp)
        return sexp->priv->text;
 }
 
-static void
-e_book_backend_sexp_finalize (GObject *object)
+/**
+ * e_book_backend_sexp_match_contact:
+ * @sexp: an #EBookBackendSExp
+ * @contact: an #EContact
+ *
+ * Checks if @contact matches @sexp.
+ *
+ * Returns: %TRUE if the contact matches, %FALSE otherwise
+ **/
+gboolean
+e_book_backend_sexp_match_contact (EBookBackendSExp *sexp,
+                                   EContact *contact)
 {
-       EBookBackendSExpPrivate *priv;
+       ESExpResult *r;
+       gboolean retval;
 
-       priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (object);
+       g_return_val_if_fail (E_IS_BOOK_BACKEND_SEXP (sexp), FALSE);
+       g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
 
-       e_sexp_unref (priv->search_sexp);
-       g_free (priv->text);
-       g_free (priv->search_context);
+       sexp->priv->search_context->contact = g_object_ref (contact);
 
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (e_book_backend_sexp_parent_class)->finalize (object);
-}
+       r = e_sexp_eval (sexp->priv->search_sexp);
 
-static void
-e_book_backend_sexp_class_init (EBookBackendSExpClass *class)
-{
-       GObjectClass *object_class;
+       retval = (r && r->type == ESEXP_RES_BOOL && r->value.boolean);
 
-       g_type_class_add_private (class, sizeof (EBookBackendSExpPrivate));
+       g_object_unref (sexp->priv->search_context->contact);
 
-       object_class = G_OBJECT_CLASS (class);
-       object_class->finalize = e_book_backend_sexp_finalize;
+       e_sexp_result_free (sexp->priv->search_sexp, r);
+
+       return retval;
 }
 
-static void
-e_book_backend_sexp_init (EBookBackendSExp *sexp)
+/**
+ * e_book_backend_sexp_match_vcard:
+ * @sexp: an #EBookBackendSExp
+ * @vcard: a vCard string
+ *
+ * Checks if @vcard matches @sexp.
+ *
+ * Returns: %TRUE if the vCard matches, %FALSE otherwise
+ **/
+gboolean
+e_book_backend_sexp_match_vcard (EBookBackendSExp *sexp,
+                                 const gchar *vcard)
 {
-       sexp->priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (sexp);
-       sexp->priv->search_context = g_new (SearchContext, 1);
+       EContact *contact;
+       gboolean retval;
+
+       g_return_val_if_fail (E_IS_BOOK_BACKEND_SEXP (sexp), FALSE);
+       g_return_val_if_fail (vcard != NULL, FALSE);
+
+       contact = e_contact_new_from_vcard (vcard);
+
+       retval = e_book_backend_sexp_match_contact (sexp, contact);
+
+       g_object_unref (contact);
+
+       return retval;
 }
+
diff --git a/addressbook/libedata-book/e-book-backend-sexp.h b/addressbook/libedata-book/e-book-backend-sexp.h
index 9f58207..7327c4e 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.h
+++ b/addressbook/libedata-book/e-book-backend-sexp.h
@@ -56,7 +56,7 @@ typedef struct _EBookBackendSExpClass EBookBackendSExpClass;
 typedef struct _EBookBackendSExpPrivate EBookBackendSExpPrivate;
 
 struct _EBookBackendSExp {
-       GObject parent_object;
+       GObject parent;
        EBookBackendSExpPrivate *priv;
 };
 
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index c163003..c93891a 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -47,7 +47,6 @@
                g_message ("%s: DB Locked ", G_STRFUNC);        \
        } G_STMT_END
 
-
 #  define UNLOCK_MUTEX(mutex)                                  \
        G_STMT_START {                                          \
                g_message ("%s: Unlocking ", G_STRFUNC);        \
@@ -81,7 +80,7 @@ struct _EBookBackendSqliteDBPrivate {
        gchar *hash_key;
 
        GMutex lock;
-       GMutex updates_lock; /* This is for deprecated e_book_backend_sqlitedb_lock_updates() */
+       GMutex updates_lock; /* This is for deprecated e_book_backend_sqlitedb_lock_updates () */
 
        gboolean store_vcard;
        guint32 in_transaction;
@@ -94,7 +93,6 @@ struct _EBookBackendSqliteDBPrivate {
 
 G_DEFINE_TYPE (EBookBackendSqliteDB, e_book_backend_sqlitedb, G_TYPE_OBJECT)
 
-
 static GHashTable *db_connections = NULL;
 static GMutex dbcon_lock;
 
@@ -323,7 +321,7 @@ book_backend_sql_exec_real (sqlite3 *db,
 
 static gint
 print_debug_cb (gpointer ref,
-               gint n_cols,
+                gint n_cols,
                 gchar **cols,
                 gchar **name)
 {
@@ -894,7 +892,7 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                                folderid);
                        stmt = sqlite3_mprintf (
                                "CREATE INDEX IF NOT EXISTS %Q ON %Q (%s)", tmp, folderid,
-                                               summary_dbname_from_field (ebsdb, 
ebsdb->priv->summary_fields[i].field));
+                               summary_dbname_from_field (ebsdb, ebsdb->priv->summary_fields[i].field));
                        success = book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, error);
                        sqlite3_free (stmt);
                        g_free (tmp);
@@ -910,7 +908,7 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                                folderid);
                        stmt = sqlite3_mprintf (
                                "CREATE INDEX IF NOT EXISTS %Q ON %Q (%s_reverse)", tmp, folderid,
-                                               summary_dbname_from_field (ebsdb, 
ebsdb->priv->summary_fields[i].field));
+                               summary_dbname_from_field (ebsdb, ebsdb->priv->summary_fields[i].field));
                        success = book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, error);
                        sqlite3_free (stmt);
                        g_free (tmp);
@@ -919,11 +917,13 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                if ((ebsdb->priv->summary_fields[i].index & INDEX_PHONE) != 0 &&
                    ebsdb->priv->summary_fields[i].type != E_TYPE_CONTACT_ATTR_LIST) {
                        /* Derive index name from field & folder */
-                       tmp = g_strdup_printf ("PINDEX_%s_%s",
-                                              summary_dbname_from_field (ebsdb, 
ebsdb->priv->summary_fields[i].field),
-                                              folderid);
-                       stmt = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (%s_phone)", tmp, 
folderid,
-                                               summary_dbname_from_field (ebsdb, 
ebsdb->priv->summary_fields[i].field));
+                       tmp = g_strdup_printf (
+                               "PINDEX_%s_%s",
+                               summary_dbname_from_field (ebsdb, ebsdb->priv->summary_fields[i].field),
+                               folderid);
+                       stmt = sqlite3_mprintf (
+                               "CREATE INDEX IF NOT EXISTS %Q ON %Q (%s_phone)", tmp, folderid,
+                               summary_dbname_from_field (ebsdb, ebsdb->priv->summary_fields[i].field));
                        success = book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, error);
                        sqlite3_free (stmt);
                        g_free (tmp);
@@ -993,9 +993,9 @@ typedef struct {
 
 static gint
 create_phone_indexes_for_columns (gpointer data,
-                                 gint n_cols,
-                                 gchar **cols,
-                                 gchar **name)
+                                  gint n_cols,
+                                  gchar **cols,
+                                  gchar **name)
 {
        const gchar *column_name = cols[1];
        CollationInfo *info = data;
@@ -1024,9 +1024,9 @@ create_phone_indexes_for_columns (gpointer data,
 
 static gint
 create_phone_indexes_for_tables (gpointer data,
-                                gint n_cols,
-                                gchar **cols,
-                                gchar **name)
+                                 gint n_cols,
+                                 gchar **cols,
+                                 gchar **name)
 {
        CollationInfo *info = data;
        GError *error = NULL;
@@ -1052,7 +1052,6 @@ create_phone_indexes_for_tables (gpointer data,
                g_clear_error (&error);
        }
 
-
        sqlite3_free (stmt);
        g_free (tmp);
 
@@ -1060,9 +1059,9 @@ create_phone_indexes_for_tables (gpointer data,
 }
 
 static GString *
-ixphone_str (gint               country_code,
-            const gchar *const national_str,
-            gint               national_len)
+ixphone_str (gint country_code,
+             const gchar *const national_str,
+             gint national_len)
 {
        GString *const str = g_string_sized_new (6 + national_len);
        g_string_append_printf (str, "+%d|", country_code);
@@ -1072,9 +1071,9 @@ ixphone_str (gint               country_code,
 
 static gint
 e_strcmp2n (const gchar *str1,
-           size_t       len1,
-           const gchar *str2,
-           size_t       len2)
+            size_t len1,
+            const gchar *str2,
+            size_t len2)
 {
        const gint cmp = memcmp (str1, str2, MIN (len1, len2));
 
@@ -1084,11 +1083,11 @@ e_strcmp2n (const gchar *str1,
 }
 
 static gint
-ixphone_compare_for_country (gpointer      data,
-                            gint          len1,
-                            gconstpointer arg1,
-                            gint          len2,
-                            gconstpointer arg2)
+ixphone_compare_for_country (gpointer data,
+                             gint len1,
+                             gconstpointer arg1,
+                             gint len2,
+                             gconstpointer arg2)
 {
        const gchar *const str1 = arg1;
        const gchar *const str2 = arg2;
@@ -1116,11 +1115,11 @@ ixphone_compare_for_country (gpointer      data,
 }
 
 static gint
-ixphone_compare_national (gpointer      data,
-                         gint          len1,
-                         gconstpointer arg1,
-                         gint          len2,
-                         gconstpointer arg2)
+ixphone_compare_national (gpointer data,
+                          gint len1,
+                          gconstpointer arg1,
+                          gint len2,
+                          gconstpointer arg2)
 {
        const gchar *const str1 = arg1;
        const gchar *const str2 = arg2;
@@ -1133,8 +1132,9 @@ ixphone_compare_national (gpointer      data,
        g_return_val_if_fail (sep2 != NULL, 0);
 
        /* First only check national portions */
-       cmp = e_strcmp2n (sep1 + 1, len1 - (sep1 + 1 - str1),
-                         sep2 + 1, len2 - (sep2 + 1 - str2));
+       cmp = e_strcmp2n (
+               sep1 + 1, len1 - (sep1 + 1 - str1),
+               sep2 + 1, len2 - (sep2 + 1 - str2));
 
        /* On match we also have to check for potential country codes.
         * Note that we can't just compare the full phone number string
@@ -1150,8 +1150,9 @@ ixphone_compare_national (gpointer      data,
        if (cmp == 0 && sep1 != str1 && sep2 != str2) {
                /* Also compare the country code if the national number
                 * matches and both numbers have a country code. */
-               cmp = e_strcmp2n (str1, sep1 - str1,
-                                 str2, sep2 - str2);
+               cmp = e_strcmp2n (
+                       str1, sep1 - str1,
+                       str2, sep2 - str2);
        }
 
        if (booksql_debug ()) {
@@ -1170,10 +1171,10 @@ ixphone_compare_national (gpointer      data,
 }
 
 static void
-create_collation (gpointer     data,
-                 sqlite3     *db,
-                 gint         encoding,
-                 const gchar *name)
+create_collation (gpointer data,
+                  sqlite3 *db,
+                  gint encoding,
+                  const gchar *name)
 {
        gint ret = SQLITE_DONE;
        gint country_code;
@@ -1411,11 +1412,11 @@ append_summary_field (GArray *array,
 }
 
 static void
-summary_fields_add_indexes (GArray         *array,
-                            EContactField  *indexes,
+summary_fields_add_indexes (GArray *array,
+                            EContactField *indexes,
                             EBookIndexType *index_types,
-                            gint            n_indexes,
-                            IndexFlags     *attr_list_indexes)
+                            gint n_indexes,
+                            IndexFlags *attr_list_indexes)
 {
        gint i, j;
 
@@ -1658,7 +1659,7 @@ mprintf_suffix (const gchar *normal)
 
 static EPhoneNumber *
 phone_number_from_string (const gchar *normal,
-                         const gchar *default_region)
+                          const gchar *default_region)
 {
        EPhoneNumber *number = NULL;
 
@@ -1674,7 +1675,7 @@ phone_number_from_string (const gchar *normal,
 
 static gchar *
 convert_phone (const gchar *normal,
-              const gchar *default_region)
+               const gchar *default_region)
 {
        EPhoneNumber *number = phone_number_from_string (normal, default_region);
        gchar *indexed_phone_number = NULL;
@@ -1705,7 +1706,7 @@ convert_phone (const gchar *normal,
 
 static gchar *
 mprintf_phone (const gchar *normal,
-              const gchar *default_region)
+               const gchar *default_region)
 {
        gchar *phone = convert_phone (normal, default_region);
        gchar *stmt = NULL;
@@ -1731,8 +1732,9 @@ insert_stmt_from_contact (EBookBackendSqliteDB *ebsdb,
        gchar *str, *vcard_str;
        gint i;
 
-       str = sqlite3_mprintf ("INSERT or %s INTO %Q VALUES (",
-                              replace_existing ? "REPLACE" : "FAIL", folderid);
+       str = sqlite3_mprintf (
+               "INSERT or %s INTO %Q VALUES (",
+               replace_existing ? "REPLACE" : "FAIL", folderid);
        string = g_string_new (str);
        sqlite3_free (str);
 
@@ -1864,11 +1866,11 @@ update_e164_attribute_params (EVCard *vcard)
 
 static gboolean
 insert_contact (EBookBackendSqliteDB *ebsdb,
-               EContact *contact,
-               const gchar *folderid,
-               gboolean replace_existing,
-               const gchar *default_region,
-               GError **error)
+                EContact *contact,
+                const gchar *folderid,
+                gboolean replace_existing,
+                const gchar *default_region,
+                GError **error)
 {
        EBookBackendSqliteDBPrivate *priv;
        gboolean success;
@@ -1918,16 +1920,17 @@ insert_contact (EBookBackendSqliteDB *ebsdb,
                                        && (priv->summary_fields[i].index & INDEX_PHONE) != 0)
                                        stmt_phone = mprintf_phone (normal, default_region);
 
-                               stmt = sqlite3_mprintf ("INSERT INTO %Q (uid, field, value%s%s) "
-                                                       "VALUES (%Q, %Q, %Q%s%s%s%s)",
-                                                       list_folder,
-                                                       stmt_suffix ? ", value_reverse" : "",
-                                                       stmt_phone ? ", value_phone" : "",
-                                                       uid, priv->summary_fields[i].dbname, normal,
-                                                       stmt_suffix ? ", " : "",
-                                                       stmt_suffix ? stmt_suffix : "",
-                                                       stmt_phone ? ", " : "",
-                                                       stmt_phone ? stmt_phone : "");
+                               stmt = sqlite3_mprintf (
+                                       "INSERT INTO %Q (uid, field, value%s%s) "
+                                       "VALUES (%Q, %Q, %Q%s%s%s%s)",
+                                       list_folder,
+                                       stmt_suffix ? ", value_reverse" : "",
+                                       stmt_phone ? ", value_phone" : "",
+                                       uid, priv->summary_fields[i].dbname, normal,
+                                       stmt_suffix ? ", " : "",
+                                       stmt_suffix ? stmt_suffix : "",
+                                       stmt_phone ? ", " : "",
+                                       stmt_phone ? stmt_phone : "");
 
                                if (stmt_suffix)
                                        sqlite3_free (stmt_suffix);
@@ -2416,7 +2419,7 @@ e_book_backend_sqlitedb_is_summary_fields (GHashTable *fields_of_interest)
  **/
 gboolean
 e_book_backend_sqlitedb_check_summary_fields (EBookBackendSqliteDB *ebsdb,
-                                             GHashTable *fields_of_interest)
+                                              GHashTable *fields_of_interest)
 {
        gboolean summary_fields = TRUE;
        GHashTableIter iter;
@@ -2643,8 +2646,8 @@ func_check_subset (ESExp *f,
 
 static gint
 func_check_field_test (EBookBackendSqliteDB *ebsdb,
-                       const gchar *query_name,
-                       const gchar *query_value)
+                        const gchar *query_name,
+                        const gchar *query_value)
 {
        gint i;
        gint ret_val = 0;
@@ -2718,10 +2721,10 @@ func_check (struct _ESExp *f,
 }
 
 static ESExpResult *
-func_check_phone (struct _ESExp         *f,
-                  gint                  argc,
-                  struct _ESExpResult **argv,
-                  gpointer              data)
+func_check_phone (struct _ESExp *f,
+                  gint argc,
+                  struct _ESExpResult **argv,
+                  gpointer data)
 {
        ESExpResult *const r = func_check (f, argc, argv, data);
        const gchar *const query_value = argv[1]->value.string;
@@ -2772,10 +2775,10 @@ static const struct {
 
 static gboolean
 e_book_backend_sqlitedb_check_summary_query_locked (EBookBackendSqliteDB *ebsdb,
-                                                   const gchar *query,
-                                                   gboolean *with_list_attrs,
-                                                   gboolean *unsupported_query,
-                                                   gboolean *invalid_query)
+                                                    const gchar *query,
+                                                    gboolean *with_list_attrs,
+                                                    gboolean *unsupported_query,
+                                                    gboolean *invalid_query)
 {
        ESExp *sexp;
        ESExpResult *r;
@@ -2985,9 +2988,9 @@ extract_digits (const gchar *normal)
 
 static gchar *
 convert_string_value (EBookBackendSqliteDB *ebsdb,
-                      const gchar          *value,
-                      ConvertFlags          flags,
-                      MatchType             match)
+                      const gchar *value,
+                      ConvertFlags flags,
+                      MatchType match)
 {
        GString *str;
        size_t len;
@@ -3075,13 +3078,13 @@ convert_string_value (EBookBackendSqliteDB *ebsdb,
 
 static gchar *
 field_name_and_query_term (EBookBackendSqliteDB *ebsdb,
-                          const gchar          *folderid,
-                          const gchar          *field_name_input,
-                          const gchar          *query_term_input,
-                          MatchType             match,
-                          gboolean             *is_list_attr,
-                          gchar               **query_term,
-                          gchar               **extra_term)
+                           const gchar *folderid,
+                           const gchar *field_name_input,
+                           const gchar *query_term_input,
+                           MatchType match,
+                           gboolean *is_list_attr,
+                           gchar **query_term,
+                           gchar **extra_term)
 {
        gint summary_index;
        gchar *field_name = NULL;
@@ -3153,7 +3156,8 @@ field_name_and_query_term (EBookBackendSqliteDB *ebsdb,
                                field_name = g_strdup ("multi.value_phone");
                                list_attr = TRUE;
                        } else {
-                               field_name = g_strdup_printf ("summary.%s_phone",
+                               field_name = g_strdup_printf (
+                                       "summary.%s_phone",
                                        ebsdb->priv->summary_fields[summary_index].dbname);
                        }
 
@@ -3389,27 +3393,27 @@ func_endswith (struct _ESExp *f,
 
 static ESExpResult *
 func_eqphone (struct _ESExp *f,
-              gint argc,
-              struct _ESExpResult **argv,
-              gpointer data)
+              gint argc,
+              struct _ESExpResult **argv,
+              gpointer data)
 {
        return convert_match_exp (f, argc, argv, data, MATCH_PHONE_NUMBER);
 }
 
 static ESExpResult *
 func_eqphone_national (struct _ESExp *f,
-                       gint argc,
-                       struct _ESExpResult **argv,
-                       gpointer data)
+                       gint argc,
+                       struct _ESExpResult **argv,
+                       gpointer data)
 {
        return convert_match_exp (f, argc, argv, data, MATCH_NATIONAL_PHONE_NUMBER);
 }
 
 static ESExpResult *
 func_eqphone_short (struct _ESExp *f,
-                    gint argc,
-                    struct _ESExpResult **argv,
-                    gpointer data)
+                    gint argc,
+                    struct _ESExpResult **argv,
+                    gpointer data)
 {
        return convert_match_exp (f, argc, argv, data, MATCH_SHORT_PHONE_NUMBER);
 }
@@ -3720,9 +3724,10 @@ e_book_backend_sqlitedb_search (EBookBackendSqliteDB *ebsdb,
        LOCK_MUTEX (&ebsdb->priv->lock);
 
        if (sexp)
-               summary_query = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp,
-                                                                                   &query_with_list_attrs,
-                                                                                   &query_unsupported, 
&query_invalid);
+               summary_query = e_book_backend_sqlitedb_check_summary_query_locked (
+                       ebsdb, sexp,
+                       &query_with_list_attrs,
+                       &query_unsupported, &query_invalid);
 
        if (query_unsupported)
                g_set_error (
@@ -3799,10 +3804,11 @@ e_book_backend_sqlitedb_search_uids (EBookBackendSqliteDB *ebsdb,
        LOCK_MUTEX (&ebsdb->priv->lock);
 
        if (sexp)
-               summary_query = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp,
-                                                                                   &query_with_list_attrs,
-                                                                                   &query_unsupported,
-                                                                                   &query_invalid);
+               summary_query = e_book_backend_sqlitedb_check_summary_query_locked (
+                       ebsdb, sexp,
+                       &query_with_list_attrs,
+                       &query_unsupported,
+                       &query_invalid);
 
        if (query_unsupported)
                g_set_error (
@@ -3975,10 +3981,10 @@ e_book_backend_sqlitedb_set_is_populated (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "UPDATE folders SET is_populated = %d "
+               "UPDATE folders SET is_populated = %d "
                "WHERE folder_id = %Q", populated, folderid);
        success = book_backend_sql_exec (
-                ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4068,10 +4074,10 @@ e_book_backend_sqlitedb_set_revision (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "UPDATE folders SET revision = %Q "
+               "UPDATE folders SET revision = %Q "
                "WHERE folder_id = %Q", revision, folderid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4149,10 +4155,10 @@ e_book_backend_sqlitedb_set_has_partial_content (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "UPDATE folders SET partial_content = %d "
+               "UPDATE folders SET partial_content = %d "
                "WHERE folder_id = %Q", partial_content, folderid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4234,10 +4240,10 @@ e_book_backend_sqlitedb_set_contact_bdata (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "UPDATE %Q SET bdata = %Q WHERE uid = %Q",
+               "UPDATE %Q SET bdata = %Q WHERE uid = %Q",
                folderid, value, uid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4310,10 +4316,10 @@ e_book_backend_sqlitedb_set_sync_data (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "UPDATE folders SET sync_data = %Q "
+               "UPDATE folders SET sync_data = %Q "
                "WHERE folder_id = %Q", sync_data, folderid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4390,10 +4396,10 @@ e_book_backend_sqlitedb_set_key_value (EBookBackendSqliteDB *ebsdb,
        }
 
        stmt = sqlite3_mprintf (
-               "INSERT or REPLACE INTO keys (key, value, folder_id) "
+               "INSERT or REPLACE INTO keys (key, value, folder_id) "
                "values (%Q, %Q, %Q)", key, value, folderid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, NULL, NULL, error);
+               ebsdb->priv->db, stmt, NULL, NULL, error);
        sqlite3_free (stmt);
 
        if (success)
@@ -4568,9 +4574,9 @@ destroy_search_data (gpointer data)
 }
 
 static gboolean
-upgrade_contacts_table (EBookBackendSqliteDB  *ebsdb,
-                        const gchar           *folderid,
-                        GError               **error)
+upgrade_contacts_table (EBookBackendSqliteDB *ebsdb,
+                        const gchar *folderid,
+                        GError **error)
 {
        gchar *stmt;
        gboolean success = FALSE;
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 7eaf505..1e30896 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -72,25 +72,56 @@ book_backend_get_backend_property (EBookBackend *backend,
                                    GCancellable *cancellable,
                                    const gchar *prop_name)
 {
-       g_return_if_fail (backend != NULL);
        g_return_if_fail (E_IS_BOOK_BACKEND (backend));
        g_return_if_fail (book != NULL);
        g_return_if_fail (prop_name != NULL);
 
        if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENED)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, "TRUE");
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, "TRUE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENING)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, "FALSE");
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_REVISION)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, "0");
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, "0");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_ONLINE)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, e_backend_get_online (E_BACKEND 
(backend)) ? "TRUE" : "FALSE");
+               gboolean online;
+
+               online = e_backend_get_online (E_BACKEND (backend));
+
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, online ? "TRUE" : "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_READONLY)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, e_book_backend_is_readonly 
(backend) ? "TRUE" : "FALSE");
+               gboolean readonly;
+
+               readonly = e_book_backend_is_readonly (backend);
+
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, readonly ? "TRUE" : "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CACHE_DIR)) {
-               e_data_book_respond_get_backend_property (book, opid, NULL, e_book_backend_get_cache_dir 
(backend));
+               const gchar *cache_dir;
+
+               cache_dir = e_book_backend_get_cache_dir (backend);
+
+               e_data_book_respond_get_backend_property (
+                       book, opid, NULL, cache_dir);
+
        } else {
-               e_data_book_respond_get_backend_property (book, opid, e_data_book_create_error_fmt 
(E_DATA_BOOK_STATUS_NOT_SUPPORTED, _("Unknown book property '%s'"), prop_name), NULL);
+               GError *error;
+
+               error = e_data_book_create_error_fmt (
+                       E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+                       _("Unknown book property '%s'"), prop_name);
+
+               /* Takes ownership of the GError. */
+               e_data_book_respond_get_backend_property (
+                       book, opid, error, NULL);
        }
 }
 
@@ -1137,7 +1168,7 @@ e_book_backend_get_direct_book (EBookBackend *backend)
  */
 void
 e_book_backend_configure_direct (EBookBackend *backend,
-                                const gchar *config)
+                                 const gchar *config)
 {
        g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 62430b8..b79da95 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -196,10 +196,10 @@ struct _EBookBackendClass {
        void            (*notify_update)        (EBookBackend *backend,
                                                 const EContact *contact);
 
-
        EDataBookDirect *
-               (* get_direct_book)             (EBookBackend *backend);
-       void    (* configure_direct)            (EBookBackend *backend, const gchar *config);
+                       (*get_direct_book)      (EBookBackend *backend);
+       void            (*configure_direct)     (EBookBackend *backend,
+                                                const gchar *config);
 
        /* Notification signals */
        void            (*sync)                 (EBookBackend *backend);
diff --git a/addressbook/libedata-book/e-data-book-direct.c b/addressbook/libedata-book/e-data-book-direct.c
index 6ed2a49..456095c 100644
--- a/addressbook/libedata-book/e-data-book-direct.c
+++ b/addressbook/libedata-book/e-data-book-direct.c
@@ -89,8 +89,8 @@ e_data_book_direct_class_init (EDataBookDirectClass *class)
  */
 EDataBookDirect *
 e_data_book_direct_new (const gchar *backend_path,
-                       const gchar *backend_factory_name,
-                       const gchar *config)
+                        const gchar *backend_factory_name,
+                        const gchar *config)
 {
        EDataBookDirect *direct;
 
@@ -119,14 +119,15 @@ e_data_book_direct_new (const gchar *backend_path,
  **/
 gboolean
 e_data_book_direct_register_gdbus_object (EDataBookDirect *direct,
-                                         GDBusConnection *connection,
-                                         const gchar *object_path,
-                                         GError **error)
+                                          GDBusConnection *connection,
+                                          const gchar *object_path,
+                                          GError **error)
 {
        g_return_val_if_fail (E_IS_DATA_BOOK_DIRECT (direct), FALSE);
        g_return_val_if_fail (connection != NULL, FALSE);
        g_return_val_if_fail (object_path != NULL, 0);
 
-       return g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (direct->priv->gdbus_object),
-                                                connection, object_path, error);
+       return g_dbus_interface_skeleton_export (
+               G_DBUS_INTERFACE_SKELETON (direct->priv->gdbus_object),
+               connection, object_path, error);
 }
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index bc71850..071073f 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -133,7 +133,6 @@ typedef struct {
 static GHashTable *modules_table = NULL;
 G_LOCK_DEFINE (modules_table);
 
-
 /* Forward Declarations */
 static void                 e_data_book_initable_init  (GInitableIface *interface);
 static DirectOperationData *direct_operation_data_push (EDataBook          *book,
@@ -184,13 +183,13 @@ load_module (const gchar *module_path)
 }
 
 static DirectOperationData *
-direct_operation_data_push (EDataBook          *book,
-                           OperationID         opid,
-                           GAsyncReadyCallback callback,
-                           gpointer            user_data,
-                           GCancellable       *cancellable,
-                           gpointer            source_tag,
-                           gboolean            sync_call)
+direct_operation_data_push (EDataBook *book,
+                            OperationID opid,
+                            GAsyncReadyCallback callback,
+                            gpointer user_data,
+                            GCancellable *cancellable,
+                            gpointer source_tag,
+                            gboolean sync_call)
 {
        DirectOperationData *data;
 
@@ -198,10 +197,11 @@ direct_operation_data_push (EDataBook          *book,
        data->callback = callback;
        data->user_data = user_data;
        data->cancellable = g_object_ref (cancellable);
-       data->result = g_simple_async_result_new (G_OBJECT (book),
-                                                 data->callback,
-                                                 data->user_data,
-                                                 source_tag);
+       data->result = g_simple_async_result_new (
+               G_OBJECT (book),
+               data->callback,
+               data->user_data,
+               source_tag);
        data->is_sync_call = sync_call;
        data->sync_call_complete = FALSE;
 
@@ -401,7 +401,7 @@ op_dispatch (EDataBook *book,
 static OperationData *
 op_claim (EDataBook *book,
           guint32 opid,
-         DirectOperationData **direct)
+          DirectOperationData **direct)
 {
        OperationData *data;
        DirectOperationData *direct_data;
@@ -422,11 +422,11 @@ op_claim (EDataBook *book,
        }
 
        direct_data = g_hash_table_lookup (
-               book->priv->direct_ops,
+               book->priv->direct_ops,
                GUINT_TO_POINTER (opid));
        if (direct_data != NULL) {
                g_hash_table_steal (
-                        book->priv->direct_ops,
+                       book->priv->direct_ops,
                        GUINT_TO_POINTER (opid));
        }
        g_rec_mutex_unlock (&book->priv->pending_ops_lock);
@@ -454,11 +454,11 @@ op_complete (EDataBook *book,
                GUINT_TO_POINTER (opid));
 
        direct_data = g_hash_table_lookup (
-               book->priv->direct_ops,
+               book->priv->direct_ops,
                GUINT_TO_POINTER (opid));
        if (direct_data != NULL) {
                g_hash_table_steal (
-                        book->priv->direct_ops,
+                       book->priv->direct_ops,
                        GUINT_TO_POINTER (opid));
        }
        g_rec_mutex_unlock (&book->priv->pending_ops_lock);
@@ -570,7 +570,7 @@ data_book_convert_to_client_error (GError *error)
                        error->code = E_CLIENT_ERROR_NOT_OPENED;
                        break;
 
-               case E_DATA_BOOK_STATUS_OUT_OF_SYNC:
+               case E_DATA_BOOK_STATUS_OUT_OF_SYNC:
                        error->domain = E_CLIENT_ERROR;
                        error->code = E_CLIENT_ERROR_OUT_OF_SYNC;
                        break;
@@ -726,7 +726,7 @@ operation_thread (gpointer data,
 
                if (op->book->priv->dbus_interface)
                        e_dbus_address_book_complete_close (
-                               op->book->priv->dbus_interface,
+                               op->book->priv->dbus_interface,
                                op->invocation);
 
                /* Let direct calls return, notify the direct callers that it's closed */
@@ -739,13 +739,13 @@ operation_thread (gpointer data,
 
 static OperationData *
 op_direct_new (OperationID op,
-              EDataBook *book,
-              GCancellable *cancellable,
-              GAsyncReadyCallback callback,
-              gpointer user_data,
-              gpointer source_tag,
-              gboolean sync_call,
-              DirectOperationData **ret_data)
+               EDataBook *book,
+               GCancellable *cancellable,
+               GAsyncReadyCallback callback,
+               gpointer user_data,
+               gpointer source_tag,
+               gboolean sync_call,
+               DirectOperationData **ret_data)
 {
        OperationData *data;
        DirectOperationData *direct_data;
@@ -767,7 +767,7 @@ op_direct_new (OperationID op,
                GUINT_TO_POINTER (data->id),
                op_ref (data));
        direct_data = direct_operation_data_push (
-                book, data->id, callback, user_data,
+               book, data->id, callback, user_data,
                data->cancellable, source_tag, sync_call);
        g_rec_mutex_unlock (&book->priv->pending_ops_lock);
 
@@ -1145,14 +1145,16 @@ e_data_book_respond_open (EDataBook *book,
                gboolean result = FALSE;
 
                if (error) {
-                       g_simple_async_result_set_error (direct->result,
-                                                        error->domain,
-                                                        error->code,
-                                                        "%s", error->message);
+                       g_simple_async_result_set_error (
+                               direct->result,
+                               error->domain,
+                               error->code,
+                               "%s", error->message);
                        g_error_free (error);
                } else {
-                       g_simple_async_result_set_check_cancellable (direct->result,
-                                                                    direct->cancellable);
+                       g_simple_async_result_set_check_cancellable (
+                               direct->result,
+                               direct->cancellable);
 
                        if (!g_cancellable_is_cancelled (direct->cancellable))
                                result = TRUE;
@@ -1300,14 +1302,16 @@ e_data_book_respond_get_contact (EDataBook *book,
        if (direct) {
 
                if (error) {
-                       g_simple_async_result_set_error (direct->result,
-                                                        error->domain,
-                                                        error->code,
-                                                        "%s", error->message);
+                       g_simple_async_result_set_error (
+                               direct->result,
+                               error->domain,
+                               error->code,
+                               "%s", error->message);
                        g_error_free (error);
                } else {
-                       g_simple_async_result_set_check_cancellable (direct->result,
-                                                                    direct->cancellable);
+                       g_simple_async_result_set_check_cancellable (
+                               direct->result,
+                               direct->cancellable);
 
                        if (!g_cancellable_is_cancelled (direct->cancellable)) {
                                EContact *contact;
@@ -1364,14 +1368,16 @@ e_data_book_respond_get_contact_list (EDataBook *book,
        if (direct) {
 
                if (error) {
-                       g_simple_async_result_set_error (direct->result,
-                                                        error->domain,
-                                                        error->code,
-                                                        "%s", error->message);
+                       g_simple_async_result_set_error (
+                               direct->result,
+                               error->domain,
+                               error->code,
+                               "%s", error->message);
                        g_error_free (error);
                } else {
-                       g_simple_async_result_set_check_cancellable (direct->result,
-                                                                    direct->cancellable);
+                       g_simple_async_result_set_check_cancellable (
+                               direct->result,
+                               direct->cancellable);
 
                        if (!g_cancellable_is_cancelled (direct->cancellable)) {
                                EContact *contact;
@@ -1388,8 +1394,9 @@ e_data_book_respond_get_contact_list (EDataBook *book,
                                contacts = g_slist_reverse (contacts);
 
                                /* Give it an EContact for the return value */
-                               g_simple_async_result_set_op_res_gpointer (direct->result, contacts,
-                                                                          
(GDestroyNotify)e_util_free_object_slist);
+                               g_simple_async_result_set_op_res_gpointer (
+                                       direct->result, contacts,
+                                       (GDestroyNotify) e_util_free_object_slist);
                        }
                }
 
@@ -1453,22 +1460,25 @@ e_data_book_respond_get_contact_list_uids (EDataBook *book,
        if (direct) {
 
                if (error) {
-                       g_simple_async_result_set_error (direct->result,
-                                                        error->domain,
-                                                        error->code,
-                                                        "%s", error->message);
+                       g_simple_async_result_set_error (
+                               direct->result,
+                               error->domain,
+                               error->code,
+                               "%s", error->message);
                        g_error_free (error);
                } else {
-                       g_simple_async_result_set_check_cancellable (direct->result,
-                                                                    direct->cancellable);
+                       g_simple_async_result_set_check_cancellable (
+                               direct->result,
+                               direct->cancellable);
 
                        if (!g_cancellable_is_cancelled (direct->cancellable)) {
                                GSList *ret_uids = NULL;
 
                                ret_uids = e_util_copy_string_slist (NULL, uids);
 
-                               g_simple_async_result_set_op_res_gpointer (direct->result, ret_uids,
-                                                                          
(GDestroyNotify)e_util_free_string_slist);
+                               g_simple_async_result_set_op_res_gpointer (
+                                       direct->result, ret_uids,
+                                       (GDestroyNotify) e_util_free_string_slist);
                        }
                }
 
@@ -1942,26 +1952,27 @@ data_book_initable_init (GInitable *initable,
 
        book = E_DATA_BOOK (initable);
 
-       if (book->priv->connection && book->priv->object_path) {
-               book->priv->dbus_interface = e_dbus_address_book_skeleton_new ();
+       if (book->priv->connection != NULL && book->priv->object_path != NULL) {
+               book->priv->dbus_interface =
+                       e_dbus_address_book_skeleton_new ();
 
                g_signal_connect (
-                       book->priv->dbus_interface, "handle-open",
+                       book->priv->dbus_interface, "handle-open",
                        G_CALLBACK (data_book_handle_open_cb), book);
                g_signal_connect (
-                       book->priv->dbus_interface, "handle-refresh",
+                       book->priv->dbus_interface, "handle-refresh",
                        G_CALLBACK (data_book_handle_refresh_cb), book);
                g_signal_connect (
-                       book->priv->dbus_interface, "handle-get-contact",
+                       book->priv->dbus_interface, "handle-get-contact",
                        G_CALLBACK (data_book_handle_get_contact_cb), book);
                g_signal_connect (
                        book->priv->dbus_interface, "handle-get-contact-list",
                        G_CALLBACK (data_book_handle_get_contact_list_cb), book);
                g_signal_connect (
-                       book->priv->dbus_interface, "handle-get-contact-list-uids",
+                       book->priv->dbus_interface, "handle-get-contact-list-uids",
                        G_CALLBACK (data_book_handle_get_contact_list_uids_cb), book);
                g_signal_connect (
-                       book->priv->dbus_interface, "handle-create-contacts",
+                       book->priv->dbus_interface, "handle-create-contacts",
                        G_CALLBACK (data_book_handle_create_contacts_cb), book);
                g_signal_connect (
                        book->priv->dbus_interface, "handle-remove-contacts",
@@ -1976,32 +1987,35 @@ data_book_initable_init (GInitable *initable,
                        book->priv->dbus_interface, "handle-close",
                        G_CALLBACK (data_book_handle_close_cb), book);
 
-               /* This will be NULL for a backend that does not support direct read access */
+               /* This will be NULL for a backend that does not support
+                * direct read access. */
                book->priv->direct_book =
                        e_book_backend_get_direct_book (book->priv->backend);
 
-               if (book->priv->direct_book) {
+               if (book->priv->direct_book != NULL) {
+                       gboolean success;
 
-                       if (!e_data_book_direct_register_gdbus_object (
-                                    book->priv->direct_book,
-                                    book->priv->connection,
-                                    book->priv->object_path,
-                                    error))
+                       success = e_data_book_direct_register_gdbus_object (
+                               book->priv->direct_book,
+                               book->priv->connection,
+                               book->priv->object_path,
+                               error);
+                       if (!success)
                                return FALSE;
                }
 
                g_object_bind_property (
-                       book->priv->backend, "cache-dir",
+                       book->priv->backend, "cache-dir",
                        book->priv->dbus_interface, "cache-dir",
                        G_BINDING_SYNC_CREATE);
 
                g_object_bind_property (
-                       book->priv->backend, "online",
+                       book->priv->backend, "online",
                        book->priv->dbus_interface, "online",
                        G_BINDING_SYNC_CREATE);
 
                g_object_bind_property (
-                       book->priv->backend, "writable",
+                       book->priv->backend, "writable",
                        book->priv->dbus_interface, "writable",
                        G_BINDING_SYNC_CREATE);
 
@@ -2012,36 +2026,36 @@ data_book_initable_init (GInitable *initable,
                op = op_new (OP_GET_BACKEND_PROPERTY, book, NULL);
                op->d.prop_name = CLIENT_BACKEND_PROPERTY_CAPABILITIES;
                e_book_backend_get_backend_property (
-                       book->priv->backend, book, op->id,
+                       book->priv->backend, book, op->id,
                        op->cancellable, op->d.prop_name);
                op_unref (op);
 
                op = op_new (OP_GET_BACKEND_PROPERTY, book, NULL);
                op->d.prop_name = CLIENT_BACKEND_PROPERTY_REVISION;
                e_book_backend_get_backend_property (
-                       book->priv->backend, book, op->id,
+                       book->priv->backend, book, op->id,
                        op->cancellable, op->d.prop_name);
                op_unref (op);
 
                op = op_new (OP_GET_BACKEND_PROPERTY, book, NULL);
                op->d.prop_name = BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS;
                e_book_backend_get_backend_property (
-                       book->priv->backend, book, op->id,
+                       book->priv->backend, book, op->id,
                        op->cancellable, op->d.prop_name);
                op_unref (op);
 
                op = op_new (OP_GET_BACKEND_PROPERTY, book, NULL);
                op->d.prop_name = BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS;
                e_book_backend_get_backend_property (
-                       book->priv->backend, book, op->id,
+                       book->priv->backend, book, op->id,
                        op->cancellable, op->d.prop_name);
                op_unref (op);
 
                return g_dbus_interface_skeleton_export (
-                              G_DBUS_INTERFACE_SKELETON (book->priv->dbus_interface),
-                              book->priv->connection,
-                              book->priv->object_path,
-                              error);
+                       G_DBUS_INTERFACE_SKELETON (book->priv->dbus_interface),
+                       book->priv->connection,
+                       book->priv->object_path,
+                       error);
        }
 
        return TRUE;
@@ -2119,8 +2133,8 @@ e_data_book_init (EDataBook *ebook)
                (GDestroyNotify) NULL,
                (GDestroyNotify) op_unref);
        ebook->priv->direct_ops = g_hash_table_new_full (
-               g_direct_hash, g_direct_equal, NULL,
-               (GDestroyNotify)direct_operation_data_free);
+               g_direct_hash, g_direct_equal, NULL,
+               (GDestroyNotify) direct_operation_data_free);
        g_rec_mutex_init (&ebook->priv->pending_ops_lock);
        g_mutex_init (&ebook->priv->open_lock);
 }
@@ -2180,11 +2194,11 @@ e_data_book_new (EBookBackend *backend,
  */
 EDataBook *
 e_data_book_new_direct (ESourceRegistry *registry,
-                       ESource         *source,
-                       const gchar     *backend_path,
-                       const gchar     *backend_name,
-                       const gchar     *config,
-                       GError         **error)
+                        ESource *source,
+                        const gchar *backend_path,
+                        const gchar *backend_name,
+                        const gchar *config,
+                        GError **error)
 {
        EDataBook *book = NULL;
        EModule *module;
@@ -2200,25 +2214,28 @@ e_data_book_new_direct (ESourceRegistry *registry,
 
        module = load_module (backend_path);
        if (!module) {
-               g_set_error (error, E_CLIENT_ERROR,
-                            E_CLIENT_ERROR_OTHER_ERROR,
-                            "Failed to load module at specified path: %s", backend_path);
+               g_set_error (
+                       error, E_CLIENT_ERROR,
+                       E_CLIENT_ERROR_OTHER_ERROR,
+                       "Failed to load module at specified path: %s", backend_path);
                goto new_direct_finish;
        }
 
        if (!g_type_module_use (G_TYPE_MODULE (module))) {
-               g_set_error (error, E_CLIENT_ERROR,
-                            E_CLIENT_ERROR_OTHER_ERROR,
-                            "Failed to use EModule at path: %s", backend_path);
+               g_set_error (
+                       error, E_CLIENT_ERROR,
+                       E_CLIENT_ERROR_OTHER_ERROR,
+                       "Failed to use EModule at path: %s", backend_path);
                goto new_direct_finish;
        }
 
        factory_type = g_type_from_name (backend_name);
        if (factory_type == 0) {
-               g_set_error (error, E_CLIENT_ERROR,
-                            E_CLIENT_ERROR_OTHER_ERROR,
-                            "Failed to get backend factory '%s' from EModule at path: %s",
-                            backend_name, backend_path);
+               g_set_error (
+                       error, E_CLIENT_ERROR,
+                       E_CLIENT_ERROR_OTHER_ERROR,
+                       "Failed to get backend factory '%s' from EModule at path: %s",
+                       backend_name, backend_path);
                g_type_module_unuse (G_TYPE_MODULE (module));
                goto new_direct_finish;
        }
@@ -2227,15 +2244,14 @@ e_data_book_new_direct (ESourceRegistry *registry,
        backend_type  = E_BOOK_BACKEND_FACTORY_CLASS (factory_class)->backend_type;
        g_type_class_unref (factory_class);
 
-
-       backend = g_object_new (backend_type,
-                               "registry", registry,
-                               "source", source, NULL);
+       backend = g_object_new (
+               backend_type,
+               "registry", registry,
+               "source", source, NULL);
 
        /* The backend must be configured for direct access
         * before calling g_initable_init() because backends
-        * now can open thier content at initable_init() time.
-        */
+        * now can open thier content at initable_init() time. */
        e_book_backend_configure_direct (backend, config);
 
        if (!g_initable_init (G_INITABLE (backend), NULL, error)) {
@@ -2244,8 +2260,9 @@ e_data_book_new_direct (ESourceRegistry *registry,
                goto new_direct_finish;
        }
 
-       book = g_initable_new (E_TYPE_DATA_BOOK, NULL, error,
-                              "backend", backend, NULL);
+       book = g_initable_new (
+               E_TYPE_DATA_BOOK, NULL, error,
+               "backend", backend, NULL);
        g_object_unref (backend);
 
        if (!book) {
@@ -2321,8 +2338,8 @@ e_data_book_get_object_path (EDataBook *book)
 
 static gboolean
 e_data_book_open_finish (EDataBook *book,
-                        GAsyncResult *result,
-                        GError **error)
+                         GAsyncResult *result,
+                         GError **error)
 {
        gboolean res;
 
@@ -2352,8 +2369,8 @@ e_data_book_open_finish (EDataBook *book,
  */
 gboolean
 e_data_book_open_sync (EDataBook *book,
-                      GCancellable *cancellable,
-                      GError **error)
+                       GCancellable *cancellable,
+                       GError **error)
 {
        DirectOperationData *data = NULL;
        OperationData *op;
@@ -2374,8 +2391,8 @@ e_data_book_open_sync (EDataBook *book,
 
 static void
 e_data_book_respond_close (EDataBook *book,
-                          guint opid,
-                          GError *error)
+                           guint opid,
+                           GError *error)
 {
        DirectOperationData *data;
 
@@ -2385,17 +2402,19 @@ e_data_book_respond_close (EDataBook *book,
                gboolean result = FALSE;
 
                if (error)
-                       g_simple_async_result_set_error (data->result,
-                                                        error->domain,
-                                                        error->code,
-                                                        "%s", error->message);
+                       g_simple_async_result_set_error (
+                               data->result,
+                               error->domain,
+                               error->code,
+                               "%s", error->message);
 
                else {
                        if (!g_cancellable_is_cancelled (data->cancellable))
                                result = TRUE;
 
-                       g_simple_async_result_set_check_cancellable (data->result,
-                                                                    data->cancellable);
+                       g_simple_async_result_set_check_cancellable (
+                               data->result,
+                               data->cancellable);
                }
 
                g_simple_async_result_set_op_res_gboolean (data->result, result);
@@ -2425,9 +2444,9 @@ e_data_book_respond_close (EDataBook *book,
  */
 void
 e_data_book_close (EDataBook *book,
-                  GCancellable *cancellable,
-                  GAsyncReadyCallback callback,
-                  gpointer user_data)
+                   GCancellable *cancellable,
+                   GAsyncReadyCallback callback,
+                   gpointer user_data)
 {
        OperationData *op;
 
@@ -2454,8 +2473,8 @@ e_data_book_close (EDataBook *book,
  */
 gboolean
 e_data_book_close_finish (EDataBook *book,
-                         GAsyncResult *result,
-                         GError **error)
+                          GAsyncResult *result,
+                          GError **error)
 {
        gboolean res;
 
@@ -2485,8 +2504,8 @@ e_data_book_close_finish (EDataBook *book,
  */
 gboolean
 e_data_book_close_sync (EDataBook *book,
-                       GCancellable *cancellable,
-                       GError **error)
+                        GCancellable *cancellable,
+                        GError **error)
 {
        DirectOperationData *data = NULL;
        OperationData *op;
@@ -2526,10 +2545,10 @@ e_data_book_close_sync (EDataBook *book,
  */
 void
 e_data_book_get_contact (EDataBook *book,
-                        const gchar *uid,
-                        GCancellable *cancellable,
-                        GAsyncReadyCallback callback,
-                        gpointer user_data)
+                         const gchar *uid,
+                         GCancellable *cancellable,
+                         GAsyncReadyCallback callback,
+                         gpointer user_data)
 {
        OperationData *op;
 
@@ -2558,9 +2577,9 @@ e_data_book_get_contact (EDataBook *book,
  */
 gboolean
 e_data_book_get_contact_finish (EDataBook *book,
-                               GAsyncResult *result,
-                               EContact **contact,
-                               GError **error)
+                                GAsyncResult *result,
+                                EContact **contact,
+                                GError **error)
 {
        EContact *ret_contact;
 
@@ -2599,10 +2618,10 @@ e_data_book_get_contact_finish (EDataBook *book,
  */
 gboolean
 e_data_book_get_contact_sync (EDataBook *book,
-                             const gchar *uid,
-                             EContact **contact,
-                             GCancellable *cancellable,
-                             GError **error)
+                              const gchar *uid,
+                              EContact **contact,
+                              GCancellable *cancellable,
+                              GError **error)
 {
        DirectOperationData *data = NULL;
        OperationData *op;
@@ -2643,10 +2662,10 @@ e_data_book_get_contact_sync (EDataBook *book,
  */
 void
 e_data_book_get_contacts (EDataBook *book,
-                         const gchar *sexp,
-                         GCancellable *cancellable,
-                         GAsyncReadyCallback callback,
-                         gpointer user_data)
+                          const gchar *sexp,
+                          GCancellable *cancellable,
+                          GAsyncReadyCallback callback,
+                          gpointer user_data)
 {
        OperationData *op;
 
@@ -2674,9 +2693,9 @@ e_data_book_get_contacts (EDataBook *book,
  */
 gboolean
 e_data_book_get_contacts_finish (EDataBook *book,
-                                GAsyncResult *result,
-                                GSList **contacts,
-                                GError **error)
+                                 GAsyncResult *result,
+                                 GSList **contacts,
+                                 GError **error)
 {
        GSList *ret_contacts;
 
@@ -2721,10 +2740,10 @@ e_data_book_get_contacts_finish (EDataBook *book,
  */
 gboolean
 e_data_book_get_contacts_sync (EDataBook *book,
-                              const gchar *sexp,
-                              GSList **contacts,
-                              GCancellable *cancellable,
-                              GError **error)
+                               const gchar *sexp,
+                               GSList **contacts,
+                               GCancellable *cancellable,
+                               GError **error)
 {
        DirectOperationData *data = NULL;
        OperationData *op;
@@ -2764,10 +2783,10 @@ e_data_book_get_contacts_sync (EDataBook *book,
  */
 void
 e_data_book_get_contacts_uids (EDataBook *book,
-                              const gchar *sexp,
-                              GCancellable *cancellable,
-                              GAsyncReadyCallback callback,
-                              gpointer user_data)
+                               const gchar *sexp,
+                               GCancellable *cancellable,
+                               GAsyncReadyCallback callback,
+                               gpointer user_data)
 {
        OperationData *op;
 
@@ -2795,9 +2814,9 @@ e_data_book_get_contacts_uids (EDataBook *book,
  */
 gboolean
 e_data_book_get_contacts_uids_finish (EDataBook *book,
-                                     GAsyncResult *result,
-                                     GSList **contacts_uids,
-                                     GError **error)
+                                      GAsyncResult *result,
+                                      GSList **contacts_uids,
+                                      GError **error)
 {
        GSList *ret_uids;
 
@@ -2842,10 +2861,10 @@ e_data_book_get_contacts_uids_finish (EDataBook *book,
  */
 gboolean
 e_data_book_get_contacts_uids_sync (EDataBook *book,
-                                   const gchar *sexp,
-                                   GSList **contacts_uids,
-                                   GCancellable *cancellable,
-                                   GError **error)
+                                    const gchar *sexp,
+                                    GSList **contacts_uids,
+                                    GCancellable *cancellable,
+                                    GError **error)
 {
        DirectOperationData *data = NULL;
        OperationData *op;
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index f97c19b..16e6a82 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1482,9 +1482,9 @@ caldav_server_list_objects (ECalBackendCalDAV *cbdav,
 
 static gboolean
 caldav_server_query_for_uid (ECalBackendCalDAV *cbdav,
-                            const gchar *uid,
-                            GCancellable *cancellable,
-                            GError **error)
+                             const gchar *uid,
+                             GCancellable *cancellable,
+                             GError **error)
 {
        SoupMessage *message;
        xmlOutputBufferPtr buf;
@@ -3086,10 +3086,10 @@ get_comp_from_cache (ECalBackendCalDAV *cbdav,
 
 static void
 put_server_comp_to_cache (ECalBackendCalDAV *cbdav,
-                         icalcomponent *icomp,
-                         const gchar *href,
-                         const gchar *etag,
-                         GTree *c_uid2complist)
+                          icalcomponent *icomp,
+                          const gchar *href,
+                          const gchar *etag,
+                          GTree *c_uid2complist)
 {
        icalcomponent_kind kind;
        ECalBackend *cal_backend;
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c 
b/calendar/backends/contacts/e-cal-backend-contacts.c
index 2f86fba..6090796 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -97,16 +97,32 @@ typedef struct _ContactRecord {
 #define ANNIVERSARY_UID_EXT "-anniversary"
 #define BIRTHDAY_UID_EXT   "-birthday"
 
-static ECalComponent * create_birthday (ECalBackendContacts *cbc, EContact *contact);
-static ECalComponent * create_anniversary (ECalBackendContacts *cbc, EContact *contact);
-
-static void contacts_modified_cb (EBookClientView *book_view, const GSList *contacts, gpointer user_data);
-static void contacts_added_cb   (EBookClientView *book_view, const GSList *contacts, gpointer user_data);
-static void contacts_removed_cb (EBookClientView *book_view, const GSList *contact_ids, gpointer user_data);
-static void e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable 
*cancellable, const gchar *tzobj, GError **perror);
-static void setup_alarm (ECalBackendContacts *cbc, ECalComponent *comp);
-
-static void book_client_opened_cb (EBookClient *book_client, const GError *error, BookRecord *br);
+static ECalComponent *
+               create_birthday                 (ECalBackendContacts *cbc,
+                                                EContact *contact);
+static ECalComponent *
+               create_anniversary              (ECalBackendContacts *cbc,
+                                                EContact *contact);
+static void    contacts_modified_cb            (EBookClientView *book_view,
+                                                const GSList *contacts,
+                                                gpointer user_data);
+static void    contacts_added_cb               (EBookClientView *book_view,
+                                                const GSList *contacts,
+                                                gpointer user_data);
+static void    contacts_removed_cb             (EBookClientView *book_view,
+                                                const GSList *contact_ids,
+                                                gpointer user_data);
+static void    e_cal_backend_contacts_add_timezone
+                                               (ECalBackendSync *backend,
+                                                EDataCal *cal,
+                                                GCancellable *cancellable,
+                                                const gchar *tzobj,
+                                                GError **perror);
+static void    setup_alarm                     (ECalBackendContacts *cbc,
+                                                ECalComponent *comp);
+static void    book_client_opened_cb           (EBookClient *book_client,
+                                                const GError *error,
+                                                BookRecord *br);
 
 static gboolean
 remove_by_book (gpointer key,
@@ -255,7 +271,7 @@ book_record_get_view_thread (gpointer user_data)
 {
        BookRecord *br;
        EBookQuery *query;
-       EBookClientView *book_view;
+       EBookClientView *book_view = NULL;
        gchar *query_sexp;
        GError *error = NULL;
 
@@ -279,23 +295,48 @@ book_record_get_view_thread (gpointer user_data)
        query_sexp = e_book_query_to_string (query);
        e_book_query_unref (query);
 
-       if (!e_book_client_get_view_sync (br->book_client, query_sexp, &book_view, NULL, &error)) {
-               ESource *source = e_client_get_source (E_CLIENT (br->book_client));
+       e_book_client_get_view_sync (
+               br->book_client, query_sexp, &book_view, NULL, &error);
+
+       /* Sanity check. */
+       g_return_val_if_fail (
+               ((book_view != NULL) && (error == NULL)) ||
+               ((book_view == NULL) && (error != NULL)), NULL);
+
+       if (error != NULL) {
+               ESource *source;
+
+               source = e_client_get_source (E_CLIENT (br->book_client));
 
-               g_warning ("%s: Failed to get book view on '%s': %s", G_STRFUNC, e_source_get_display_name 
(source), error ? error->message : "Unknown error");
+               g_warning (
+                       "%s: Failed to get book view on '%s': %s",
+                       G_STRFUNC, e_source_get_display_name (source),
+                       error->message);
+
+               g_clear_error (&error);
+
+               goto exit;
        }
-       g_free (query_sexp);
-       g_clear_error (&error);
 
-       g_signal_connect (book_view, "objects-added", G_CALLBACK (contacts_added_cb), br->cbc);
-       g_signal_connect (book_view, "objects-removed", G_CALLBACK (contacts_removed_cb), br->cbc);
-       g_signal_connect (book_view, "objects-modified", G_CALLBACK (contacts_modified_cb), br->cbc);
+       g_signal_connect (
+               book_view, "objects-added",
+               G_CALLBACK (contacts_added_cb), br->cbc);
+       g_signal_connect (
+               book_view, "objects-removed",
+               G_CALLBACK (contacts_removed_cb), br->cbc);
+       g_signal_connect (
+               book_view, "objects-modified",
+               G_CALLBACK (contacts_modified_cb), br->cbc);
 
        e_book_client_view_start (book_view, NULL);
 
        book_record_set_book_view (br, book_view);
 
        g_object_unref (book_view);
+
+exit:
+       g_free (query_sexp);
+
        book_record_unref (br);
 
        return NULL;
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index f00fbbf..eef1f8b 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -74,7 +74,11 @@ struct _ECalBackendHttpPrivate {
 
 #define d(x)
 
-static void e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable 
*cancellable, const gchar *tzobj, GError **perror);
+static void    e_cal_backend_http_add_timezone (ECalBackendSync *backend,
+                                                EDataCal *cal,
+                                                GCancellable *cancellable,
+                                                const gchar *tzobj,
+                                                GError **perror);
 
 static void
 soup_authenticate (SoupSession *session,
diff --git a/calendar/backends/weather/e-cal-backend-weather.c 
b/calendar/backends/weather/e-cal-backend-weather.c
index 018b561..1bc9535 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -41,10 +41,18 @@
 
 G_DEFINE_TYPE (ECalBackendWeather, e_cal_backend_weather, E_TYPE_CAL_BACKEND_SYNC)
 
-static gboolean reload_cb (ECalBackendWeather *cbw);
-static gboolean begin_retrieval_cb (ECalBackendWeather *cbw);
-static ECalComponent * create_weather (ECalBackendWeather *cbw, GWeatherInfo *report, gboolean is_forecast);
-static void e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable 
*cancellable, const gchar *tzobj, GError **perror);
+static gboolean        reload_cb                       (ECalBackendWeather *cbw);
+static gboolean        begin_retrieval_cb              (ECalBackendWeather *cbw);
+static ECalComponent *
+               create_weather                  (ECalBackendWeather *cbw,
+                                                GWeatherInfo *report,
+                                                gboolean is_forecast);
+static void    e_cal_backend_weather_add_timezone
+                                               (ECalBackendSync *backend,
+                                                EDataCal *cal,
+                                                GCancellable *cancellable,
+                                                const gchar *tzobj,
+                                                GError **perror);
 
 /* Private part of the ECalBackendWeather structure */
 struct _ECalBackendWeatherPrivate {
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 1468b85..f0d0ae7 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -288,7 +288,10 @@ GError *
 e_cal_client_error_create (ECalClientError code,
                            const gchar *custom_msg)
 {
-       return g_error_new_literal (E_CAL_CLIENT_ERROR, code, custom_msg ? custom_msg : 
e_cal_client_error_to_string (code));
+       if (custom_msg == NULL)
+               custom_msg = e_cal_client_error_to_string (code);
+
+       return g_error_new_literal (E_CAL_CLIENT_ERROR, code, custom_msg);
 }
 
 static gpointer
@@ -1713,9 +1716,10 @@ e_cal_client_get_local_attachment_store (ECalClient *client)
        return e_dbus_calendar_get_cache_dir (client->priv->dbus_proxy);
 }
 
-/* icaltimezone_copy does a shallow copy while icaltimezone_free tries to free the entire 
- * the contents inside the structure with libical 0.43. Use this, till eds allows older libical.
-*/
+/* icaltimezone_copy does a shallow copy while icaltimezone_free tries to
+ * free the entire the contents inside the structure with libical 0.43.
+ * Use this, till eds allows older libical.
+ */
 static icaltimezone *
 copy_timezone (icaltimezone *ozone)
 {
@@ -1728,13 +1732,14 @@ copy_timezone (icaltimezone *ozone)
                icalcomponent *comp;
 
                comp = icaltimezone_get_component (ozone);
-               if (comp) {
+               if (comp != NULL) {
                        zone = icaltimezone_new ();
-                       icaltimezone_set_component (zone, icalcomponent_new_clone (comp));
+                       icaltimezone_set_component (
+                               zone, icalcomponent_new_clone (comp));
                }
        }
 
-       if (!zone)
+       if (zone == NULL)
                zone = icaltimezone_get_utc_timezone ();
 
        return zone;
@@ -1776,8 +1781,11 @@ e_cal_client_set_default_timezone (ECalClient *client,
  * e_cal_client_get_default_timezone:
  * @client: A calendar client.
  *
- * Returns: Default timezone previously set with e_cal_client_set_default_timezone().
- * Returned pointer is owned by the @client and should not be freed.
+ * Returns the default timezone previously set with
+ * e_cal_client_set_default_timezone().  The returned pointer is owned by
+ * the @client and should not be freed.
+ *
+ * Returns: an #icaltimezone
  *
  * Since: 3.2
  **/
@@ -1949,8 +1957,10 @@ e_cal_client_resolve_tzid_cb (const gchar *tzid,
 
        e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, &error);
 
-       if (error) {
-               g_debug ("%s: Failed to find '%s' timezone: %s", G_STRFUNC, tzid, error->message);
+       if (error != NULL) {
+               g_debug (
+                       "%s: Failed to find '%s' timezone: %s",
+                       G_STRFUNC, tzid, error->message);
                g_error_free (error);
        }
 
@@ -1986,7 +1996,8 @@ add_instance (ECalComponent *comp,
 
        ci = g_new (struct comp_instance, 1);
 
-       icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+       icalcomp = icalcomponent_new_clone (
+               e_cal_component_get_icalcomponent (comp));
 
        /* add the instance to the list */
        ci->comp = e_cal_component_new ();
@@ -2006,11 +2017,15 @@ add_instance (ECalComponent *comp,
                e_cal_component_get_dtstart (comp, &dtstart);
 
                if (instances_hold->start_zone) {
-                       itt = icaltime_from_timet_with_zone (start, dtstart.value && dtstart.value->is_date, 
instances_hold->start_zone);
+                       itt = icaltime_from_timet_with_zone (
+                               start, dtstart.value && dtstart.value->is_date,
+                               instances_hold->start_zone);
                        g_free ((gchar *) dtstart.tzid);
-                       dtstart.tzid = g_strdup (icaltimezone_get_tzid (instances_hold->start_zone));
+                       dtstart.tzid = g_strdup (icaltimezone_get_tzid (
+                               instances_hold->start_zone));
                } else {
-                       itt = icaltime_from_timet (start, dtstart.value && dtstart.value->is_date);
+                       itt = icaltime_from_timet (
+                               start, dtstart.value && dtstart.value->is_date);
                        if (dtstart.tzid) {
                                g_free ((gchar *) dtstart.tzid);
                                dtstart.tzid = NULL;
@@ -2038,11 +2053,15 @@ add_instance (ECalComponent *comp,
                e_cal_component_get_dtend (comp, &dtend);
 
                if (instances_hold->end_zone) {
-                       itt = icaltime_from_timet_with_zone (end, dtend.value && dtend.value->is_date, 
instances_hold->end_zone);
+                       itt = icaltime_from_timet_with_zone (
+                               end, dtend.value && dtend.value->is_date,
+                               instances_hold->end_zone);
                        g_free ((gchar *) dtend.tzid);
-                       dtend.tzid = g_strdup (icaltimezone_get_tzid (instances_hold->end_zone));
+                       dtend.tzid = g_strdup (icaltimezone_get_tzid (
+                               instances_hold->end_zone));
                } else {
-                       itt = icaltime_from_timet (end, dtend.value && dtend.value->is_date);
+                       itt = icaltime_from_timet (
+                               end, dtend.value && dtend.value->is_date);
                        if (dtend.tzid) {
                                g_free ((gchar *) dtend.tzid);
                                dtend.tzid = NULL;
@@ -2172,7 +2191,8 @@ process_detached_instances (GSList *instances,
                        unprocessed_instances = g_slist_prepend (unprocessed_instances, cid);
        }
 
-       /* add the unprocessed instances (ie, detached instances with no master object */
+       /* add the unprocessed instances
+        * (ie, detached instances with no master object) */
        while (unprocessed_instances != NULL) {
                cid = unprocessed_instances->data;
                ci = g_new0 (struct comp_instance, 1);
@@ -2232,7 +2252,8 @@ generate_instances (ECalClient *client,
                         * TZID (i.e. floating times) we use the default
                         * timezone. */
                        if (dtstart.tzid && dtstart.value && !dtstart.value->is_date) {
-                               start_zone = e_cal_client_resolve_tzid_cb (dtstart.tzid, client);
+                               start_zone = e_cal_client_resolve_tzid_cb (
+                                       dtstart.tzid, client);
                                if (!start_zone)
                                        start_zone = default_zone;
                        } else {
@@ -2240,17 +2261,20 @@ generate_instances (ECalClient *client,
                        }
 
                        if (dtend.tzid && dtend.value && !dtend.value->is_date) {
-                               end_zone = e_cal_client_resolve_tzid_cb (dtend.tzid, client);
+                               end_zone = e_cal_client_resolve_tzid_cb (
+                                       dtend.tzid, client);
                                if (!end_zone)
                                        end_zone = default_zone;
                        } else {
                                end_zone = default_zone;
                        }
 
-                       ci->start = icaltime_as_timet_with_zone (*dtstart.value, start_zone);
+                       ci->start = icaltime_as_timet_with_zone (
+                               *dtstart.value, start_zone);
 
                        if (dtend.value)
-                               ci->end = icaltime_as_timet_with_zone (*dtend.value, end_zone);
+                               ci->end = icaltime_as_timet_with_zone (
+                                       *dtend.value, end_zone);
                        else if (icaltime_is_date (*dtstart.value))
                                ci->end = time_day_end (ci->start);
                        else
@@ -2260,7 +2284,8 @@ generate_instances (ECalClient *client,
                        e_cal_component_free_datetime (&dtend);
 
                        if (ci->start <= end && ci->end >= start) {
-                               detached_instances = g_slist_prepend (detached_instances, ci);
+                               detached_instances = g_slist_prepend (
+                                       detached_instances, ci);
                        } else {
                                /* it doesn't fit to our time range, thus skip it */
                                g_object_unref (G_OBJECT (ci->comp));
@@ -2274,7 +2299,9 @@ generate_instances (ECalClient *client,
                        /* Get the start timezone */
                        e_cal_component_get_dtstart (comp, &datetime);
                        if (datetime.tzid)
-                               e_cal_client_get_timezone_sync (client, datetime.tzid, &start_zone, 
cancellable, NULL);
+                               e_cal_client_get_timezone_sync (
+                                       client, datetime.tzid,
+                                       &start_zone, cancellable, NULL);
                        else
                                start_zone = NULL;
                        e_cal_component_free_datetime (&datetime);
@@ -2282,7 +2309,9 @@ generate_instances (ECalClient *client,
                        /* Get the end timezone */
                        e_cal_component_get_dtend (comp, &datetime);
                        if (datetime.tzid)
-                               e_cal_client_get_timezone_sync (client, datetime.tzid, &end_zone, 
cancellable, NULL);
+                               e_cal_client_get_timezone_sync (
+                                       client, datetime.tzid,
+                                       &end_zone, cancellable, NULL);
                        else
                                end_zone = NULL;
                        e_cal_component_free_datetime (&datetime);
@@ -2358,8 +2387,13 @@ get_objects_sync (ECalClient *client,
        if (uid && *uid) {
                GError *error = NULL;
 
-               if (!e_cal_client_get_objects_for_uid_sync (client, uid, &objects, NULL, &error)) {
-                       g_message ("Failed to get recurrence objects for uid %s \n", error ? error->message : 
"Unknown error");
+               e_cal_client_get_objects_for_uid_sync (
+                       client, uid, &objects, NULL, &error);
+
+               if (error != NULL) {
+                       g_warning (
+                               "Failed to get recurrence objects "
+                               "for uid: %s\n", error->message);
                        g_clear_error (&error);
                        return NULL;
                }
@@ -2378,11 +2412,13 @@ get_objects_sync (ECalClient *client,
                }
 
                query = g_strdup_printf (
-                       "(occur-in-time-range? (make-time \"%s\") (make-time \"%s\"))",
+                       "(occur-in-time-range? "
+                       "(make-time \"%s\") (make-time \"%s\"))",
                        iso_start, iso_end);
                g_free (iso_start);
                g_free (iso_end);
-               if (!e_cal_client_get_object_list_as_comps_sync (client, query, &objects, NULL, NULL)) {
+               if (!e_cal_client_get_object_list_as_comps_sync (
+                       client, query, &objects, NULL, NULL)) {
                        g_free (query);
                        return NULL;
                }
@@ -2392,8 +2428,7 @@ get_objects_sync (ECalClient *client,
        return objects;
 }
 
-struct get_objects_async_data
-{
+struct get_objects_async_data {
        GCancellable *cancellable;
        ECalClient *client;
        time_t start;
@@ -2443,7 +2478,10 @@ got_objects_for_uid_cb (GObject *source_object,
        g_return_if_fail (goad != NULL);
        g_return_if_fail (goad->client == E_CAL_CLIENT (source_object));
 
-       if (!e_cal_client_get_objects_for_uid_finish (goad->client, result, &objects, &error)) {
+       e_cal_client_get_objects_for_uid_finish (
+               goad->client, result, &objects, &error);
+
+       if (error != NULL) {
                if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
                    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        free_get_objects_async_data (goad);
@@ -2475,7 +2513,10 @@ got_object_list_as_comps_cb (GObject *source_object,
        g_return_if_fail (goad != NULL);
        g_return_if_fail (goad->client == E_CAL_CLIENT (source_object));
 
-       if (!e_cal_client_get_object_list_as_comps_finish (goad->client, result, &objects, &error)) {
+       e_cal_client_get_object_list_as_comps_finish (
+               goad->client, result, &objects, &error);
+
+       if (error != NULL) {
                if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
                    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        free_get_objects_async_data (goad);
@@ -2493,7 +2534,8 @@ got_object_list_as_comps_cb (GObject *source_object,
        goad->ready_cb (goad, objects);
 }
 
-/* ready_cb may take care of both arguments, goad and objects; objects can be also NULL */
+/* ready_cb may take care of both arguments, goad and objects;
+ * objects can be also NULL */
 static void
 get_objects_async (void (*ready_cb) (struct get_objects_async_data *goad,
                                      GSList *objects),
@@ -2505,7 +2547,9 @@ get_objects_async (void (*ready_cb) (struct get_objects_async_data *goad,
        goad->ready_cb = ready_cb;
 
        if (goad->uid && *goad->uid) {
-               e_cal_client_get_objects_for_uid (goad->client, goad->uid, goad->cancellable, 
got_objects_for_uid_cb, goad);
+               e_cal_client_get_objects_for_uid (
+                       goad->client, goad->uid, goad->cancellable,
+                       got_objects_for_uid_cb, goad);
        } else {
                gchar *iso_start, *iso_end;
 
@@ -2522,12 +2566,17 @@ get_objects_async (void (*ready_cb) (struct get_objects_async_data *goad,
                        return;
                }
 
-               goad->query = g_strdup_printf ("(occur-in-time-range? (make-time \"%s\") (make-time 
\"%s\"))", iso_start, iso_end);
+               goad->query = g_strdup_printf (
+                       "(occur-in-time-range? "
+                       "(make-time \"%s\") (make-time \"%s\"))",
+                       iso_start, iso_end);
 
                g_free (iso_start);
                g_free (iso_end);
 
-               e_cal_client_get_object_list_as_comps (goad->client, goad->query, goad->cancellable, 
got_object_list_as_comps_cb, goad);
+               e_cal_client_get_object_list_as_comps (
+                       goad->client, goad->query, goad->cancellable,
+                       got_object_list_as_comps_cb, goad);
        }
 }
 
@@ -2539,7 +2588,9 @@ generate_instances_got_objects_cb (struct get_objects_async_data *goad,
 
        /* generate_instaces () frees 'objects' slist */
        if (objects)
-               generate_instances (goad->client, goad->start, goad->end, objects, goad->cancellable, 
goad->cb, goad->cb_data);
+               generate_instances (
+                       goad->client, goad->start, goad->end, objects,
+                       goad->cancellable, goad->cb, goad->cb_data);
 
        free_get_objects_async_data (goad);
 }
@@ -2552,11 +2603,13 @@ generate_instances_got_objects_cb (struct get_objects_async_data *goad,
  * @cancellable: a #GCancellable; can be %NULL
  * @cb: Callback for each generated instance.
  * @cb_data: Closure data for the callback.
- * @destroy_cb_data: Function to call when the processing is done, to free @cb_data; can be %NULL.
+ * @destroy_cb_data: Function to call when the processing is done, to free
+ *                   @cb_data; can be %NULL.
  *
  * Does a combination of e_cal_client_get_object_list() and
- * e_cal_client_recur_generate_instances(). Unlike e_cal_client_generate_instances_sync(),
- * this returns immediately and the @cb callback is called asynchronously.
+ * e_cal_client_recur_generate_instances(). Unlike
+ * e_cal_client_generate_instances_sync(), this returns immediately and the
+ * @cb callback is called asynchronously.
  *
  * The callback function should do a g_object_ref() of the calendar component
  * it gets passed if it intends to keep it around, since it will be unref'ed
@@ -2656,7 +2709,8 @@ process_instances (ECalComponent *comp,
 
        rid = e_cal_component_get_recurid_as_string (comp);
 
-       /* Reverse the instances list because the add_instance() function is prepending */
+       /* Reverse the instances list because the add_instance() function
+        * is prepending. */
        instances = g_slist_reverse (instances);
 
        /* now only return back the instances for the given object */
@@ -2674,7 +2728,7 @@ process_instances (ECalComponent *comp,
                                if (instance_rid && *instance_rid && strcmp (rid, instance_rid) == 0)
                                        result = (* cb) (ci->comp, ci->start, ci->end, cb_data);
                        } else
-                               result = (* cb)  (ci->comp, ci->start, ci->end, cb_data);
+                               result = (* cb) (ci->comp, ci->start, ci->end, cb_data);
                }
 
                /* remove instance from list */
@@ -2703,10 +2757,14 @@ generate_instances_for_object_got_objects_cb (struct get_objects_async_data *goa
        instances_hold->end_zone = goad->end_zone;
 
        /* generate all instances in the given time range */
-       generate_instances (goad->client, goad->start, goad->end, objects, goad->cancellable, add_instance, 
instances_hold);
+       generate_instances (
+               goad->client, goad->start, goad->end, objects,
+               goad->cancellable, add_instance, instances_hold);
 
        /* it also frees 'instances' GSList */
-       process_instances (goad->comp, *(instances_hold->instances), goad->cb, goad->cb_data);
+       process_instances (
+               goad->comp, *(instances_hold->instances),
+               goad->cb, goad->cb_data);
 
        /* clean up */
        free_get_objects_async_data (goad);
@@ -2722,12 +2780,14 @@ generate_instances_for_object_got_objects_cb (struct get_objects_async_data *goa
  * @cancellable: a #GCancellable; can be %NULL
  * @cb: Callback for each generated instance.
  * @cb_data: Closure data for the callback.
- * @destroy_cb_data: Function to call when the processing is done, to free @cb_data; can be %NULL.
+ * @destroy_cb_data: Function to call when the processing is done, to
+ *                   free @cb_data; can be %NULL.
  *
  * Does a combination of e_cal_client_get_object_list() and
- * e_cal_client_recur_generate_instances(), like e_cal_client_generate_instances(), but
- * for a single object. Unlike e_cal_client_generate_instances_for_object_sync(),
- * this returns immediately and the @cb callback is called asynchronously.
+ * e_cal_client_recur_generate_instances(), like
+ * e_cal_client_generate_instances(), but for a single object. Unlike
+ * e_cal_client_generate_instances_for_object_sync(), this returns immediately
+ * and the @cb callback is called asynchronously.
  *
  * The callback function should do a g_object_ref() of the calendar component
  * it gets passed if it intends to keep it around, since it will be unref'ed
@@ -2769,8 +2829,14 @@ e_cal_client_generate_instances_for_object (ECalClient *client,
         * have a master object - do not expand */
        if (is_single_instance || e_client_check_capability (E_CLIENT (client), 
CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
                /* return the same instance */
-               (* cb)  (comp, icaltime_as_timet_with_zone (icalcomponent_get_dtstart (icalcomp), 
client->priv->default_zone),
-                               icaltime_as_timet_with_zone (icalcomponent_get_dtend (icalcomp), 
client->priv->default_zone), cb_data);
+               (* cb)  (comp,
+                       icaltime_as_timet_with_zone (
+                               icalcomponent_get_dtstart (icalcomp),
+                               client->priv->default_zone),
+                       icaltime_as_timet_with_zone (
+                               icalcomponent_get_dtend (icalcomp),
+                               client->priv->default_zone),
+                       cb_data);
                g_object_unref (comp);
 
                if (destroy_cb_data)
@@ -2783,7 +2849,8 @@ e_cal_client_generate_instances_for_object (ECalClient *client,
        /* Get the start timezone */
        e_cal_component_get_dtstart (comp, &datetime);
        if (datetime.tzid)
-               e_cal_client_get_timezone_sync (client, datetime.tzid, &start_zone, NULL, NULL);
+               e_cal_client_get_timezone_sync (
+                       client, datetime.tzid, &start_zone, NULL, NULL);
        else
                start_zone = NULL;
        e_cal_component_free_datetime (&datetime);
@@ -2791,7 +2858,8 @@ e_cal_client_generate_instances_for_object (ECalClient *client,
        /* Get the end timezone */
        e_cal_component_get_dtend (comp, &datetime);
        if (datetime.tzid)
-               e_cal_client_get_timezone_sync (client, datetime.tzid, &end_zone, NULL, NULL);
+               e_cal_client_get_timezone_sync (
+                       client, datetime.tzid, &end_zone, NULL, NULL);
        else
                end_zone = NULL;
        e_cal_component_free_datetime (&datetime);
@@ -2829,8 +2897,8 @@ e_cal_client_generate_instances_for_object (ECalClient *client,
  * @cb_data: (closure): Closure data for the callback
  *
  * Does a combination of e_cal_client_get_object_list() and
- * e_cal_client_recur_generate_instances(), like e_cal_client_generate_instances_sync(), but
- * for a single object.
+ * e_cal_client_recur_generate_instances(), like
+ * e_cal_client_generate_instances_sync(), but for a single object.
  *
  * The callback function should do a g_object_ref() of the calendar component
  * it gets passed if it intends to keep it around, since it will be unref'ed
@@ -2870,8 +2938,14 @@ e_cal_client_generate_instances_for_object_sync (ECalClient *client,
         * have a master object - do not expand */
        if (is_single_instance || e_client_check_capability (E_CLIENT (client), 
CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
                /* return the same instance */
-               (* cb)  (comp, icaltime_as_timet_with_zone (icalcomponent_get_dtstart (icalcomp), 
client->priv->default_zone),
-                               icaltime_as_timet_with_zone (icalcomponent_get_dtend (icalcomp), 
client->priv->default_zone), cb_data);
+               (* cb)  (comp,
+                       icaltime_as_timet_with_zone (
+                               icalcomponent_get_dtstart (icalcomp),
+                               client->priv->default_zone),
+                       icaltime_as_timet_with_zone (
+                               icalcomponent_get_dtend (icalcomp),
+                               client->priv->default_zone),
+                       cb_data);
                g_object_unref (comp);
                return;
        }
@@ -2881,7 +2955,8 @@ e_cal_client_generate_instances_for_object_sync (ECalClient *client,
        /* Get the start timezone */
        e_cal_component_get_dtstart (comp, &datetime);
        if (datetime.tzid)
-               e_cal_client_get_timezone_sync (client, datetime.tzid, &start_zone, NULL, NULL);
+               e_cal_client_get_timezone_sync (
+                       client, datetime.tzid, &start_zone, NULL, NULL);
        else
                start_zone = NULL;
        e_cal_component_free_datetime (&datetime);
@@ -2889,7 +2964,8 @@ e_cal_client_generate_instances_for_object_sync (ECalClient *client,
        /* Get the end timezone */
        e_cal_component_get_dtend (comp, &datetime);
        if (datetime.tzid)
-               e_cal_client_get_timezone_sync (client, datetime.tzid, &end_zone, NULL, NULL);
+               e_cal_client_get_timezone_sync (
+                       client, datetime.tzid, &end_zone, NULL, NULL);
        else
                end_zone = NULL;
        e_cal_component_free_datetime (&datetime);
@@ -2900,7 +2976,10 @@ e_cal_client_generate_instances_for_object_sync (ECalClient *client,
        instances_hold->end_zone = end_zone;
 
        /* generate all instances in the given time range */
-       generate_instances (client, start, end, get_objects_sync (client, start, end, uid), NULL, 
add_instance, instances_hold);
+       generate_instances (
+               client, start, end,
+               get_objects_sync (client, start, end, uid),
+               NULL, add_instance, instances_hold);
 
        /* it also frees 'instances' GSList */
        process_instances (comp, *(instances_hold->instances), cb, cb_data);
@@ -4922,7 +5001,7 @@ cal_client_remove_object_thread (GSimpleAsyncResult *simple,
  * This function allows the removal of instances of a recurrent
  * appointment. By using a combination of the @uid, @rid and @mod
  * arguments, you can remove specific instances. If what you want
- * is to remove all instances, use #NULL @rid and E_CAL_OBJ_MOD_ALL
+ * is to remove all instances, use %NULL @rid and E_CAL_OBJ_MOD_ALL
  * for the @mod.
  *
  * The call is finished by e_cal_client_remove_object_finish() from
@@ -5009,7 +5088,7 @@ e_cal_client_remove_object_finish (ECalClient *client,
  * This function allows the removal of instances of a recurrent
  * appointment. By using a combination of the @uid, @rid and @mod
  * arguments, you can remove specific instances. If what you want
- * is to remove all instances, use #NULL @rid and E_CAL_OBJ_MODE_THIS
+ * is to remove all instances, use %NULL @rid and E_CAL_OBJ_MODE_THIS
  * for the @mod.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
@@ -5065,10 +5144,10 @@ cal_client_remove_objects_thread (GSimpleAsyncResult *simple,
  * @callback: callback to call when a result is ready
  * @user_data: user data for the @callback
  *
- * This function allows the removal of instances of recurrent
- * appointments. #ECalComponentId objects can identify specific instances (if rid is not NULL).
- * If what you want is to remove all instances, use a #NULL rid in the #ECalComponentId and E_CAL_OBJ_MOD_ALL
- * for the @mod.
+ * This function allows the removal of instances of recurrent appointments.
+ * #ECalComponentId objects can identify specific instances (if rid is not
+ * %NULL).  If what you want is to remove all instances, use a %NULL rid in
+ * the #ECalComponentId and E_CAL_OBJ_MOD_ALL for the @mod.
  *
  * The call is finished by e_cal_client_remove_objects_finish() from
  * the @callback.
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index 249b8b9..1544db2 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -5503,7 +5503,7 @@ e_cal_component_get_alarm_uids (ECalComponent *comp)
  * Queries a particular alarm subcomponent of a calendar component.
  *
  * Returns: The alarm subcomponent that corresponds to the specified @auid,
- * or #NULL if no alarm exists with that UID.  This should be freed using
+ * or %NULL if no alarm exists with that UID.  This should be freed using
  * e_cal_component_alarm_free().
  **/
 ECalComponentAlarm *
diff --git a/calendar/libecal/e-cal-system-timezone.c b/calendar/libecal/e-cal-system-timezone.c
index 57d6a30..8015428 100644
--- a/calendar/libecal/e-cal-system-timezone.c
+++ b/calendar/libecal/e-cal-system-timezone.c
@@ -216,8 +216,8 @@ update_fallback (gchar **fallback,
 
        /* ignore those not available in libical */
        if (adept && ical_zones) {
-               if (!g_hash_table_lookup (ical_zones, adept) ||
-                   (*fallback && g_hash_table_lookup (ical_zones, *fallback))) {
+               if (!g_hash_table_contains (ical_zones, adept) ||
+                   (*fallback && g_hash_table_contains (ical_zones, *fallback))) {
                        g_free (adept);
                        return;
                }
@@ -268,12 +268,12 @@ recursive_compare (struct stat *localtime_stat,
                                  file)) {
                        gchar *tz = system_timezone_strip_path_if_valid (file);
 
-                       if (deep_level <= 1 || (ical_zones && g_hash_table_lookup (ical_zones, tz))) {
+                       if (deep_level <= 1 || (ical_zones && g_hash_table_contains (ical_zones, tz))) {
                                update_fallback (fallback, tz, ical_zones);
                                return NULL;
                        }
 
-                       if (ical_zones && !g_hash_table_lookup (ical_zones, tz)) {
+                       if (ical_zones && !g_hash_table_contains (ical_zones, tz)) {
                                g_free (tz);
                                return NULL;
                        }
@@ -336,8 +336,9 @@ files_are_identical_inode (struct stat *a_stat,
                else
                        filename = b_filename;
 
-               /* There is a 'localtime' soft link to /etc/localtime in the zoneinfo
-                * directory on Slackware, thus rather skip this file. */
+               /* There is a 'localtime' soft link to /etc/localtime in the
+                * zoneinfo directory on Slackware, thus rather skip this file.
+                */
                res = !g_str_equal (filename, "localtime");
        }
 
@@ -507,7 +508,7 @@ system_timezone_is_valid (const gchar *tz,
 {
        const gchar *c;
 
-       if (!tz)
+       if (tz == NULL)
                return FALSE;
 
        for (c = tz; *c != '\0'; c++) {
@@ -516,10 +517,10 @@ system_timezone_is_valid (const gchar *tz,
                        return FALSE;
        }
 
-       if (ical_zones && !g_hash_table_lookup (ical_zones, tz))
-               return FALSE;
+       if (ical_zones == NULL)
+               return TRUE;
 
-       return TRUE;
+       return g_hash_table_contains (ical_zones, tz);
 }
 
 static gchar *
@@ -532,7 +533,7 @@ system_timezone_find (void)
 
        /* return only timezones known to libical */
        ical_zones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-       g_hash_table_insert (ical_zones, g_strdup ("UTC"), GINT_TO_POINTER (1));
+       g_hash_table_add (ical_zones, g_strdup ("UTC"));
 
        builtin_timezones = icaltimezone_get_builtin_timezones ();
        for (ii = 0; ii < builtin_timezones->num_elements; ii++) {
@@ -545,7 +546,8 @@ system_timezone_find (void)
 
                location = icaltimezone_get_location (zone);
                if (location)
-                       g_hash_table_insert (ical_zones, g_strdup (location), GINT_TO_POINTER (1));
+                       g_hash_table_add (
+                               ical_zones, g_strdup (location));
        }
 
        /* softlink is the best option, it points to the correct file */
@@ -586,7 +588,10 @@ system_timezone_find (void)
                                         &localtime_content_len,
                                         NULL)) {
                        struct stat stat_config_tz;
-                       gchar *filename = g_build_filename (SYSTEM_ZONEINFODIR, config_tz, NULL);
+                       gchar *filename;
+
+                       filename = g_build_filename (
+                               SYSTEM_ZONEINFODIR, config_tz, NULL);
 
                        if (filename &&
                            g_stat (filename, &stat_config_tz) == 0 &&
@@ -599,10 +604,11 @@ system_timezone_find (void)
                                g_free (localtime_content);
                                g_hash_table_destroy (ical_zones);
 
-                               /* corresponding file name to config_tz matches /etc/localtime,
-                                * thus that's the correct one - return it as system timezone;
-                                * bonus is that it might match configured system timezone name too
-                               */
+                               /* Corresponding file name to config_tz matches
+                                * /etc/localtime, thus that's the correct one.
+                                * Return it as system timezone; bonus is that
+                                * it might match configured system timezone
+                                * name too. */
                                return config_tz;
                        }
                        g_free (filename);
@@ -631,8 +637,7 @@ system_timezone_find (void)
 #else /* G_OS_WIN32 */
 #include <windows.h>
 
-struct timezone_map_entry
-{
+struct timezone_map_entry {
        const gchar *windows_string;
        const gchar *olson_string;
 };
@@ -837,16 +842,19 @@ system_timezone_win32_query_registry (void)
 
        res = RegOpenKeyExA (
                HKEY_LOCAL_MACHINE,
-               "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation", 0, KEY_READ, &reg_key);
+               "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation", 0,
+               KEY_READ, &reg_key);
        if (res != ERROR_SUCCESS) {
                g_debug ("Could not find system timezone! (1)\n");
                return NULL;
        }
 
-       /* On Windows Vista, Windows Server 2008 and later, the Windows timezone name is the value of 
'TimeZoneKeyName' */
+       /* On Windows Vista, Windows Server 2008 and later,
+        * the Windows timezone name is the value of 'TimeZoneKeyName' */
 
        size = MAX_VALUE_NAME;
-       res = RegQueryValueExA (reg_key, "TimeZoneKeyName", 0, &type, (LPBYTE) timeZone, &size);
+       res = RegQueryValueExA (
+               reg_key, "TimeZoneKeyName", 0, &type, (LPBYTE) timeZone, &size);
 
        if (type == REG_SZ && res == ERROR_SUCCESS) {
                RegCloseKey (reg_key);
@@ -856,7 +864,8 @@ system_timezone_win32_query_registry (void)
 
        /* On older Windows, we must first find the value of 'StandardName' */
 
-       res = RegQueryValueExA (reg_key, "StandardName", 0, &type, (LPBYTE) timeZone, &size);
+       res = RegQueryValueExA (
+               reg_key, "StandardName", 0, &type, (LPBYTE) timeZone, &size);
 
        if (type != REG_SZ || res != ERROR_SUCCESS) {
                RegCloseKey (reg_key);
@@ -880,7 +889,8 @@ system_timezone_win32_query_registry (void)
                size = MAX_VALUE_NAME;
                res = RegEnumKeyEx (reg_key, i, subKey, &size, NULL, NULL, NULL, NULL);
                if (res == ERROR_SUCCESS) {
-                       res = RegOpenKeyExA (reg_key, subKey, 0, KEY_READ, &reg_subkey);
+                       res = RegOpenKeyExA (
+                               reg_key, subKey, 0, KEY_READ, &reg_subkey);
                        if (res != ERROR_SUCCESS)
                                continue;
                        size = MAX_VALUE_NAME;
@@ -928,7 +938,8 @@ e_cal_system_timezone_get_location (void)
 
        if (!(windows_timezone_string = system_timezone_win32_query_registry ()))
                return NULL;
-       olson_timezone_string = windows_timezone_string_to_olson (windows_timezone_string);
+       olson_timezone_string =
+               windows_timezone_string_to_olson (windows_timezone_string);
        g_free (windows_timezone_string);
        if (!olson_timezone_string)
                return NULL;
diff --git a/calendar/libecal/e-cal-time-util.c b/calendar/libecal/e-cal-time-util.c
index 1c57ca7..725a7ba 100644
--- a/calendar/libecal/e-cal-time-util.c
+++ b/calendar/libecal/e-cal-time-util.c
@@ -586,7 +586,14 @@ isodate_from_time_t (time_t t)
 
        gmtime_r (&t, &stm);
        ret = g_malloc (ISODATE_LENGTH);
-       g_snprintf (ret, ISODATE_LENGTH, fmt, (stm.tm_year + 1900), (stm.tm_mon + 1), stm.tm_mday, 
stm.tm_hour, stm.tm_min, stm.tm_sec);
+       g_snprintf (
+               ret, ISODATE_LENGTH, fmt,
+               (stm.tm_year + 1900),
+               (stm.tm_mon + 1),
+               stm.tm_mday,
+               stm.tm_hour,
+               stm.tm_min,
+               stm.tm_sec);
 
        return ret;
 }
diff --git a/calendar/libecal/e-cal-util.c b/calendar/libecal/e-cal-util.c
index 2d02d97..36b3dcc 100644
--- a/calendar/libecal/e-cal-util.c
+++ b/calendar/libecal/e-cal-util.c
@@ -130,7 +130,6 @@ e_cal_util_new_component (icalcomponent_kind kind)
 static gchar *
 read_line (const gchar *string)
 {
-       gchar *line;
        GString *line_str = NULL;
 
        for (; *string; string++) {
@@ -142,10 +141,7 @@ read_line (const gchar *string)
                        break;
        }
 
-       line = line_str->str;
-       g_string_free (line_str, FALSE);
-
-       return line;
+       return g_string_free (line_str, FALSE);
 }
 
 /**
@@ -163,46 +159,50 @@ read_line (const gchar *string)
 icalcomponent *
 e_cal_util_parse_ics_string (const gchar *string)
 {
+       GString *comp_str = NULL;
        gchar *s;
        icalcomponent *icalcomp = NULL;
 
        g_return_val_if_fail (string != NULL, NULL);
 
        /* Split string into separated VCALENDAR's, if more than one */
-       if ((s = g_strstr_len (string, strlen (string), "BEGIN:VCALENDAR"))) {
-               GString *comp_str = NULL;
-
-               while (*s) {
-                       gchar *line = read_line (s);
-                       if (line) {
-                               if (!comp_str)
-                                       comp_str = g_string_new (line);
-                               else
-                                       comp_str = g_string_append (comp_str, line);
+       s = g_strstr_len (string, strlen (string), "BEGIN:VCALENDAR");
 
-                               if (!strncmp (line, "END:VCALENDAR", 13)) {
-                                       icalcomponent *tmp;
+       if (s == NULL)
+               return icalparser_parse_string (string);
 
-                                       tmp = icalparser_parse_string (comp_str->str);
-                                       if (tmp && icalcomponent_isa (tmp) == ICAL_VCALENDAR_COMPONENT) {
-                                               if (icalcomp)
-                                                       icalcomponent_merge_component (icalcomp, tmp);
-                                               else
-                                                       icalcomp = tmp;
-                                       } else
-                                               g_warning ("Could not merge the components, the component is 
either invalid or not a toplevel component \n");
+       while (*s != '\0') {
+               gchar *line = read_line (s);
 
-                                       g_string_free (comp_str, TRUE);
-                                       comp_str = NULL;
-                               }
+               if (!comp_str)
+                       comp_str = g_string_new (line);
+               else
+                       comp_str = g_string_append (comp_str, line);
 
-                               s += strlen (line);
+               if (strncmp (line, "END:VCALENDAR", 13) == 0) {
+                       icalcomponent *tmp;
 
-                               g_free (line);
+                       tmp = icalparser_parse_string (comp_str->str);
+                       if (tmp && icalcomponent_isa (tmp) == ICAL_VCALENDAR_COMPONENT) {
+                               if (icalcomp)
+                                       icalcomponent_merge_component (icalcomp, tmp);
+                               else
+                                       icalcomp = tmp;
+                       } else {
+                               g_warning (
+                                       "Could not merge the components, "
+                                       "the component is either invalid "
+                                       "or not a toplevel component \n");
                        }
+
+                       g_string_free (comp_str, TRUE);
+                       comp_str = NULL;
                }
-       } else
-               icalcomp = icalparser_parse_string (string);
+
+               s += strlen (line);
+
+               g_free (line);
+       }
 
        return icalcomp;
 }
@@ -294,7 +294,8 @@ compute_alarm_range (ECalComponent *comp,
                        if (repeat.repetitions != 0) {
                                gint rdur;
 
-                               rdur = repeat.repetitions * icaldurationtype_as_int (repeat.duration);
+                               rdur = repeat.repetitions *
+                                       icaldurationtype_as_int (repeat.duration);
                                repeat_time = MAX (repeat_time, rdur);
                        }
 
@@ -482,12 +483,14 @@ generate_absolute_triggers (ECalComponent *comp,
                if (trigger.type != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE)
                        continue;
 
-               /* Absolute triggers are always in UTC; see RFC 2445 section 4.8.6.3 */
+               /* Absolute triggers are always in UTC;
+                * see RFC 2445 section 4.8.6.3 */
                zone = icaltimezone_get_utc_timezone ();
 
                abs_time = icaltime_as_timet_with_zone (trigger.u.abs_time, zone);
 
-               /* No particular occurrence, so just use the times from the component */
+               /* No particular occurrence, so just use the times from the
+                * component */
 
                if (dt_start.value) {
                        if (dt_start.tzid && !dt_start.value->is_date)
@@ -495,7 +498,8 @@ generate_absolute_triggers (ECalComponent *comp,
                        else
                                zone = default_timezone;
 
-                       occur_start = icaltime_as_timet_with_zone (*dt_start.value, zone);
+                       occur_start = icaltime_as_timet_with_zone (
+                               *dt_start.value, zone);
                } else
                        occur_start = -1;
 
@@ -523,7 +527,9 @@ generate_absolute_triggers (ECalComponent *comp,
                                t = abs_time + (i + 1) * repeat_time;
 
                                if (t >= aod->start && t < aod->end)
-                                       add_trigger (aod, auid, t, occur_start, occur_end);
+                                       add_trigger (
+                                               aod, auid, t,
+                                               occur_start, occur_end);
                        }
                }
 
@@ -593,7 +599,8 @@ e_cal_util_generate_alarms_for_comp (ECalComponent *comp,
                return NULL;
 
        alarm_uids = e_cal_component_get_alarm_uids (comp);
-       compute_alarm_range (comp, alarm_uids, start, end, &alarm_start, &alarm_end);
+       compute_alarm_range (
+               comp, alarm_uids, start, end, &alarm_start, &alarm_end);
 
        aod.alarm_uids = alarm_uids;
        aod.start = start;
@@ -609,7 +616,8 @@ e_cal_util_generate_alarms_for_comp (ECalComponent *comp,
                default_timezone);
 
        /* We add the ABSOLUTE triggers separately */
-       generate_absolute_triggers (comp, &aod, resolve_tzid, user_data, default_timezone);
+       generate_absolute_triggers (
+               comp, &aod, resolve_tzid, user_data, default_timezone);
 
        cal_obj_uid_list_free (alarm_uids);
 
@@ -665,7 +673,9 @@ e_cal_util_generate_alarms_for_list (GList *comps,
                ECalComponentAlarms *alarms;
 
                comp = E_CAL_COMPONENT (l->data);
-               alarms = e_cal_util_generate_alarms_for_comp (comp, start, end, omit, resolve_tzid, 
user_data, default_timezone);
+               alarms = e_cal_util_generate_alarms_for_comp (
+                       comp, start, end, omit, resolve_tzid,
+                       user_data, default_timezone);
 
                if (alarms) {
                        *comp_alarms = g_slist_prepend (*comp_alarms, alarms);
@@ -798,7 +808,7 @@ e_cal_util_add_timezones_from_component (icalcomponent *vcal_comp,
  * e_cal_util_component_is_instance:
  * @icalcomp: An #icalcomponent.
  *
- * Checks whether an #icalcomponent is an instance of a recurring appointment or not.
+ * Checks whether an #icalcomponent is an instance of a recurring appointment.
  *
  * Returns: TRUE if it is an instance, FALSE if not.
  */
@@ -809,8 +819,10 @@ e_cal_util_component_is_instance (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
-       return prop ? TRUE : FALSE;
+       prop = icalcomponent_get_first_property (
+               icalcomp, ICAL_RECURRENCEID_PROPERTY);
+
+       return (prop != NULL);
 }
 
 /**
@@ -828,15 +840,17 @@ e_cal_util_component_has_alarms (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       alarm = icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT);
-       return alarm ? TRUE : FALSE;
+       alarm = icalcomponent_get_first_component (
+               icalcomp, ICAL_VALARM_COMPONENT);
+
+       return (alarm != NULL);
 }
 
 /**
  * e_cal_util_component_has_organizer:
  * @icalcomp: An #icalcomponent.
  *
- * Checks whether an #icalcomponent has an organizer or not.
+ * Checks whether an #icalcomponent has an organizer.
  *
  * Returns: TRUE if there is an organizer, FALSE if not.
  */
@@ -847,8 +861,10 @@ e_cal_util_component_has_organizer (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ORGANIZER_PROPERTY);
-       return prop ? TRUE : FALSE;
+       prop = icalcomponent_get_first_property (
+               icalcomp, ICAL_ORGANIZER_PROPERTY);
+
+       return (prop != NULL);
 }
 
 /**
@@ -866,9 +882,10 @@ e_cal_util_component_has_attendee (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+       prop = icalcomponent_get_first_property (
+               icalcomp, ICAL_ATTENDEE_PROPERTY);
 
-       return prop ? TRUE : FALSE;
+       return (prop != NULL);
 }
 
 /**
@@ -884,7 +901,8 @@ e_cal_util_component_has_recurrences (icalcomponent *icalcomp)
 {
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       return e_cal_util_component_has_rdates (icalcomp) || e_cal_util_component_has_rrules (icalcomp);
+       return e_cal_util_component_has_rdates (icalcomp) ||
+               e_cal_util_component_has_rrules (icalcomp);
 }
 
 /**
@@ -902,8 +920,10 @@ e_cal_util_component_has_rdates (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_RDATE_PROPERTY);
-       return prop ? TRUE : FALSE;
+       prop = icalcomponent_get_first_property (
+               icalcomp, ICAL_RDATE_PROPERTY);
+
+       return (prop != NULL);
 }
 
 /**
@@ -921,8 +941,10 @@ e_cal_util_component_has_rrules (icalcomponent *icalcomp)
 
        g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY);
-       return prop ? TRUE : FALSE;
+       prop = icalcomponent_get_first_property (
+               icalcomp, ICAL_RRULE_PROPERTY);
+
+       return (prop != NULL);
 }
 
 /**
@@ -1068,8 +1090,8 @@ time_matches_rid (struct icaltimetype itt,
  *
  * Removes one or more instances from @comp according to @rid and @mod.
  *
- * FIXME: should probably have a return value indicating whether or not
- * @icalcomp still has any instances
+ * FIXME: should probably have a return value indicating whether @icalcomp
+ *        still has any instances
  **/
 void
 e_cal_util_remove_instances (icalcomponent *icalcomp,
@@ -1145,7 +1167,8 @@ e_cal_util_remove_instances (icalcomponent *icalcomp,
                                 * here, but Outlook/Exchange handle
                                 * UNTIL incorrectly.
                                 */
-                               rule.until = icaltime_add (rid, icalcomponent_get_duration (icalcomp));
+                               rule.until = icaltime_add (
+                                       rid, icalcomponent_get_duration (icalcomp));
                                prop = icalproperty_new_exrule (rule);
                                icalcomponent_add_property (icalcomp, prop);
                        } else
@@ -1210,7 +1233,8 @@ componenttime_to_utc_timet (const ECalComponentDateTime *dt_time,
                        zone = tz_cb (dt_time->tzid, tz_cb_data);
 
                // zone = icaltimezone_get_utc_timezone ();
-               timet = icaltime_as_timet_with_zone (*dt_time->value, zone ? zone : default_zone);
+               timet = icaltime_as_timet_with_zone (
+                       *dt_time->value, zone ? zone : default_zone);
        }
 
        return timet;
@@ -1252,7 +1276,7 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
        /* Get dtstart of the component and convert it to UTC */
        e_cal_component_get_dtstart (comp, &dt_start);
 
-       if ( (*start = componenttime_to_utc_timet (&dt_start, tz_cb, tz_cb_data, default_timezone)) == -1)
+       if ((*start = componenttime_to_utc_timet (&dt_start, tz_cb, tz_cb_data, default_timezone)) == -1)
                *start = _TIME_MIN;
 
        e_cal_component_free_datetime (&dt_start);
@@ -1291,7 +1315,10 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
                /* ALARMS, EVENTS: DTEND and reccurences */
 
                if (e_cal_component_has_recurrences (comp)) {
-                       GSList *rrules = NULL, *exrules = NULL, *elem, *rdates = NULL;
+                       GSList *rrules = NULL;
+                       GSList *exrules = NULL;
+                       GSList *elem;
+                       GSList *rdates = NULL;
 
                        /* Do the RRULEs, EXRULEs and RDATEs*/
                        e_cal_component_get_rrule_property_list (comp, &rrules);
@@ -1305,7 +1332,8 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
                                ir = icalproperty_get_rrule (prop);
 
                                utc_zone = icaltimezone_get_utc_timezone ();
-                               rule_end = e_cal_recur_obtain_enddate (&ir, prop, utc_zone, TRUE);
+                               rule_end = e_cal_recur_obtain_enddate (
+                                       &ir, prop, utc_zone, TRUE);
 
                                if (rule_end == -1) /* repeats forever */
                                        *end = _TIME_MAX;
@@ -1321,8 +1349,8 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
                                ir = icalproperty_get_exrule (prop);
 
                                utc_zone = icaltimezone_get_utc_timezone ();
-                               rule_end =
-                                       e_cal_recur_obtain_enddate (&ir, prop, utc_zone, TRUE);
+                               rule_end = e_cal_recur_obtain_enddate (
+                                       &ir, prop, utc_zone, TRUE);
 
                                if (rule_end == -1) /* repeats forever */
                                        *end = _TIME_MAX;
@@ -1359,7 +1387,10 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
                e_cal_component_get_dtend (comp, &dt_end);
 
                if (dt_end.value) {
-                       time_t dtend_time = componenttime_to_utc_timet (&dt_end, tz_cb, tz_cb_data, 
default_timezone);
+                       time_t dtend_time;
+
+                       dtend_time = componenttime_to_utc_timet (
+                               &dt_end, tz_cb, tz_cb_data, default_timezone);
 
                        if (dtend_time == -1 || (dtend_time > *end))
                                *end = dtend_time;
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index cec19e3..917aa45 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -762,7 +762,13 @@ e_cal_open_async (ECal *ecal,
 
        switch (priv->load_state) {
        case E_CAL_LOAD_LOADING :
-               async_report_idle (ecal, g_error_new_literal (E_CALENDAR_ERROR, E_CALENDAR_STATUS_BUSY, 
e_cal_get_error_message (E_CALENDAR_STATUS_BUSY)));
+               async_report_idle (
+                       ecal,
+                       g_error_new_literal (
+                               E_CALENDAR_ERROR,
+                               E_CALENDAR_STATUS_BUSY,
+                               e_cal_get_error_message (
+                               E_CALENDAR_STATUS_BUSY)));
                return;
        case E_CAL_LOAD_LOADED :
                async_report_idle (ecal, NULL /* success */);
@@ -1936,7 +1942,8 @@ e_cal_get_component_as_string (ECal *ecal,
  * e_cal_create_object: (skip)
  * @ecal: A calendar client.
  * @icalcomp: The component to create.
- * @uid: Return value for the UID assigned to the new component by the calendar backend.
+ * @uid: Return value for the UID assigned to the new component by the
+ *       calendar backend.
  * @error: Placeholder for error information.
  *
  * Requests the calendar backend to create the object specified by the @icalcomp
@@ -2061,13 +2068,15 @@ e_cal_remove_object_with_mod (ECal *ecal,
  * @error: Placeholder for error information.
  *
  * Asks a calendar to remove all components with the given UID.
- * If more control of the removal is desired, then use e_cal_remove_object_with_mod().
+ * If more control of the removal is desired, then use
+ * e_cal_remove_object_with_mod().
  * If the server is able to remove the component(s), all clients will
  * be notified and they will emit the "obj_removed" signal.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
  *
- * Deprecated: 3.2: Use e_cal_client_remove_object_sync() instead, with rid set to NULL and mod set to 
CALOBJ_MOD_ALL.
+ * Deprecated: 3.2: Use e_cal_client_remove_object_sync() instead, with rid
+ *                  set to NULL and mod set to CALOBJ_MOD_ALL.
  **/
 gboolean
 e_cal_remove_object (ECal *ecal,
diff --git a/calendar/libedata-cal/e-cal-backend-intervaltree.c 
b/calendar/libedata-cal/e-cal-backend-intervaltree.c
index 90e87c7..ec29393 100644
--- a/calendar/libedata-cal/e-cal-backend-intervaltree.c
+++ b/calendar/libedata-cal/e-cal-backend-intervaltree.c
@@ -48,8 +48,7 @@ typedef struct _EIntervalNode EIntervalNode;
 static EIntervalNode *
 intervaltree_node_next (EIntervalTree *tree, EIntervalNode *x);
 
-struct _EIntervalNode
-{
+struct _EIntervalNode {
        /* start of the interval - the key of the node */
        time_t start;
        /* end of the interval */
@@ -70,8 +69,7 @@ struct _EIntervalNode
        EIntervalNode * parent;
 };
 
-struct _EIntervalTreePrivate
-{
+struct _EIntervalTreePrivate {
        EIntervalNode *root;
        EIntervalNode *nil;
        GHashTable *id_node_hash;
@@ -144,15 +142,13 @@ static void
 left_rotate (EIntervalTree *tree,
              EIntervalNode *x)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *y;
        EIntervalNode *nil;
 
-       g_return_if_fail (tree != NULL);
+       g_return_if_fail (E_IS_INTERVALTREE (tree));
        g_return_if_fail (x != NULL);
 
-       priv = tree->priv;
-       nil = priv->nil;
+       nil = tree->priv->nil;
        y = x->right;
        x->right = y->left;
 
@@ -190,15 +186,13 @@ static void
 right_rotate (EIntervalTree *tree,
               EIntervalNode *y)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *x;
        EIntervalNode *nil;
 
-       g_return_if_fail (tree != NULL);
+       g_return_if_fail (E_IS_INTERVALTREE (tree));
        g_return_if_fail (y != NULL);
 
-       priv = tree->priv;
-       nil = priv->nil;
+       nil = tree->priv->nil;
        x = y->left;
        y->left = x->right;
 
@@ -226,9 +220,7 @@ static void
 fixup_min_max_fields (EIntervalTree *tree,
                       EIntervalNode *node)
 {
-       EIntervalTreePrivate *priv = tree->priv;
-       while (node != priv->root)
-       {
+       while (node != tree->priv->root) {
                node->max = MAX (node->end, MAX (node->left->max, node->right->max));
                node->min = MIN (node->start, node->left->min);
 
@@ -241,20 +233,20 @@ static void
 binary_tree_insert (EIntervalTree *tree,
                     EIntervalNode *z)
 {
-       EIntervalTreePrivate *priv = tree->priv;
        EIntervalNode *x;
        EIntervalNode *y;
-       EIntervalNode *nil = priv->nil;
+       EIntervalNode *nil;
 
-       g_return_if_fail (tree != NULL);
+       g_return_if_fail (E_IS_INTERVALTREE (tree));
        g_return_if_fail (z != NULL);
 
+       nil = tree->priv->nil;
+
        z->left = z->right = nil;
-       y = priv->root;
-       x = priv->root->left;
+       y = tree->priv->root;
+       x = tree->priv->root->left;
 
-       while ( x != nil)
-       {
+       while (x != nil) {
                y = x;
 
                if (get_direction (x, z->start, z->end) == DIRECTION_GO_LEFT)
@@ -265,7 +257,7 @@ binary_tree_insert (EIntervalTree *tree,
 
        z->parent = y;
 
-       if ( (y == priv->root) || (get_direction (y, z->start, z->end) == DIRECTION_GO_LEFT))
+       if ((y == tree->priv->root) || (get_direction (y, z->start, z->end) == DIRECTION_GO_LEFT))
                y->left = z;
        else
                y->right = z;
@@ -275,129 +267,21 @@ binary_tree_insert (EIntervalTree *tree,
        y->max = MAX (y->left->max, MAX (y->end, y->right->max));
 }
 
-/**
- * e_intervaltree_insert:
- * @tree: interval tree
- * @start: start of the interval
- * @end: end of the interval
- * @comp: Component
- * 
- * Since: 2.32
- **/
-gboolean
-e_intervaltree_insert (EIntervalTree *tree,
-                       time_t start,
-                       time_t end,
-                       ECalComponent *comp)
-{
-       EIntervalTreePrivate *priv;
-       EIntervalNode *y;
-       EIntervalNode *x;
-       EIntervalNode *newNode;
-       const gchar *uid;
-       gchar *rid;
-
-       g_return_val_if_fail (tree != NULL, FALSE);
-       g_return_val_if_fail (comp != NULL, FALSE);
-       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
-
-       priv = tree->priv;
-
-       g_rec_mutex_lock (&priv->mutex);
-
-       e_cal_component_get_uid (comp, &uid);
-       rid = e_cal_component_get_recurid_as_string (comp);
-       e_intervaltree_remove (tree, uid, rid);
-
-       x = g_new (EIntervalNode, 1);
-       x->min = x->start = start;
-       x->max = x->end = end;
-       x->comp = g_object_ref (comp);
-
-       binary_tree_insert (tree, x);
-       newNode = x;
-       x->red = TRUE;
-
-       fixup_min_max_fields (tree, x->parent);
-       while (x->parent->red)
-       { /* use sentinel instead of checking for root */
-               if (x->parent == x->parent->parent->left)
-               {
-                       y = x->parent->parent->right;
-
-                       if (y->red)
-                       {
-                               x->parent->red = FALSE;
-                               y->red = FALSE;
-                               x->parent->parent->red = TRUE;
-                               x = x->parent->parent;
-                       }
-                       else
-                       {
-                               if (x == x->parent->right)
-                               {
-                                       x = x ->parent;
-                                       left_rotate (tree, x);
-                               }
-
-                               x->parent->red = FALSE;
-                               x->parent->parent->red = TRUE;
-                               right_rotate (tree, x->parent->parent);
-                       }
-               }
-               else
-               { /* case for x->parent == x->parent->parent->right */
-                       y = x->parent->parent->left;
-
-                       if (y->red)
-                       {
-                               x->parent->red = FALSE;
-                               y->red = FALSE;
-                               x->parent->parent->red = TRUE;
-                               x = x->parent->parent;
-                       }
-                       else
-                       {
-                               if (x == x->parent->left)
-                               {
-                                       x = x->parent;
-                                       right_rotate (tree, x);
-                               }
-
-                               x->parent->red = FALSE;
-                               x->parent->parent->red = TRUE;
-                               left_rotate (tree, x->parent->parent);
-                       }
-               }
-       }
-
-       priv->root->left->red = FALSE;
-       g_hash_table_insert (priv->id_node_hash, component_key (uid, rid), newNode);
-       g_free (rid);
-
-       g_rec_mutex_unlock (&priv->mutex);
-
-       return TRUE;
-}
-
 static EIntervalNode *
 intervaltree_node_next (EIntervalTree *tree,
                         EIntervalNode *x)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *y, *nil, *root;
 
-       g_return_val_if_fail (tree != NULL, NULL);
+       g_return_val_if_fail (E_IS_INTERVALTREE (tree), NULL);
        g_return_val_if_fail (x != NULL, NULL);
 
-       priv = tree->priv;
-       g_return_val_if_fail (x != priv->nil, NULL);
+       g_return_val_if_fail (x != tree->priv->nil, NULL);
 
-       nil = priv->nil;
-       root = priv->root;
+       nil = tree->priv->nil;
+       root = tree->priv->root;
 
-       if (nil != (y = x->right))
-       {
+       if (nil != (y = x->right)) {
                /* find out minimum of right subtree of x (assignment to y is ok) */
                while (y->left != nil)
                        y = y->left;
@@ -407,8 +291,7 @@ intervaltree_node_next (EIntervalTree *tree,
 
        y = x->parent;
 
-       while (x == y->right)
-       {
+       while (x == y->right) {
                x = y;
                y = y->parent;
        }
@@ -419,76 +302,30 @@ intervaltree_node_next (EIntervalTree *tree,
        return y;
 }
 
-/**
- * e_intervaltree_destroy:
- * @tree: an #EIntervalTree
- *
- * Since: 2.32
- **/
-void
-e_intervaltree_destroy (EIntervalTree *tree)
-{
-       EIntervalTreePrivate *priv;
-       EIntervalNode *node;
-       GList *stack_start = NULL, *pos;
-
-       g_return_if_fail (tree != NULL);
-
-       priv = tree->priv;
-       stack_start = pos = g_list_insert (stack_start, priv->root->left, -1);
-
-       while (pos != NULL)
-       {
-               node = (EIntervalNode *) pos->data;
-
-               if (node != priv->nil)
-               {
-                       pos = g_list_insert (pos, node->left, -1);
-                       pos = g_list_insert (pos, node->right, -1);
-
-                       g_object_unref (node->comp);
-                       g_free (node);
-               }
-
-               pos = pos->next;
-       }
-
-       g_list_free (stack_start);
-       g_object_unref (tree);
-}
-
 /* Caller should hold the lock */
 static void
-e_intervaltree_fixup_deletion (EIntervalTree *tree,
-                               EIntervalNode *x)
+intervaltree_fixup_deletion (EIntervalTree *tree,
+                             EIntervalNode *x)
 {
-       EIntervalTreePrivate *priv = tree->priv;
-       EIntervalNode *root = priv->root->left;
+       EIntervalNode *root = tree->priv->root->left;
        EIntervalNode *w;
 
-       while ( (!x->red) && (root != x))
-       {
-               if (x == x->parent->left)
-               {
+       while ((!x->red) && (root != x)) {
+               if (x == x->parent->left) {
                        w = x->parent->right;
 
-                       if (w->red)
-                       {
+                       if (w->red) {
                                w->red = FALSE;
                                x->parent->red = TRUE;
                                left_rotate (tree, x->parent);
                                w = x->parent->right;
                        }
 
-                       if ((!w->right->red) && (!w->left->red))
-                       {
+                       if ((!w->right->red) && (!w->left->red)) {
                                w->red = TRUE;
                                x = x->parent;
-                       }
-                       else
-                       {
-                               if (!w->right->red)
-                               {
+                       } else {
+                               if (!w->right->red) {
                                        w->left->red = FALSE;
                                        w->red = TRUE;
                                        right_rotate (tree, w);
@@ -504,23 +341,18 @@ e_intervaltree_fixup_deletion (EIntervalTree *tree,
                } else {
                        w = x->parent->left;
 
-                       if (w->red)
-                       {
+                       if (w->red) {
                                w->red = FALSE;
                                x->parent->red = TRUE;
                                right_rotate (tree, x->parent);
                                w = x->parent->left;
                        }
 
-                       if ((!w->right->red) && (!w->left->red))
-                       {
+                       if ((!w->right->red) && (!w->left->red)) {
                                w->red = TRUE;
                                x = x->parent;
-                       }
-                       else
-                       {
-                               if (!w->left->red)
-                               {
+                       } else {
+                               if (!w->left->red) {
                                        w->right->red = FALSE;
                                        w->red = TRUE;
                                        left_rotate (tree, w);
@@ -539,131 +371,199 @@ e_intervaltree_fixup_deletion (EIntervalTree *tree,
        x->red = 0;
 }
 
-/**
- * e_intervaltree_search:
- * @tree: interval tree
- * @start: start of the interval
- * @end: end of the interval
- * 
- * Returns list of nodes that overlaps given interval or %NULL.
- *
- * Since: 2.32
- **/
-GList *
-e_intervaltree_search (EIntervalTree *tree,
-                       time_t start,
-                       time_t end)
+/** Caller should hold the lock. **/
+static EIntervalNode *
+intervaltree_search_component (EIntervalTree *tree,
+                               const gchar *searched_uid,
+                               const gchar *searched_rid)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *node;
-       GList *list = NULL;
-       GList *stack_start = NULL, *pos;
+       gchar *key;
 
-       g_return_val_if_fail (tree != NULL, NULL);
+       g_return_val_if_fail (E_IS_INTERVALTREE (tree), NULL);
+       g_return_val_if_fail (searched_uid != NULL, NULL);
 
-       priv = tree->priv;
-       g_rec_mutex_lock (&priv->mutex);
+       if (!searched_uid) {
+               g_warning (
+                       "Searching the interval tree, the component "
+                       " does not have a valid UID skipping it\n");
 
-       stack_start = pos = g_list_insert (stack_start, priv->root->left, -1);
+               return NULL;
+       }
 
-       while (pos != NULL)
-       {
-               node = (EIntervalNode *) pos->data;
+       key = component_key (searched_uid, searched_rid);
+       node = g_hash_table_lookup (tree->priv->id_node_hash, key);
+       g_free (key);
 
-               if (node != priv->nil)
-               {
-                       if (compare_intervals (node->start, node->end, start, end) == 0)
-                       {
-                               list = g_list_insert (list, node->comp, -1);
-                               g_object_ref (node->comp);
-                       }
+       return node;
+}
 
-                       if (compare_intervals (node->left->min, node->left->max, start, end) == 0)
-                               pos = g_list_insert (pos, node->left, -1);
+static void
+intervaltree_finalize (GObject *object)
+{
+       EIntervalTreePrivate *priv;
 
-                       if (compare_intervals (node->right->min, node->right->max, start, end) == 0)
-                               pos = g_list_insert (pos, node->right, -1);
-               }
+       priv = E_INTERVALTREE_GET_PRIVATE (object);
 
-               pos = pos->next;
-       }
+       g_free (priv->root);
+       g_free (priv->nil);
 
-       g_list_free (stack_start);
+       if (priv->id_node_hash != NULL)
+               g_hash_table_destroy (priv->id_node_hash);
 
-       g_rec_mutex_unlock (&priv->mutex);
+       g_rec_mutex_clear (&priv->mutex);
 
-       return list;
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
 }
 
-#ifdef E_INTERVALTREE_DEBUG
 static void
-e_intervaltree_node_dump (EIntervalTree *tree,
-                          EIntervalNode *node,
-                          gint indent)
+e_intervaltree_class_init (EIntervalTreeClass *class)
 {
-       /*
-       gchar start_time[32] = {0}, end_time[32] = {0};
-       struct tm tm_start_time, tm_end_time;
- *
-       localtime_r (&node->start, &tm_start_time);
-       localtime_r (&node->end, &tm_end_time);
-       strftime (start_time, sizeof (start_time), "%Y-%m-%d T%H:%M:%S", &tm_start_time);
-       strftime (end_time, sizeof (end_time), "%Y-%m-%d T%H:%M:%S", &tm_end_time);
-       g_print ("%*s[%s - %s]\n", indent, "", start_time, end_time);
-       */
-       EIntervalTreePrivate *priv = tree->priv;
-       if (node != priv->nil) {
-               g_print (
-                       "%*s[%ld - %ld] [%ld - %ld] red %d\n", indent, "", node->start,
-                       node->end, node->min, node->max, node->red);
-       } else {
-               g_print ("%*s[ - ]\n", indent, "");
-               return;
-       }
+       GObjectClass *object_class;
 
-       e_intervaltree_node_dump (tree, node->left, indent + 2);
-       e_intervaltree_node_dump (tree, node->right, indent + 2);
+       g_type_class_add_private (class, sizeof (EIntervalTreePrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = intervaltree_finalize;
 }
 
-void
-e_intervaltree_dump (EIntervalTree *tree)
+static void
+e_intervaltree_init (EIntervalTree *tree)
 {
-       EIntervalTreePrivate *priv = tree->priv;
-       if (priv->root)
-                 e_intervaltree_node_dump (tree, priv->root, 0);
+       EIntervalNode *root, *nil;
+
+       tree->priv = E_INTERVALTREE_GET_PRIVATE (tree);
+
+       tree->priv->nil = nil = g_new (EIntervalNode, 1);
+       nil->parent = nil->left = nil->right = nil;
+       nil->red = FALSE;
+       nil->start = nil->end = nil->max = _TIME_MIN;
+       nil->min = _TIME_MAX;
+
+       tree->priv->root = root = g_new (EIntervalNode, 1);
+       root->parent = root->left = root->right = nil;
+       root->red = FALSE;
+       root->start = _TIME_MAX;
+       root->end = 0;
+       root->max = _TIME_MAX;
+       root->min = _TIME_MIN;
+
+       g_rec_mutex_init (&tree->priv->mutex);
+
+       tree->priv->id_node_hash = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) NULL);
 }
-#endif
 
 /**
-  * Caller should hold the lock.       
+ * e_intervaltree_new:
+ *
+ * Creates a new #EIntervalTree.
+ *
+ * Returns: The newly-created #EIntervalTree.
+ *
+ * Since: 2.32
  **/
-static EIntervalNode *
-e_intervaltree_search_component (EIntervalTree *tree,
-                                 const gchar *searched_uid,
-                                 const gchar *searched_rid)
+EIntervalTree *
+e_intervaltree_new (void)
 {
-       EIntervalTreePrivate *priv;
-       EIntervalNode *node;
-       gchar *key;
+       return g_object_new (E_TYPE_INTERVALTREE, NULL);
+}
 
-       g_return_val_if_fail (tree != NULL, NULL);
-       g_return_val_if_fail (searched_uid != NULL, NULL);
+/**
+ * e_intervaltree_insert:
+ * @tree: interval tree
+ * @start: start of the interval
+ * @end: end of the interval
+ * @comp: Component
+ * 
+ * Since: 2.32
+ **/
+gboolean
+e_intervaltree_insert (EIntervalTree *tree,
+                       time_t start,
+                       time_t end,
+                       ECalComponent *comp)
+{
+       EIntervalNode *y;
+       EIntervalNode *x;
+       EIntervalNode *newNode;
+       const gchar *uid;
+       gchar *rid;
 
-       priv = tree->priv;
-       if (!searched_uid)
-       {
-               g_warning (
-                       "Searching the interval tree, the component "
-                       " does not have a valid UID skipping it\n");
+       g_return_val_if_fail (E_IS_INTERVALTREE (tree), FALSE);
+       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
 
-               return NULL;
+       g_rec_mutex_lock (&tree->priv->mutex);
+
+       e_cal_component_get_uid (comp, &uid);
+       rid = e_cal_component_get_recurid_as_string (comp);
+       e_intervaltree_remove (tree, uid, rid);
+
+       x = g_new (EIntervalNode, 1);
+       x->min = x->start = start;
+       x->max = x->end = end;
+       x->comp = g_object_ref (comp);
+
+       binary_tree_insert (tree, x);
+       newNode = x;
+       x->red = TRUE;
+
+       fixup_min_max_fields (tree, x->parent);
+       while (x->parent->red) {
+               /* use sentinel instead of checking for root */
+               if (x->parent == x->parent->parent->left) {
+                       y = x->parent->parent->right;
+
+                       if (y->red) {
+                               x->parent->red = FALSE;
+                               y->red = FALSE;
+                               x->parent->parent->red = TRUE;
+                               x = x->parent->parent;
+                       } else {
+                               if (x == x->parent->right) {
+                                       x = x ->parent;
+                                       left_rotate (tree, x);
+                               }
+
+                               x->parent->red = FALSE;
+                               x->parent->parent->red = TRUE;
+                               right_rotate (tree, x->parent->parent);
+                       }
+               } else {
+                       /* case for x->parent == x->parent->parent->right */
+                       y = x->parent->parent->left;
+
+                       if (y->red) {
+                               x->parent->red = FALSE;
+                               y->red = FALSE;
+                               x->parent->parent->red = TRUE;
+                               x = x->parent->parent;
+                       } else {
+                               if (x == x->parent->left) {
+                                       x = x->parent;
+                                       right_rotate (tree, x);
+                               }
+
+                               x->parent->red = FALSE;
+                               x->parent->parent->red = TRUE;
+                               left_rotate (tree, x->parent->parent);
+                       }
+               }
        }
 
-       key = component_key (searched_uid, searched_rid);
-       node = g_hash_table_lookup (priv->id_node_hash, key);
-       g_free (key);
+       tree->priv->root->left->red = FALSE;
+       g_hash_table_insert (
+               tree->priv->id_node_hash,
+               component_key (uid, rid), newNode);
+       g_free (rid);
 
-       return node;
+       g_rec_mutex_unlock (&tree->priv->mutex);
+
+       return TRUE;
 }
 
 /**
@@ -677,28 +577,27 @@ e_intervaltree_remove (EIntervalTree *tree,
                        const gchar *uid,
                        const gchar *rid)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *y;
        EIntervalNode *x;
        EIntervalNode *z;
        EIntervalNode *nil, *root;
        gchar *key;
 
-       g_return_val_if_fail (tree != NULL, FALSE);
+       g_return_val_if_fail (E_IS_INTERVALTREE (tree), FALSE);
 
-       priv = tree->priv;
-       nil = priv->nil;
-       root = priv->root;
-       g_rec_mutex_lock (&priv->mutex);
+       nil = tree->priv->nil;
+       root = tree->priv->root;
+       g_rec_mutex_lock (&tree->priv->mutex);
 
-       z = e_intervaltree_search_component (tree, uid, rid);
+       z = intervaltree_search_component (tree, uid, rid);
 
        if (!z || z == nil) {
-               g_rec_mutex_unlock (&priv->mutex);
+               g_rec_mutex_unlock (&tree->priv->mutex);
                return FALSE;
        }
 
-       y = ((z->left == nil) || (z->right == nil)) ? z : intervaltree_node_next (tree, z);
+       y = ((z->left == nil) || (z->right == nil)) ? z :
+               intervaltree_node_next (tree, z);
        x = (y->left == nil) ? y->right : y->left;
        /* y is to be spliced out. x is it's only child */
 
@@ -706,18 +605,16 @@ e_intervaltree_remove (EIntervalTree *tree,
 
        if (root == x->parent)
                root->left = x;
-       else
-       {
+       else {
                if (y == y->parent->left)
                        y->parent->left = x;
                else
                        y->parent->right = x;
        }
 
-       if (y != z)
-       {
+       if (y != z) {
                /* y (the succesor of z) is the node to be spliced out */
-               g_return_val_if_fail (y != priv->nil, FALSE);
+               g_return_val_if_fail (y != tree->priv->nil, FALSE);
 
                y->max = _TIME_MIN;
                y->min = _TIME_MAX;
@@ -733,115 +630,155 @@ e_intervaltree_remove (EIntervalTree *tree,
 
                fixup_min_max_fields (tree, x->parent);
 
-               if (!(y->red))
-               {
+               if (!(y->red)) {
                        y->red = z->red;
-                       e_intervaltree_fixup_deletion (tree, x);
+                       intervaltree_fixup_deletion (tree, x);
                }
                else
                        y->red = z->red;
-       }
-       else
-       {
+       } else {
                /* z is the node to be spliced out */
 
                fixup_min_max_fields (tree, x->parent);
 
                if (!(y->red))
-                       e_intervaltree_fixup_deletion (tree, x);
+                       intervaltree_fixup_deletion (tree, x);
        }
 
        key = component_key (uid, rid);
-       g_hash_table_remove (priv->id_node_hash, key);
+       g_hash_table_remove (tree->priv->id_node_hash, key);
        g_free (key);
 
        g_object_unref (z->comp);
        g_free (z);
-       g_rec_mutex_unlock (&priv->mutex);
+       g_rec_mutex_unlock (&tree->priv->mutex);
 
        return TRUE;
 }
 
-static void
-intervaltree_finalize (GObject *object)
+/**
+ * e_intervaltree_search:
+ * @tree: interval tree
+ * @start: start of the interval
+ * @end: end of the interval
+ * 
+ * Returns list of nodes that overlaps given interval or %NULL.
+ *
+ * Since: 2.32
+ **/
+GList *
+e_intervaltree_search (EIntervalTree *tree,
+                       time_t start,
+                       time_t end)
 {
-       EIntervalTreePrivate *priv = E_INTERVALTREE_GET_PRIVATE (object);
+       EIntervalNode *node;
+       GList *list = NULL;
+       GList *stack_start = NULL, *pos;
 
-       if (priv->root) {
-               g_free (priv->root);
-               priv->root = NULL;
-       }
+       g_return_val_if_fail (E_IS_INTERVALTREE (tree), NULL);
 
-       if (priv->nil) {
-               g_free (priv->nil);
-               priv->nil = NULL;
-       }
+       g_rec_mutex_lock (&tree->priv->mutex);
 
-       if (priv->id_node_hash) {
-               g_hash_table_destroy (priv->id_node_hash);
-               priv->id_node_hash = NULL;
-       }
+       stack_start = pos = g_list_insert (
+               stack_start, tree->priv->root->left, -1);
 
-       g_rec_mutex_clear (&priv->mutex);
+       while (pos != NULL) {
+               node = (EIntervalNode *) pos->data;
 
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
-}
+               if (node != tree->priv->nil) {
+                       if (compare_intervals (node->start, node->end, start, end) == 0) {
+                               list = g_list_insert (list, node->comp, -1);
+                               g_object_ref (node->comp);
+                       }
 
-static void
-e_intervaltree_class_init (EIntervalTreeClass *class)
-{
-       GObjectClass *object_class;
+                       if (compare_intervals (node->left->min, node->left->max, start, end) == 0)
+                               pos = g_list_insert (pos, node->left, -1);
 
-       g_type_class_add_private (class, sizeof (EIntervalTreePrivate));
+                       if (compare_intervals (node->right->min, node->right->max, start, end) == 0)
+                               pos = g_list_insert (pos, node->right, -1);
+               }
 
-       object_class = G_OBJECT_CLASS (class);
-       object_class->finalize = intervaltree_finalize;
+               pos = pos->next;
+       }
+
+       g_list_free (stack_start);
+
+       g_rec_mutex_unlock (&tree->priv->mutex);
+
+       return list;
 }
 
-static void
-e_intervaltree_init (EIntervalTree *tree)
+/**
+ * e_intervaltree_destroy:
+ * @tree: an #EIntervalTree
+ *
+ * Since: 2.32
+ **/
+void
+e_intervaltree_destroy (EIntervalTree *tree)
 {
-       EIntervalNode *root, *nil;
+       EIntervalNode *node;
+       GList *stack_start = NULL, *pos;
 
-       tree->priv = E_INTERVALTREE_GET_PRIVATE (tree);
+       g_return_if_fail (E_IS_INTERVALTREE (tree));
 
-       tree->priv->nil = nil = g_new (EIntervalNode, 1);
-       nil->parent = nil->left = nil->right = nil;
-       nil->red = FALSE;
-       nil->start = nil->end = nil->max = _TIME_MIN;
-       nil->min = _TIME_MAX;
+       stack_start = pos = g_list_insert (
+               stack_start, tree->priv->root->left, -1);
 
-       tree->priv->root = root = g_new (EIntervalNode, 1);
-       root->parent = root->left = root->right = nil;
-       root->red = FALSE;
-       root->start = _TIME_MAX;
-       root->end = 0;
-       root->max = _TIME_MAX;
-       root->min = _TIME_MIN;
+       while (pos != NULL) {
+               node = (EIntervalNode *) pos->data;
 
-       g_rec_mutex_init (&tree->priv->mutex);
+               if (node != tree->priv->nil) {
+                       pos = g_list_insert (pos, node->left, -1);
+                       pos = g_list_insert (pos, node->right, -1);
 
-       tree->priv->id_node_hash = g_hash_table_new_full (
-               (GHashFunc) g_str_hash,
-               (GEqualFunc) g_str_equal,
-               (GDestroyNotify) g_free,
-               (GDestroyNotify) NULL);
+                       g_object_unref (node->comp);
+                       g_free (node);
+               }
+
+               pos = pos->next;
+       }
+
+       g_list_free (stack_start);
+       g_object_unref (tree);
 }
 
-/**
- * e_intervaltree_new:
- *
- * Creates a new #EIntervalTree.
- *
- * Returns: The newly-created #EIntervalTree.
+#ifdef E_INTERVALTREE_DEBUG
+static void
+e_intervaltree_node_dump (EIntervalTree *tree,
+                          EIntervalNode *node,
+                          gint indent)
+{
+       /*
+       gchar start_time[32] = {0}, end_time[32] = {0};
+       struct tm tm_start_time, tm_end_time;
  *
- * Since: 2.32
- **/
-EIntervalTree *
-e_intervaltree_new (void)
+       localtime_r (&node->start, &tm_start_time);
+       localtime_r (&node->end, &tm_end_time);
+       strftime (start_time, sizeof (start_time), "%Y-%m-%d T%H:%M:%S", &tm_start_time);
+       strftime (end_time, sizeof (end_time), "%Y-%m-%d T%H:%M:%S", &tm_end_time);
+       g_print ("%*s[%s - %s]\n", indent, "", start_time, end_time);
+       */
+       if (node != tree->priv->nil) {
+               g_print (
+                       "%*s[%ld - %ld] [%ld - %ld] red %d\n", indent, "", node->start,
+                       node->end, node->min, node->max, node->red);
+       } else {
+               g_print ("%*s[ - ]\n", indent, "");
+               return;
+       }
+
+       e_intervaltree_node_dump (tree, node->left, indent + 2);
+       e_intervaltree_node_dump (tree, node->right, indent + 2);
+}
+
+void
+e_intervaltree_dump (EIntervalTree *tree)
 {
-       EIntervalTree *tree;
-       tree = g_object_new (E_TYPE_INTERVALTREE, NULL);
-       return tree;
+       g_return_if_fail (E_IS_INTERVALTREE (tree));
+
+       if (tree->priv->root)
+                 e_intervaltree_node_dump (tree, tree->priv->root, 0);
 }
+#endif
+
diff --git a/calendar/libedata-cal/e-cal-backend-intervaltree.h 
b/calendar/libedata-cal/e-cal-backend-intervaltree.h
index 00d53cd..412be30 100644
--- a/calendar/libedata-cal/e-cal-backend-intervaltree.h
+++ b/calendar/libedata-cal/e-cal-backend-intervaltree.h
@@ -31,22 +31,34 @@
 
 #define E_INTERVALTREE_DEBUG 1
 
-#define E_TYPE_INTERVALTREE        (e_intervaltree_get_type ())
-#define E_INTERVALTREE(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_INTERVALTREE, EIntervalTree))
-#define E_INTERVALTREE_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_INTERVALTREE, EIntervalTreeClass))
-#define E_IS_INTERVALTREE(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_INTERVALTREE))
-#define E_IS_INTERVALTREE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_INTERVALTREE))
-#define E_INTERVALTREE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_INTERVALTREE, 
EIntervalTreeClass))
+/* Standard GObject macros */
+#define E_TYPE_INTERVALTREE \
+       (e_intervaltree_get_type ())
+#define E_INTERVALTREE(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_INTERVALTREE, EIntervalTree))
+#define E_INTERVALTREE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_INTERVALTREE, EIntervalTreeClass))
+#define E_IS_INTERVALTREE(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_INTERVALTREE))
+#define E_IS_INTERVALTREE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_INTERVALTREE))
+#define E_INTERVALTREE_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_INTERVALTREE, EIntervalTreeClass))
 
 G_BEGIN_DECLS
 
 /* #undef E_INTERVALTREE_DEBUG */
 /*
- * Implementation of the interval node as described in Introduction to Algorithms
- * book by Cormen et al, chapter 14.3.
+ * Implementation of the interval node as described in Introduction to
+ * Algorithms book by Cormen et al, chapter 14.3.
  *
- * Basically, the interval tree is the red-black tree, the node key is the start
- * of the interval.
+ * Basically, the interval tree is the red-black tree, the node key is
+ * the start of the interval.
  */
 
 typedef struct _EIntervalTree EIntervalTree;
@@ -58,31 +70,31 @@ typedef struct _EIntervalTreePrivate EIntervalTreePrivate;
  *
  * Since: 2.32
  **/
-struct _EIntervalTree
-{
+struct _EIntervalTree {
        GObject parent;
        EIntervalTreePrivate *priv;
 };
 
-struct _EIntervalTreeClass
-{
-       GObjectClass parent;
+struct _EIntervalTreeClass {
+       GObjectClass parent_class;
 };
 
-GType          e_intervaltree_get_type (void);
+GType          e_intervaltree_get_type         (void) G_GNUC_CONST;
+EIntervalTree *        e_intervaltree_new              (void);
+gboolean       e_intervaltree_insert           (EIntervalTree *tree,
+                                                time_t start,
+                                                time_t end,
+                                                ECalComponent *comp);
+gboolean       e_intervaltree_remove           (EIntervalTree *tree,
+                                                const gchar *uid,
+                                                const gchar *rid);
+GList *                e_intervaltree_search           (EIntervalTree *tree,
+                                                time_t start,
+                                                time_t end);
+void           e_intervaltree_destroy          (EIntervalTree *tree);
 
-EIntervalTree * e_intervaltree_new (void);
-
-gboolean e_intervaltree_insert (EIntervalTree *tree, time_t start, time_t end, ECalComponent *comp);
-
-gboolean e_intervaltree_remove (EIntervalTree *tree, const gchar *uid, const gchar *rid);
-
-void e_intervaltree_destroy (EIntervalTree *tree);
-
-GList *
-e_intervaltree_search (EIntervalTree *tree, time_t start, time_t end);
 #ifdef E_INTERVALTREE_DEBUG
-void e_intervaltree_dump (EIntervalTree *tree);
+void           e_intervaltree_dump             (EIntervalTree *tree);
 #endif
 
 G_END_DECLS
diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c
index 8b3261e..bfe3fd1 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -54,254 +54,6 @@ struct _SearchContext {
 
 static ESExpResult *func_is_completed (ESExp *esexp, gint argc, ESExpResult **argv, gpointer data);
 
-/**
- * e_cal_backend_sexp_func_time_now:
- * @esexp: An #ESExp object.
- * @argc: Number of arguments.
- * @argv: The arguments.
- * @data: Closure data.
- *
- * Processes the (time-now) sexp expression.
- *
- * Returns: The result of the function.
- */
-ESExpResult *
-e_cal_backend_sexp_func_time_now (ESExp *esexp,
-                                  gint argc,
-                                  ESExpResult **argv,
-                                  gpointer data)
-{
-       ESExpResult *result;
-
-       if (argc != 0) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects no arguments"),
-                       "time-now");
-               return NULL;
-       }
-
-       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
-       result->value.time = time (NULL);
-
-       return result;
-}
-
-/**
- * e_cal_backend_sexp_func_make_time:
- * @esexp: An #ESExp object.
- * @argc: Number of arguments.
- * @argv: The arguments.
- * @data: Closure data.
- *
- * (make-time ISODATE)
- * ISODATE - string, ISO 8601 date/time representation
- *
- * Constructs a time_t value for the specified date.
- *
- * Returns: The result of the function.
- */
-ESExpResult *
-e_cal_backend_sexp_func_make_time (ESExp *esexp,
-                                   gint argc,
-                                   ESExpResult **argv,
-                                   gpointer data)
-{
-       const gchar *str;
-       time_t t;
-       ESExpResult *result;
-
-       if (argc != 1) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects one argument"),
-                       "make-time");
-               return NULL;
-       }
-
-       if (argv[0]->type != ESEXP_RES_STRING) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be a string"),
-                       "make-time");
-               return NULL;
-       }
-       str = argv[0]->value.string;
-       if (!str || !*str) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be a string"),
-                       "make-time");
-               return NULL;
-       }
-
-       t = time_from_isodate (str);
-       if (t == -1) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be an ISO 8601 "
-                       "date/time string"),
-                       "make-time");
-               return NULL;
-       }
-
-       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
-       result->value.time = t;
-
-       return result;
-}
-
-/**
- * e_cal_backend_sexp_func_time_add_day:
- * @esexp: An #ESExp object.
- * @argc: Number of arguments.
- * @argv: The arguments.
- * @data: Closure data.
- *
- * (time-add-day TIME N)
- * TIME - time_t, base time
- * N - int, number of days to add
- *
- * Adds the specified number of days to a time value.
- *
- * FIXME: TIMEZONES - need to use a timezone or daylight saving changes will
- * make the result incorrect.
- *
- * Returns: The result of the function.
- */
-ESExpResult *
-e_cal_backend_sexp_func_time_add_day (ESExp *esexp,
-                                      gint argc,
-                                      ESExpResult **argv,
-                                      gpointer data)
-{
-       ESExpResult *result;
-       time_t t;
-       gint n;
-
-       if (argc != 2) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects two arguments"),
-                       "time-add-day");
-               return NULL;
-       }
-
-       if (argv[0]->type != ESEXP_RES_TIME) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be a time_t"),
-                       "time-add-day");
-               return NULL;
-       }
-       t = argv[0]->value.time;
-
-       if (argv[1]->type != ESEXP_RES_INT) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the second "
-                       "argument to be an integer"),
-                       "time-add-day");
-               return NULL;
-       }
-       n = argv[1]->value.number;
-
-       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
-       result->value.time = time_add_day (t, n);
-
-       return result;
-}
-
-/**
- * e_cal_backend_sexp_func_time_day_begin:
- * @esexp: An #ESExp object.
- * @argc: Number of arguments.
- * @argv: The arguments.
- * @data: Closure data.
- *
- * (time-day-begin TIME)
- * TIME - time_t, base time
- *
- * Returns the start of the day, according to the local time.
- *
- * FIXME: TIMEZONES - this uses the current Unix timezone.
- *
- * Returns: The result of the function.
- */
-ESExpResult *
-e_cal_backend_sexp_func_time_day_begin (ESExp *esexp,
-                                        gint argc,
-                                        ESExpResult **argv,
-                                        gpointer data)
-{
-       time_t t;
-       ESExpResult *result;
-
-       if (argc != 1) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects one argument"),
-                       "time-day-begin");
-               return NULL;
-       }
-
-       if (argv[0]->type != ESEXP_RES_TIME) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be a time_t"),
-                       "time-day-begin");
-               return NULL;
-       }
-       t = argv[0]->value.time;
-
-       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
-       result->value.time = time_day_begin (t);
-
-       return result;
-}
-
-/**
- * e_cal_backend_sexp_func_time_day_end:
- * @esexp: An #ESExp object.
- * @argc: Number of arguments.
- * @argv: The arguments.
- * @data: Closure data.
- *
- * (time-day-end TIME)
- * TIME - time_t, base time
- *
- * Returns the end of the day, according to the local time.
- *
- * FIXME: TIMEZONES - this uses the current Unix timezone.
- *
- * Returns: The result of the function.
- */
-ESExpResult *
-e_cal_backend_sexp_func_time_day_end (ESExp *esexp,
-                                      gint argc,
-                                      ESExpResult **argv,
-                                      gpointer data)
-{
-       time_t t;
-       ESExpResult *result;
-
-       if (argc != 1) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects one argument"),
-                       "time-day-end");
-               return NULL;
-       }
-
-       if (argv[0]->type != ESEXP_RES_TIME) {
-               e_sexp_fatal_error (
-                       esexp, _("\"%s\" expects the first "
-                       "argument to be a time_t"),
-                       "time-day-end");
-               return NULL;
-       }
-       t = argv[0]->value.time;
-
-       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
-       result->value.time = time_day_end (t);
-
-       return result;
-}
-
 /* (uid? UID)
  *
  * UID - the uid of the component
@@ -882,7 +634,8 @@ func_percent_complete (ESExp *esexp,
 
 /* (contains? FIELD STR)
  *
- * FIELD - string, name of field to match (any, comment, description, summary, location)
+ * FIELD - string, name of field to match
+ *         (any, comment, description, summary, location)
  * STR - string, match string
  *
  * Returns a boolean indicating whether the specified field contains the
@@ -953,7 +706,9 @@ func_contains (ESExp *esexp,
                e_sexp_fatal_error (
                        esexp, _("\"%s\" expects the first "
                        "argument to be either \"any\", "
-                       "\"summary\", or \"description\", or \"location\", or \"attendee\", or \"organizer\", 
or \"classification\""),
+                       "\"summary\", or \"description\", or "
+                       "\"location\", or \"attendee\", or "
+                       "\"organizer\", or \"classification\""),
                        "contains");
                return NULL;
        }
@@ -968,7 +723,7 @@ func_contains (ESExp *esexp,
  *
  * A boolean value for components that have/don't have filled start date/time.
  *
- * Returns: a boolean indicating whether the component has start date/time filled or not.
+ * Returns: whether the component has start date/time filled
  */
 static ESExpResult *
 func_has_start (ESExp *esexp,
@@ -1229,7 +984,9 @@ func_has_recurrences (ESExp *esexp,
        }
 
        result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
-       result->value.boolean = (e_cal_component_has_recurrences (ctx->comp) || e_cal_component_is_instance 
(ctx->comp));
+       result->value.boolean =
+               e_cal_component_has_recurrences (ctx->comp) ||
+               e_cal_component_is_instance (ctx->comp);
 
        return result;
 }
@@ -1316,17 +1073,9 @@ func_completed_before (ESExp *esexp,
                zone = icaltimezone_get_utc_timezone ();
                completed_time = icaltime_as_timet_with_zone (*tt, zone);
 
-#if 0
-               g_print ("Query Time    : %s", ctime (&before_time));
-               g_print ("Completed Time: %s", ctime (&completed_time));
-#endif
-
                /* We want to return TRUE if before_time is after
                 * completed_time. */
                if (difftime (before_time, completed_time) > 0) {
-#if 0
-                       g_print ("  Returning TRUE\n");
-#endif
                        retval = TRUE;
                }
 
@@ -1339,128 +1088,46 @@ func_completed_before (ESExp *esexp,
        return result;
 }
 
-#if 0
-static struct prop_info {
-       ECardSimpleField field_id;
-       const gchar *query_prop;
-       const gchar *ecard_prop;
-#define PROP_TYPE_NORMAL   0x01
-#define PROP_TYPE_LIST     0x02
-#define PROP_TYPE_LISTITEM 0x03
-#define PROP_TYPE_ID 0x04
-       gint prop_type;
-       gboolean (*list_compare)(ECardSimple *ecard, const gchar *str,
-                                gchar *(*compare)(const gchar *, const gchar *));
-
-} prop_info_table[] = {
-#define NORMAL_PROP(f,q,e) {f, q, e, PROP_TYPE_NORMAL, NULL}
-#define ID_PROP {0, "id", NULL, PROP_TYPE_ID, NULL}
-#define LIST_PROP(q,e,c) {0, q, e, PROP_TYPE_LIST, c}
-
-       /* query prop,  ecard prop,   type,              list compare function */
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "file_as" ),
-       LIST_PROP ( "full_name", "full_name", compare_name), /* not really a list, but we need to compare 
both full and surname */
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_URL, "url", "url" ),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MAILER, "mailer", "mailer"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG, "org", "org"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "org_unit"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_OFFICE, "office", "office"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_TITLE, "title", "title"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ROLE, "role", "role"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MANAGER, "manager", "manager"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "assistant"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "nickname"),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "spouse" ),
-       NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NOTE, "note", "note"),
-       ID_PROP,
-       LIST_PROP ( "email", "email", compare_email ),
-       LIST_PROP ( "phone", "phone", compare_phone ),
-       LIST_PROP ( "address", "address", compare_address ),
-       LIST_PROP ( "category", "category", compare_category ),
-       LIST_PROP ( "arbitrary", "arbitrary", compare_arbitrary )
-};
-
-static ESExpResult *
-entry_compare (SearchContext *ctx,
-               struct _ESExp *f,
-               gint argc,
-               struct _ESExpResult **argv,
-               gchar *(*compare)(const gchar *, const gchar *))
+static void
+cal_backend_sexp_finalize (GObject *object)
 {
-       ESExpResult *r;
-       gint truth = FALSE;
-
-       if (argc == 2
-           && argv[0]->type == ESEXP_RES_STRING
-           && argv[1]->type == ESEXP_RES_STRING) {
-               gchar *propname;
-               struct prop_info *info = NULL;
-               gint i;
-               gboolean any_field;
-
-               propname = argv[0]->value.string;
-
-               any_field = !strcmp (propname, "x-evolution-any-field");
-               for (i = 0; i < G_N_ELEMENTS (prop_info_table); i++) {
-                       if (any_field
-                           || !strcmp (prop_info_table[i].query_prop, propname)) {
-                               info = &prop_info_table[i];
-
-                               if (info->prop_type == PROP_TYPE_NORMAL) {
-                                       gchar *prop = NULL;
-                                       /* searches where the query's property
-                                        * maps directly to an ecard property */
-
-                                       prop = e_card_simple_get (ctx->card, info->field_id);
-
-                                       if (prop && compare (prop, argv[1]->value.string)) {
-                                               truth = TRUE;
-                                       }
-                                       if ((!prop) && compare ("", argv[1]->value.string)) {
-                                               truth = TRUE;
-                                       }
-                                       g_free (prop);
-                               } else if (info->prop_type == PROP_TYPE_LIST) {
-                               /* the special searches that match any of the list elements */
-                                       truth = info->list_compare (ctx->card, argv[1]->value.string, 
compare);
-                               } else if (info->prop_type == PROP_TYPE_ID) {
-                                       const gchar *prop = NULL;
-                                       /* searches where the query's property
-                                        * maps directly to an ecard property */
-
-                                       prop = e_card_get_id (ctx->card->card);
-
-                                       if (prop && compare (prop, argv[1]->value.string)) {
-                                               truth = TRUE;
-                                       }
-                                       if ((!prop) && compare ("", argv[1]->value.string)) {
-                                               truth = TRUE;
-                                       }
-                               }
-
-                               /* if we're looking at all fields and find a match,
-                                * or if we're just looking at this one field,
-                                * break. */
-                               if ((any_field && truth)
-                                   || !any_field)
-                                       break;
-                       }
-               }
+       ECalBackendSExpPrivate *priv;
 
-       }
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = truth;
+       priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (object);
 
-       return r;
+       e_sexp_unref (priv->search_sexp);
+       g_free (priv->text);
+       g_free (priv->search_context);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_cal_backend_sexp_parent_class)->finalize (object);
+}
+
+static void
+e_cal_backend_sexp_class_init (ECalBackendSExpClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (ECalBackendSExpPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = cal_backend_sexp_finalize;
+}
+
+static void
+e_cal_backend_sexp_init (ECalBackendSExp *sexp)
+{
+       sexp->priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (sexp);
+       sexp->priv->search_context = g_new (SearchContext, 1);
 }
-#endif
 
 /* 'builtin' functions */
 static struct {
        const gchar *name;
        ESExpFunc *func;
-       gint type;              /* set to 1 if a function can perform shortcut evaluation, or
-                                  doesn't execute everything, 0 otherwise */
+       gint type;      /* set to 1 if a function can perform shortcut
+                        * evaluation, or doesn't execute everything,
+                        * 0 otherwise */
 } symbols[] = {
        /* Time-related functions */
        { "time-now", e_cal_backend_sexp_func_time_now, 0 },
@@ -1486,31 +1153,77 @@ static struct {
 };
 
 /**
- * e_cal_backend_sexp_evaluate_occur_times:
- * @sexp: An #ESExp object.
- * @start: Start of the time window will be stored here.
- * @end: End of the time window will be stored here.
+ * e_cal_backend_card_sexp_new:
+ * @text: The expression to use.
  *
- * Determines biggest time window given by expressions "occur-in-range" in sexp.
+ * Creates a new #ECalBackendSExp from @text.
  *
- * Since: 2.32
+ * Returns: a new #ECalBackendSExp
  */
-gboolean
-e_cal_backend_sexp_evaluate_occur_times (ECalBackendSExp *sexp,
-                                         time_t *start,
-                                         time_t *end)
+ECalBackendSExp *
+e_cal_backend_sexp_new (const gchar *text)
 {
-       g_return_val_if_fail (sexp != NULL, FALSE);
-       g_return_val_if_fail (start != NULL, FALSE);
-       g_return_val_if_fail (end != NULL, FALSE);
+       ECalBackendSExp *sexp;
+       gint ii;
 
-       if (!sexp->priv->search_context->expr_range_set)
-               return FALSE;
+       g_return_val_if_fail (text != NULL, NULL);
 
-       *start = sexp->priv->search_context->expr_range_start;
-       *end = sexp->priv->search_context->expr_range_end;
+       sexp = g_object_new (E_TYPE_CAL_BACKEND_SEXP, NULL);
+       sexp->priv->search_sexp = e_sexp_new ();
+       sexp->priv->text = g_strdup (text);
 
-       return TRUE;
+       for (ii = 0; ii < G_N_ELEMENTS (symbols); ii++) {
+               if (symbols[ii].type == 1) {
+                       e_sexp_add_ifunction (
+                               sexp->priv->search_sexp, 0,
+                               symbols[ii].name,
+                               (ESExpIFunc *) symbols[ii].func,
+                               sexp->priv->search_context);
+               } else {
+                       e_sexp_add_function (
+                               sexp->priv->search_sexp, 0,
+                               symbols[ii].name,
+                               symbols[ii].func,
+                               sexp->priv->search_context);
+               }
+       }
+
+       e_sexp_input_text (sexp->priv->search_sexp, text, strlen (text));
+
+       if (e_sexp_parse (sexp->priv->search_sexp) == -1) {
+               g_warning (
+                       "%s: Error in parsing: %s",
+                       G_STRFUNC, sexp->priv->search_sexp->error);
+               g_object_unref (sexp);
+               sexp = NULL;
+       }
+
+       if (sexp != NULL) {
+               SearchContext *ctx = sexp->priv->search_context;
+
+               ctx->expr_range_set = e_sexp_evaluate_occur_times (
+                       sexp->priv->search_sexp,
+                       &ctx->expr_range_start,
+                       &ctx->expr_range_end);
+       }
+
+       return sexp;
+}
+
+/**
+ * e_cal_backend_sexp_text:
+ * @sexp: An #ECalBackendSExp object.
+ *
+ * Retrieve the text expression for the given #ECalBackendSExp object.
+ *
+ * Returns: the text expression
+ */
+const gchar *
+e_cal_backend_sexp_text (ECalBackendSExp *sexp)
+{
+       g_return_val_if_fail (E_IS_CAL_BACKEND_SEXP (sexp), NULL);
+
+       return sexp->priv->text;
 }
 
 /**
@@ -1519,9 +1232,9 @@ e_cal_backend_sexp_evaluate_occur_times (ECalBackendSExp *sexp,
  * @comp: Component to match against the expression.
  * @cache: an #ETimezoneCache
  *
- * Matches the given ECalComponent against the expression.
+ * Checks if @comp matches @sexp.
  *
- * Returns: TRUE if the component matched the expression, FALSE if not.
+ * Returns: %TRUE if the component matches, %FALSE otherwise
  */
 gboolean
 e_cal_backend_sexp_match_comp (ECalBackendSExp *sexp,
@@ -1556,9 +1269,9 @@ e_cal_backend_sexp_match_comp (ECalBackendSExp *sexp,
  * @object: An iCalendar string.
  * @cache: an #ETimezoneCache
  *
- * Match an iCalendar expression against the expression.
+ * Checks if @object matches @sexp.
  *
- * Returns: TRUE if the object matches the expression, FALSE if not.
+ * Returns: %TRUE if the object matches, %FALSE otherwise
  */
 gboolean
 e_cal_backend_sexp_match_object (ECalBackendSExp *sexp,
@@ -1569,6 +1282,10 @@ e_cal_backend_sexp_match_object (ECalBackendSExp *sexp,
        icalcomponent *icalcomp;
        gboolean retval;
 
+       g_return_val_if_fail (E_IS_CAL_BACKEND_SEXP (sexp), FALSE);
+       g_return_val_if_fail (object != NULL, FALSE);
+       g_return_val_if_fail (E_IS_TIMEZONE_CACHE (cache), FALSE);
+
        icalcomp = icalcomponent_new_from_string ((gchar *) object);
        if (!icalcomp)
                return FALSE;
@@ -1583,105 +1300,289 @@ e_cal_backend_sexp_match_object (ECalBackendSExp *sexp,
        return retval;
 }
 
-
-
 /**
- * e_cal_backend_card_sexp_new:
- * @text: The expression to use.
+ * e_cal_backend_sexp_func_time_now:
+ * @esexp: An #ESExp object.
+ * @argc: Number of arguments.
+ * @argv: The arguments.
+ * @data: Closure data.
  *
- * Creates a new #EXCalBackendSExp object.
+ * Processes the (time-now) sexp expression.
  *
- * Returns: The newly created ECalBackendSExp object.
+ * Returns: The result of the function.
  */
-ECalBackendSExp *
-e_cal_backend_sexp_new (const gchar *text)
+ESExpResult *
+e_cal_backend_sexp_func_time_now (ESExp *esexp,
+                                  gint argc,
+                                  ESExpResult **argv,
+                                  gpointer data)
 {
-       ECalBackendSExp *sexp = g_object_new (E_TYPE_CAL_BACKEND_SEXP, NULL);
-       gint esexp_error;
-       gint i;
+       ESExpResult *result;
 
-       sexp->priv->search_sexp = e_sexp_new ();
-       sexp->priv->text = g_strdup (text);
+       g_return_val_if_fail (esexp != NULL, NULL);
 
-       for (i = 0; i < G_N_ELEMENTS (symbols); i++) {
-               if (symbols[i].type == 1) {
-                       e_sexp_add_ifunction (sexp->priv->search_sexp, 0, symbols[i].name,
-                                            (ESExpIFunc *) symbols[i].func, sexp->priv->search_context);
-               } else {
-                       e_sexp_add_function (
-                               sexp->priv->search_sexp, 0, symbols[i].name,
-                               symbols[i].func, sexp->priv->search_context);
-               }
+       if (argc != 0) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects no arguments"),
+                       "time-now");
+               return NULL;
        }
 
-       e_sexp_input_text (sexp->priv->search_sexp, text, strlen (text));
-       esexp_error = e_sexp_parse (sexp->priv->search_sexp);
+       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
+       result->value.time = time (NULL);
 
-       if (esexp_error == -1) {
-               g_warning ("%s: Error in parsing: %s", G_STRFUNC, sexp->priv->search_sexp->error);
-               g_object_unref (sexp);
-               sexp = NULL;
+       return result;
+}
+
+/**
+ * e_cal_backend_sexp_func_make_time:
+ * @esexp: An #ESExp object.
+ * @argc: Number of arguments.
+ * @argv: The arguments.
+ * @data: Closure data.
+ *
+ * (make-time ISODATE)
+ * ISODATE - string, ISO 8601 date/time representation
+ *
+ * Constructs a time_t value for the specified date.
+ *
+ * Returns: The result of the function.
+ */
+ESExpResult *
+e_cal_backend_sexp_func_make_time (ESExp *esexp,
+                                   gint argc,
+                                   ESExpResult **argv,
+                                   gpointer data)
+{
+       const gchar *str;
+       time_t t;
+       ESExpResult *result;
+
+       g_return_val_if_fail (esexp != NULL, NULL);
+
+       if (argc != 1) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects one argument"),
+                       "make-time");
+               return NULL;
        }
 
-       if (sexp) {
-               SearchContext *ctx = sexp->priv->search_context;
+       if (argv[0]->type != ESEXP_RES_STRING) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be a string"),
+                       "make-time");
+               return NULL;
+       }
+       str = argv[0]->value.string;
+       if (!str || !*str) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be a string"),
+                       "make-time");
+               return NULL;
+       }
 
-               ctx->expr_range_set = e_sexp_evaluate_occur_times (sexp->priv->search_sexp, 
&ctx->expr_range_start, &ctx->expr_range_end);
+       t = time_from_isodate (str);
+       if (t == -1) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be an ISO 8601 "
+                       "date/time string"),
+                       "make-time");
+               return NULL;
        }
 
-       return sexp;
+       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
+       result->value.time = t;
+
+       return result;
 }
 
 /**
- * e_cal_backend_sexp_text:
- * @sexp: An #ECalBackendSExp object.
+ * e_cal_backend_sexp_func_time_add_day:
+ * @esexp: An #ESExp object.
+ * @argc: Number of arguments.
+ * @argv: The arguments.
+ * @data: Closure data.
+ *
+ * (time-add-day TIME N)
+ * TIME - time_t, base time
+ * N - int, number of days to add
  *
- * Retrieve the text expression for the given ECalBackendSExp object.
+ * Adds the specified number of days to a time value.
  *
- * Returns: The text expression.
+ * FIXME: TIMEZONES - need to use a timezone or daylight saving changes will
+ * make the result incorrect.
+ *
+ * Returns: The result of the function.
  */
-const gchar *
-e_cal_backend_sexp_text (ECalBackendSExp *sexp)
+ESExpResult *
+e_cal_backend_sexp_func_time_add_day (ESExp *esexp,
+                                      gint argc,
+                                      ESExpResult **argv,
+                                      gpointer data)
 {
-       ECalBackendSExpPrivate *priv;
+       ESExpResult *result;
+       time_t t;
+       gint n;
 
-       g_return_val_if_fail (sexp != NULL, NULL);
-       g_return_val_if_fail (E_IS_CAL_BACKEND_SEXP (sexp), NULL);
+       g_return_val_if_fail (esexp != NULL, NULL);
 
-       priv = sexp->priv;
+       if (argc != 2) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects two arguments"),
+                       "time-add-day");
+               return NULL;
+       }
 
-       return priv->text;
+       if (argv[0]->type != ESEXP_RES_TIME) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be a time_t"),
+                       "time-add-day");
+               return NULL;
+       }
+       t = argv[0]->value.time;
+
+       if (argv[1]->type != ESEXP_RES_INT) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the second "
+                       "argument to be an integer"),
+                       "time-add-day");
+               return NULL;
+       }
+       n = argv[1]->value.number;
+
+       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
+       result->value.time = time_add_day (t, n);
+
+       return result;
 }
 
-static void
-e_cal_backend_sexp_finalize (GObject *object)
+/**
+ * e_cal_backend_sexp_func_time_day_begin:
+ * @esexp: An #ESExp object.
+ * @argc: Number of arguments.
+ * @argv: The arguments.
+ * @data: Closure data.
+ *
+ * (time-day-begin TIME)
+ * TIME - time_t, base time
+ *
+ * Returns the start of the day, according to the local time.
+ *
+ * FIXME: TIMEZONES - this uses the current Unix timezone.
+ *
+ * Returns: The result of the function.
+ */
+ESExpResult *
+e_cal_backend_sexp_func_time_day_begin (ESExp *esexp,
+                                        gint argc,
+                                        ESExpResult **argv,
+                                        gpointer data)
 {
-       ECalBackendSExpPrivate *priv;
+       time_t t;
+       ESExpResult *result;
 
-       priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (object);
+       g_return_val_if_fail (esexp != NULL, NULL);
 
-       e_sexp_unref (priv->search_sexp);
-       g_free (priv->text);
-       g_free (priv->search_context);
+       if (argc != 1) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects one argument"),
+                       "time-day-begin");
+               return NULL;
+       }
 
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (e_cal_backend_sexp_parent_class)->finalize (object);
+       if (argv[0]->type != ESEXP_RES_TIME) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be a time_t"),
+                       "time-day-begin");
+               return NULL;
+       }
+       t = argv[0]->value.time;
+
+       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
+       result->value.time = time_day_begin (t);
+
+       return result;
 }
 
-static void
-e_cal_backend_sexp_class_init (ECalBackendSExpClass *class)
+/**
+ * e_cal_backend_sexp_func_time_day_end:
+ * @esexp: An #ESExp object.
+ * @argc: Number of arguments.
+ * @argv: The arguments.
+ * @data: Closure data.
+ *
+ * (time-day-end TIME)
+ * TIME - time_t, base time
+ *
+ * Returns the end of the day, according to the local time.
+ *
+ * FIXME: TIMEZONES - this uses the current Unix timezone.
+ *
+ * Returns: The result of the function.
+ */
+ESExpResult *
+e_cal_backend_sexp_func_time_day_end (ESExp *esexp,
+                                      gint argc,
+                                      ESExpResult **argv,
+                                      gpointer data)
 {
-       GObjectClass *object_class;
+       time_t t;
+       ESExpResult *result;
 
-       g_type_class_add_private (class, sizeof (ECalBackendSExpPrivate));
+       g_return_val_if_fail (esexp != NULL, NULL);
 
-       object_class = G_OBJECT_CLASS (class);
-       object_class->finalize = e_cal_backend_sexp_finalize;
+       if (argc != 1) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects one argument"),
+                       "time-day-end");
+               return NULL;
+       }
+
+       if (argv[0]->type != ESEXP_RES_TIME) {
+               e_sexp_fatal_error (
+                       esexp, _("\"%s\" expects the first "
+                       "argument to be a time_t"),
+                       "time-day-end");
+               return NULL;
+       }
+       t = argv[0]->value.time;
+
+       result = e_sexp_result_new (esexp, ESEXP_RES_TIME);
+       result->value.time = time_day_end (t);
+
+       return result;
 }
 
-static void
-e_cal_backend_sexp_init (ECalBackendSExp *sexp)
+/**
+ * e_cal_backend_sexp_evaluate_occur_times:
+ * @sexp: An #ESExp object.
+ * @start: Start of the time window will be stored here.
+ * @end: End of the time window will be stored here.
+ *
+ * Determines biggest time window given by expressions "occur-in-range" in sexp.
+ *
+ * Since: 2.32
+ */
+gboolean
+e_cal_backend_sexp_evaluate_occur_times (ECalBackendSExp *sexp,
+                                         time_t *start,
+                                         time_t *end)
 {
-       sexp->priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (sexp);
-       sexp->priv->search_context = g_new (SearchContext, 1);
+       g_return_val_if_fail (E_IS_CAL_BACKEND_SEXP (sexp), FALSE);
+       g_return_val_if_fail (start != NULL, FALSE);
+       g_return_val_if_fail (end != NULL, FALSE);
+
+       if (!sexp->priv->search_context->expr_range_set)
+               return FALSE;
+
+       *start = sexp->priv->search_context->expr_range_start;
+       *end = sexp->priv->search_context->expr_range_end;
+
+       return TRUE;
 }
+
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 7a13327..64ab709 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -833,8 +833,11 @@ cal_backend_get_timezone (ECalBackend *backend,
 
                        icaltimezone *zone = icaltimezone_get_builtin_timezone (tzid);
                        if (!zone) {
-                               /* Try fetching the timezone from zone directory. There are some timezones 
like MST, US/Pacific etc. which do not appear in
-                               zone.tab, so they will not be available in the libical builtin timezone */
+                               /* Try fetching the timezone from zone
+                                * directory. There are some timezones like
+                                * MST, US/Pacific etc. which do not appear
+                                * in zone.tab, so they will not be available
+                                * in the libical builtin timezone */
                                icalcomp = free_comp = icaltzutil_fetch_timezone (tzid);
                        }
 
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index e2a31e1..328d7bf 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -161,19 +161,51 @@ cal_backend_get_backend_property (ECalBackend *backend,
        g_return_if_fail (prop_name != NULL);
 
        if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENED)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, "TRUE");
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, "TRUE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENING)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, "FALSE");
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_REVISION)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, "0");
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, "0");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_ONLINE)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, e_backend_get_online (E_BACKEND 
(backend)) ? "TRUE" : "FALSE");
+               gboolean online;
+
+               online = e_backend_get_online (E_BACKEND (backend));
+
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, online ? "TRUE" : "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_READONLY)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, e_cal_backend_is_readonly (backend) 
? "TRUE" : "FALSE");
+               gboolean readonly;
+
+               readonly = e_cal_backend_is_readonly (backend);
+
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, readonly ? "TRUE" : "FALSE");
+
        } else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CACHE_DIR)) {
-               e_data_cal_respond_get_backend_property (cal, opid, NULL, e_cal_backend_get_cache_dir 
(backend));
+               const gchar *cache_dir;
+
+               cache_dir = e_cal_backend_get_cache_dir (backend);
+
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, NULL, cache_dir);
+
        } else {
-               e_data_cal_respond_get_backend_property (cal, opid, e_data_cal_create_error_fmt 
(NotSupported, _("Unknown calendar property '%s'"), prop_name), NULL);
+               GError *error;
+
+               error = e_data_cal_create_error_fmt (
+                       NotSupported,
+                       _("Unknown calendar property '%s'"), prop_name);
+
+               /* Takes ownership of the GError. */
+               e_data_cal_respond_get_backend_property (
+                       cal, opid, error, NULL);
        }
 }
 
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index a864b15..c1eb539 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -1611,9 +1611,18 @@ camel_cipher_validity_clone (CamelCipherValidity *vin)
                CamelCipherCertInfo *info = link->data;
 
                if (info->cert_data && info->cert_data_clone && info->cert_data_free)
-                       camel_cipher_validity_add_certinfo_ex (vo, CAMEL_CIPHER_VALIDITY_SIGN, info->name, 
info->email, info->cert_data_clone (info->cert_data), info->cert_data_free, info->cert_data_clone);
+                       camel_cipher_validity_add_certinfo_ex (
+                               vo, CAMEL_CIPHER_VALIDITY_SIGN,
+                               info->name,
+                               info->email,
+                               info->cert_data_clone (info->cert_data),
+                               info->cert_data_free,
+                               info->cert_data_clone);
                else
-                       camel_cipher_validity_add_certinfo (vo, CAMEL_CIPHER_VALIDITY_SIGN, info->name, 
info->email);
+                       camel_cipher_validity_add_certinfo (
+                               vo, CAMEL_CIPHER_VALIDITY_SIGN,
+                               info->name,
+                               info->email);
        }
 
        head = g_queue_peek_head_link (&vin->encrypt.encrypters);
@@ -1621,9 +1630,18 @@ camel_cipher_validity_clone (CamelCipherValidity *vin)
                CamelCipherCertInfo *info = link->data;
 
                if (info->cert_data && info->cert_data_clone && info->cert_data_free)
-                       camel_cipher_validity_add_certinfo_ex (vo, CAMEL_CIPHER_VALIDITY_SIGN, info->name, 
info->email, info->cert_data_clone (info->cert_data), info->cert_data_free, info->cert_data_clone);
+                       camel_cipher_validity_add_certinfo_ex (
+                               vo, CAMEL_CIPHER_VALIDITY_SIGN,
+                               info->name,
+                               info->email,
+                               info->cert_data_clone (info->cert_data),
+                               info->cert_data_free,
+                               info->cert_data_clone);
                else
-                       camel_cipher_validity_add_certinfo (vo, CAMEL_CIPHER_VALIDITY_ENCRYPT, info->name, 
info->email);
+                       camel_cipher_validity_add_certinfo (
+                               vo, CAMEL_CIPHER_VALIDITY_ENCRYPT,
+                               info->name,
+                               info->email);
        }
 
        return vo;
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 4e53686..851bbd1 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -380,10 +380,44 @@ init_sqlite_vfs (void)
 }
 
 #define d(x) if (camel_debug("sqlite")) x
-#define START(stmt)    if (camel_debug("dbtime")) { g_print ("\n===========\nDB SQL operation [%s] 
started\n", stmt); if (!cdb->priv->timer) { cdb->priv->timer = g_timer_new (); } else { 
g_timer_reset(cdb->priv->timer);} }
-#define END    if (camel_debug("dbtime")) { g_timer_stop (cdb->priv->timer); g_print ("DB Operation ended. 
Time Taken : %f\n###########\n", g_timer_elapsed (cdb->priv->timer, NULL)); }
-#define STARTTS(stmt)  if (camel_debug("dbtimets")) { g_print ("\n===========\nDB SQL operation [%s] 
started\n", stmt); if (!cdb->priv->timer) { cdb->priv->timer = g_timer_new (); } else { 
g_timer_reset(cdb->priv->timer);} }
-#define ENDTS  if (camel_debug("dbtimets")) { g_timer_stop (cdb->priv->timer); g_print ("DB Operation ended. 
Time Taken : %f\n###########\n", g_timer_elapsed (cdb->priv->timer, NULL)); }
+#define START(stmt) \
+       if (camel_debug ("dbtime")) { \
+               g_print ( \
+                       "\n===========\n" \
+                       "DB SQL operation [%s] started\n", stmt); \
+               if (!cdb->priv->timer) { \
+                       cdb->priv->timer = g_timer_new (); \
+               } else { \
+                       g_timer_reset (cdb->priv->timer); \
+               } \
+       }
+#define END \
+       if (camel_debug ("dbtime")) { \
+               g_timer_stop (cdb->priv->timer); \
+               g_print ( \
+                       "DB Operation ended. " \
+                       "Time Taken : %f\n###########\n", \
+                       g_timer_elapsed (cdb->priv->timer, NULL)); \
+       }
+#define STARTTS(stmt) \
+       if (camel_debug ("dbtimets")) { \
+               g_print ( \
+                       "\n===========\n" \
+                       "DB SQL operation [%s] started\n", stmt); \
+               if (!cdb->priv->timer) { \
+                       cdb->priv->timer = g_timer_new (); \
+               } else { \
+                       g_timer_reset (cdb->priv->timer); \
+               } \
+       }
+#define ENDTS \
+       if (camel_debug ("dbtimets")) { \
+               g_timer_stop (cdb->priv->timer); \
+               g_print ( \
+                       "DB Operation ended. " \
+                       "Time Taken : %f\n###########\n", \
+                       g_timer_elapsed (cdb->priv->timer, NULL)); \
+       }
 
 struct _CamelDBPrivate {
        GTimer *timer;
@@ -1051,7 +1085,13 @@ camel_db_get_folder_uids (CamelDB *db,
         gchar *sel_query;
         gint ret;
 
-        sel_query = sqlite3_mprintf ("SELECT uid,flags FROM %Q%s%s%s%s", folder_name, sort_by ? " order by " 
: "", sort_by ? sort_by: "", (sort_by && collate) ? " collate " : "", (sort_by && collate) ? collate : "");
+               sel_query = sqlite3_mprintf (
+               "SELECT uid,flags FROM %Q%s%s%s%s",
+               folder_name,
+               sort_by ? " order by " : "",
+               sort_by ? sort_by : "",
+               (sort_by && collate) ? " collate " : "",
+               (sort_by && collate) ? collate : "");
 
         ret = camel_db_select (db, sel_query, read_uids_to_hash_callback, hash, error);
         sqlite3_free (sel_query);
@@ -1218,7 +1258,19 @@ gint
 camel_db_create_folders_table (CamelDB *cdb,
                                GError **error)
 {
-       const gchar *query = "CREATE TABLE IF NOT EXISTS folders ( folder_name TEXT PRIMARY KEY, version 
REAL, flags INTEGER, nextuid INTEGER, time NUMERIC, saved_count INTEGER, unread_count INTEGER, deleted_count 
INTEGER, junk_count INTEGER, visible_count INTEGER, jnd_count INTEGER, bdata TEXT )";
+       const gchar *query = "CREATE TABLE IF NOT EXISTS folders ( "
+               "folder_name TEXT PRIMARY KEY, "
+               "version REAL, "
+               "flags INTEGER, "
+               "nextuid INTEGER, "
+               "time NUMERIC, "
+               "saved_count INTEGER, "
+               "unread_count INTEGER, "
+               "deleted_count INTEGER, "
+               "junk_count INTEGER, "
+               "visible_count INTEGER, "
+               "jnd_count INTEGER, "
+               "bdata TEXT )";
        CAMEL_DB_RELEASE_SQLITE_MEMORY;
        return ((camel_db_command (cdb, query, error)));
 }
@@ -1231,12 +1283,50 @@ camel_db_create_message_info_table (CamelDB *cdb,
        gint ret;
        gchar *table_creation_query, *safe_index;
 
-       /* README: It is possible to compress all system flags into a single column and use just as userflags 
but that makes querying for other applications difficult an d bloats the parsing code. Instead, it is better 
to bloat the tables. Sqlite should have some optimizations for sparse columns etc. */
-       table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS %Q (  uid TEXT PRIMARY KEY , 
flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , 
junk INTEGER , attachment INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , 
subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , 
followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , 
bdata TEXT, created TEXT, modified TEXT)", folder_name);
+       /* README: It is possible to compress all system flags into a single
+        * column and use just as userflags but that makes querying for other
+        * applications difficult and bloats the parsing code. Instead, it is
+        * better to bloat the tables. Sqlite should have some optimizations
+        * for sparse columns etc. */
+       table_creation_query = sqlite3_mprintf (
+               "CREATE TABLE IF NOT EXISTS %Q ( "
+                       "uid TEXT PRIMARY KEY , "
+                       "flags INTEGER , "
+                       "msg_type INTEGER , "
+                       "read INTEGER , "
+                       "deleted INTEGER , "
+                       "replied INTEGER , "
+                       "important INTEGER , "
+                       "junk INTEGER , "
+                       "attachment INTEGER , "
+                       "dirty INTEGER , "
+                       "size INTEGER , "
+                       "dsent NUMERIC , "
+                       "dreceived NUMERIC , "
+                       "subject TEXT , "
+                       "mail_from TEXT , "
+                       "mail_to TEXT , "
+                       "mail_cc TEXT , "
+                       "mlist TEXT , "
+                       "followup_flag TEXT , "
+                       "followup_completed_on TEXT , "
+                       "followup_due_by TEXT , "
+                       "part TEXT , "
+                       "labels TEXT , "
+                       "usertags TEXT , "
+                       "cinfo TEXT , "
+                       "bdata TEXT, "
+                       "created TEXT, "
+                       "modified TEXT)",
+                       folder_name);
        ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
        sqlite3_free (table_creation_query);
 
-       table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS '%q_bodystructure' (  uid TEXT 
PRIMARY KEY , bodystructure TEXT )", folder_name);
+       table_creation_query = sqlite3_mprintf (
+               "CREATE TABLE IF NOT EXISTS '%q_bodystructure' ( "
+                       "uid TEXT PRIMARY KEY , "
+                       "bodystructure TEXT )",
+                       folder_name);
        ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
        sqlite3_free (table_creation_query);
 
@@ -1306,11 +1396,51 @@ camel_db_migrate_folder_prepare (CamelDB *cdb,
                ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
                sqlite3_free (table_creation_query);
 
-               table_creation_query = sqlite3_mprintf ("CREATE TEMP TABLE IF NOT EXISTS 'mem.%q' (  uid TEXT 
PRIMARY KEY , flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important 
INTEGER , junk INTEGER , attachment INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived 
NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , 
followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , 
bdata TEXT, created TEXT, modified TEXT )", folder_name);
+               table_creation_query = sqlite3_mprintf (
+                       "CREATE TEMP TABLE IF NOT EXISTS 'mem.%q' ( "
+                               "uid TEXT PRIMARY KEY , "
+                               "flags INTEGER , "
+                               "msg_type INTEGER , "
+                               "read INTEGER , "
+                               "deleted INTEGER , "
+                               "replied INTEGER , "
+                               "important INTEGER , "
+                               "junk INTEGER , "
+                               "attachment INTEGER , "
+                               "dirty INTEGER , "
+                               "size INTEGER , "
+                               "dsent NUMERIC , "
+                               "dreceived NUMERIC , "
+                               "subject TEXT , "
+                               "mail_from TEXT , "
+                               "mail_to TEXT , "
+                               "mail_cc TEXT , "
+                               "mlist TEXT , "
+                               "followup_flag TEXT , "
+                               "followup_completed_on TEXT , "
+                               "followup_due_by TEXT , "
+                               "part TEXT , "
+                               "labels TEXT , "
+                               "usertags TEXT , "
+                               "cinfo TEXT , "
+                               "bdata TEXT, "
+                               "created TEXT, "
+                               "modified TEXT )",
+                               folder_name);
                ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
                sqlite3_free (table_creation_query);
 
-               table_creation_query = sqlite3_mprintf ("INSERT INTO 'mem.%q' SELECT uid , flags , msg_type , 
read , deleted , replied , important , junk , attachment , dirty , size , dsent , dreceived , subject , 
mail_from , mail_to , mail_cc , mlist , followup_flag , followup_completed_on , followup_due_by , part , 
labels , usertags , cinfo , bdata , strftime(\"%%s\", 'now'), strftime(\"%%s\", 'now') FROM %Q", folder_name, 
folder_name);
+               table_creation_query = sqlite3_mprintf (
+                       "INSERT INTO 'mem.%q' SELECT "
+                       "uid , flags , msg_type , read , deleted , "
+                       "replied , important , junk , attachment , dirty , "
+                       "size , dsent , dreceived , subject , mail_from , "
+                       "mail_to , mail_cc , mlist , followup_flag , "
+                       "followup_completed_on , followup_due_by , "
+                       "part , labels , usertags , cinfo , bdata , "
+                       "strftime(\"%%s\", 'now'), "
+                       "strftime(\"%%s\", 'now') FROM %Q",
+                       folder_name, folder_name);
                ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
                sqlite3_free (table_creation_query);
 
@@ -1341,7 +1471,15 @@ camel_db_migrate_folder_recreate (CamelDB *cdb,
        if (version < 2) {
                GError *local_error = NULL;
 
-               table_creation_query = sqlite3_mprintf ("INSERT INTO %Q SELECT uid , flags , msg_type , read 
, deleted , replied , important , junk , attachment , dirty , size , dsent , dreceived , subject , mail_from 
, mail_to , mail_cc , mlist , followup_flag , followup_completed_on , followup_due_by , part , labels , 
usertags , cinfo , bdata, created, modified FROM 'mem.%q'", folder_name, folder_name);
+               table_creation_query = sqlite3_mprintf (
+                       "INSERT INTO %Q SELECT uid , flags , msg_type , "
+                       "read , deleted , replied , important , junk , "
+                       "attachment , dirty , size , dsent , dreceived , "
+                       "subject , mail_from , mail_to , mail_cc , mlist , "
+                       "followup_flag , followup_completed_on , "
+                       "followup_due_by , part , labels , usertags , "
+                       "cinfo , bdata, created, modified FROM 'mem.%q'",
+                       folder_name, folder_name);
                ret = camel_db_add_to_transaction (cdb, table_creation_query, &local_error);
                sqlite3_free (table_creation_query);
 
@@ -1755,7 +1893,11 @@ camel_db_read_message_info_record_with_uid (CamelDB *cdb,
        gchar *query;
        gint ret;
 
-       query = sqlite3_mprintf ("SELECT uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, 
mail_cc, mlist, part, labels, usertags, cinfo, bdata FROM %Q WHERE uid = %Q", folder_name, uid);
+       query = sqlite3_mprintf (
+               "SELECT uid, flags, size, dsent, dreceived, subject, "
+               "mail_from, mail_to, mail_cc, mlist, part, labels, "
+               "usertags, cinfo, bdata FROM %Q WHERE uid = %Q",
+               folder_name, uid);
        ret = camel_db_select (cdb, query, read_mir_callback, p, error);
        sqlite3_free (query);
 
@@ -1777,7 +1919,10 @@ camel_db_read_message_info_records (CamelDB *cdb,
        gchar *query;
        gint ret;
 
-       query = sqlite3_mprintf ("SELECT uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, 
mail_cc, mlist, part, labels, usertags, cinfo, bdata FROM %Q ", folder_name);
+       query = sqlite3_mprintf (
+               "SELECT uid, flags, size, dsent, dreceived, subject, "
+               "mail_from, mail_to, mail_cc, mlist, part, labels, "
+               "usertags, cinfo, bdata FROM %Q ", folder_name);
        ret = camel_db_select (cdb, query, read_mir_callback, p, error);
        sqlite3_free (query);
 
@@ -1795,7 +1940,12 @@ camel_db_create_deleted_table (CamelDB *cdb,
 {
        gint ret;
        gchar *table_creation_query;
-       table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS Deletes (id INTEGER primary key 
AUTOINCREMENT not null, uid TEXT, time TEXT, mailbox TEXT)");
+       table_creation_query = sqlite3_mprintf (
+               "CREATE TABLE IF NOT EXISTS Deletes ("
+                       "id INTEGER primary key AUTOINCREMENT not null, "
+                       "uid TEXT, "
+                       "time TEXT, "
+                       "mailbox TEXT)");
        ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
        sqlite3_free (table_creation_query);
        return ret;
@@ -1832,7 +1982,10 @@ camel_db_delete_uid (CamelDB *cdb,
 
        ret = camel_db_create_deleted_table (cdb, error);
 
-       tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, 
strftime(\"%%s\", 'now') FROM %Q WHERE uid = %Q", folder, folder, uid);
+       tab = sqlite3_mprintf (
+               "INSERT OR REPLACE INTO Deletes (uid, mailbox, time) "
+               "SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q "
+               "WHERE uid = %Q", folder, folder, uid);
        ret = camel_db_add_to_transaction (cdb, tab, error);
        sqlite3_free (tab);
 
@@ -1970,7 +2123,10 @@ camel_db_clear_folder_summary (CamelDB *cdb,
 
        ret = camel_db_create_deleted_table (cdb, error);
 
-       tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, 
strftime(\"%%s\", 'now') FROM %Q", folder, folder);
+       tab = sqlite3_mprintf (
+               "INSERT OR REPLACE INTO Deletes (uid, mailbox, time) "
+               "SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q",
+               folder, folder);
        ret = camel_db_add_to_transaction (cdb, tab, error);
        sqlite3_free (tab);
 
@@ -2007,7 +2163,10 @@ camel_db_delete_folder (CamelDB *cdb,
 
        ret = camel_db_create_deleted_table (cdb, error);
 
-       tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, 
strftime(\"%%s\", 'now') FROM %Q", folder, folder);
+       tab = sqlite3_mprintf (
+               "INSERT OR REPLACE INTO Deletes (uid, mailbox, time) "
+               "SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q",
+               folder, folder);
        ret = camel_db_add_to_transaction (cdb, tab, error);
        sqlite3_free (tab);
 
@@ -2049,7 +2208,10 @@ camel_db_rename_folder (CamelDB *cdb,
 
        ret = camel_db_create_deleted_table (cdb, error);
 
-       tab = sqlite3_mprintf ("INSERT OR REPLACE INTO Deletes (uid, mailbox, time) SELECT uid, %Q, 
strftime(\"%%s\", 'now') FROM %Q", old_folder, old_folder);
+       tab = sqlite3_mprintf (
+               "INSERT OR REPLACE INTO Deletes (uid, mailbox, time) "
+               "SELECT uid, %Q, strftime(\"%%s\", 'now') FROM %Q",
+               old_folder, old_folder);
        ret = camel_db_add_to_transaction (cdb, tab, error);
        sqlite3_free (tab);
 
@@ -2197,7 +2359,35 @@ camel_db_start_in_memory_transactions (CamelDB *cdb,
        ret = camel_db_command (cdb, cmd, error);
        sqlite3_free (cmd);
 
-       cmd = sqlite3_mprintf ("CREATE TEMPORARY TABLE %Q (  uid TEXT PRIMARY KEY , flags INTEGER , msg_type 
INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment 
INTEGER , dirty INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , 
mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by 
TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT )", CAMEL_DB_IN_MEMORY_TABLE);
+       cmd = sqlite3_mprintf (
+               "CREATE TEMPORARY TABLE %Q ( "
+                       "uid TEXT PRIMARY KEY , "
+                       "flags INTEGER , "
+                       "msg_type INTEGER , "
+                       "read INTEGER , "
+                       "deleted INTEGER , "
+                       "replied INTEGER , "
+                       "important INTEGER , "
+                       "junk INTEGER , "
+                       "attachment INTEGER , "
+                       "dirty INTEGER , "
+                       "size INTEGER , "
+                       "dsent NUMERIC , "
+                       "dreceived NUMERIC , "
+                       "subject TEXT , "
+                       "mail_from TEXT , "
+                       "mail_to TEXT , "
+                       "mail_cc TEXT , "
+                       "mlist TEXT , "
+                       "followup_flag TEXT , "
+                       "followup_completed_on TEXT , "
+                       "followup_due_by TEXT , "
+                       "part TEXT , "
+                       "labels TEXT , "
+                       "usertags TEXT , "
+                       "cinfo TEXT , "
+                       "bdata TEXT )",
+               CAMEL_DB_IN_MEMORY_TABLE);
        ret = camel_db_command (cdb, cmd, error);
        if (ret != 0 )
                abort ();
diff --git a/camel/camel-enums.h b/camel/camel-enums.h
index a3fcb8e..3dd1d98 100644
--- a/camel/camel-enums.h
+++ b/camel/camel-enums.h
@@ -136,7 +136,7 @@ typedef enum { /*< flags >*/
 #define CAMEL_FOLDER_TYPE_MASK (63 << CAMEL_FOLDER_TYPE_BIT)
 
 /* Note: The HTML elements are escaped in the doc comment intentionally,
-   to have them shown as expected in generated documentation. */
+ *       to have them shown as expected in generated documentation. */
 /**
  * CamelMimeFilterToHTMLFlags:
  * @CAMEL_MIME_FILTER_TOHTML_PRE:
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index cc7d062..7fe13a9 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -335,7 +335,9 @@ check_header (CamelSExp *sexp,
                                if (argv[i]->value.string[0] == 0) {
                                        truth = TRUE;
                                } else if (how == CAMEL_SEARCH_MATCH_CONTAINS) {
-                                       /* doesn't make sense to split words on anything but contains i.e. we 
can't have an ending match different words */
+                                       /* Doesn't make sense to split words on
+                                        * anything but contains i.e. we can't
+                                        * have an ending match different words */
                                        words = camel_search_words_split ((const guchar *) 
argv[i]->value.string);
                                        truth = TRUE;
                                        for (j = 0; j < words->len && truth; j++) {
@@ -350,7 +352,10 @@ check_header (CamelSExp *sexp,
 
                                                        truth = raw_header != NULL;
                                                } else
-                                                       truth = camel_search_header_match (header, 
words->words[j]->word, how, type, charset);
+                                                       truth = camel_search_header_match (
+                                                               header,
+                                                               words->words[j]->word,
+                                                               how, type, charset);
                                        }
                                        camel_search_words_free (words);
                                } else {
@@ -358,11 +363,17 @@ check_header (CamelSExp *sexp,
                                                for (raw_header = ((CamelMimePart *) message)->headers; 
raw_header && !truth; raw_header = raw_header->next) {
                                                        /* empty name means any header */
                                                        if (!headername || !*headername || 
!g_ascii_strcasecmp (raw_header->name, headername)) {
-                                                               truth = camel_search_header_match 
(raw_header->value, argv[i]->value.string, how, type, charset);
+                                                               truth = camel_search_header_match (
+                                                                       raw_header->value,
+                                                                       argv[i]->value.string,
+                                                                       how, type, charset);
                                                        }
                                                }
                                        } else
-                                               truth = camel_search_header_match (header, 
argv[i]->value.string, how, type, charset);
+                                               truth = camel_search_header_match (
+                                                       header,
+                                                       argv[i]->value.string,
+                                                       how, type, charset);
                                }
                        }
                }
@@ -449,7 +460,10 @@ match_words_index (CamelFolderSearch *search,
                                                                gint mask;
 
                                                                mask = (GPOINTER_TO_INT (g_hash_table_lookup 
(ht, name))) | (1 << i);
-                                                               g_hash_table_insert (ht, (gchar *) 
camel_pstring_peek (name), GINT_TO_POINTER (mask));
+                                                               g_hash_table_insert (
+                                                                       ht,
+                                                                       (gchar *) camel_pstring_peek (name),
+                                                                       GINT_TO_POINTER (mask));
                                                }
                                                g_object_unref (nc);
                                        }
@@ -1031,10 +1045,19 @@ folder_search_body_contains (CamelSExp *sexp,
                                        truth = TRUE;
                                        if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && 
search->body_index) {
                                                for (j = 0; j < words->len && truth; j++)
-                                                       truth = match_message_index (search->body_index, 
camel_message_info_uid (search->current), words->words[j]->word, error);
+                                                       truth = match_message_index (
+                                                               search->body_index,
+                                                               camel_message_info_uid (search->current),
+                                                               words->words[j]->word,
+                                                               error);
                                        } else {
                                                /* TODO: cache current message incase of multiple body search 
terms */
-                                               truth = match_words_message (search->folder, 
camel_message_info_uid (search->current), words, search->priv->cancellable, error);
+                                               truth = match_words_message (
+                                                       search->folder,
+                                                       camel_message_info_uid (search->current),
+                                                       words,
+                                                       search->priv->cancellable,
+                                                       error);
                                        }
                                        camel_search_words_free (words);
                                }
@@ -1097,7 +1120,13 @@ folder_search_body_regex (CamelSExp *sexp,
                r = camel_sexp_result_new (sexp, CAMEL_SEXP_RES_BOOL);
 
                if (!g_cancellable_is_cancelled (search->priv->cancellable) &&
-                   camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE | 
CAMEL_SEARCH_MATCH_REGEX | CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
+                   camel_search_build_match_regex (
+                               &pattern,
+                               CAMEL_SEARCH_MATCH_ICASE |
+                               CAMEL_SEARCH_MATCH_REGEX |
+                               CAMEL_SEARCH_MATCH_NEWLINE,
+                               argc, argv,
+                               search->priv->error) == 0) {
                        r->value.boolean = camel_search_message_body_contains ((CamelDataWrapper *) msg, 
&pattern);
                        regfree (&pattern);
                } else
@@ -1111,7 +1140,13 @@ folder_search_body_regex (CamelSExp *sexp,
                r->value.ptrarray = g_ptr_array_new ();
 
                if (!g_cancellable_is_cancelled (search->priv->cancellable) &&
-                   camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE | 
CAMEL_SEARCH_MATCH_REGEX | CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
+                   camel_search_build_match_regex (
+                               &pattern,
+                               CAMEL_SEARCH_MATCH_ICASE |
+                               CAMEL_SEARCH_MATCH_REGEX |
+                               CAMEL_SEARCH_MATCH_NEWLINE,
+                               argc, argv,
+                               search->priv->error) == 0) {
                        gint i;
                        GPtrArray *v = search->summary_set ? search->summary_set : search->summary;
                        CamelMimeMessage *message;
@@ -1224,7 +1259,12 @@ folder_search_header_regex (CamelSExp *sexp,
 
                if (argc > 1 && argv[0]->type == CAMEL_SEXP_RES_STRING
                    && (contents = camel_medium_get_header (CAMEL_MEDIUM (msg), argv[0]->value.string))
-                   && camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX | 
CAMEL_SEARCH_MATCH_ICASE, argc - 1, argv + 1, search->priv->error) == 0) {
+                   && camel_search_build_match_regex (
+                               &pattern,
+                               CAMEL_SEARCH_MATCH_REGEX |
+                               CAMEL_SEARCH_MATCH_ICASE,
+                               argc - 1, argv + 1,
+                               search->priv->error) == 0) {
                        r->value.boolean = regexec (&pattern, contents, 0, NULL, 0) == 0;
                        regfree (&pattern);
                } else
@@ -1255,7 +1295,13 @@ folder_search_header_full_regex (CamelSExp *sexp,
 
                r = camel_sexp_result_new (sexp, CAMEL_SEXP_RES_BOOL);
 
-               if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX | 
CAMEL_SEARCH_MATCH_ICASE | CAMEL_SEARCH_MATCH_NEWLINE, argc, argv, search->priv->error) == 0) {
+               if (camel_search_build_match_regex (
+                               &pattern,
+                               CAMEL_SEARCH_MATCH_REGEX |
+                               CAMEL_SEARCH_MATCH_ICASE |
+                               CAMEL_SEARCH_MATCH_NEWLINE,
+                               argc, argv,
+                               search->priv->error) == 0) {
                        gchar *contents;
 
                        contents = get_full_header (msg);
@@ -1500,7 +1546,7 @@ folder_search_uid (CamelSExp *sexp,
 /* this is copied from Evolution's libemail-engine/e-mail-folder-utils.c */
 static gchar *
 mail_folder_uri_build (CamelStore *store,
-                      const gchar *folder_name)
+                       const gchar *folder_name)
 {
        const gchar *uid;
        gchar *encoded_name;
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 1cec5b5..0bcef82 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -863,7 +863,15 @@ imapx_command_start (CamelIMAPXServer *is,
                goto err;
        }
 
-       c (is->tagprefix, "Starting command (active=%d,%s) %c%05u %s\r\n", 
camel_imapx_command_queue_get_length (is->active), is->literal?" literal":"", is->tagprefix, ic->tag, 
cp->data && g_str_has_prefix (cp->data, "LOGIN") ? "LOGIN..." : cp->data);
+       c (
+               is->tagprefix,
+               "Starting command (active=%d,%s) %c%05u %s\r\n",
+               camel_imapx_command_queue_get_length (is->active),
+               is->literal ? " literal" : "",
+               is->tagprefix,
+               ic->tag,
+               cp->data && g_str_has_prefix (cp->data, "LOGIN") ?
+                       "LOGIN..." : cp->data);
 
        string = g_strdup_printf (
                "%c%05u %s\r\n", is->tagprefix, ic->tag, cp->data);
@@ -1256,7 +1264,11 @@ imapx_command_queue (CamelIMAPXServer *is,
 
        camel_imapx_command_close (ic);
 
-       c (is->tagprefix, "enqueue job '%.*s'\n", ((CamelIMAPXCommandPart *) 
ic->parts.head->data)->data_size, ((CamelIMAPXCommandPart *) ic->parts.head->data)->data);
+       c (
+               is->tagprefix,
+               "enqueue job '%.*s'\n",
+               ((CamelIMAPXCommandPart *) ic->parts.head->data)->data_size,
+               ((CamelIMAPXCommandPart *) ic->parts.head->data)->data);
 
        QUEUE_LOCK (is);
 
@@ -1926,7 +1938,10 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
 
                                                mid = (min + max) / 2;
                                                r = &g_array_index (data->infos, struct _refresh_info, mid);
-                                               cmp = imapx_refresh_info_uid_cmp (finfo->uid, r->uid, 
is->priv->context->fetch_order == CAMEL_SORT_ASCENDING);
+                                               cmp = imapx_refresh_info_uid_cmp (
+                                                       finfo->uid,
+                                                       r->uid,
+                                                       is->priv->context->fetch_order == 
CAMEL_SORT_ASCENDING);
 
                                                if (cmp > 0)
                                                        min = mid + 1;
@@ -4989,10 +5004,14 @@ imapx_command_step_fetch_done (CamelIMAPXServer *is,
                //printf ("Total: %d: %d, %d, %d\n", total, fetch_limit, i, data->last_index);
                data->last_index = i;
 
-               /* If its mobile client and  when total=0 (new account setup) fetch only one batch of mails,
-                * on futher attempts download all new mails as per the limit. */
+               /* If its mobile client and when total=0 (new account setup)
+                * fetch only one batch of mails, on futher attempts download
+                * all new mails as per the limit. */
                //printf ("Total: %d: %d\n", total, fetch_limit);
-               for (; i < data->infos->len && (!mobile_mode || (total && i == 0) || ((fetch_limit != -1 && i 
< fetch_limit) || (fetch_limit == -1 && i < batch_count))); i++) {
+               for (; i < data->infos->len &&
+                       (!mobile_mode || (total && i == 0) ||
+                       ((fetch_limit != -1 && i < fetch_limit) ||
+                       (fetch_limit == -1 && i < batch_count))); i++) {
 
                        gint res;
                        struct _refresh_info *r = &g_array_index (data->infos, struct _refresh_info, i);
@@ -5168,8 +5187,15 @@ imapx_job_scan_changes_done (CamelIMAPXServer *is,
                        if (s_minfo && uid_cmp (s_minfo->uid, r->uid, s) == 0) {
                                info = (CamelIMAPXMessageInfo *) s_minfo;
 
-                               if (imapx_update_message_info_flags ((CamelMessageInfo *) info, 
r->server_flags, r->server_user_flags, is->permanentflags, folder, FALSE))
-                                       camel_folder_change_info_change_uid (data->changes, 
camel_message_info_uid (s_minfo));
+                               if (imapx_update_message_info_flags (
+                                               (CamelMessageInfo *) info,
+                                               r->server_flags,
+                                               r->server_user_flags,
+                                               is->permanentflags,
+                                               folder, FALSE))
+                                       camel_folder_change_info_change_uid (
+                                               data->changes,
+                                               camel_message_info_uid (s_minfo));
                                r->exists = TRUE;
                        } else
                                fetch_new = TRUE;
@@ -5778,12 +5804,22 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
                can_qresync = TRUE;
 
        e (
-               is->tagprefix, "folder %s is %sselected, total %u / %u, unread %u / %u, modseq %" 
G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT ", uidnext %u / %u: will %srescan\n",
-               full_name, is_selected?"": "not ", total, ifolder->exists_on_server,
-               camel_folder_summary_get_unread_count (folder->summary), ifolder->unread_on_server,
-               (guint64) isum->modseq, (guint64) ifolder->modseq_on_server,
-               isum->uidnext, ifolder->uidnext_on_server,
-               need_rescan?"":"not ");
+               is->tagprefix,
+               "folder %s is %sselected, "
+               "total %u / %u, unread %u / %u, modseq %"
+               G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT
+               ", uidnext %u / %u: will %srescan\n",
+               full_name,
+               is_selected ? "" : "not ",
+               total,
+               ifolder->exists_on_server,
+               camel_folder_summary_get_unread_count (folder->summary),
+               ifolder->unread_on_server,
+               (guint64) isum->modseq,
+               (guint64) ifolder->modseq_on_server,
+               isum->uidnext,
+               ifolder->uidnext_on_server,
+               need_rescan ? "" : "not ");
 
        /* Fetch new messages first, so that they appear to the user ASAP */
        if (ifolder->exists_on_server > total ||
@@ -5818,16 +5854,26 @@ imapx_job_refresh_info_start (CamelIMAPXJob *job,
                    camel_folder_summary_get_unread_count (folder->summary) != ifolder->unread_on_server ||
                    (isum->modseq != ifolder->modseq_on_server)) {
                        c (
-                               is->tagprefix, "Eep, after QRESYNC we're out of sync. total %u / %u, unread 
%u / %u, modseq %" G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
+                               is->tagprefix,
+                               "Eep, after QRESYNC we're out of sync. "
+                               "total %u / %u, unread %u / %u, modseq %"
+                               G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
                                total, ifolder->exists_on_server,
-                               camel_folder_summary_get_unread_count (folder->summary), 
ifolder->unread_on_server,
-                               isum->modseq, ifolder->modseq_on_server);
+                               camel_folder_summary_get_unread_count (folder->summary),
+                               ifolder->unread_on_server,
+                               isum->modseq,
+                               ifolder->modseq_on_server);
                } else {
                        c (
-                               is->tagprefix, "OK, after QRESYNC we're still in sync. total %u / %u, unread 
%u / %u, modseq %" G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
+                               is->tagprefix,
+                               "OK, after QRESYNC we're still in sync. "
+                               "total %u / %u, unread %u / %u, modseq %"
+                               G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
                                total, ifolder->exists_on_server,
-                               camel_folder_summary_get_unread_count (folder->summary), 
ifolder->unread_on_server,
-                               isum->modseq, ifolder->modseq_on_server);
+                               camel_folder_summary_get_unread_count (folder->summary),
+                               ifolder->unread_on_server,
+                               isum->modseq,
+                               ifolder->modseq_on_server);
                        goto done;
                }
        }
@@ -6610,7 +6656,10 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is,
                                if (si->total != camel_folder_summary_get_saved_count (folder->summary) ||
                                    si->unread != camel_folder_summary_get_unread_count (folder->summary)) {
                                        si->total = camel_folder_summary_get_saved_count (folder->summary);
-                                       if (!mobile_mode) /* Don't mess with server's unread count in mobile 
mode, as what we have downloaded is little */
+                                       /* Don't mess with server's unread
+                                        * count in mobile mode, as what we
+                                        * have downloaded is little. */
+                                       if (!mobile_mode)
                                                si->unread = camel_folder_summary_get_unread_count 
(folder->summary);
                                        camel_store_summary_touch ((CamelStoreSummary *)((CamelIMAPXStore *) 
parent_store)->summary);
                                }
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index aa300ec..d851e5f 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -268,7 +268,10 @@ imapx_update_message_info_flags (CamelMessageInfo *info,
                if (permanent_flags > 0)
                        server_cleared &= permanent_flags;
 
-               camel_message_info_set_flags ((CamelMessageInfo *) xinfo, server_set | server_cleared, 
(xinfo->info.flags | server_set) & ~server_cleared);
+               camel_message_info_set_flags ((
+                       CamelMessageInfo *) xinfo,
+                       server_set | server_cleared,
+                       (xinfo->info.flags | server_set) & ~server_cleared);
 
                xinfo->server_flags = server_flags;
                xinfo->info.flags = xinfo->info.flags & ~CAMEL_MESSAGE_FOLDER_FLAGGED;
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c
index 0d8f441..21d0af3 100644
--- a/camel/camel-mime-filter-basic.c
+++ b/camel/camel-mime-filter-basic.c
@@ -55,32 +55,57 @@ mime_filter_basic_filter (CamelMimeFilter *mime_filter,
        switch (priv->type) {
        case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
                /* wont go to more than 2x size (overly conservative) */
-               camel_mime_filter_set_size (mime_filter, len * 2 + 6, FALSE);
-               newlen = g_base64_encode_step ((const guchar *) in, len, TRUE, mime_filter->outbuf, 
&priv->state, &priv->save);
+               camel_mime_filter_set_size (
+                       mime_filter, len * 2 + 6, FALSE);
+               newlen = g_base64_encode_step (
+                       (const guchar *) in, len,
+                       TRUE,
+                       mime_filter->outbuf,
+                       &priv->state,
+                       &priv->save);
                g_assert (newlen <= len * 2 + 6);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_ENC:
                /* *4 is overly conservative, but will do */
-               camel_mime_filter_set_size (mime_filter, len * 4 + 4, FALSE);
-               newlen = camel_quoted_encode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, (gint *) &priv->save);
+               camel_mime_filter_set_size (
+                       mime_filter, len * 4 + 4, FALSE);
+               newlen = camel_quoted_encode_step (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       (gint *) &priv->save);
                g_assert (newlen <= len * 4 + 4);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_ENC:
                /* won't go to more than 2 * (x + 2) + 62 */
-               camel_mime_filter_set_size (mime_filter, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_uuencode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
priv->uubuf, &priv->state, (guint32 *) &priv->save);
+               camel_mime_filter_set_size (
+                       mime_filter, (len + 2) * 2 + 62, FALSE);
+               newlen = camel_uuencode_step (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       priv->uubuf,
+                       &priv->state,
+                       (guint32 *) &priv->save);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
        case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size (mime_filter, len + 3, FALSE);
-               newlen = g_base64_decode_step (in, len, (guchar *) mime_filter->outbuf, &priv->state, (guint 
*) &priv->save);
+               newlen = g_base64_decode_step (
+                       in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       (guint *) &priv->save);
                g_assert (newlen <= len + 3);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size (mime_filter, len + 2, FALSE);
-               newlen = camel_quoted_decode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, (gint *) &priv->save);
+               newlen = camel_quoted_decode_step (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       (gint *) &priv->save);
                g_assert (newlen <= len + 2);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_DEC:
@@ -120,9 +145,15 @@ mime_filter_basic_filter (CamelMimeFilter *mime_filter,
                }
 
                if ((priv->state & CAMEL_UUDECODE_STATE_BEGIN) && !(priv->state & CAMEL_UUDECODE_STATE_END)) {
-                       /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
-                       camel_mime_filter_set_size (mime_filter, len + 3, FALSE);
-                       newlen = camel_uudecode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, (guint32 *) &priv->save);
+                       /* "begin <mode> <filename>\n" has been
+                        * found, so we can now start decoding */
+                       camel_mime_filter_set_size (
+                               mime_filter, len + 3, FALSE);
+                       newlen = camel_uudecode_step (
+                               (guchar *) in, len,
+                               (guchar *) mime_filter->outbuf,
+                               &priv->state,
+                               (guint32 *) &priv->save);
                } else {
                        newlen = 0;
                }
@@ -160,41 +191,77 @@ mime_filter_basic_complete (CamelMimeFilter *mime_filter,
        switch (priv->type) {
        case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
                /* wont go to more than 2x size (overly conservative) */
-               camel_mime_filter_set_size (mime_filter, len * 2 + 6, FALSE);
+               camel_mime_filter_set_size (
+                       mime_filter, len * 2 + 6, FALSE);
                if (len > 0)
-                       newlen += g_base64_encode_step ((const guchar *) in, len, TRUE, mime_filter->outbuf, 
&priv->state, &priv->save);
-               newlen += g_base64_encode_close (TRUE, mime_filter->outbuf, &priv->state, &priv->save);
+                       newlen += g_base64_encode_step (
+                               (const guchar *) in, len,
+                               TRUE,
+                               mime_filter->outbuf,
+                               &priv->state,
+                               &priv->save);
+               newlen += g_base64_encode_close (
+                       TRUE,
+                       mime_filter->outbuf,
+                       &priv->state,
+                       &priv->save);
                g_assert (newlen <= len * 2 + 6);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_ENC:
                /* *4 is definetly more than needed ... */
-               camel_mime_filter_set_size (mime_filter, len * 4 + 4, FALSE);
-               newlen = camel_quoted_encode_close ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, &priv->save);
+               camel_mime_filter_set_size (
+                       mime_filter, len * 4 + 4, FALSE);
+               newlen = camel_quoted_encode_close (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       &priv->save);
                g_assert (newlen <= len * 4 + 4);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_ENC:
                /* won't go to more than 2 * (x + 2) + 62 */
-               camel_mime_filter_set_size (mime_filter, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_uuencode_close ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
priv->uubuf, &priv->state, (guint32 *) &priv->save);
+               camel_mime_filter_set_size (
+                       mime_filter, (len + 2) * 2 + 62, FALSE);
+               newlen = camel_uuencode_close (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       priv->uubuf,
+                       &priv->state,
+                       (guint32 *) &priv->save);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
        case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size (mime_filter, len, FALSE);
-               newlen = g_base64_decode_step (in, len, (guchar *) mime_filter->outbuf, &priv->state, (guint 
*) &priv->save);
+               newlen = g_base64_decode_step (
+                       in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       (guint *) &priv->save);
                g_assert (newlen <= len);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_DEC:
-               /* output can't possibly exceed the input size, well unless its not really qp, then +2 max */
+               /* output can't possibly exceed the input size,
+                * well unless its not really qp, then +2 max */
                camel_mime_filter_set_size (mime_filter, len + 2, FALSE);
-               newlen = camel_quoted_decode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, (gint *) &priv->save);
+               newlen = camel_quoted_decode_step (
+                       (guchar *) in, len,
+                       (guchar *) mime_filter->outbuf,
+                       &priv->state,
+                       (gint *) &priv->save);
                g_assert (newlen <= len + 2);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_DEC:
                if ((priv->state & CAMEL_UUDECODE_STATE_BEGIN) && !(priv->state & CAMEL_UUDECODE_STATE_END)) {
-                       /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
-                       camel_mime_filter_set_size (mime_filter, len + 3, FALSE);
-                       newlen = camel_uudecode_step ((guchar *) in, len, (guchar *) mime_filter->outbuf, 
&priv->state, (guint32 *) &priv->save);
+                       /* "begin <mode> <filename>\n" has been
+                        * found, so we can now start decoding */
+                       camel_mime_filter_set_size (
+                               mime_filter, len + 3, FALSE);
+                       newlen = camel_uudecode_step (
+                               (guchar *) in, len,
+                               (guchar *) mime_filter->outbuf,
+                               &priv->state,
+                               (guint32 *) &priv->save);
                } else {
                        newlen = 0;
                }
diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c
index 6f8520d..4d8e753 100644
--- a/camel/camel-mime-filter-tohtml.c
+++ b/camel/camel-mime-filter-tohtml.c
@@ -186,7 +186,11 @@ writeln (CamelMimeFilter *mime_filter,
                u = camel_utf8_getc_limit (&inptr, inend);
                switch (u) {
                case 0xffff:
-                       g_warning ("Truncated UTF-8 buffer (The cause might be missing character encoding 
information in the message header. Try a different character encoding.)");
+                       g_warning (
+                               "Truncated UTF-8 buffer (The cause might "
+                               "be missing character encoding information "
+                               "in the message header. Try a different "
+                               "character encoding.)");
                        return outptr;
                case '<':
                        outptr = g_stpcpy (outptr, "&lt;");
diff --git a/camel/camel-store.c b/camel/camel-store.c
index f9c96d9..4807d90 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -2081,21 +2081,63 @@ camel_store_get_folder_info_sync (CamelStore *store,
        if (info && (top == NULL || *top == '\0') && (flags & CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL) == 0) {
                if (store->flags & CAMEL_STORE_VTRASH)
                        /* the name of the Trash folder, used for deleted messages */
-                       add_special_info (store, info, CAMEL_VTRASH_NAME, _("Trash"), FALSE, 
CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_VTRASH | CAMEL_FOLDER_TYPE_TRASH);
+                       add_special_info (
+                               store,
+                               info,
+                               CAMEL_VTRASH_NAME,
+                               _("Trash"),
+                               FALSE,
+                               CAMEL_FOLDER_VIRTUAL |
+                               CAMEL_FOLDER_SYSTEM |
+                               CAMEL_FOLDER_VTRASH |
+                               CAMEL_FOLDER_TYPE_TRASH);
                if (store->flags & CAMEL_STORE_VJUNK)
                        /* the name of the Junk folder, used for spam messages */
-                       add_special_info (store, info, CAMEL_VJUNK_NAME, _("Junk"), TRUE, 
CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_VTRASH | CAMEL_FOLDER_TYPE_JUNK);
+                       add_special_info (
+                               store,
+                               info,
+                               CAMEL_VJUNK_NAME,
+                               _("Junk"),
+                               TRUE,
+                               CAMEL_FOLDER_VIRTUAL |
+                               CAMEL_FOLDER_SYSTEM |
+                               CAMEL_FOLDER_VTRASH |
+                               CAMEL_FOLDER_TYPE_JUNK);
        } else if (!info && top && (flags & CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL) == 0) {
                CamelFolderInfo *root_info = NULL;
 
                if ((store->flags & CAMEL_STORE_VTRASH) != 0 && g_str_equal (top, CAMEL_VTRASH_NAME)) {
-                       root_info = class->get_folder_info_sync (store, NULL, flags & 
(~CAMEL_STORE_FOLDER_INFO_RECURSIVE), cancellable, error);
-                       if (root_info)
-                               add_special_info (store, root_info, CAMEL_VTRASH_NAME, _("Trash"), FALSE, 
CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_VTRASH | CAMEL_FOLDER_TYPE_TRASH);
+                       root_info = class->get_folder_info_sync (
+                               store, NULL,
+                               flags & (~CAMEL_STORE_FOLDER_INFO_RECURSIVE),
+                               cancellable, error);
+                       if (root_info != NULL)
+                               add_special_info (
+                                       store,
+                                       root_info,
+                                       CAMEL_VTRASH_NAME,
+                                       _("Trash"),
+                                       FALSE,
+                                       CAMEL_FOLDER_VIRTUAL |
+                                       CAMEL_FOLDER_SYSTEM |
+                                       CAMEL_FOLDER_VTRASH |
+                                       CAMEL_FOLDER_TYPE_TRASH);
                } else if ((store->flags & CAMEL_STORE_VJUNK) != 0 && g_str_equal (top, CAMEL_VJUNK_NAME)) {
-                       root_info = class->get_folder_info_sync (store, NULL, flags & 
(~CAMEL_STORE_FOLDER_INFO_RECURSIVE), cancellable, error);
-                       if (root_info)
-                               add_special_info (store, root_info, CAMEL_VJUNK_NAME, _("Junk"), TRUE, 
CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_VTRASH | CAMEL_FOLDER_TYPE_JUNK);
+                       root_info = class->get_folder_info_sync (
+                               store, NULL,
+                               flags & (~CAMEL_STORE_FOLDER_INFO_RECURSIVE),
+                               cancellable, error);
+                       if (root_info != NULL)
+                               add_special_info (
+                                       store,
+                                       root_info,
+                                       CAMEL_VJUNK_NAME,
+                                       _("Junk"),
+                                       TRUE,
+                                       CAMEL_FOLDER_VIRTUAL |
+                                       CAMEL_FOLDER_SYSTEM |
+                                       CAMEL_FOLDER_VTRASH |
+                                       CAMEL_FOLDER_TYPE_JUNK);
                }
 
                if (root_info) {
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 09b86ff..9e58400 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -557,8 +557,8 @@ enable_ssl (CamelTcpStreamSSL *ssl,
                static gchar v2_hello = -1;
 
                /* Zarafa server with disabled SSL v2 rejects connection when
-                  SSL v2 compatible hello is sent, thus disabled this by default.
-                  After all, SSL v3 should be used in general these days anyway.
+                * SSL v2 compatible hello is sent, thus disabled this by default.
+                * After all, SSL v3 should be used in general these days anyway.
                */
                if (v2_hello == -1)
                        v2_hello = g_strcmp0 (g_getenv ("CAMEL_SSL_V2_HELLO"), "1") == 0 ? 1 : 0;
diff --git a/camel/camel-vee-data-cache.c b/camel/camel-vee-data-cache.c
index 812c871..5a82ce8 100644
--- a/camel/camel-vee-data-cache.c
+++ b/camel/camel-vee-data-cache.c
@@ -27,31 +27,47 @@
 
 #include "camel-vee-data-cache.h"
 
+#define CAMEL_VEE_SUBFOLDER_DATA_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_VEE_SUBFOLDER_DATA, CamelVeeSubfolderDataPrivate))
+
 struct _CamelVeeSubfolderDataPrivate {
        CamelFolder *folder;
        const gchar *folder_id; /* stored in string pool */
 };
 
-G_DEFINE_TYPE (CamelVeeSubfolderData, camel_vee_subfolder_data, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+       CamelVeeSubfolderData,
+       camel_vee_subfolder_data,
+       G_TYPE_OBJECT)
 
 static void
-camel_vee_subfolder_data_dispose (GObject *object)
+vee_subfolder_data_dispose (GObject *object)
 {
-       CamelVeeSubfolderData *data;
+       CamelVeeSubfolderDataPrivate *priv;
 
-       data = CAMEL_VEE_SUBFOLDER_DATA (object);
-       if (data->priv) {
-               if (data->priv->folder)
-                       g_object_unref (data->priv->folder);
-               data->priv->folder = NULL;
+       priv = CAMEL_VEE_SUBFOLDER_DATA_GET_PRIVATE (object);
 
-               if (data->priv->folder_id)
-                       camel_pstring_free (data->priv->folder_id);
-               data->priv->folder_id = NULL;
-       }
+       g_clear_object (&priv->folder);
 
-       /* Chain up to parent's dispose () method. */
-       G_OBJECT_CLASS (camel_vee_subfolder_data_parent_class)->dispose (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (camel_vee_subfolder_data_parent_class)->
+               dispose (object);
+}
+
+static void
+vee_subfolder_data_finalize (GObject *object)
+{
+       CamelVeeSubfolderDataPrivate *priv;
+
+       priv = CAMEL_VEE_SUBFOLDER_DATA_GET_PRIVATE (object);
+
+       if (priv->folder_id != NULL)
+               camel_pstring_free (priv->folder_id);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (camel_vee_subfolder_data_parent_class)->
+               finalize (object);
 }
 
 static void
@@ -62,13 +78,14 @@ camel_vee_subfolder_data_class_init (CamelVeeSubfolderDataClass *class)
        g_type_class_add_private (class, sizeof (CamelVeeSubfolderDataPrivate));
 
        object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = camel_vee_subfolder_data_dispose;
+       object_class->dispose = vee_subfolder_data_dispose;
+       object_class->finalize = vee_subfolder_data_finalize;
 }
 
 static void
 camel_vee_subfolder_data_init (CamelVeeSubfolderData *data)
 {
-       data->priv = G_TYPE_INSTANCE_GET_PRIVATE (data, CAMEL_TYPE_VEE_SUBFOLDER_DATA, 
CamelVeeSubfolderDataPrivate);
+       data->priv = CAMEL_VEE_SUBFOLDER_DATA_GET_PRIVATE (data);
 }
 
 static void
@@ -168,36 +185,51 @@ camel_vee_subfolder_data_get_folder_id (CamelVeeSubfolderData *data)
 
 /* ----------------------------------------------------------------------- */
 
+#define CAMEL_VEE_MESSAGE_INFO_DATA_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_VEE_MESSAGE_INFO_DATA, CamelVeeMessageInfoDataPrivate))
+
 struct _CamelVeeMessageInfoDataPrivate {
        CamelVeeSubfolderData *subfolder_data;
        const gchar *orig_message_uid; /* stored in string pool */
        const gchar *vee_message_uid; /* stored in string pool */
 };
 
-G_DEFINE_TYPE (CamelVeeMessageInfoData, camel_vee_message_info_data, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+       CamelVeeMessageInfoData,
+       camel_vee_message_info_data,
+       G_TYPE_OBJECT)
 
 static void
-camel_vee_message_info_data_dispose (GObject *object)
+vee_message_info_data_dispose (GObject *object)
 {
-       CamelVeeMessageInfoData *data;
+       CamelVeeMessageInfoDataPrivate *priv;
 
-       data = CAMEL_VEE_MESSAGE_INFO_DATA (object);
-       if (data->priv) {
-               if (data->priv->subfolder_data)
-                       g_object_unref (data->priv->subfolder_data);
-               data->priv->subfolder_data = NULL;
+       priv = CAMEL_VEE_MESSAGE_INFO_DATA_GET_PRIVATE (object);
 
-               if (data->priv->orig_message_uid)
-                       camel_pstring_free (data->priv->orig_message_uid);
-               data->priv->orig_message_uid = NULL;
+       g_clear_object (&priv->subfolder_data);
 
-               if (data->priv->vee_message_uid)
-                       camel_pstring_free (data->priv->vee_message_uid);
-               data->priv->vee_message_uid = NULL;
-       }
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (camel_vee_message_info_data_parent_class)->
+               dispose (object);
+}
 
-       /* Chain up to parent's dispose () method. */
-       G_OBJECT_CLASS (camel_vee_message_info_data_parent_class)->dispose (object);
+static void
+vee_message_info_data_finalize (GObject *object)
+{
+       CamelVeeMessageInfoDataPrivate *priv;
+
+       priv = CAMEL_VEE_MESSAGE_INFO_DATA_GET_PRIVATE (object);
+
+       if (priv->orig_message_uid != NULL)
+               camel_pstring_free (priv->orig_message_uid);
+
+       if (priv->vee_message_uid != NULL)
+               camel_pstring_free (priv->vee_message_uid);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (camel_vee_message_info_data_parent_class)->
+               finalize (object);
 }
 
 static void
@@ -205,16 +237,18 @@ camel_vee_message_info_data_class_init (CamelVeeMessageInfoDataClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (CamelVeeMessageInfoDataPrivate));
+       g_type_class_add_private (
+               class, sizeof (CamelVeeMessageInfoDataPrivate));
 
        object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = camel_vee_message_info_data_dispose;
+       object_class->dispose = vee_message_info_data_dispose;
+       object_class->finalize = vee_message_info_data_finalize;
 }
 
 static void
 camel_vee_message_info_data_init (CamelVeeMessageInfoData *data)
 {
-       data->priv = G_TYPE_INSTANCE_GET_PRIVATE (data, CAMEL_TYPE_VEE_MESSAGE_INFO_DATA, 
CamelVeeMessageInfoDataPrivate);
+       data->priv = CAMEL_VEE_MESSAGE_INFO_DATA_GET_PRIVATE (data);
 }
 
 /**
@@ -292,6 +326,10 @@ camel_vee_message_info_data_get_vee_message_uid (CamelVeeMessageInfoData *data)
 
 /* ----------------------------------------------------------------------- */
 
+#define CAMEL_VEE_DATA_CACHE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_VEE_DATA_CACHE, CamelVeeDataCachePrivate))
+
 struct _CamelVeeDataCachePrivate {
        GMutex sf_mutex; /* guards subfolder_hash */
        GHashTable *subfolder_hash; /* CamelFolder * => CamelVeeSubfolderData * */
@@ -336,23 +374,25 @@ vee_data_equal (gconstpointer v1,
 }
 
 static void
-camel_vee_data_cache_dispose (GObject *object)
+vee_data_cache_dispose (GObject *object)
 {
-       CamelVeeDataCache *data_cache;
+       CamelVeeDataCachePrivate *priv;
 
-       data_cache = CAMEL_VEE_DATA_CACHE (object);
-       if (data_cache->priv) {
-               if (data_cache->priv->subfolder_hash)
-                       g_hash_table_destroy (data_cache->priv->subfolder_hash);
-               data_cache->priv->subfolder_hash = NULL;
+       priv = CAMEL_VEE_DATA_CACHE_GET_PRIVATE (object);
 
-               if (data_cache->priv->orig_message_uid_hash)
-                       g_hash_table_destroy (data_cache->priv->orig_message_uid_hash);
-               data_cache->priv->orig_message_uid_hash = NULL;
+       if (priv->subfolder_hash != NULL) {
+               g_hash_table_destroy (priv->subfolder_hash);
+               priv->subfolder_hash = NULL;
+       }
 
-               if (data_cache->priv->vee_message_uid_hash)
-                       g_hash_table_destroy (data_cache->priv->vee_message_uid_hash);
-               data_cache->priv->vee_message_uid_hash = NULL;
+       if (priv->orig_message_uid_hash != NULL) {
+               g_hash_table_destroy (priv->orig_message_uid_hash);
+               priv->orig_message_uid_hash = NULL;
+       }
+
+       if (priv->vee_message_uid_hash != NULL) {
+               g_hash_table_destroy (priv->vee_message_uid_hash);
+               priv->vee_message_uid_hash = NULL;
        }
 
        /* Chain up to parent's dispose () method. */
@@ -360,15 +400,14 @@ camel_vee_data_cache_dispose (GObject *object)
 }
 
 static void
-camel_vee_data_cache_finalize (GObject *object)
+vee_data_cache_finalize (GObject *object)
 {
-       CamelVeeDataCache *data_cache;
+       CamelVeeDataCachePrivate *priv;
 
-       data_cache = CAMEL_VEE_DATA_CACHE (object);
-       if (data_cache->priv) {
-               g_mutex_clear (&data_cache->priv->sf_mutex);
-               g_mutex_clear (&data_cache->priv->mi_mutex);
-       }
+       priv = CAMEL_VEE_DATA_CACHE_GET_PRIVATE (object);
+
+       g_mutex_clear (&priv->sf_mutex);
+       g_mutex_clear (&priv->mi_mutex);
 
        /* Chain up to parent's finalize () method. */
        G_OBJECT_CLASS (camel_vee_data_cache_parent_class)->finalize (object);
@@ -382,14 +421,14 @@ camel_vee_data_cache_class_init (CamelVeeDataCacheClass *class)
        g_type_class_add_private (class, sizeof (CamelVeeDataCachePrivate));
 
        object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = camel_vee_data_cache_dispose;
-       object_class->finalize = camel_vee_data_cache_finalize;
+       object_class->dispose = vee_data_cache_dispose;
+       object_class->finalize = vee_data_cache_finalize;
 }
 
 static void
 camel_vee_data_cache_init (CamelVeeDataCache *data_cache)
 {
-       data_cache->priv = G_TYPE_INSTANCE_GET_PRIVATE (data_cache, CAMEL_TYPE_VEE_DATA_CACHE, 
CamelVeeDataCachePrivate);
+       data_cache->priv = CAMEL_VEE_DATA_CACHE_GET_PRIVATE (data_cache);
 
        g_mutex_init (&data_cache->priv->sf_mutex);
        data_cache->priv->subfolder_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, 
g_object_unref);
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 8250f69..c4e1c1b 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -33,6 +33,10 @@
 #include "camel-vee-folder.h"
 #include "camel-vee-store.h"
 
+#define CAMEL_VEE_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_VEE_STORE, CamelVeeStorePrivate))
+
 /* Translators: 'Unmatched' is a folder name under Search folders where are shown
  * all messages not belonging into any other configured search folder */
 #define PRETTY_UNMATCHED_FOLDER_NAME _("Unmatched")
@@ -56,8 +60,7 @@ enum {
 
 G_DEFINE_TYPE (CamelVeeStore, camel_vee_store, CAMEL_TYPE_STORE)
 
-struct _CamelVeeStorePrivate
-{
+struct _CamelVeeStorePrivate {
        CamelVeeDataCache *vee_data_cache;
        CamelVeeFolder *unmatched_folder;
        gboolean unmatched_enabled;
@@ -113,16 +116,53 @@ change_folder (CamelStore *store,
 }
 
 static void
+vee_store_set_property (GObject *object,
+                        guint property_id,
+                        const GValue *value,
+                        GParamSpec *pspec)
+{
+       switch (property_id) {
+               case PROP_UNMATCHED_ENABLED:
+                       camel_vee_store_set_unmatched_enabled (
+                               CAMEL_VEE_STORE (object),
+                               g_value_get_boolean (value));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+vee_store_get_property (GObject *object,
+                        guint property_id,
+                        GValue *value,
+                        GParamSpec *pspec)
+{
+       switch (property_id) {
+               case PROP_UNMATCHED_ENABLED:
+                       g_value_set_boolean (
+                               value,
+                               camel_vee_store_get_unmatched_enabled (
+                               CAMEL_VEE_STORE (object)));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
 vee_store_finalize (GObject *object)
 {
-       CamelVeeStore *vee_store = CAMEL_VEE_STORE (object);
+       CamelVeeStorePrivate *priv;
 
-       g_object_unref (vee_store->priv->unmatched_folder);
-       g_object_unref (vee_store->priv->vee_data_cache);
-       g_hash_table_destroy (vee_store->priv->subfolder_usage_counts);
-       g_hash_table_destroy (vee_store->priv->vuid_usage_counts);
-       g_mutex_clear (&vee_store->priv->sf_counts_mutex);
-       g_mutex_clear (&vee_store->priv->vu_counts_mutex);
+       priv = CAMEL_VEE_STORE_GET_PRIVATE (object);
+
+       g_object_unref (priv->unmatched_folder);
+       g_object_unref (priv->vee_data_cache);
+       g_hash_table_destroy (priv->subfolder_usage_counts);
+       g_hash_table_destroy (priv->vuid_usage_counts);
+       g_mutex_clear (&priv->sf_counts_mutex);
+       g_mutex_clear (&priv->vu_counts_mutex);
 
        /* Chain up to parent's finalize () method. */
        G_OBJECT_CLASS (camel_vee_store_parent_class)->finalize (object);
@@ -152,40 +192,6 @@ vee_store_constructed (GObject *object)
        g_mutex_init (&vee_store->priv->vu_counts_mutex);
 }
 
-static void
-vee_store_get_property (GObject *object,
-                        guint property_id,
-                        GValue *value,
-                        GParamSpec *pspec)
-{
-       switch (property_id) {
-               case PROP_UNMATCHED_ENABLED:
-                       g_value_set_boolean (
-                               value, camel_vee_store_get_unmatched_enabled (
-                               CAMEL_VEE_STORE (object)));
-                       return;
-       }
-
-       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-vee_store_set_property (GObject *object,
-                        guint property_id,
-                        const GValue *value,
-                        GParamSpec *pspec)
-{
-       switch (property_id) {
-               case PROP_UNMATCHED_ENABLED:
-                       camel_vee_store_set_unmatched_enabled (
-                               CAMEL_VEE_STORE (object),
-                               g_value_get_boolean (value));
-                       return;
-       }
-
-       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
 static gchar *
 vee_store_get_name (CamelService *service,
                     gboolean brief)
@@ -506,10 +512,10 @@ camel_vee_store_class_init (CamelVeeStoreClass *class)
        g_type_class_add_private (class, sizeof (CamelVeeStorePrivate));
 
        object_class = G_OBJECT_CLASS (class);
+       object_class->set_property = vee_store_set_property;
+       object_class->get_property = vee_store_get_property;
        object_class->finalize = vee_store_finalize;
        object_class->constructed = vee_store_constructed;
-       object_class->get_property = vee_store_get_property;
-       object_class->set_property = vee_store_set_property;
 
        service_class = CAMEL_SERVICE_CLASS (class);
        service_class->get_name = vee_store_get_name;
@@ -539,7 +545,7 @@ camel_vee_store_init (CamelVeeStore *vee_store)
 {
        CamelStore *store = CAMEL_STORE (vee_store);
 
-       vee_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (vee_store, CAMEL_TYPE_VEE_STORE, CamelVeeStorePrivate);
+       vee_store->priv = CAMEL_VEE_STORE_GET_PRIVATE (vee_store);
        vee_store->priv->vee_data_cache = camel_vee_data_cache_new ();
        vee_store->priv->unmatched_enabled = TRUE;
 
diff --git a/camel/providers/local/camel-local-provider.c b/camel/providers/local/camel-local-provider.c
index 17d8593..996355a 100644
--- a/camel/providers/local/camel-local-provider.c
+++ b/camel/providers/local/camel-local-provider.c
@@ -109,7 +109,9 @@ static CamelProviderConfEntry spool_conf_entries[] = {
 static CamelProvider spool_file_provider = {
        "spool",
        N_("Standard Unix mbox spool file"),
-       N_("For reading and storing local mail in external standard mbox spool files.\nMay also be used to 
read a tree of Elm, Pine, or Mutt style folders."),
+       N_("For reading and storing local mail in external standard mbox "
+       "spool files.\nMay also be used to read a tree of Elm, Pine, or Mutt "
+       "style folders."),
        "mail",
        CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
        CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE | CAMEL_URL_FRAGMENT_IS_PATH,
@@ -121,7 +123,9 @@ static CamelProvider spool_file_provider = {
 static CamelProvider spool_directory_provider = {
        "spooldir",
        N_("Standard Unix mbox spool directory"),
-       N_("For reading and storing local mail in external standard mbox spool files.\nMay also be used to 
read a tree of Elm, Pine, or Mutt style folders."),
+       N_("For reading and storing local mail in external standard mbox "
+       "spool files.\nMay also be used to read a tree of Elm, Pine, or Mutt "
+       "style folders."),
        "mail",
        CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
        CAMEL_URL_NEED_PATH | CAMEL_URL_NEED_PATH_DIR | CAMEL_URL_PATH_IS_ABSOLUTE | 
CAMEL_URL_FRAGMENT_IS_PATH,
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 224ea1b..36fc3e1 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -43,19 +43,43 @@
 
 #define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
 
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, GError **error);
-static gboolean summary_header_from_db (CamelFolderSummary *, CamelFIRecord *);
+static CamelFIRecord *
+               summary_header_to_db            (CamelFolderSummary *,
+                                                GError **error);
+static gboolean        summary_header_from_db          (CamelFolderSummary *,
+                                                CamelFIRecord *);
 
-static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
-
-static gint local_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, 
CamelLocalMessageInfo *mi);
-static gchar *local_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
-
-static gint local_summary_load (CamelLocalSummary *cls, gint forceindex, GError **error);
-static gint local_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable 
*cancellable, GError **error);
-static gint local_summary_sync (CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, 
GCancellable *cancellable, GError **error);
-static CamelMessageInfo *local_summary_add (CamelLocalSummary *cls, CamelMimeMessage *msg, const 
CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
-static gint local_summary_need_index (void);
+static CamelMessageInfo *
+               message_info_new_from_header    (CamelFolderSummary *,
+                                                struct _camel_header_raw *);
+
+static gint    local_summary_decode_x_evolution
+                                               (CamelLocalSummary *cls,
+                                                const gchar *xev,
+                                                CamelLocalMessageInfo *mi);
+static gchar * local_summary_encode_x_evolution
+                                               (CamelLocalSummary *cls,
+                                                const CamelLocalMessageInfo *mi);
+
+static gint    local_summary_load              (CamelLocalSummary *cls,
+                                                gint forceindex,
+                                                GError **error);
+static gint    local_summary_check             (CamelLocalSummary *cls,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static gint    local_summary_sync              (CamelLocalSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static CamelMessageInfo *
+               local_summary_add               (CamelLocalSummary *cls,
+                                                CamelMimeMessage *msg,
+                                                const CamelMessageInfo *info,
+                                                CamelFolderChangeInfo *,
+                                                GError **error);
+static gint    local_summary_need_index        (void);
 
 G_DEFINE_TYPE (CamelLocalSummary, camel_local_summary, CAMEL_TYPE_FOLDER_SUMMARY)
 
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 9afec8e..53d0230 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -39,11 +39,9 @@
 
 #define d(x)
 
-G_DEFINE_TYPE (CamelMaildirStore, camel_maildir_store, CAMEL_TYPE_LOCAL_STORE)
-
-struct _CamelMaildirStorePrivate {
-       gboolean already_migrated;
-};
+#define CAMEL_MAILDIR_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MAILDIR_STORE, CamelMaildirStorePrivate))
 
 /* after the space is a version of the folder structure */
 #define MAILDIR_CONTENT_VERSION_STR  "maildir++ 1"
@@ -52,6 +50,10 @@ struct _CamelMaildirStorePrivate {
 #define HIER_SEP "."
 #define HIER_SEP_CHAR '.'
 
+struct _CamelMaildirStorePrivate {
+       gboolean already_migrated;
+};
+
 static CamelFolder * maildir_store_get_folder_sync (CamelStore *store, const gchar *folder_name, 
CamelStoreGetFolderFlags flags,
                                                GCancellable *cancellable, GError **error);
 static CamelFolderInfo *maildir_store_create_folder_sync (CamelStore *store, const gchar *parent_name, const 
gchar *folder_name,
@@ -65,6 +67,8 @@ static gchar *maildir_get_meta_path (CamelLocalStore *ls, const gchar *full_name
 static void maildir_migrate_hierarchy (CamelMaildirStore *mstore, gint maildir_version, GCancellable 
*cancellable, GError **error);
 static gboolean maildir_version_requires_migrate (const gchar *meta_filename, gint *maildir_version);
 
+G_DEFINE_TYPE (CamelMaildirStore, camel_maildir_store, CAMEL_TYPE_LOCAL_STORE)
+
 /* This fixes up some historical cruft of names starting with "./" */
 static const gchar *
 md_canon_name (const gchar *a)
@@ -845,7 +849,11 @@ maildir_store_rename_folder_sync (CamelStore *store,
                return FALSE;
        }
 
-       subfolders = maildir_store_get_folder_info_sync (store, old, CAMEL_STORE_FOLDER_INFO_RECURSIVE | 
CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL, cancellable, NULL);
+       subfolders = maildir_store_get_folder_info_sync (
+               store, old,
+               CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+               CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL,
+               cancellable, NULL);
 
        old_dir = maildir_full_name_to_dir_name (old);
        new_dir = maildir_full_name_to_dir_name (new);
@@ -857,7 +865,11 @@ maildir_store_rename_folder_sync (CamelStore *store,
 
        if (subfolders) {
                if (ret)
-                       ret = rename_traverse_fi (store, store_class, subfolders->child, old, new, 
cancellable, error);
+                       ret = rename_traverse_fi (
+                               store, store_class,
+                               subfolders->child,
+                               old, new,
+                               cancellable, error);
 
                camel_store_free_folder_info (store, subfolders);
        }
@@ -895,7 +907,7 @@ camel_maildir_store_class_init (CamelMaildirStoreClass *class)
 static void
 camel_maildir_store_init (CamelMaildirStore *maildir_store)
 {
-       maildir_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (maildir_store, CAMEL_TYPE_MAILDIR_STORE, 
CamelMaildirStorePrivate);
+       maildir_store->priv = CAMEL_MAILDIR_STORE_GET_PRIVATE (maildir_store);
        maildir_store->priv->already_migrated = FALSE;
 }
 
@@ -980,7 +992,7 @@ scan_hash (gconstpointer d)
 
 static gboolean
 scan_equal (gconstpointer a,
-           gconstpointer b)
+            gconstpointer b)
 {
        const struct _scan_node *v1 = a, *v2 = b;
 
@@ -989,8 +1001,8 @@ scan_equal (gconstpointer a,
 
 static void
 scan_free (gpointer k,
-          gpointer v,
-          gpointer d)
+           gpointer v,
+           gpointer d)
 {
        g_free (k);
 }
@@ -1115,23 +1127,23 @@ exit:
 
 static void
 maildir_maybe_rename_old_folder (CamelMaildirStore *mstore,
-                                CamelFolderInfo *fi,
-                                gint maildir_version,
-                                GCancellable *cancellable,
-                                GError **error)
+                                 CamelFolderInfo *fi,
+                                 gint maildir_version,
+                                 GCancellable *cancellable,
+                                 GError **error)
 {
        gchar *new_name = NULL;
 
        if (maildir_version == -1) {
                /* this is when maildir was not converted yet to maildir++ at all,
-                  the '_' and '.'  are still there and the dir separator is slash
+                * the '_' and '.'  are still there and the dir separator is slash
                */
                new_name = maildir_full_name_to_dir_name (fi->full_name);
        } else if (maildir_version == 0) {
                /* this is a conversion with maildir folder being already there,
-                  only with no version; there should be escaped only '_', because
-                  the '.' is already garbled;
-                  fi->full_name is a dir name here
+                * only with no version; there should be escaped only '_', because
+                * the '.' is already garbled;
+                * fi->full_name is a dir name here
                */
                gchar *full_name;
 
@@ -1164,7 +1176,7 @@ maildir_maybe_rename_old_folder (CamelMaildirStore *mstore,
 static void
 traverse_rename_folder_info (CamelMaildirStore *mstore,
                              CamelFolderInfo *fi,
-                            gint maildir_version,
+                             gint maildir_version,
                              GCancellable *cancellable,
                              GError **error)
 {
@@ -1180,7 +1192,7 @@ traverse_rename_folder_info (CamelMaildirStore *mstore,
 
 static gboolean
 maildir_version_requires_migrate (const gchar *meta_filename,
-                                 gint *maildir_version)
+                                  gint *maildir_version)
 {
        FILE *metafile;
        gchar cc;
@@ -1226,7 +1238,7 @@ maildir_version_requires_migrate (const gchar *meta_filename,
 
 static void
 maildir_migrate_hierarchy (CamelMaildirStore *mstore,
-                          gint maildir_version,
+                           gint maildir_version,
                            GCancellable *cancellable,
                            GError **error)
 {
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 46f1e56..6e6466f 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -50,18 +50,42 @@
 
 #define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000)
 
-static CamelMessageInfo *message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
-static CamelMessageInfo *maildir_message_info_from_db (CamelFolderSummary *summary, CamelMIRecord *record);
-static void message_info_free (CamelFolderSummary *, CamelMessageInfo *mi);
-
-static gint maildir_summary_load (CamelLocalSummary *cls, gint forceindex, GError **error);
-static gint maildir_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable 
*cancellable, GError **error);
-static gint maildir_summary_sync (CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo 
*changeinfo, GCancellable *cancellable, GError **error);
-static CamelMessageInfo *maildir_summary_add (CamelLocalSummary *cls, CamelMimeMessage *msg, const 
CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);
-
-static gchar *maildir_summary_next_uid_string (CamelFolderSummary *s);
-static gint maildir_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, 
CamelLocalMessageInfo *mi);
-static gchar *maildir_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
+static CamelMessageInfo *
+               message_info_new_from_header    (CamelFolderSummary *,
+                                                struct _camel_header_raw *);
+static CamelMessageInfo *
+               maildir_message_info_from_db    (CamelFolderSummary *summary,
+                                                CamelMIRecord *record);
+static void    message_info_free               (CamelFolderSummary *,
+                                                CamelMessageInfo *mi);
+
+static gint    maildir_summary_load            (CamelLocalSummary *cls,
+                                                gint forceindex,
+                                                GError **error);
+static gint    maildir_summary_check           (CamelLocalSummary *cls,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static gint    maildir_summary_sync            (CamelLocalSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static CamelMessageInfo *
+               maildir_summary_add             (CamelLocalSummary *cls,
+                                                CamelMimeMessage *msg,
+                                                const CamelMessageInfo *info,
+                                                CamelFolderChangeInfo *,
+                                                GError **error);
+
+static gchar * maildir_summary_next_uid_string (CamelFolderSummary *s);
+static gint    maildir_summary_decode_x_evolution
+                                               (CamelLocalSummary *cls,
+                                                const gchar *xev,
+                                                CamelLocalMessageInfo *mi);
+static gchar * maildir_summary_encode_x_evolution
+                                               (CamelLocalSummary *cls,
+                                                const CamelLocalMessageInfo *mi);
 
 struct _CamelMaildirSummaryPrivate {
        gchar *current_file;
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 6925c33..516914a 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -43,29 +43,61 @@
 
 #define CAMEL_MBOX_SUMMARY_VERSION (1)
 
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *, GError **error);
-static gboolean summary_header_from_db (CamelFolderSummary *, CamelFIRecord *);
-static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *record);
-static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
-
-static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
-static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
-/*static void            message_info_free (CamelFolderSummary *, CamelMessageInfo *);*/
-
-static gchar *mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
+static CamelFIRecord *
+               summary_header_to_db            (CamelFolderSummary *,
+                                                GError **error);
+static gboolean        summary_header_from_db          (CamelFolderSummary *,
+                                                CamelFIRecord *);
+static CamelMessageInfo *
+               message_info_from_db            (CamelFolderSummary *s,
+                                                CamelMIRecord *record);
+static CamelMIRecord *
+               message_info_to_db              (CamelFolderSummary *s,
+                                                CamelMessageInfo *info);
 
-static gint mbox_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable 
*cancellable, GError **error);
-static gint mbox_summary_sync (CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, 
GCancellable *cancellable, GError **error);
+static CamelMessageInfo *
+               message_info_new_from_header    (CamelFolderSummary *,
+                                                struct _camel_header_raw *);
+static CamelMessageInfo *
+               message_info_new_from_parser    (CamelFolderSummary *,
+                                                CamelMimeParser *);
+
+static gchar * mbox_summary_encode_x_evolution (CamelLocalSummary *cls,
+                                                const CamelLocalMessageInfo *mi);
+
+static gint    mbox_summary_check              (CamelLocalSummary *cls,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static gint    mbox_summary_sync               (CamelLocalSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
 #ifdef STATUS_PINE
-static CamelMessageInfo *mbox_summary_add (CamelLocalSummary *cls, CamelMimeMessage *msg, const 
CamelMessageInfo *info, CamelFolderChangeInfo *ci, GError **error);
+static CamelMessageInfo *
+               mbox_summary_add                (CamelLocalSummary *cls,
+                                                CamelMimeMessage *msg,
+                                                const CamelMessageInfo *info,
+                                                CamelFolderChangeInfo *ci,
+                                                GError **error);
 #endif
 
-static gint mbox_summary_sync_quick (CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo 
*changeinfo, GCancellable *cancellable, GError **error);
-static gint mbox_summary_sync_full (CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo 
*changeinfo, GCancellable *cancellable, GError **error);
+static gint    mbox_summary_sync_quick         (CamelMboxSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static gint    mbox_summary_sync_full          (CamelMboxSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
 
 #ifdef STATUS_PINE
 /* Which status flags are stored in each separate header */
-#define STATUS_XSTATUS (CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_DELETED)
+#define STATUS_XSTATUS \
+       (CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED)
 #define STATUS_STATUS (CAMEL_MESSAGE_SEEN)
 
 static void encode_status (guint32 flags, gchar status[8]);
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index de89424..559bd11 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -44,11 +44,20 @@
 
 #define CAMEL_SPOOL_SUMMARY_VERSION (0x400)
 
-static gint spool_summary_load (CamelLocalSummary *cls, gint forceindex, GError **error);
-static gint spool_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable 
*cancellable, GError **error);
-
-static gint spool_summary_sync_full (CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo 
*changeinfo, GCancellable *cancellable, GError **error);
-static gint spool_summary_need_index (void);
+static gint    spool_summary_load              (CamelLocalSummary *cls,
+                                                gint forceindex,
+                                                GError **error);
+static gint    spool_summary_check             (CamelLocalSummary *cls,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+
+static gint    spool_summary_sync_full         (CamelMboxSummary *cls,
+                                                gboolean expunge,
+                                                CamelFolderChangeInfo *changeinfo,
+                                                GCancellable *cancellable,
+                                                GError **error);
+static gint    spool_summary_need_index        (void);
 
 G_DEFINE_TYPE (CamelSpoolSummary, camel_spool_summary, CAMEL_TYPE_MBOX_SUMMARY)
 
diff --git a/camel/providers/nntp/camel-nntp-store-summary.h b/camel/providers/nntp/camel-nntp-store-summary.h
index 30a35f1..7f61b34 100644
--- a/camel/providers/nntp/camel-nntp-store-summary.h
+++ b/camel/providers/nntp/camel-nntp-store-summary.h
@@ -80,29 +80,47 @@ struct _CamelNNTPStoreSummaryClass {
        CamelStoreSummaryClass summary_class;
 };
 
-GType                   camel_nntp_store_summary_get_type      (void);
-CamelNNTPStoreSummary      *camel_nntp_store_summary_new       (void);
-
-/* TODO: this api needs some more work, needs to support lists */
-/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_new(CamelNNTPStoreSummary *s, const gchar 
*full_name, gchar dir_sep);*/
-/*void camel_nntp_store_summary_namespace_set(CamelNNTPStoreSummary *s, CamelNNTPStoreNamespace *ns);*/
-/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_path(CamelNNTPStoreSummary *s, const 
gchar *path);*/
-/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_full(CamelNNTPStoreSummary *s, const 
gchar *full_name);*/
+GType          camel_nntp_store_summary_get_type
+                                               (void);
+CamelNNTPStoreSummary *
+               camel_nntp_store_summary_new    (void);
 
 /* helper macro's */
-#define camel_nntp_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const 
CamelStoreInfo *)i, CAMEL_NNTP_STORE_INFO_FULL_NAME))
+#define camel_nntp_store_info_full_name(s, i) \
+       (camel_store_info_string ( \
+               (CamelStoreSummary *) s, \
+               (const CamelStoreInfo *) i, \
+               CAMEL_NNTP_STORE_INFO_FULL_NAME))
 
 /* converts to/from utf8 canonical nasmes */
-gchar *camel_nntp_store_summary_full_to_path (CamelNNTPStoreSummary *s, const gchar *full_name, gchar 
dir_sep);
-
-gchar *camel_nntp_store_summary_path_to_full (CamelNNTPStoreSummary *s, const gchar *path, gchar dir_sep);
-gchar *camel_nntp_store_summary_dotted_to_full (CamelNNTPStoreSummary *s, const gchar *dotted, gchar 
dir_sep);
-
-CamelNNTPStoreInfo *camel_nntp_store_summary_full_name (CamelNNTPStoreSummary *s, const gchar *full_name);
-CamelNNTPStoreInfo *camel_nntp_store_summary_add_from_full (CamelNNTPStoreSummary *s, const gchar 
*full_name, gchar dir_sep);
+gchar *                camel_nntp_store_summary_full_to_path
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *full_name,
+                                                gchar dir_sep);
+
+gchar *                camel_nntp_store_summary_path_to_full
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *path,
+                                                gchar dir_sep);
+gchar *                camel_nntp_store_summary_dotted_to_full
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *dotted,
+                                                gchar dir_sep);
+
+CamelNNTPStoreInfo *
+               camel_nntp_store_summary_full_name
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *full_name);
+CamelNNTPStoreInfo *
+               camel_nntp_store_summary_add_from_full
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *full_name,
+                                                gchar dir_sep);
 
 /* a convenience lookup function. always use this if path known */
-gchar *camel_nntp_store_summary_full_from_path (CamelNNTPStoreSummary *s, const gchar *path);
+gchar *                camel_nntp_store_summary_full_from_path
+                                               (CamelNNTPStoreSummary *s,
+                                                const gchar *path);
 
 G_END_DECLS
 
diff --git a/libebackend/e-authentication-mediator.c b/libebackend/e-authentication-mediator.c
index 2719fb7..fa64bd5 100644
--- a/libebackend/e-authentication-mediator.c
+++ b/libebackend/e-authentication-mediator.c
@@ -959,9 +959,12 @@ e_authentication_mediator_initable_init (GInitableIface *interface)
 static void
 e_authentication_mediator_interface_init (ESourceAuthenticatorInterface *interface)
 {
-       interface->try_password_sync = authentication_mediator_try_password_sync;
-       interface->try_password = authentication_mediator_try_password;
-       interface->try_password_finish = authentication_mediator_try_password_finish;
+       interface->try_password_sync =
+               authentication_mediator_try_password_sync;
+       interface->try_password =
+               authentication_mediator_try_password;
+       interface->try_password_finish =
+               authentication_mediator_try_password_finish;
 }
 
 static void
diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index c2e7565..8211f85 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -816,7 +816,7 @@ e_authentication_session_init (EAuthenticationSession *session)
 }
 
 G_DEFINE_QUARK (
-       e-authentication-session-error-quark,
+       e - authentication - session - error - quark,
        e_authentication_session_error);
 
 /**
diff --git a/libebackend/e-backend.c b/libebackend/e-backend.c
index 6e859fe..aa1ed4f 100644
--- a/libebackend/e-backend.c
+++ b/libebackend/e-backend.c
@@ -113,7 +113,7 @@ backend_network_monitor_can_reach_cb (GObject *source_object,
                (!host_is_reachable && (error != NULL)));
 
        if (G_IS_IO_ERROR (error, G_IO_ERROR_CANCELLED) ||
-           (host_is_reachable ? 1 : 0) == (e_backend_get_online (backend) ? 1 : 0)) {
+           host_is_reachable == e_backend_get_online (backend)) {
                g_clear_error (&error);
                g_object_unref (backend);
                return;
@@ -152,16 +152,16 @@ backend_update_online_state_idle_cb (gpointer user_data)
                cancellable = NULL;
        }
 
-       #if !GLIB_CHECK_VERSION (2, 35, 9)
+#if !GLIB_CHECK_VERSION (2, 35, 9)
        if (connectable && G_IS_NETWORK_ADDRESS (connectable)) {
                GNetworkAddress *network_address = G_NETWORK_ADDRESS (connectable);
 
-               /* create copy of the backend's connectable, because once the connectable
-                  reaches its destination it caches the value and doesn't retry after
-                  network changes.
-
-                  This might be fixed since GLib 2.35.9, see:
-                  https://bugzilla.gnome.org/show_bug.cgi?id=694181
+               /* Create a copy of the backend's connectable, because once
+                * the connectable reaches its destination it caches the value
+                * and doesn't retry after network changes.
+                *
+                * This is fixed since GLib 2.35.9, see:
+                * https://bugzilla.gnome.org/show_bug.cgi?id=694181
                */
                connectable = g_network_address_new (
                        g_network_address_get_hostname (network_address),
@@ -169,7 +169,7 @@ backend_update_online_state_idle_cb (gpointer user_data)
 
                g_object_unref (network_address);
        }
-       #endif
+#endif
 
        if (!connectable) {
                gchar *host = NULL;
@@ -480,11 +480,11 @@ backend_authenticate_finish (EBackend *backend,
 
 static gboolean
 backend_get_destination_address (EBackend *backend,
-                                gchar **host,
-                                guint16 *port)
+                                 gchar **host,
+                                 guint16 *port)
 {
        /* default implementation returns FALSE, indicating
-          no remote destination being used for this backend */
+        * no remote destination being used for this backend */
        return FALSE;
 }
 
@@ -1052,8 +1052,8 @@ e_backend_trust_prompt_finish (EBackend *backend,
  **/
 gboolean
 e_backend_get_destination_address (EBackend *backend,
-                                  gchar **host,
-                                  guint16 *port)
+                                   gchar **host,
+                                   guint16 *port)
 {
        EBackendClass *klass;
 
@@ -1088,8 +1088,8 @@ e_backend_get_destination_address (EBackend *backend,
  **/
 gboolean
 e_backend_is_destination_reachable (EBackend *backend,
-                                   GCancellable *cancellable,
-                                   GError **error)
+                                    GCancellable *cancellable,
+                                    GError **error)
 {
        gboolean reachable = TRUE;
        gchar *host = NULL;
@@ -1108,7 +1108,9 @@ e_backend_is_destination_reachable (EBackend *backend,
 
                        connectable = g_network_address_new (host, port);
                        if (connectable) {
-                               reachable = g_network_monitor_can_reach (network_monitor, connectable, 
cancellable, error);
+                               reachable = g_network_monitor_can_reach (
+                                       network_monitor, connectable,
+                                       cancellable, error);
                                g_object_unref (connectable);
                        } else {
                                reachable = FALSE;
diff --git a/libebackend/e-dbhash.c b/libebackend/e-dbhash.c
index 81ec12f..ff6a701 100644
--- a/libebackend/e-dbhash.c
+++ b/libebackend/e-dbhash.c
@@ -57,7 +57,8 @@ e_dbhash_new (const gchar *filename)
                        return NULL;
                }
 
-               rv = (*db->open) (db, NULL, filename, NULL, DB_HASH, DB_CREATE, 0666);
+               rv = (*db->open) (
+                       db, NULL, filename, NULL, DB_HASH, DB_CREATE, 0666);
 
                if (rv != 0) {
                        db->close (db, 0);
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index 3ab0e1d..c97800f 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -241,11 +241,12 @@ dbus_server_quit_server (EDBusServer *server,
 
 static void
 ignore_log (const gchar *log_domain,
-           GLogLevelFlags log_level,
-           const gchar *message,
-           gpointer user_data)
+            GLogLevelFlags log_level,
+            const gchar *message,
+            gpointer user_data)
 {
-       /* Avoid printing of trivial messages while running test cases, only print warnings/criticals and 
errors */
+       /* Avoid printing of trivial messages while running test
+        * cases.  Only print warnings, criticals and errors. */
        if ((log_level & (G_LOG_FLAG_FATAL     |
                          G_LOG_LEVEL_ERROR    |
                          G_LOG_LEVEL_CRITICAL |
diff --git a/libebackend/e-file-cache.c b/libebackend/e-file-cache.c
index c7ce9b6..c18c18c 100644
--- a/libebackend/e-file-cache.c
+++ b/libebackend/e-file-cache.c
@@ -230,7 +230,8 @@ e_file_cache_remove (EFileCache *cache)
                dir = g_dir_open (dirname, 0, NULL);
                if (dir) {
                        while ((fname = g_dir_read_name (dir))) {
-                               full_path = g_build_filename (dirname, fname, NULL);
+                               full_path = g_build_filename (
+                                       dirname, fname, NULL);
                                if (g_unlink (full_path) != 0) {
                                        g_free (full_path);
                                        g_free (dirname);
diff --git a/libebackend/e-oauth2-support.c b/libebackend/e-oauth2-support.c
index 7315404..5aeaf4b 100644
--- a/libebackend/e-oauth2-support.c
+++ b/libebackend/e-oauth2-support.c
@@ -145,8 +145,10 @@ oauth2_support_get_access_token_finish (EOAuth2Support *support,
 static void
 e_oauth2_support_default_init (EOAuth2SupportInterface *interface)
 {
-       interface->get_access_token = oauth2_support_get_access_token;
-       interface->get_access_token_finish = oauth2_support_get_access_token_finish;
+       interface->get_access_token =
+               oauth2_support_get_access_token;
+       interface->get_access_token_finish =
+               oauth2_support_get_access_token_finish;
 }
 
 /**
diff --git a/libebackend/e-server-side-source.c b/libebackend/e-server-side-source.c
index 9bdb47f..686df0c 100644
--- a/libebackend/e-server-side-source.c
+++ b/libebackend/e-server-side-source.c
@@ -1167,9 +1167,12 @@ e_server_side_source_class_init (EServerSideSourceClass *class)
        source_class->write_sync = server_side_source_write_sync;
        source_class->write = server_side_source_write;
        source_class->write_finish = server_side_source_write_finish;
-       source_class->remote_create_sync = server_side_source_remote_create_sync;
-       source_class->remote_delete_sync = server_side_source_remote_delete_sync;
-       source_class->get_oauth2_access_token_sync = server_side_source_get_oauth2_access_token_sync;
+       source_class->remote_create_sync =
+               server_side_source_remote_create_sync;
+       source_class->remote_delete_sync =
+               server_side_source_remote_delete_sync;
+       source_class->get_oauth2_access_token_sync =
+               server_side_source_get_oauth2_access_token_sync;
 
        g_object_class_install_property (
                object_class,
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index eea48b3..0caa0cc 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -2356,8 +2356,9 @@ e_source_registry_server_new_auth_session (ESourceRegistryServer *server,
        }
 
        g_return_val_if_fail (
-               g_type_is_a (auth_session_type,
-               E_TYPE_AUTHENTICATION_SESSION), NULL);
+               g_type_is_a (
+                       auth_session_type,
+                       E_TYPE_AUTHENTICATION_SESSION), NULL);
 
        return g_object_new (
                auth_session_type,
diff --git a/libebackend/e-user-prompter-server.c b/libebackend/e-user-prompter-server.c
index f4874c4..65ab1ae 100644
--- a/libebackend/e-user-prompter-server.c
+++ b/libebackend/e-user-prompter-server.c
@@ -62,8 +62,12 @@ enum {
 
 static guint signals[LAST_SIGNAL];
 
-G_DEFINE_TYPE_WITH_CODE (EUserPrompterServer, e_user_prompter_server, E_TYPE_DBUS_SERVER,
-                        G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
+G_DEFINE_TYPE_WITH_CODE (
+       EUserPrompterServer,
+       e_user_prompter_server,
+       E_TYPE_DBUS_SERVER,
+       G_IMPLEMENT_INTERFACE (
+               E_TYPE_EXTENSIBLE, NULL))
 
 typedef struct _PromptRequest {
        gint id;
@@ -160,7 +164,8 @@ remove_prompt (EUserPrompterServer *server,
                PromptRequest *pr = iter->data;
 
                if (pr && pr->id == prompt_id) {
-                       server->priv->prompts = g_slist_remove (server->priv->prompts, pr);
+                       server->priv->prompts = g_slist_remove (
+                               server->priv->prompts, pr);
 
                        if (is_extension_prompt)
                                *is_extension_prompt = pr->is_extension_prompt;
@@ -193,14 +198,29 @@ do_show_prompt (EUserPrompterServer *server)
        if (pr->is_extension_prompt) {
                EUserPrompterServerExtension *extension;
 
-               extension = g_hash_table_lookup (server->priv->extensions, pr->dialog_name);
+               extension = g_hash_table_lookup (
+                       server->priv->extensions, pr->dialog_name);
                g_return_if_fail (extension != NULL);
 
-               if (!e_user_prompter_server_extension_prompt (extension, pr->id, pr->dialog_name, 
pr->parameters)) {
-                       e_user_prompter_server_response (server, pr->id, -1, NULL);
+               if (!e_user_prompter_server_extension_prompt (
+                               extension,
+                               pr->id,
+                               pr->dialog_name,
+                               pr->parameters)) {
+                       e_user_prompter_server_response (
+                               server, pr->id, -1, NULL);
                }
        } else {
-               g_signal_emit (server, signals[PROMPT], 0, pr->id, pr->type, pr->title, pr->primary_text, 
pr->secondary_text, pr->use_markup, pr->button_captions);
+               g_signal_emit (
+                       server,
+                       signals[PROMPT], 0,
+                       pr->id,
+                       pr->type,
+                       pr->title,
+                       pr->primary_text,
+                       pr->secondary_text,
+                       pr->use_markup,
+                       pr->button_captions);
        }
 }
 
@@ -230,7 +250,8 @@ maybe_schedule_prompt (EUserPrompterServer *server)
 
        g_rec_mutex_lock (&server->priv->lock);
        if (!server->priv->schedule_id && server->priv->prompts)
-               server->priv->schedule_id = g_idle_add (show_prompt_idle_cb, server);
+               server->priv->schedule_id = g_idle_add (
+                       show_prompt_idle_cb, server);
        g_rec_mutex_unlock (&server->priv->lock);
 }
 
@@ -249,7 +270,10 @@ user_prompter_server_prompt_cb (EDBusUserPrompter *dbus_prompter,
 
        g_rec_mutex_lock (&server->priv->lock);
 
-       id = add_prompt (server, FALSE, type, title, primary_text, secondary_text, use_markup, 
button_captions, NULL, NULL);
+       id = add_prompt (
+               server, FALSE, type, title,
+               primary_text, secondary_text,
+               use_markup, button_captions, NULL, NULL);
 
        e_dbus_user_prompter_complete_prompt (dbus_prompter, invocation, id);
 
@@ -276,14 +300,18 @@ user_prompter_server_extension_prompt_cb (EDBusUserPrompter *dbus_prompter,
 
                g_dbus_method_invocation_return_error (
                        invocation, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
-                       _("Extension dialog '%s' not found."), dialog_name ? dialog_name : "[null]");
+                       _("Extension dialog '%s' not found."),
+                       dialog_name ? dialog_name : "[null]");
 
                return TRUE;
        }
 
-       id = add_prompt (server, TRUE, NULL, NULL, NULL, NULL, FALSE, NULL, dialog_name, parameters);
+       id = add_prompt (
+               server, TRUE, NULL, NULL, NULL, NULL, FALSE, NULL,
+               dialog_name, parameters);
 
-       e_dbus_user_prompter_complete_extension_prompt (dbus_prompter, invocation, id);
+       e_dbus_user_prompter_complete_extension_prompt (
+               dbus_prompter, invocation, id);
 
        maybe_schedule_prompt (server);
 
@@ -296,7 +324,8 @@ static void
 user_prompter_server_constructed (GObject *object)
 {
        /* Chain up to parent's constructed() method. */
-       G_OBJECT_CLASS (e_user_prompter_server_parent_class)->constructed (object);
+       G_OBJECT_CLASS (e_user_prompter_server_parent_class)->
+               constructed (object);
 
        e_extensible_load_extensions (E_EXTENSIBLE (object));
 }
@@ -367,10 +396,12 @@ user_prompter_server_quit_server (EDBusServer *server,
 
        priv = E_USER_PROMPTER_SERVER_GET_PRIVATE (server);
 
-       g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (priv->dbus_prompter));
+       g_dbus_interface_skeleton_unexport (
+               G_DBUS_INTERFACE_SKELETON (priv->dbus_prompter));
 
        /* Chain up to parent's quit_server() method. */
-       E_DBUS_SERVER_CLASS (e_user_prompter_server_parent_class)->quit_server (server, code);
+       E_DBUS_SERVER_CLASS (e_user_prompter_server_parent_class)->
+               quit_server (server, code);
 }
 
 static void
@@ -397,10 +428,15 @@ e_user_prompter_server_class_init (EUserPrompterServerClass *class)
                G_OBJECT_CLASS_TYPE (object_class),
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET (EUserPrompterServerClass, prompt),
-               NULL, NULL,
-               e_marshal_VOID__INT_STRING_STRING_STRING_STRING_BOOLEAN_POINTER,
+               NULL, NULL, NULL,
                G_TYPE_NONE, 7,
-               G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, 
G_TYPE_POINTER);
+               G_TYPE_INT,
+               G_TYPE_STRING,
+               G_TYPE_STRING,
+               G_TYPE_STRING,
+               G_TYPE_STRING,
+               G_TYPE_BOOLEAN,
+               G_TYPE_POINTER);
 }
 
 static void
@@ -409,7 +445,11 @@ e_user_prompter_server_init (EUserPrompterServer *server)
        server->priv = E_USER_PROMPTER_SERVER_GET_PRIVATE (server);
        server->priv->dbus_prompter = e_dbus_user_prompter_skeleton_new ();
        server->priv->prompts = NULL;
-       server->priv->extensions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+       server->priv->extensions = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) g_object_unref);
 
        g_rec_mutex_init (&server->priv->lock);
 
@@ -478,13 +518,16 @@ e_user_prompter_server_response (EUserPrompterServer *server,
                        values = e_named_parameters_to_strv (extension_values);
 
                        e_dbus_user_prompter_emit_extension_response (
-                               server->priv->dbus_prompter, prompt_id, response,
+                               server->priv->dbus_prompter,
+                               prompt_id, response,
                                (const gchar * const *) values);
 
                        if (values)
                                g_strfreev (values);
                } else {
-                       e_dbus_user_prompter_emit_response (server->priv->dbus_prompter, prompt_id, response);
+                       e_dbus_user_prompter_emit_response (
+                               server->priv->dbus_prompter,
+                               prompt_id, response);
                }
        }
 
@@ -532,8 +575,13 @@ e_user_prompter_server_register (EUserPrompterServer *server,
                return FALSE;
        }
 
-       g_print ("Registering %s for dialog '%s'\n", G_OBJECT_TYPE_NAME (extension), dialog_name);
-       g_hash_table_insert (server->priv->extensions, g_strdup (dialog_name), g_object_ref (extension));
+       g_print (
+               "Registering %s for dialog '%s'\n",
+               G_OBJECT_TYPE_NAME (extension), dialog_name);
+       g_hash_table_insert (
+               server->priv->extensions,
+               g_strdup (dialog_name),
+               g_object_ref (extension));
 
        g_rec_mutex_unlock (&server->priv->lock);
 
diff --git a/libedataserver/e-categories.c b/libedataserver/e-categories.c
index 29ccff3..27e9e64 100644
--- a/libedataserver/e-categories.c
+++ b/libedataserver/e-categories.c
@@ -297,7 +297,8 @@ categories_add_full (const gchar *category,
        cat_info = g_slice_new (CategoryInfo);
        if (is_default) {
                const gchar *display_name;
-               display_name = g_dpgettext2 (GETTEXT_PACKAGE, "CategoryName", category);
+               display_name = g_dpgettext2 (
+                       GETTEXT_PACKAGE, "CategoryName", category);
                cat_info->display_name = g_strdup (display_name);
                cat_info->clocale_name = g_strdup (category);
        } else {
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index 53d1b28..b0b2959 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -142,8 +142,9 @@ e_client_error_to_string (EClientError code)
        case E_CLIENT_ERROR_REPOSITORY_OFFLINE:
                return _("Repository offline");
        case E_CLIENT_ERROR_OFFLINE_UNAVAILABLE:
-               /* Translators: This means that the EClient does not support offline mode, or
-                * it's not set to by a user, thus it is unavailable while user is not connected. */
+               /* Translators: This means that the EClient does not
+                * support offline mode, or it's not set to by a user,
+                * thus it is unavailable while user is not connected. */
                return _("Offline unavailable");
        case E_CLIENT_ERROR_PERMISSION_DENIED:
                return _("Permission denied");
@@ -198,7 +199,10 @@ GError *
 e_client_error_create (EClientError code,
                        const gchar *custom_msg)
 {
-       return g_error_new_literal (E_CLIENT_ERROR, code, custom_msg ? custom_msg : e_client_error_to_string 
(code));
+       if (custom_msg == NULL)
+               custom_msg = e_client_error_to_string (code);
+
+       return g_error_new_literal (E_CLIENT_ERROR, code, custom_msg);
 }
 
 static void
@@ -1247,7 +1251,8 @@ e_client_retrieve_capabilities_finish (EClient *client,
        g_return_val_if_fail (class->retrieve_capabilities_finish != NULL, FALSE);
 
        *capabilities = NULL;
-       res = class->retrieve_capabilities_finish (client, result, capabilities, error);
+       res = class->retrieve_capabilities_finish (
+               client, result, capabilities, error);
 
        e_client_set_capabilities (client, res ? *capabilities : NULL);
 
@@ -1290,7 +1295,8 @@ e_client_retrieve_capabilities_sync (EClient *client,
        g_return_val_if_fail (class->retrieve_capabilities_sync != NULL, FALSE);
 
        *capabilities = NULL;
-       res = class->retrieve_capabilities_sync (client, capabilities, cancellable, error);
+       res = class->retrieve_capabilities_sync (
+               client, capabilities, cancellable, error);
 
        e_client_set_capabilities (client, res ? *capabilities : NULL);
 
@@ -1328,7 +1334,8 @@ e_client_get_backend_property (EClient *client,
        g_return_if_fail (class != NULL);
        g_return_if_fail (class->get_backend_property != NULL);
 
-       class->get_backend_property (client, prop_name, cancellable, callback, user_data);
+       class->get_backend_property (
+               client, prop_name, cancellable, callback, user_data);
 }
 
 /**
@@ -1435,7 +1442,9 @@ e_client_set_backend_property (EClient *client,
        g_return_if_fail (class != NULL);
        g_return_if_fail (class->set_backend_property != NULL);
 
-       class->set_backend_property (client, prop_name, prop_value, cancellable, callback, user_data);
+       class->set_backend_property (
+               client, prop_name, prop_value,
+               cancellable, callback, user_data);
 }
 
 /**
@@ -1511,7 +1520,8 @@ e_client_set_backend_property_sync (EClient *client,
 /**
  * e_client_open:
  * @client: an #EClient
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ *                  otherwise create it first
  * @cancellable: a #GCancellable; can be %NULL
  * @callback: callback to call when a result is ready
  * @user_data: user data for the @callback
@@ -1581,7 +1591,8 @@ e_client_open_finish (EClient *client,
 /**
  * e_client_open_sync:
  * @client: an #EClient
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ *                  otherwise create it first
  * @cancellable: a #GCancellable; can be %NULL
  * @error: (out): a #GError to set an error, if any
  *
@@ -2044,7 +2055,10 @@ e_client_util_unwrap_dbus_error (GError *dbus_error,
                                        g_free (name);
 
                                        g_dbus_error_strip_remote_error (dbus_error);
-                                       *client_error = g_error_new_literal (known_errors_domain, 
known_errors[ii].err_code, dbus_error->message);
+                                       *client_error = g_error_new_literal (
+                                               known_errors_domain,
+                                               known_errors[ii].err_code,
+                                               dbus_error->message);
                                        g_error_free (dbus_error);
                                        return TRUE;
                                }
@@ -2059,7 +2073,10 @@ e_client_util_unwrap_dbus_error (GError *dbus_error,
 
        if (g_error_matches (dbus_error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
                g_dbus_error_strip_remote_error (dbus_error);
-               *client_error = g_error_new_literal (E_CLIENT_ERROR, E_CLIENT_ERROR_OTHER_ERROR, 
dbus_error->message);
+               *client_error = g_error_new_literal (
+                       E_CLIENT_ERROR,
+                       E_CLIENT_ERROR_OTHER_ERROR,
+                       dbus_error->message);
                g_error_free (dbus_error);
        } else {
                g_dbus_error_strip_remote_error (dbus_error);
diff --git a/libedataserver/e-gdbus-templates.c b/libedataserver/e-gdbus-templates.c
index d741001..9c2e2ad 100644
--- a/libedataserver/e-gdbus-templates.c
+++ b/libedataserver/e-gdbus-templates.c
@@ -1431,7 +1431,7 @@ e_gdbus_proxy_sync_ready_cb (GObject *proxy,
 
        if (!sync_data) {
                /* already finished operation; it can happen when the operation is cancelled,
-                  but the result is already waiting in an idle queue.
+                * but the result is already waiting in an idle queue.
                */
                return;
        }
diff --git a/libedataserver/e-list.c b/libedataserver/e-list.c
index d8bee66..18ce584 100644
--- a/libedataserver/e-list.c
+++ b/libedataserver/e-list.c
@@ -134,7 +134,8 @@ e_list_append (EList *list,
 {
        e_list_invalidate_iterators (list, NULL);
        if (list->copy)
-               list->list = g_list_append (list->list, list->copy (data, list->closure));
+               list->list = g_list_append (
+                       list->list, list->copy (data, list->closure));
        else
                list->list = g_list_append (list->list, (gpointer) data);
 }
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index 86d66ca..c28b0b3 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -783,7 +783,15 @@ ep_set_proxy (EProxy *proxy,
        changed = ep_change_uri (&priv->uri_socks, uri_socks) || changed;
 
  emit_signal:
-       d (g_print ("%s: changed:%d uri_http: %s; uri_https: %s; uri_socks: %s\n", G_STRFUNC, changed ? 1 : 
0, uri_http ? uri_http : "[null]", uri_https ? uri_https : "[null]", uri_socks ? uri_socks : "[null]"));
+       d (g_print (
+               "%s: changed:%d "
+               "uri_http: %s; "
+               "uri_https: %s; "
+               "uri_socks: %s\n",
+               G_STRFUNC, changed ? 1 : 0,
+               uri_http ? uri_http : "[null]",
+               uri_https ? uri_https : "[null]",
+               uri_socks ? uri_socks : "[null]"));
        if (changed)
                g_signal_emit (proxy, signals[CHANGED], 0);
 
diff --git a/libedataserver/e-source-alarms.c b/libedataserver/e-source-alarms.c
index f8a128e..f208356 100644
--- a/libedataserver/e-source-alarms.c
+++ b/libedataserver/e-source-alarms.c
@@ -302,7 +302,9 @@ e_source_alarms_set_last_notified (ESourceAlarms *extension,
                GTimeVal time_val;
 
                if (!g_time_val_from_iso8601 (last_notified, &time_val)) {
-                       g_warning ("%s: Invalid timestamp: '%s'", G_STRFUNC, last_notified);
+                       g_warning (
+                               "%s: Invalid timestamp: '%s'",
+                               G_STRFUNC, last_notified);
                        return;
                }
        }
diff --git a/libedataserver/e-source-goa.c b/libedataserver/e-source-goa.c
index 2856ab8..57684f8 100644
--- a/libedataserver/e-source-goa.c
+++ b/libedataserver/e-source-goa.c
@@ -343,7 +343,8 @@ e_source_goa_dup_calendar_url (ESourceGoa *extension)
 /**
  * e_source_goa_set_calendar_url:
  * @extension: an #ESourceGoa
- * @calendar_url: (allow-none): the associated GNOME Online Account calendar URL, or %NULL
+ * @calendar_url: (allow-none): the associated GNOME Online Account
+ *                calendar URL, or %NULL
  *
  * Sets the calendar URL of the GNOME Online Account associated
  * with the #ESource to which @extension belongs.
@@ -356,7 +357,7 @@ e_source_goa_dup_calendar_url (ESourceGoa *extension)
  **/
 void
 e_source_goa_set_calendar_url (ESourceGoa *extension,
-                              const gchar *calendar_url)
+                               const gchar *calendar_url)
 {
        g_return_if_fail (E_IS_SOURCE_GOA (extension));
 
@@ -429,7 +430,8 @@ e_source_goa_dup_contacts_url (ESourceGoa *extension)
 /**
  * e_source_goa_set_contacts_url:
  * @extension: an #ESourceGoa
- * @contacts_url: (allow-none): the associated GNOME Online Account contacts URL, or %NULL
+ * @contacts_url: (allow-none): the associated GNOME Online Account
+ *                contacts URL, or %NULL
  *
  * Sets the contacts URL of the GNOME Online Account associated
  * with the #ESource to which @extension belongs.
@@ -442,7 +444,7 @@ e_source_goa_dup_contacts_url (ESourceGoa *extension)
  **/
 void
 e_source_goa_set_contacts_url (ESourceGoa *extension,
-                              const gchar *contacts_url)
+                               const gchar *contacts_url)
 {
        g_return_if_fail (E_IS_SOURCE_GOA (extension));
 
diff --git a/libedataserver/e-source-revision-guards.c b/libedataserver/e-source-revision-guards.c
index db49900..7a3b71d 100644
--- a/libedataserver/e-source-revision-guards.c
+++ b/libedataserver/e-source-revision-guards.c
@@ -165,7 +165,7 @@ e_source_revision_guards_get_enabled (ESourceRevisionGuards *extension)
  * Since: 3.8
  */
 void
-e_source_revision_guards_set_enabled (ESourceRevisionGuards  *extension,
+e_source_revision_guards_set_enabled (ESourceRevisionGuards *extension,
                                       gboolean enabled)
 {
        g_return_if_fail (E_IS_SOURCE_REVISION_GUARDS (extension));
diff --git a/libedataserver/e-source-webdav.c b/libedataserver/e-source-webdav.c
index 482d5e4..26e9729 100644
--- a/libedataserver/e-source-webdav.c
+++ b/libedataserver/e-source-webdav.c
@@ -1392,12 +1392,14 @@ e_source_webdav_prepare_ssl_trust_prompt (ESourceWebdav *extension,
                parent_uid = e_source_get_parent (source);
 
                if (parent_uid != NULL)
-                       parent_source = e_source_registry_ref_source (registry, parent_uid);
+                       parent_source = e_source_registry_ref_source (
+                               registry, parent_uid);
 
                g_object_unref (source);
        }
 
-       res = e_source_webdav_prepare_ssl_trust_prompt_with_parent (extension, message, parent_source, 
parameters);
+       res = e_source_webdav_prepare_ssl_trust_prompt_with_parent (
+               extension, message, parent_source, parameters);
 
        if (parent_source)
                g_object_unref (parent_source);
@@ -1412,17 +1414,18 @@ e_source_webdav_prepare_ssl_trust_prompt (ESourceWebdav *extension,
  * @parent_source: an #ESource, parent of the @extension<!-- -->'s source
  * @parameters: an #ENamedParameters to be populated
  *
- * The same as e_source_webdav_prepare_ssl_trust_prompt(), only takes @parent_source
- * directly, instead of an #ESourceRegistry. See e_source_webdav_prepare_ssl_trust_prompt()
- * for more details.
+ * The same as e_source_webdav_prepare_ssl_trust_prompt(), only takes
+ * @parent_source directly, instead of an #ESourceRegistry.
+ *
+ * See e_source_webdav_prepare_ssl_trust_prompt() for more details.
  *
  * Since: 3.8
  **/
 ETrustPromptResponse
 e_source_webdav_prepare_ssl_trust_prompt_with_parent (ESourceWebdav *extension,
-                                                     SoupMessage *message,
-                                                     ESource *parent_source,
-                                                     ENamedParameters *parameters)
+                                                      SoupMessage *message,
+                                                      ESource *parent_source,
+                                                      ENamedParameters *parameters)
 {
        ETrustPromptResponse response;
        ESource *source;
@@ -1431,7 +1434,11 @@ e_source_webdav_prepare_ssl_trust_prompt_with_parent (ESourceWebdav *extension,
        GByteArray *bytes = NULL;
        SoupURI *soup_uri;
        const gchar *host;
-       gchar *base64, *old_host = NULL, *old_hash = NULL, *cert_errs_str, *markup = NULL;
+       gchar *base64;
+       gchar *old_host = NULL;
+       gchar *old_hash = NULL;
+       gchar *cert_errs_str;
+       gchar *markup = NULL;
        gint issuer_count;
 
        g_return_val_if_fail (
@@ -1503,8 +1510,11 @@ e_source_webdav_prepare_ssl_trust_prompt_with_parent (ESourceWebdav *extension,
                if (parent_source != NULL) {
                        const gchar *parent_display_name;
 
-                       parent_display_name = e_source_get_display_name (parent_source);
-                       bname = g_strdup_printf ("<b>%s: %s</b>", parent_display_name, display_name);
+                       parent_display_name =
+                               e_source_get_display_name (parent_source);
+                       bname = g_strdup_printf (
+                               "<b>%s: %s</b>",
+                               parent_display_name, display_name);
                }
 
                if (bname == NULL)
@@ -1579,12 +1589,15 @@ e_source_webdav_prepare_ssl_trust_prompt_with_parent (ESourceWebdav *extension,
                        if (bytes) {
                                base64 = g_base64_encode (bytes->data, bytes->len);
                                if (issuer_count == 0) {
-                                       e_named_parameters_set (parameters, "issuer", base64);
+                                       e_named_parameters_set (
+                                       parameters, "issuer", base64);
                                } else {
                                        gchar *name;
 
-                                       name = g_strdup_printf ("issuer-%d", issuer_count);
-                                       e_named_parameters_set (parameters, name, base64);
+                                       name = g_strdup_printf (
+                                               "issuer-%d", issuer_count);
+                                       e_named_parameters_set (
+                                               parameters, name, base64);
                                        g_free (name);
                                }
 
@@ -1670,8 +1683,11 @@ e_source_webdav_store_ssl_trust_prompt (ESourceWebdav *extension,
        if (changed) {
                ESource *source;
 
-               source = e_source_extension_ref_source (E_SOURCE_EXTENSION (extension));
-               e_source_write (source, NULL, webdav_extension_changes_written_cb, NULL);
+               source = e_source_extension_ref_source (
+                       E_SOURCE_EXTENSION (extension));
+               e_source_write (
+                       source, NULL,
+                       webdav_extension_changes_written_cb, NULL);
                g_object_unref (source);
        }
 }
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index ba0e18f..4a8b41c 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -518,19 +518,22 @@ __strptime_internal (rp,
 #elif defined (G_OS_WIN32)
              if (*decided !=raw)
                {
-                 if (match_string (get_locale_string (LOCALE_SDAYNAME1 + cnt), rp))
+                 const gchar *locale_str;
+
+                 locale_str = get_locale_string (LOCALE_SDAYNAME1 + cnt);
+                 if (match_string (locale_str, rp))
                    {
                      if (*decided == not
-                         && strcmp (get_locale_string (LOCALE_SDAYNAME1 + cnt),
-                                    weekday_name[cnt]))
+                         && strcmp (locale_str, weekday_name[cnt]))
                        *decided = loc;
                      break;
                    }
-                 if (match_string (get_locale_string (LOCALE_SABBREVDAYNAME1 + cnt), rp))
+
+                 locale_str = get_locale_string (LOCALE_SABBREVDAYNAME1 + cnt);
+                 if (match_string (locale_str, rp))
                    {
                      if (*decided == not
-                         && strcmp (get_locale_string (LOCALE_SABBREVDAYNAME1 + cnt),
-                                    ab_weekday_name[cnt]))
+                         && strcmp (locale_str, ab_weekday_name[cnt]))
                        *decided = loc;
                      break;
                    }
@@ -579,19 +582,22 @@ __strptime_internal (rp,
 #elif defined (G_OS_WIN32)
              if (*decided !=raw)
                {
-                 if (match_string (get_locale_string (LOCALE_SMONTHNAME1 + cnt), rp))
+                 const gchar *locale_str;
+
+                 locale_str = get_locale_string (LOCALE_SMONTHNAME1 + cnt);
+                 if (match_string (locale_str, rp))
                    {
                      if (*decided == not
-                         && strcmp (get_locale_string (LOCALE_SMONTHNAME1 + cnt),
-                                    month_name[cnt]))
+                         && strcmp (locale_str, month_name[cnt]))
                        *decided = loc;
                      break;
                    }
-                 if (match_string (get_locale_string (LOCALE_SABBREVMONTHNAME1 + cnt), rp))
+
+                 locale_str = get_locale_string (LOCALE_SABBREVMONTHNAME1 + cnt);
+                 if (match_string (locale_str, rp))
                    {
                      if (*decided == not
-                         && strcmp (get_locale_string (LOCALE_SABBREVMONTHNAME1 + cnt),
-                                    ab_month_name[cnt]))
+                         && strcmp (locale_str, ab_month_name[cnt]))
                        *decided = loc;
                      break;
                    }
@@ -712,7 +718,12 @@ __strptime_internal (rp,
 #elif defined (G_OS_WIN32)
          if (*decided != raw)
            {
-               const gchar *posix_d_fmt = translate_picture (get_locale_string (LOCALE_SSHORTDATE));
+               const gchar *picture;
+               const gchar *posix_d_fmt;
+
+               picture = get_locale_string (LOCALE_SSHORTDATE);
+               posix_d_fmt = translate_picture (picture);
+
                if (!recursive (posix_d_fmt))
                {
                  if (*decided == loc)
@@ -930,7 +941,12 @@ __strptime_internal (rp,
 #elif defined (G_OS_WIN32)
          if (*decided != raw)
            {
-             const gchar *posix_t_fmt = translate_picture (get_locale_string (LOCALE_STIMEFORMAT));
+             const gchar *picture;
+             const gchar *posix_t_fmt;
+
+             picture = get_local_string (LOCALE_STIMEFORMAT);
+             posix_t_fmt = translate_picture (picture);
+
              if (!recursive (posix_t_fmt))
                {
                  if (*decided == loc)
diff --git a/libedataserver/e-xml-hash-utils.c b/libedataserver/e-xml-hash-utils.c
index ab0b1b8..9498745 100644
--- a/libedataserver/e-xml-hash-utils.c
+++ b/libedataserver/e-xml-hash-utils.c
@@ -251,11 +251,14 @@ e_xmlhash_remove (EXmlHash *hash,
 {
        gpointer orig_key;
        gpointer orig_value;
+       gboolean found;
 
        g_return_if_fail (hash != NULL);
        g_return_if_fail (key != NULL);
 
-       if (g_hash_table_lookup_extended (hash->objects, key, &orig_key, &orig_value)) {
+       found = g_hash_table_lookup_extended (
+               hash->objects, key, &orig_key, &orig_value);
+       if (found) {
                g_hash_table_remove (hash->objects, key);
                g_free (orig_key);
                g_free (orig_value);
diff --git a/modules/gnome-online-accounts/module-gnome-online-accounts.c 
b/modules/gnome-online-accounts/module-gnome-online-accounts.c
index 45e6f39..e6907f4 100644
--- a/modules/gnome-online-accounts/module-gnome-online-accounts.c
+++ b/modules/gnome-online-accounts/module-gnome-online-accounts.c
@@ -590,10 +590,9 @@ gnome_online_accounts_config_collection (EGnomeOnlineAccounts *extension,
                source_extension, "account-id",
                G_BINDING_SYNC_CREATE);
 
-       /* requires more properties from ownCould, but these are not
+       /* Requires more properties from ownCloud, but these are not
         * available before ownCloud was introduced, thus workaround
-        * it with the backend_name check
-       */
+        * it with the backend_name check. */
        if (g_strcmp0 (backend_name, "owncloud") == 0) {
                GoaCalendar *goa_calendar;
                GoaContacts *goa_contacts;
diff --git a/modules/owncloud-backend/module-owncloud-backend.c 
b/modules/owncloud-backend/module-owncloud-backend.c
index 2c04bd3..02f93d6 100644
--- a/modules/owncloud-backend/module-owncloud-backend.c
+++ b/modules/owncloud-backend/module-owncloud-backend.c
@@ -73,8 +73,8 @@ G_DEFINE_DYNAMIC_TYPE (
 
 static void
 owncloud_remove_unknown_sources_cb (gpointer resource_id,
-                                   gpointer uid,
-                                   gpointer user_data)
+                                    gpointer uid,
+                                    gpointer user_data)
 {
        ESourceRegistryServer *server = user_data;
        ESource *source;
@@ -89,11 +89,11 @@ owncloud_remove_unknown_sources_cb (gpointer resource_id,
 
 static void
 owncloud_source_found_cb (ECollectionBackend *collection,
-                         OwnCloudSourceType source_type,
-                         SoupURI *uri,
-                         const gchar *display_name,
-                         const gchar *color,
-                         gpointer user_data)
+                          OwnCloudSourceType source_type,
+                          SoupURI *uri,
+                          const gchar *display_name,
+                          const gchar *color,
+                          gpointer user_data)
 {
        GHashTable *known_sources = user_data;
        ESourceRegistryServer *server;
@@ -194,7 +194,7 @@ owncloud_source_found_cb (ECollectionBackend *collection,
 
 static void
 owncloud_add_uid_to_hashtable (gpointer source,
-                              gpointer known_sources)
+                               gpointer known_sources)
 {
        ESourceResource *resource;
        gchar *uid, *rid;
diff --git a/modules/owncloud-backend/owncloud-utils.c b/modules/owncloud-backend/owncloud-utils.c
index 8b652c5..2e74f05 100644
--- a/modules/owncloud-backend/owncloud-utils.c
+++ b/modules/owncloud-backend/owncloud-utils.c
@@ -49,9 +49,9 @@ struct _EOwncloudAuthenticatorClass {
 
 static ESourceAuthenticationResult
 owncloud_authenticator_try_password_sync (ESourceAuthenticator *auth,
-                                         const GString *password,
-                                         GCancellable *cancellable,
-                                         GError **error)
+                                          const GString *password,
+                                          GCancellable *cancellable,
+                                          GError **error)
 {
        EOwncloudAuthenticator *authenticator = (EOwncloudAuthenticator *) auth;
 
@@ -64,12 +64,18 @@ owncloud_authenticator_try_password_sync (ESourceAuthenticator *auth,
 
 #define E_TYPE_OWNCLOUD_AUTHENTICATOR (e_owncloud_authenticator_get_type ())
 
-GType e_owncloud_authenticator_get_type (void) G_GNUC_CONST;
+GType          e_owncloud_authenticator_get_type
+                               (void) G_GNUC_CONST;
+static void    e_owncloud_authenticator_authenticator_init
+                               (ESourceAuthenticatorInterface *interface);
 
-static void e_owncloud_authenticator_authenticator_init (ESourceAuthenticatorInterface *interface);
-
-G_DEFINE_TYPE_EXTENDED (EOwncloudAuthenticator, e_owncloud_authenticator, G_TYPE_OBJECT, 0,
-       G_IMPLEMENT_INTERFACE (E_TYPE_SOURCE_AUTHENTICATOR, e_owncloud_authenticator_authenticator_init))
+G_DEFINE_TYPE_EXTENDED (
+       EOwncloudAuthenticator,
+       e_owncloud_authenticator,
+       G_TYPE_OBJECT, 0,
+       G_IMPLEMENT_INTERFACE (
+               E_TYPE_SOURCE_AUTHENTICATOR,
+               e_owncloud_authenticator_authenticator_init))
 
 static void
 owncloud_authenticator_finalize (GObject *object)
@@ -187,13 +193,13 @@ xp_object_get_string (xmlXPathObjectPtr xpres)
 
 static void
 add_source (ECollectionBackend *collection,
-           OwnCloudSourceFoundCb found_cb,
-           gpointer user_data,
-           OwnCloudSourceType source_type,
-           SoupURI *base_uri,
-           const gchar *href,
-           const gchar *display_name,
-           const gchar *color)
+            OwnCloudSourceFoundCb found_cb,
+            gpointer user_data,
+            OwnCloudSourceType source_type,
+            SoupURI *base_uri,
+            const gchar *href,
+            const gchar *display_name,
+            const gchar *color)
 {
        SoupURI *uri = NULL;
 
@@ -206,7 +212,13 @@ add_source (ECollectionBackend *collection,
                uri = soup_uri_new (href);
        }
 
-       found_cb (collection, source_type, uri ? uri : base_uri, display_name, color, user_data);
+       found_cb (
+               collection,
+               source_type,
+               uri ? uri : base_uri,
+               display_name,
+               color,
+               user_data);
 
        if (uri)
                soup_uri_free (uri);
@@ -214,19 +226,31 @@ add_source (ECollectionBackend *collection,
 
 static void
 enum_calendars (ECollectionBackend *collection,
-               OwnCloudSourceFoundCb found_cb,
-               gpointer user_data,
-               /* const */ xmlXPathContextPtr xpctx,
-               /* const */ xmlXPathObjectPtr xpathobj,
-               gint response_index,
-               SoupURI *base_uri,
-               const gchar *href,
-               const gchar *display_name,
-               const gchar *color)
+                OwnCloudSourceFoundCb found_cb,
+                gpointer user_data,
+                /* const */ xmlXPathContextPtr xpctx,
+                /* const */ xmlXPathObjectPtr xpathobj,
+                gint response_index,
+                SoupURI *base_uri,
+                const gchar *href,
+                const gchar *display_name,
+                const gchar *color)
 {
        gint ii, nn;
 
-       if (!href || !display_name || !xpctx || !xpathobj || xpathobj->type != XPATH_NODESET)
+       if (href == NULL)
+               return;
+
+       if (display_name == NULL)
+               return;
+
+       if (xpctx == NULL)
+               return;
+
+       if (xpathobj == NULL)
+               return;
+
+       if (xpathobj->type != XPATH_NODESET)
                return;
 
        nn = xmlXPathNodeSetGetLength (xpathobj->nodesetval);
@@ -234,15 +258,43 @@ enum_calendars (ECollectionBackend *collection,
                xmlXPathObjectPtr xpres;
                gchar *comp_type;
 
-               xpres = xpath_eval (xpctx, XPATH_CALENDAR_COMP_TYPE, response_index, ii + 1);
+               xpres = xpath_eval (
+                       xpctx,
+                       XPATH_CALENDAR_COMP_TYPE,
+                       response_index,
+                       ii + 1);
                comp_type = xp_object_get_string (xpres);
 
                if (g_strcmp0 (comp_type, "VEVENT") == 0) {
-                       add_source (collection, found_cb, user_data, OwnCloud_Source_Events, base_uri, href, 
display_name, color);
+                       add_source (
+                               collection,
+                               found_cb,
+                               user_data,
+                               OwnCloud_Source_Events,
+                               base_uri,
+                               href,
+                               display_name,
+                               color);
                } else if (g_strcmp0 (comp_type, "VTODO") == 0) {
-                       add_source (collection, found_cb, user_data, OwnCloud_Source_Tasks, base_uri, href, 
display_name, color);
+                       add_source (
+                               collection,
+                               found_cb,
+                               user_data,
+                               OwnCloud_Source_Tasks,
+                               base_uri,
+                               href,
+                               display_name,
+                               color);
                } else if (g_strcmp0 (comp_type, "VJOURNAL") == 0) {
-                       add_source (collection, found_cb, user_data, OwnCloud_Source_Memos, base_uri, href, 
display_name, color);
+                       add_source (
+                               collection,
+                               found_cb,
+                               user_data,
+                               OwnCloud_Source_Memos,
+                               base_uri,
+                               href,
+                               display_name,
+                               color);
                }
 
                g_free (comp_type);
@@ -251,11 +303,11 @@ enum_calendars (ECollectionBackend *collection,
 
 static void
 parse_propfind_response (ECollectionBackend *collection,
-                        OwnCloudSourceFoundCb found_cb,
-                        gpointer user_data,
-                        SoupURI *base_uri,
-                        const gchar *body_str,
-                        glong body_len)
+                         OwnCloudSourceFoundCb found_cb,
+                         gpointer user_data,
+                         SoupURI *base_uri,
+                         const gchar *body_str,
+                         glong body_len)
 {
        xmlXPathContextPtr xpctx;
        xmlXPathObjectPtr xpathobj;
@@ -269,11 +321,26 @@ parse_propfind_response (ECollectionBackend *collection,
                return;
 
        xpctx = xmlXPathNewContext (doc);
-       xmlXPathRegisterNs (xpctx, (xmlChar *) "D", (xmlChar *) "DAV:");
-       xmlXPathRegisterNs (xpctx, (xmlChar *) "B", (xmlChar *) "urn:ietf:params:xml:ns:carddav");
-       xmlXPathRegisterNs (xpctx, (xmlChar *) "C", (xmlChar *) "urn:ietf:params:xml:ns:caldav");
-       xmlXPathRegisterNs (xpctx, (xmlChar *) "CS", (xmlChar *) "http://calendarserver.org/ns/";);
-       xmlXPathRegisterNs (xpctx, (xmlChar *) "APL", (xmlChar *) "http://apple.com/ns/ical/";);
+       xmlXPathRegisterNs (
+               xpctx,
+               (xmlChar *) "D",
+               (xmlChar *) "DAV:");
+       xmlXPathRegisterNs (
+               xpctx,
+               (xmlChar *) "B",
+               (xmlChar *) "urn:ietf:params:xml:ns:carddav");
+       xmlXPathRegisterNs (
+               xpctx,
+               (xmlChar *) "C",
+               (xmlChar *) "urn:ietf:params:xml:ns:caldav");
+       xmlXPathRegisterNs (
+               xpctx,
+               (xmlChar *) "CS",
+               (xmlChar *) "http://calendarserver.org/ns/";);
+       xmlXPathRegisterNs (
+               xpctx,
+               (xmlChar *) "APL",
+               (xmlChar *) "http://apple.com/ns/ical/";);
 
        xpathobj = xpath_eval (xpctx, "/D:multistatus/D:response");
        if (xpathobj && xpathobj->type == XPATH_NODESET) {
@@ -301,19 +368,46 @@ parse_propfind_response (ECollectionBackend *collection,
                        color = xp_object_get_string (xpres);
 
                        if (display_name && *display_name) {
-                               xpres = xpath_eval (xpctx, XPATH_RESOURCE_TYPE_ADDRESSBOOK, ii + 1);
+                               xpres = xpath_eval (
+                                       xpctx,
+                                       XPATH_RESOURCE_TYPE_ADDRESSBOOK,
+                                       ii + 1);
                                if (xpres) {
-                                       add_source (collection, found_cb, user_data, 
OwnCloud_Source_Contacts, base_uri, href, display_name, NULL);
+                                       add_source (
+                                               collection,
+                                               found_cb,
+                                               user_data,
+                                               OwnCloud_Source_Contacts,
+                                               base_uri,
+                                               href,
+                                               display_name,
+                                               NULL);
                                        xmlXPathFreeObject (xpres);
                                }
 
-                               xpres = xpath_eval (xpctx, XPATH_RESOURCE_TYPE_CALENDAR, ii + 1);
+                               xpres = xpath_eval (
+                                       xpctx,
+                                       XPATH_RESOURCE_TYPE_CALENDAR,
+                                       ii + 1);
                                if (xpres) {
                                        xmlXPathFreeObject (xpres);
 
-                                       xpres = xpath_eval (xpctx, XPATH_SUPPORTED_CALENDAR_COMPONENT_SET, ii 
+ 1);
+                                       xpres = xpath_eval (
+                                               xpctx,
+                                               XPATH_SUPPORTED_CALENDAR_COMPONENT_SET,
+                                               ii + 1);
                                        if (xpres) {
-                                               enum_calendars (collection, found_cb, user_data, xpctx, 
xpres, ii + 1, base_uri, href, display_name, color);
+                                               enum_calendars (
+                                                       collection,
+                                                       found_cb,
+                                                       user_data,
+                                                       xpctx,
+                                                       xpres,
+                                                       ii + 1,
+                                                       base_uri,
+                                                       href,
+                                                       display_name,
+                                                       color);
                                                xmlXPathFreeObject (xpres);
                                        }
                                }
@@ -333,10 +427,10 @@ parse_propfind_response (ECollectionBackend *collection,
 
 static void
 authenticate_cb (SoupSession *session,
-                SoupMessage *msg,
-                SoupAuth *auth,
-                gboolean retrying,
-                gpointer user_data)
+                 SoupMessage *msg,
+                 SoupAuth *auth,
+                 gboolean retrying,
+                 gpointer user_data)
 {
        EOwncloudAuthenticator *authenticator = user_data;
 
@@ -347,10 +441,15 @@ authenticate_cb (SoupSession *session,
                EAuthenticationSession *auth_session;
                ESource *source;
 
-               source = e_backend_get_source (E_BACKEND (authenticator->collection));
-               server = e_collection_backend_ref_server (authenticator->collection);
+               source = e_backend_get_source (
+                       E_BACKEND (authenticator->collection));
+               server = e_collection_backend_ref_server (
+                       authenticator->collection);
 
-               auth_session = e_source_registry_server_new_auth_session (server, E_SOURCE_AUTHENTICATOR 
(authenticator), e_source_get_uid (source));
+               auth_session = e_source_registry_server_new_auth_session (
+                       server,
+                       E_SOURCE_AUTHENTICATOR (authenticator),
+                       e_source_get_uid (source));
                if (!e_source_registry_server_authenticate_sync (server, auth_session, NULL, NULL)) {
                        if (authenticator->password)
                                g_string_free (authenticator->password, TRUE);
@@ -362,23 +461,29 @@ authenticate_cb (SoupSession *session,
        }
 
        if (authenticator->username && authenticator->password)
-               soup_auth_authenticate (auth, authenticator->username, authenticator->password->str);
+               soup_auth_authenticate (
+                       auth, authenticator->username,
+                       authenticator->password->str);
 }
 
 static ETrustPromptResponse
 trust_prompt_sync (const ENamedParameters *parameters,
-                  GCancellable *cancellable,
-                  GError **error)
+                   GCancellable *cancellable,
+                   GError **error)
 {
        EUserPrompter *prompter;
        gint response;
 
-       g_return_val_if_fail (parameters != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
+       g_return_val_if_fail (
+               parameters != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
 
        prompter = e_user_prompter_new ();
-       g_return_val_if_fail (prompter != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
+       g_return_val_if_fail (
+               prompter != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
 
-       response = e_user_prompter_extension_prompt_sync (prompter, "ETrustPrompt::trust-prompt", parameters, 
NULL, cancellable, error);
+       response = e_user_prompter_extension_prompt_sync (
+               prompter, "ETrustPrompt::trust-prompt",
+               parameters, NULL, cancellable, error);
 
        g_object_unref (prompter);
 
@@ -396,11 +501,11 @@ trust_prompt_sync (const ENamedParameters *parameters,
 
 static gboolean
 find_sources (ECollectionBackend *collection,
-             OwnCloudSourceFoundCb found_cb,
-             gpointer user_data,
-             const gchar *base_url,
-             const gchar *base_collection_path,
-             EOwncloudAuthenticator *authenticator)
+              OwnCloudSourceFoundCb found_cb,
+              gpointer user_data,
+              const gchar *base_url,
+              const gchar *base_collection_path,
+              EOwncloudAuthenticator *authenticator)
 {
        const gchar *req_body =
                "<D:propfind "
@@ -441,12 +546,15 @@ find_sources (ECollectionBackend *collection,
        }
 
        session = soup_session_sync_new ();
-       g_object_set (session,
+       g_object_set (
+               session,
                SOUP_SESSION_TIMEOUT, 90,
                SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
                SOUP_SESSION_SSL_STRICT, TRUE,
                NULL);
-       g_signal_connect (session, "authenticate", G_CALLBACK (authenticate_cb), authenticator);
+       g_signal_connect (
+               session, "authenticate",
+               G_CALLBACK (authenticate_cb), authenticator);
 
        proxy = e_proxy_new ();
        e_proxy_setup_proxy (proxy);
@@ -462,7 +570,9 @@ find_sources (ECollectionBackend *collection,
 
        g_string_free (url, TRUE);
 
-       soup_message_set_request (msg, "application/xml; charset=utf-8", SOUP_MEMORY_STATIC, req_body, strlen 
(req_body));
+       soup_message_set_request (
+               msg, "application/xml; charset=utf-8",
+               SOUP_MEMORY_STATIC, req_body, strlen (req_body));
 
        if (soup_session_send_message (session, msg) == SOUP_STATUS_SSL_FAILED) {
                ETrustPromptResponse response;
@@ -498,7 +608,10 @@ find_sources (ECollectionBackend *collection,
 
                suri = soup_uri_copy (suri);
 
-               parse_propfind_response (collection, found_cb, user_data, suri, msg->response_body->data, 
msg->response_body->length);
+               parse_propfind_response (
+                       collection, found_cb, user_data, suri,
+                       msg->response_body->data,
+                       msg->response_body->length);
 
                soup_uri_free (suri);
                tested = TRUE;
@@ -513,8 +626,8 @@ find_sources (ECollectionBackend *collection,
 
 gboolean
 owncloud_utils_search_server (ECollectionBackend *collection,
-                             OwnCloudSourceFoundCb found_cb,
-                             gpointer user_data)
+                              OwnCloudSourceFoundCb found_cb,
+                              gpointer user_data)
 {
        ESourceCollection *collection_extension;
        ESourceGoa *goa_extension;
@@ -538,7 +651,9 @@ owncloud_utils_search_server (ECollectionBackend *collection,
                url = e_source_goa_dup_calendar_url (goa_extension);
 
                if (url && *url)
-                       res = find_sources (collection, found_cb, user_data, url, "calendars", authenticator);
+                       res = find_sources (
+                               collection, found_cb, user_data,
+                               url, "calendars", authenticator);
 
                g_free (url);
        }
@@ -547,7 +662,9 @@ owncloud_utils_search_server (ECollectionBackend *collection,
                url = e_source_goa_dup_contacts_url (goa_extension);
 
                if (url && *url)
-                       res = find_sources (collection, found_cb, user_data, url, "addressbooks", 
authenticator);
+                       res = find_sources (
+                               collection, found_cb, user_data,
+                               url, "addressbooks", authenticator);
 
                g_free (url);
        }
diff --git a/tests/libebook/client/test-client-custom-summary.c 
b/tests/libebook/client/test-client-custom-summary.c
index 8af77b9..7c4a6aa 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -88,14 +88,14 @@ setup_custom_book (ESource *scratch,
 
 static void
 client_test_setup (ClientTestFixture *fixture,
-                  gconstpointer user_data)
+                   gconstpointer user_data)
 {
        e_test_server_utils_setup (&fixture->parent, user_data);
 }
 
 static void
 client_test_teardown (ClientTestFixture *fixture,
-                     gconstpointer user_data)
+                      gconstpointer user_data)
 {
        gint i;
 
@@ -109,13 +109,13 @@ client_test_teardown (ClientTestFixture *fixture,
 
 static void
 add_client_test_sexp (const gchar *prefix,
-                     const gchar *test_case_name,
-                     gpointer func,
-                     gchar *sexp, /* sexp is 'given' */
-                     gint num_contacts,
-                     gboolean direct,
-                     gboolean custom,
-                     gboolean phone_number_query)
+                      const gchar *test_case_name,
+                      gpointer func,
+                      gchar *sexp, /* sexp is 'given' */
+                      gint num_contacts,
+                      gboolean direct,
+                      gboolean custom,
+                      gboolean phone_number_query)
 {
        ClientTestData *data = g_slice_new0 (ClientTestData);
        gchar *path = g_strconcat (prefix, test_case_name, NULL);
@@ -130,25 +130,27 @@ add_client_test_sexp (const gchar *prefix,
        data->num_contacts = num_contacts;
        data->phone_number_query = phone_number_query;
 
-       g_test_add (path, ClientTestFixture, data,
-                   client_test_setup, func, client_test_teardown);
+       g_test_add (
+               path, ClientTestFixture, data,
+               client_test_setup, func, client_test_teardown);
 
        g_free (path);
 }
 
 static void
 add_client_test (const gchar *prefix,
-                const gchar *test_case_name,
+                 const gchar *test_case_name,
                  gpointer func,
                  EBookQuery *query,
                  gint num_contacts,
-                gboolean direct,
-                gboolean custom,
-                gboolean phone_number_query)
+                 gboolean direct,
+                 gboolean custom,
+                 gboolean phone_number_query)
 {
-       add_client_test_sexp (prefix, test_case_name, func,
-                             e_book_query_to_string (query),
-                             num_contacts, direct, custom, phone_number_query);
+       add_client_test_sexp (
+               prefix, test_case_name, func,
+               e_book_query_to_string (query),
+               num_contacts, direct, custom, phone_number_query);
        e_book_query_unref (query);
 }
 
@@ -193,8 +195,9 @@ search_test (ClientTestFixture *fixture,
                if (e_book_client_get_contacts_sync (book_client, data->sexp, &results, NULL, &error))
                        g_error ("Succeeded to query contacts when phone numbers are not supported");
                else if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_NOT_SUPPORTED))
-                       g_error ("Wrong error when querying with unsupported query: %s (domain: %s, code: 
%d)",
-                                error->message, g_quark_to_string (error->domain), error->code);
+                       g_error (
+                               "Wrong error when querying with unsupported query: %s (domain: %s, code: %d)",
+                               error->message, g_quark_to_string (error->domain), error->code);
                else
                        g_clear_error (&error);
 
@@ -203,8 +206,9 @@ search_test (ClientTestFixture *fixture,
                if (e_book_client_get_contacts_sync (book_client, data->sexp, &results, NULL, &error))
                        g_error ("Succeeded to query contacts with an invalid query type");
                else if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_INVALID_QUERY))
-                       g_error ("Wrong error when querying with an invalid query: %s (domain: %s, code: %d)",
-                                error->message, g_quark_to_string (error->domain), error->code);
+                       g_error (
+                               "Wrong error when querying with an invalid query: %s (domain: %s, code: %d)",
+                               error->message, g_quark_to_string (error->domain), error->code);
                else
                        g_clear_error (&error);
        } else {
@@ -236,8 +240,9 @@ uid_test (ClientTestFixture *fixture,
                if (e_book_client_get_contacts_uids_sync (book_client, data->sexp, &results, NULL, &error))
                        g_error ("Succeeded to query contact uids when phone numbers are not supported");
                else if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_NOT_SUPPORTED))
-                       g_error ("Wrong error when querying uids with unsupported query: %s (domain: %s, 
code: %d)",
-                                error->message, g_quark_to_string (error->domain), error->code);
+                       g_error (
+                               "Wrong error when querying uids with unsupported query: %s (domain: %s, code: 
%d)",
+                               error->message, g_quark_to_string (error->domain), error->code);
                else
                        g_clear_error (&error);
 
@@ -246,8 +251,9 @@ uid_test (ClientTestFixture *fixture,
                if (e_book_client_get_contacts_uids_sync (book_client, data->sexp, &results, NULL, &error))
                        g_error ("Succeeded to query contacts with an invalid query type");
                else if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_INVALID_QUERY))
-                       g_error ("Wrong error when querying with an invalid query: %s (domain: %s, code: %d)",
-                                error->message, g_quark_to_string (error->domain), error->code);
+                       g_error (
+                               "Wrong error when querying with an invalid query: %s (domain: %s, code: %d)",
+                               error->message, g_quark_to_string (error->domain), error->code);
                else
                        g_clear_error (&error);
        } else {
@@ -267,7 +273,7 @@ uid_test (ClientTestFixture *fixture,
 
 static void
 locale_change_test (ClientTestFixture *fixture,
-                    gconstpointer user_data)
+                     gconstpointer user_data)
 {
        EBookClient *book_client;
        GSList *results = NULL;
@@ -338,49 +344,58 @@ main (gint argc,
        for (i = 0; i < G_N_ELEMENTS (suites); i++) {
 
                /* A query that will cause e_sexp_parse() to report an error */
-               add_client_test_sexp (suites[i].prefix, "/InvalidQuery", suites[i].func,
-                                     g_strdup ("(invalid \"query\" \"term\")"),
-                                     -1, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test_sexp (
+                       suites[i].prefix, "/InvalidQuery", suites[i].func,
+                       g_strdup ("(invalid \"query\" \"term\")"),
+                       -1, suites[i].direct, suites[i].custom, FALSE);
 
                /* Add search tests that fetch contacts */
-               add_client_test (suites[i].prefix, "/Exact/FullName", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James 
Brown"),
-                                1, suites[i].direct, suites[i].custom, FALSE);
-
-               add_client_test (suites[i].prefix, "/Exact/Name", suites[i].func,
-                                e_book_query_vcard_field_test (EVC_N, E_BOOK_QUERY_IS, "Janet"),
-                                1, suites[i].direct, suites[i].custom, FALSE);
-
-               add_client_test (suites[i].prefix, "/Prefix/FullName", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "B"),
-                                2, suites[i].direct, suites[i].custom, FALSE);
-
-               add_client_test (suites[i].prefix, "/Prefix/FullName/Percent", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "%"),
-                                1, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test (
+                       suites[i].prefix, "/Exact/FullName", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James Brown"),
+                       1, suites[i].direct, suites[i].custom, FALSE);
+
+               add_client_test (
+                       suites[i].prefix, "/Exact/Name", suites[i].func,
+                       e_book_query_vcard_field_test (EVC_N, E_BOOK_QUERY_IS, "Janet"),
+                       1, suites[i].direct, suites[i].custom, FALSE);
+
+               add_client_test (
+                       suites[i].prefix, "/Prefix/FullName", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "B"),
+                       2, suites[i].direct, suites[i].custom, FALSE);
+
+               add_client_test (
+                       suites[i].prefix, "/Prefix/FullName/Percent", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "%"),
+                       1, suites[i].direct, suites[i].custom, FALSE);
 
                /* Query the E_CONTACT_TEL field for something that is not a phone number, user is
                 * searching for all the contacts when they noted they must ask Jenny for the phone number
                 */
-               add_client_test (suites[i].prefix, "/Prefix/Phone/NotAPhoneNumber", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_BEGINS_WITH, "ask 
Jenny"),
-                                1, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test (
+                       suites[i].prefix, "/Prefix/Phone/NotAPhoneNumber", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_BEGINS_WITH, "ask Jenny"),
+                       1, suites[i].direct, suites[i].custom, FALSE);
 
-               add_client_test (suites[i].prefix, "/Suffix/Phone", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "999"),
-                                2, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test (
+                       suites[i].prefix, "/Suffix/Phone", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "999"),
+                       2, suites[i].direct, suites[i].custom, FALSE);
 
                /* This test proves that we do not get any results for custom-7.vcf, which contains
                 * a phone number ending with "88 99", if this were accidentally normalized, we would
                 * get a result for it.
                 */
-               add_client_test (suites[i].prefix, "/Suffix/Phone/NotNormalized", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "8899"),
-                                0, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test (
+                       suites[i].prefix, "/Suffix/Phone/NotNormalized", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "8899"),
+                       0, suites[i].direct, suites[i].custom, FALSE);
 
-               add_client_test (suites[i].prefix, "/Suffix/Email", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, 
"jackson.com"),
-                                2, suites[i].direct, suites[i].custom, FALSE);
+               add_client_test (
+                       suites[i].prefix, "/Suffix/Email", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, "jackson.com"),
+                       2, suites[i].direct, suites[i].custom, FALSE);
 
                /*********************************************
                 *         PHONE NUMBER QUERIES FOLLOW       *
@@ -390,34 +405,37 @@ main (gint argc,
                 * for contact-6.vcf, it can be searched using normal E_BOOK_QUERY_* queries but
                 * treating it as a phone number is an invalid query.
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/InvalidPhoneNumber", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL,
-                                                         E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
-                                                         "ask Jenny for Lisa's number"),
-                                -1, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/InvalidPhoneNumber", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL,
+                       E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+                       "ask Jenny for Lisa's number"),
+                       -1, suites[i].direct, suites[i].custom, TRUE);
 
                /* These queries will do an index lookup with a custom summary, and a full table scan
                 * matching with EBookBackendSexp when the default summary is used
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/Exact", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_PHONE_NUMBER, 
"+1 221.542.3789"),
-                                1, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/Exact", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_PHONE_NUMBER, "+1 
221.542.3789"),
+                       1, suites[i].direct, suites[i].custom, TRUE);
 
                /* This test checks that phone number matching works when deeply nested into a query, when 
ENABLE_PHONENUMBER
                 * is not defined, then it ensures that the query is refused while being deeply nested.
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/Exact/Nested", suites[i].func,
-                                e_book_query_orv (
-                                        e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "Not 
In The Summary"),
-                                        e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_IS, "not in 
the summary com"),
-                                        e_book_query_andv (
-                                                e_book_query_field_test (E_CONTACT_FULL_NAME,
-                                                                         E_BOOK_QUERY_BEGINS_WITH, 
"Micheal"),
-                                                e_book_query_field_test (E_CONTACT_TEL,
-                                                                         E_BOOK_QUERY_EQUALS_PHONE_NUMBER, 
"+1 221.542.3789"),
-                                                NULL),
-                                        NULL),
-                                1, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/Exact/Nested", suites[i].func,
+                       e_book_query_orv (
+                       e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "Not In The Summary"),
+                       e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_IS, "not in the summary com"),
+                       e_book_query_andv (
+                       e_book_query_field_test (E_CONTACT_FULL_NAME,
+                       E_BOOK_QUERY_BEGINS_WITH, "Micheal"),
+                       e_book_query_field_test (E_CONTACT_TEL,
+                       E_BOOK_QUERY_EQUALS_PHONE_NUMBER, "+1 221.542.3789"),
+                       NULL),
+                       NULL),
+                       1, suites[i].direct, suites[i].custom, TRUE);
 
                /*********************************************
                 * E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER *
@@ -429,9 +447,10 @@ main (gint argc,
                 * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +1-221-5423789 | Matches: 
yes |
                 * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +31-221-5423789 | Matches: 
yes  |
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/National", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, 
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "221.542.3789"),
-                                2, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/National", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, 
"221.542.3789"),
+                       2, suites[i].direct, suites[i].custom, TRUE);
 
                /* Test that a query term with a specified country returns only vCards that 
                 * are specifically in the specified country code.
@@ -439,35 +458,38 @@ main (gint argc,
                 * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +1-221-5423789 | 
Matches: no |
                 * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +31-221-5423789 | 
Matches: no |
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/National/CountryMismatch", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL,
-                                                         E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 
221.542.3789"),
-                                0, suites[i].direct, suites[i].custom, TRUE);
-
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/National/CountryMismatch", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL,
+                       E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 221.542.3789"),
+                       0, suites[i].direct, suites[i].custom, TRUE);
 
                /* Test that a query term with the active country code specified returns a vCard with an 
unspecified
                 * country code.
                 *
                 * | Active Country Code: +1 | Query: +1 514-845-8436 | vCard Data: 514-845-8436 | Matches: 
yes |
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryWithCountry", 
suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL,
-                                                         E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+1 
514-845-8436"),
-                                1, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryWithCountry", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL,
+                       E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+1 514-845-8436"),
+                       1, suites[i].direct, suites[i].custom, TRUE);
 
                /* Test that a query term with an arbitrary country code specified returns a vCard with an 
unspecified
                 * country code.
                 *
                 * | Active Country Code: +1 | Query: +49 514-845-8436 | vCard Data: 514-845-8436 | Matches: 
yes |
                 */
-               add_client_test (suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryOtherCountry", 
suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL,
-                                                         E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 
514-845-8436"),
-                                1, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryOtherCountry", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL,
+                       E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 514-845-8436"),
+                       1, suites[i].direct, suites[i].custom, TRUE);
 
-               add_client_test (suites[i].prefix, "/EqPhone/Short", suites[i].func,
-                                e_book_query_field_test (E_CONTACT_TEL, 
E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, "5423789"),
-                                2, suites[i].direct, suites[i].custom, TRUE);
+               add_client_test (
+                       suites[i].prefix, "/EqPhone/Short", suites[i].func,
+                       e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, 
"5423789"),
+                       2, suites[i].direct, suites[i].custom, TRUE);
 
        }
 
@@ -475,11 +497,11 @@ main (gint argc,
 #if 0 /* FIXME: This test is broken */
 
        add_client_test (
-               "/EBookClient", "/EqPhone/LocaleChange", locale_change_test,
+               "/EBookClient", "/EqPhone/LocaleChange", locale_change_test,
                NULL, 0, FALSE, TRUE);
 
        add_client_test (
-               "/EBookClient/DirectAccess", "/EqPhone/LocaleChange", locale_change_test,
+               "/EBookClient/DirectAccess", "/EqPhone/LocaleChange", locale_change_test,
                NULL, 0, TRUE, TRUE);
 #endif
 #endif /* ENABLE_PHONENUMBER */
diff --git a/tests/libebook/client/test-client-e164-param.c b/tests/libebook/client/test-client-e164-param.c
index d415d1b..944e390 100644
--- a/tests/libebook/client/test-client-e164-param.c
+++ b/tests/libebook/client/test-client-e164-param.c
@@ -51,10 +51,10 @@ test_data_free (gpointer user_data)
 
 static TestData *
 test_data_new (const gchar *vcard_name,
-              const gchar *formatted_number,
-              const gchar *country_calling_code,
-              const gchar *national_number,
-              gboolean     direct)
+               const gchar *formatted_number,
+               const gchar *country_calling_code,
+               const gchar *national_number,
+               gboolean direct)
 {
        TestData *const data = g_new0 (TestData, 1);
 
@@ -72,7 +72,7 @@ test_data_new (const gchar *vcard_name,
 
 static void
 test_add_e164_param (ETestServerFixture *fixture,
-                    gconstpointer       user_data)
+                     gconstpointer user_data)
 {
        const TestData *const data = user_data;
        EBookClient          *book_client;
@@ -109,7 +109,6 @@ test_add_e164_param (ETestServerFixture *fixture,
 
        g_free (uid);
 
-
        tel = e_vcard_get_attribute (E_VCARD (contact), EVC_TEL);
        values = tel ? e_vcard_attribute_get_values (tel) : NULL;
 
diff --git a/tests/libebook/client/test-client-preserve-uid.c 
b/tests/libebook/client/test-client-preserve-uid.c
index 7e04dce..9b7d4ab 100644
--- a/tests/libebook/client/test-client-preserve-uid.c
+++ b/tests/libebook/client/test-client-preserve-uid.c
@@ -31,7 +31,7 @@ static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 }
 
 static void
 test_preserve_uid (ETestServerFixture *fixture,
-                  gconstpointer       user_data)
+                   gconstpointer user_data)
 {
        EBookClient *book_client;
        EContact    *contact;
@@ -57,7 +57,7 @@ test_preserve_uid (ETestServerFixture *fixture,
 
 static void
 test_uid_conflict (ETestServerFixture *fixture,
-                  gconstpointer       user_data)
+                   gconstpointer user_data)
 {
        EBookClient *book_client;
        EContact    *contact;
@@ -93,10 +93,12 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       g_test_add ("/EBookClient/AddContact/PreserveUid", ETestServerFixture, &book_closure,
-                   e_test_server_utils_setup, test_preserve_uid, e_test_server_utils_teardown);
-       g_test_add ("/EBookClient/AddContact/UidConflict", ETestServerFixture, &book_closure,
-                   e_test_server_utils_setup, test_uid_conflict, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/AddContact/PreserveUid", ETestServerFixture, &book_closure,
+               e_test_server_utils_setup, test_preserve_uid, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/AddContact/UidConflict", ETestServerFixture, &book_closure,
+               e_test_server_utils_setup, test_uid_conflict, e_test_server_utils_teardown);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libebook/client/test-client-remove-contact.c 
b/tests/libebook/client/test-client-remove-contact.c
index 7cfce66..0bfb8c8 100644
--- a/tests/libebook/client/test-client-remove-contact.c
+++ b/tests/libebook/client/test-client-remove-contact.c
@@ -11,7 +11,7 @@ static ETestServerClosure direct_book_closure = { E_TEST_SERVER_DIRECT_ADDRESS_B
 
 static void
 check_removed_contact (EBookClient *book_client,
-                      const gchar *uid)
+                       const gchar *uid)
 {
        GError *error = NULL;
        EContact *contact = NULL;
@@ -19,16 +19,18 @@ check_removed_contact (EBookClient *book_client,
        if (e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error))
                g_error ("succeeded to fetch removed contact");
        else if (!g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND))
-               g_error ("Wrong error in get contact sync on removed contact: %s (domain: %s, code: %d)",
-                        error->message, g_quark_to_string (error->domain), error->code);
+               g_error (
+                       "Wrong error in get contact sync on removed contact: %s (domain: %s, code: %d)",
+                       error->message, g_quark_to_string (error->domain), error->code);
        else
                g_clear_error (&error);
 
        if (e_book_client_remove_contact_by_uid_sync (book_client, uid, NULL, &error))
                g_error ("succeeded to remove the already removed contact");
        else if (!g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND))
-               g_error ("Wrong error in remove contact sync on removed contact: %s (domain: %s, code: %d)",
-                        error->message, g_quark_to_string (error->domain), error->code);
+               g_error (
+                       "Wrong error in remove contact sync on removed contact: %s (domain: %s, code: %d)",
+                       error->message, g_quark_to_string (error->domain), error->code);
        else
                g_clear_error (&error);
 }
@@ -126,10 +128,12 @@ main (gint argc,
 
        /* We run the direct access variants here because we're interested in testing the error
         * code from e_book_client_get_contact(removed_contact_uid)  */
-       g_test_add ("/EBookClient/DirectAccess/RemoveContact/Sync", ETestServerFixture, &direct_book_closure,
-                   e_test_server_utils_setup, test_remove_contact_sync, e_test_server_utils_teardown);
-       g_test_add ("/EBookClient/DirectAccess/RemoveContact/Async", ETestServerFixture, &direct_book_closure,
-                   e_test_server_utils_setup, test_remove_contact_async, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/DirectAccess/RemoveContact/Sync", ETestServerFixture, &direct_book_closure,
+               e_test_server_utils_setup, test_remove_contact_sync, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/DirectAccess/RemoveContact/Async", ETestServerFixture, &direct_book_closure,
+               e_test_server_utils_setup, test_remove_contact_async, e_test_server_utils_teardown);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libebook/client/test-client-view-operations.c 
b/tests/libebook/client/test-client-view-operations.c
index 97f2cdb..776f3b0 100644
--- a/tests/libebook/client/test-client-view-operations.c
+++ b/tests/libebook/client/test-client-view-operations.c
@@ -32,7 +32,7 @@ typedef struct {
 static void
 objects_added (EBookClientView *view,
                const GSList *contacts,
-              ThreadData *data)
+               ThreadData *data)
 {
        const GSList *l;
 
@@ -45,8 +45,8 @@ objects_added (EBookClientView *view,
 
 static void
 objects_modified (EBookClientView *view,
-                 const GSList *contacts,
-                 ThreadData *data)
+                  const GSList *contacts,
+                  ThreadData *data)
 {
        const GSList *l;
 
@@ -58,7 +58,7 @@ objects_modified (EBookClientView *view,
 static void
 objects_removed (EBookClientView *view,
                  const GSList *ids,
-                ThreadData *data)
+                 ThreadData *data)
 {
        const GSList *l;
 
@@ -72,7 +72,7 @@ objects_removed (EBookClientView *view,
 static void
 complete (EBookClientView *view,
           const GError *error,
-         ThreadData *data)
+          ThreadData *data)
 {
        g_mutex_lock (&data->complete_mutex);
        data->complete = TRUE;
@@ -122,7 +122,7 @@ start_thread_test (ThreadData *data)
        context = g_main_loop_get_context (data->loop);
        source  = g_idle_source_new ();
 
-       g_source_set_callback (source, (GSourceFunc)start_view, data, NULL);
+       g_source_set_callback (source, (GSourceFunc) start_view, data, NULL);
        g_source_attach (source, context);
 }
 
@@ -160,9 +160,9 @@ test_view_thread (ThreadData *data)
                g_error ("Unable to fetch source uid '%s' from the registry", data->book_uid);
 
        if (data->closure->type == E_TEST_SERVER_DIRECT_ADDRESS_BOOK)
-               data->client = (EBookClient *)e_book_client_connect_direct_sync (registry, source, NULL, 
&error);
+               data->client = (EBookClient *) e_book_client_connect_direct_sync (registry, source, NULL, 
&error);
        else
-               data->client = (EBookClient *)e_book_client_connect_sync (source, NULL, &error);
+               data->client = (EBookClient *) e_book_client_connect_sync (source, NULL, &error);
 
        if (!data->client)
                g_error ("Unable to create EBookClient for uid '%s': %s", data->book_uid, error->message);
@@ -183,25 +183,25 @@ test_view_thread (ThreadData *data)
 }
 
 static ThreadData *
-create_test_thread (const gchar   *book_uid,
-                   gconstpointer  user_data)
+create_test_thread (const gchar *book_uid,
+                    gconstpointer user_data)
 {
        ThreadData  *data = g_slice_new0 (ThreadData);
 
        data->book_uid    = book_uid;
-       data->closure     = (ETestServerClosure *)user_data;
+       data->closure     = (ETestServerClosure *) user_data;
 
        g_mutex_init (&data->complete_mutex);
        g_cond_init (&data->complete_cond);
 
-       data->thread = g_thread_new ("test-thread", (GThreadFunc)test_view_thread, data);
+       data->thread = g_thread_new ("test-thread", (GThreadFunc) test_view_thread, data);
 
        return data;
 }
 
 static void
 test_concurrent_views (ETestServerFixture *fixture,
-                      gconstpointer       user_data)
+                       gconstpointer user_data)
 {
        EBookClient *main_client;
        ESource *source;
@@ -228,13 +228,13 @@ test_concurrent_views (ETestServerFixture *fixture,
        for (i = 0; i < N_THREADS; i++)
                tests[i] = create_test_thread (book_uid, user_data);
 
-
        /* Wait for all threads to receive the complete signal */
        for (i = 0; i < N_THREADS; i++) {
                g_mutex_lock (&(tests[i]->complete_mutex));
                while (!tests[i]->complete)
-                       g_cond_wait (&(tests[i]->complete_cond),
-                                    &(tests[i]->complete_mutex));
+                       g_cond_wait (
+                               &(tests[i]->complete_cond),
+                               &(tests[i]->complete_mutex));
                g_mutex_unlock (&(tests[i]->complete_mutex));
        }
 
@@ -256,10 +256,12 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
        setlocale (LC_ALL, "en_US.UTF-8");
 
-       g_test_add ("/EBookClient/ConcurrentViews", ETestServerFixture, &book_closure,
-                   e_test_server_utils_setup, test_concurrent_views, e_test_server_utils_teardown);
-       g_test_add ("/EBookClient/DirectAccess/ConcurrentViews", ETestServerFixture, &direct_book_closure,
-                   e_test_server_utils_setup, test_concurrent_views, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/ConcurrentViews", ETestServerFixture, &book_closure,
+               e_test_server_utils_setup, test_concurrent_views, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/DirectAccess/ConcurrentViews", ETestServerFixture, &direct_book_closure,
+               e_test_server_utils_setup, test_concurrent_views, e_test_server_utils_teardown);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libebook/client/test-client-write-write.c b/tests/libebook/client/test-client-write-write.c
index 3331b46..22dd263 100644
--- a/tests/libebook/client/test-client-write-write.c
+++ b/tests/libebook/client/test-client-write-write.c
@@ -30,10 +30,9 @@ static void setup_custom_book (ESource            *scratch,
 
 static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, setup_custom_book, 0 };
 
-
 static void
-setup_custom_book (ESource            *scratch,
-                  ETestServerClosure *closure)
+setup_custom_book (ESource *scratch,
+                   ETestServerClosure *closure)
 {
        ESourceRevisionGuards *guards;
 
@@ -89,8 +88,8 @@ static gboolean try_write_field_thread_idle (ThreadData *data);
 
 static void
 test_write_thread_contact_modified (GObject *source_object,
-                                   GAsyncResult *res,
-                                   ThreadData *data)
+                                    GAsyncResult *res,
+                                    ThreadData *data)
 {
        GError   *error = NULL;
        gboolean  retry = FALSE;
@@ -105,9 +104,10 @@ test_write_thread_contact_modified (GObject *source_object,
                                     E_CLIENT_ERROR_OUT_OF_SYNC))
                        retry = TRUE;
                else
-                       g_error ("Error updating '%s' field: %s\n",
-                                e_contact_field_name (data->field),
-                                error->message);
+                       g_error (
+                               "Error updating '%s' field: %s\n",
+                               e_contact_field_name (data->field),
+                               error->message);
 
                g_error_free (error);
        }
@@ -120,20 +120,22 @@ test_write_thread_contact_modified (GObject *source_object,
 
 static void
 test_write_thread_contact_fetched (GObject *source_object,
-                                  GAsyncResult *res,
-                                  ThreadData *data)
+                                   GAsyncResult *res,
+                                   ThreadData *data)
 {
        EContact *contact = NULL;
        GError   *error = NULL;
 
        if (!e_book_client_get_contact_finish (E_BOOK_CLIENT (source_object), res, &contact, &error))
-               g_error ("Failed to fetch contact in thread '%s': %s",
-                        e_contact_field_name (data->field), error->message);
+               g_error (
+                       "Failed to fetch contact in thread '%s': %s",
+                       e_contact_field_name (data->field), error->message);
 
        e_contact_set (contact, data->field, data->value);
 
-       e_book_client_modify_contact (data->client, contact, NULL, 
-                                     (GAsyncReadyCallback)test_write_thread_contact_modified, data);
+       e_book_client_modify_contact (
+               data->client, contact, NULL,
+               (GAsyncReadyCallback) test_write_thread_contact_modified, data);
 
        g_object_unref (contact);
 }
@@ -141,29 +143,31 @@ test_write_thread_contact_fetched (GObject *source_object,
 static gboolean
 try_write_field_thread_idle (ThreadData *data)
 {
-       e_book_client_get_contact (data->client, data->contact_uid, NULL,
-                                  (GAsyncReadyCallback)test_write_thread_contact_fetched, data);
+       e_book_client_get_contact (
+               data->client, data->contact_uid, NULL,
+               (GAsyncReadyCallback) test_write_thread_contact_fetched, data);
 
        return FALSE;
 }
 
 static void
 test_write_thread_client_opened (GObject *source_object,
-                                GAsyncResult *res,
-                                ThreadData *data)
+                                 GAsyncResult *res,
+                                 ThreadData *data)
 {
        GMainContext *context;
        GSource      *gsource;
        GError       *error = NULL;
 
        if (!e_client_open_finish (E_CLIENT (source_object), res, &error))
-               g_error ("Error opening client for thread '%s': %s",
-                        e_contact_field_name (data->field),
-                        error->message);
+               g_error (
+                       "Error opening client for thread '%s': %s",
+                       e_contact_field_name (data->field),
+                       error->message);
 
        context = g_main_loop_get_context (data->loop);
        gsource = g_idle_source_new ();
-       g_source_set_callback (gsource, (GSourceFunc)try_write_field_thread_idle, data, NULL);
+       g_source_set_callback (gsource, (GSourceFunc) try_write_field_thread_idle, data, NULL);
        g_source_attach (gsource, context);
 }
 
@@ -171,7 +175,7 @@ static gboolean
 test_write_thread_open_idle (ThreadData *data)
 {
        /* Open the book client, only if it exists, it should be the same book created by the main thread */
-       e_client_open (E_CLIENT (data->client), TRUE, NULL, 
(GAsyncReadyCallback)test_write_thread_client_opened, data);
+       e_client_open (E_CLIENT (data->client), TRUE, NULL, (GAsyncReadyCallback) 
test_write_thread_client_opened, data);
 
        return FALSE;
 }
@@ -205,7 +209,7 @@ test_write_thread (ThreadData *data)
        /* Retry setting the contact field until we succeed setting the field
         */
        gsource = g_idle_source_new ();
-       g_source_set_callback (gsource, (GSourceFunc)test_write_thread_open_idle, data, NULL);
+       g_source_set_callback (gsource, (GSourceFunc) test_write_thread_open_idle, data, NULL);
        g_source_attach (gsource, context);
        g_main_loop_run (data->loop);
 
@@ -221,10 +225,10 @@ test_write_thread (ThreadData *data)
 }
 
 static ThreadData *
-create_test_thread (const gchar   *book_uid,
-                   const gchar   *contact_uid,
-                   EContactField  field,
-                   const gchar   *value)
+create_test_thread (const gchar *book_uid,
+                    const gchar *contact_uid,
+                    EContactField field,
+                    const gchar *value)
 {
        ThreadData  *data = g_slice_new0 (ThreadData);
        const gchar *name = e_contact_field_name (field);
@@ -234,7 +238,7 @@ create_test_thread (const gchar   *book_uid,
        data->field       = field;
        data->value       = value;
 
-       data->thread = g_thread_new (name, (GThreadFunc)test_write_thread, data);
+       data->thread = g_thread_new (name, (GThreadFunc) test_write_thread, data);
 
        return data;
 }
@@ -248,7 +252,7 @@ wait_thread_test (ThreadData *data)
 
 static void
 test_concurrent_writes (ETestServerFixture *fixture,
-                      gconstpointer       user_data)
+                       gconstpointer user_data)
 {
        EBookClient *main_client;
        ESource *source;
@@ -273,9 +277,10 @@ test_concurrent_writes (ETestServerFixture *fixture,
        /* Create all concurrent threads accessing the same addressbook */
        tests = g_new0 (ThreadData *, G_N_ELEMENTS (field_tests));
        for (i = 0; i < G_N_ELEMENTS (field_tests); i++)
-               tests[i] = create_test_thread (book_uid, contact_uid,
-                                              field_tests[i].field,
-                                              field_tests[i].value);
+               tests[i] = create_test_thread (
+                       book_uid, contact_uid,
+                       field_tests[i].field,
+                       field_tests[i].value);
 
        /* Wait for all threads to complete */
        for (i = 0; i < G_N_ELEMENTS (field_tests); i++)
@@ -296,9 +301,12 @@ test_concurrent_writes (ETestServerFixture *fixture,
 
                        vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 
-                       g_error ("Lost data in concurrent writes, expected value for field '%s' was '%s', "
-                                "actual value is '%s', vcard:\n%s\n",
-                                e_contact_field_name (field_tests[i].field), field_tests[i].value, value, 
vcard);
+                       g_error (
+                               "Lost data in concurrent writes, expected "
+                               "value for field '%s' was '%s', actual value "
+                               "is '%s', vcard:\n%s\n",
+                               e_contact_field_name (field_tests[i].field),
+                               field_tests[i].value, value, vcard);
                }
 
                g_free (value);
@@ -318,8 +326,9 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
        setlocale (LC_ALL, "en_US.UTF-8");
 
-       g_test_add ("/EBookClient/ConcurrentWrites", ETestServerFixture, &book_closure,
-                   e_test_server_utils_setup, test_concurrent_writes, e_test_server_utils_teardown);
+       g_test_add (
+               "/EBookClient/ConcurrentWrites", ETestServerFixture, &book_closure,
+               e_test_server_utils_setup, test_concurrent_writes, e_test_server_utils_teardown);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libebook/test-ebook-get-supported-auth-methods.c 
b/tests/libebook/test-ebook-get-supported-auth-methods.c
index 3f9c56c..0447164 100644
--- a/tests/libebook/test-ebook-get-supported-auth-methods.c
+++ b/tests/libebook/test-ebook-get-supported-auth-methods.c
@@ -87,7 +87,7 @@ static void
 test_get_supported_auth_methods_async (ETestServerFixture *fixture,
                                        gconstpointer user_data)
 {
-       g_idle_add ((GSourceFunc)get_supported_auth_methods_async_in_idle, fixture);
+       g_idle_add ((GSourceFunc) get_supported_auth_methods_async_in_idle, fixture);
        g_timeout_add (5 * 1000, (GSourceFunc) main_loop_fail_timeout, NULL);
        g_main_loop_run (fixture->loop);
 }
diff --git a/tests/libebook/test-ebook-phone-number.c b/tests/libebook/test-ebook-phone-number.c
index 2b58b19..63b8c39 100644
--- a/tests/libebook/test-ebook-phone-number.c
+++ b/tests/libebook/test-ebook-phone-number.c
@@ -26,7 +26,7 @@
 #include <libebook/libebook.h>
 #include <locale.h>
 
-static const char *match_candidates[] = {
+static const gchar *match_candidates[] = {
        "not-a-number",
        "+1-617-4663489", "617-4663489", "4663489",
        "+1.408.845.5246", "4088455246", "8455246",
@@ -125,15 +125,15 @@ typedef struct {
 } ParseAndFormatData;
 
 static ParseAndFormatData *
-parse_and_format_data_new (const gchar                 *phone_number,
-                           const gchar                 *region_code,
-                           EPhoneNumberCountrySource    country_source,
-                           gint                                 country_code,
-                           const gchar                 *national_number,
-                           const gchar                 *formatted_e164,
-                           const gchar                 *formatted_intl,
-                           const gchar                 *formatted_natl,
-                           const gchar                 *formatted_uri)
+parse_and_format_data_new (const gchar *phone_number,
+                           const gchar *region_code,
+                           EPhoneNumberCountrySource country_source,
+                           gint country_code,
+                           const gchar *national_number,
+                           const gchar *formatted_e164,
+                           const gchar *formatted_intl,
+                           const gchar *formatted_natl,
+                           const gchar *formatted_uri)
 {
        ParseAndFormatData *test_data = g_slice_new0 (ParseAndFormatData);
 
@@ -291,7 +291,7 @@ test_compare_numbers (gconstpointer data)
        const size_t j = n / G_N_ELEMENTS (match_candidates);
 
 #ifdef ENABLE_PHONENUMBER
-       const gboolean error_expected = !(i && j) ;
+       const gboolean error_expected = !(i && j);
 #else /* ENABLE_PHONENUMBER */
        const gboolean error_expected = TRUE;
 #endif /* ENABLE_PHONENUMBER */
@@ -299,9 +299,10 @@ test_compare_numbers (gconstpointer data)
        EPhoneNumberMatch actual_match;
        GError *error = NULL;
 
-       actual_match = e_phone_number_compare_strings (match_candidates[i],
-                                                      match_candidates[j],
-                                                      &error);
+       actual_match = e_phone_number_compare_strings (
+               match_candidates[i],
+               match_candidates[j],
+               &error);
 
 #ifdef ENABLE_PHONENUMBER
        g_assert_cmpuint (actual_match, ==, expected_matches[n]);
@@ -381,27 +382,27 @@ main (gint argc,
                test_parse_and_format, parse_and_format_data_free);
        g_test_add_data_func_full (
                "/ebook-phone-number/parse-and-format/national", parse_and_format_data_new (
-                        "(030) 22334-455", "DE",
-                        E_PHONE_NUMBER_COUNTRY_FROM_DEFAULT, 49, "3022334455",
-                        "+493022334455", "+49 30 22334455", "030 22334455", "tel:+49-30-22334455"),
+               "(030) 22334-455", "DE",
+               E_PHONE_NUMBER_COUNTRY_FROM_DEFAULT, 49, "3022334455",
+               "+493022334455", "+49 30 22334455", "030 22334455", "tel:+49-30-22334455"),
                test_parse_and_format, parse_and_format_data_free);
        g_test_add_data_func_full (
                "/ebook-phone-number/parse-and-format/national2", parse_and_format_data_new (
-                        "0049 (30) 22334-455", "DE",
-                        E_PHONE_NUMBER_COUNTRY_FROM_IDD, 49, "3022334455",
-                        "+493022334455", "+49 30 22334455", "030 22334455", "tel:+49-30-22334455"),
+               "0049 (30) 22334-455", "DE",
+               E_PHONE_NUMBER_COUNTRY_FROM_IDD, 49, "3022334455",
+               "+493022334455", "+49 30 22334455", "030 22334455", "tel:+49-30-22334455"),
                test_parse_and_format, parse_and_format_data_free);
        g_test_add_data_func_full (
                "/ebook-phone-number/parse-and-format/international", parse_and_format_data_new (
-                        "+1 212 33445566", NULL,
-                        E_PHONE_NUMBER_COUNTRY_FROM_FQTN, 1, "21233445566",
-                        "+121233445566", "+1 21233445566", "21233445566", "tel:+1-21233445566"),
+               "+1 212 33445566", NULL,
+               E_PHONE_NUMBER_COUNTRY_FROM_FQTN, 1, "21233445566",
+               "+121233445566", "+1 21233445566", "21233445566", "tel:+1-21233445566"),
                test_parse_and_format, parse_and_format_data_free);
        g_test_add_data_func_full (
                "/ebook-phone-number/parse-and-format/rfc3966", parse_and_format_data_new (
-                        "tel:+358-71-44556677", NULL,
-                        E_PHONE_NUMBER_COUNTRY_FROM_FQTN, 358, "7144556677",
-                        "+3587144556677", "+358 71 44556677", "071 44556677", "tel:+358-71-44556677"),
+               "tel:+358-71-44556677", NULL,
+               E_PHONE_NUMBER_COUNTRY_FROM_FQTN, 358, "7144556677",
+               "+3587144556677", "+358 71 44556677", "071 44556677", "tel:+358-71-44556677"),
                test_parse_and_format, parse_and_format_data_free);
 
        g_test_add_func (
@@ -412,14 +413,16 @@ main (gint argc,
                "/ebook-phone-number/parse-and-format/auto-region",
                test_parse_auto_region);
 
-       g_assert_cmpint (G_N_ELEMENTS (match_candidates) * G_N_ELEMENTS (match_candidates),
-                        ==, G_N_ELEMENTS (expected_matches));
+       g_assert_cmpint (
+               G_N_ELEMENTS (match_candidates) * G_N_ELEMENTS (match_candidates),
+               ==, G_N_ELEMENTS (expected_matches));
 
        for (i = 0; i < G_N_ELEMENTS (match_candidates); ++i) {
                for (j = 0; j < G_N_ELEMENTS (match_candidates); ++j) {
                        const size_t n = j + i * G_N_ELEMENTS (match_candidates);
-                       char *path = g_strdup_printf ("/ebook-phone-number/compare/%s/%s",
-                                                     match_candidates[i], match_candidates[j]);
+                       gchar *path = g_strdup_printf (
+                               "/ebook-phone-number/compare/%s/%s",
+                               match_candidates[i], match_candidates[j]);
 
                        g_test_add_data_func (path, GUINT_TO_POINTER (n), test_compare_numbers);
                        g_free (path);
diff --git a/tests/libebook/test-query.c b/tests/libebook/test-query.c
index 53fd7cd..cf46606 100644
--- a/tests/libebook/test-query.c
+++ b/tests/libebook/test-query.c
@@ -13,10 +13,10 @@ typedef struct {
 } TestData;
 
 static void
-normalize_space (char *str)
+normalize_space (gchar *str)
 {
        while (*str) {
-               char *tail;
+               gchar *tail;
 
                if (*str++ != ' ')
                        continue;
@@ -35,7 +35,7 @@ test_query (gconstpointer data)
 {
        const TestData *const test = data;
        EBookQuery *query;
-       char *sexp;
+       gchar *sexp;
 
        setlocale (LC_ADDRESS, test->locale);
        sexp = e_book_query_to_string (test->query);
@@ -68,9 +68,9 @@ test_data_free (gpointer data)
 }
 
 static void
-add_query_test (const char *path,
+add_query_test (const gchar *path,
                 EBookQuery *query,
-                const char *sexp)
+                const gchar *sexp)
 {
        TestData *data = g_slice_new (TestData);
 
@@ -91,98 +91,123 @@ main (gint argc,
 
        setlocale (LC_ADDRESS, "en_US.UTF-8");
 
-       add_query_test ("/libebook/test-query/sexp/all",
-                       e_book_query_any_field_contains (NULL),
-                       "(contains \"x-evolution-any-field\" \"\")");
-
-       add_query_test ("/libebook/test-query/sexp/any",
-                       e_book_query_any_field_contains ("liberty"),
-                       "(contains \"x-evolution-any-field\" \"liberty\")");
-
-       add_query_test ("/libebook/test-query/sexp/not",
-                       e_book_query_not (e_book_query_any_field_contains ("liberty"), TRUE),
-                       "(not (contains \"x-evolution-any-field\" \"liberty\"))");
-
-       add_query_test ("/libebook/test-query/sexp/and",
-                       e_book_query_andv (e_book_query_any_field_contains ("liberty"),
-                                          e_book_query_any_field_contains ("friendship"),
-                                          NULL),
-                       "(and (contains \"x-evolution-any-field\" \"liberty\")"
-                           " (contains \"x-evolution-any-field\" \"friendship\")"
-                           " )");
-
-       add_query_test ("/libebook/test-query/sexp/or",
-                       e_book_query_orv (e_book_query_any_field_contains ("liberty"),
-                                         e_book_query_any_field_contains ("friendship"),
-                                         NULL),
-                       "(or (contains \"x-evolution-any-field\" \"liberty\")"
-                          " (contains \"x-evolution-any-field\" \"friendship\")"
-                          " )");
-
-       add_query_test ("/libebook/test-query/sexp/exists",
-                       e_book_query_field_exists (E_CONTACT_FULL_NAME),
-                       "(exists \"full_name\")");
-
-       add_query_test ("/libebook/test-query/sexp/contains",
-                       e_book_query_field_test (E_CONTACT_FULL_NAME,
-                                                E_BOOK_QUERY_CONTAINS,
-                                                "Miguel"),
-                       "(contains \"full_name\" \"Miguel\")");
-
-       add_query_test ("/libebook/test-query/sexp/is",
-                       e_book_query_field_test (E_CONTACT_GIVEN_NAME,
-                                                E_BOOK_QUERY_IS,
-                                                "Miguel"),
-                       "(is \"given_name\" \"Miguel\")");
-
-       add_query_test ("/libebook/test-query/sexp/beginswith",
-                       e_book_query_field_test (E_CONTACT_FULL_NAME,
-                                                E_BOOK_QUERY_BEGINS_WITH,
-                                                "Mig"),
-                       "(beginswith \"full_name\" \"Mig\")");
-
-       add_query_test ("/libebook/test-query/sexp/endswith",
-                       e_book_query_field_test (E_CONTACT_TEL,
-                                                E_BOOK_QUERY_ENDS_WITH,
-                                                "5423789"),
-                       "(endswith \"phone\" \"5423789\")");
-
-       add_query_test ("/libebook/test-query/sexp/eqphone/us",
-                       e_book_query_orv (e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
-                                                                  "+1-2215423789"),
-                                         e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
-                                                                  "2215423789"),
-                                         e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
-                                                                  "5423789"),
-                                         NULL),
-
-                       "(or (eqphone \"phone\" \"+1-2215423789\" \"en_US.UTF-8\")"
-                          " (eqphone_national \"phone\" \"2215423789\" \"en_US.UTF-8\")"
-                          " (eqphone_short \"phone\" \"5423789\" \"en_US.UTF-8\")"
-                          " )");
+       add_query_test (
+               "/libebook/test-query/sexp/all",
+               e_book_query_any_field_contains (NULL),
+               "(contains \"x-evolution-any-field\" \"\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/any",
+               e_book_query_any_field_contains ("liberty"),
+               "(contains \"x-evolution-any-field\" \"liberty\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/not",
+               e_book_query_not (
+                       e_book_query_any_field_contains ("liberty"), TRUE),
+               "(not (contains \"x-evolution-any-field\" \"liberty\"))");
+
+       add_query_test (
+               "/libebook/test-query/sexp/and",
+               e_book_query_andv (
+                       e_book_query_any_field_contains ("liberty"),
+                       e_book_query_any_field_contains ("friendship"),
+                       NULL),
+               "(and (contains \"x-evolution-any-field\" \"liberty\")"
+               " (contains \"x-evolution-any-field\" \"friendship\")"
+               " )");
+
+       add_query_test (
+               "/libebook/test-query/sexp/or",
+               e_book_query_orv (
+                       e_book_query_any_field_contains ("liberty"),
+                       e_book_query_any_field_contains ("friendship"),
+                       NULL),
+               "(or (contains \"x-evolution-any-field\" \"liberty\")"
+               " (contains \"x-evolution-any-field\" \"friendship\")"
+               " )");
+
+       add_query_test (
+               "/libebook/test-query/sexp/exists",
+               e_book_query_field_exists (
+                       E_CONTACT_FULL_NAME),
+                       "(exists \"full_name\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/contains",
+               e_book_query_field_test (
+                       E_CONTACT_FULL_NAME,
+                       E_BOOK_QUERY_CONTAINS,
+                       "Miguel"),
+               "(contains \"full_name\" \"Miguel\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/is",
+               e_book_query_field_test (
+                       E_CONTACT_GIVEN_NAME,
+                       E_BOOK_QUERY_IS,
+                       "Miguel"),
+               "(is \"given_name\" \"Miguel\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/beginswith",
+               e_book_query_field_test (
+                       E_CONTACT_FULL_NAME,
+                       E_BOOK_QUERY_BEGINS_WITH,
+                       "Mig"),
+               "(beginswith \"full_name\" \"Mig\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/endswith",
+               e_book_query_field_test (
+                       E_CONTACT_TEL,
+                       E_BOOK_QUERY_ENDS_WITH,
+                       "5423789"),
+               "(endswith \"phone\" \"5423789\")");
+
+       add_query_test (
+               "/libebook/test-query/sexp/eqphone/us",
+               e_book_query_orv (
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+                               "+1-2215423789"),
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
+                               "2215423789"),
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
+                               "5423789"),
+                               NULL),
+               "(or (eqphone \"phone\" \"+1-2215423789\" \"en_US.UTF-8\")"
+               " (eqphone_national \"phone\" \"2215423789\" \"en_US.UTF-8\")"
+               " (eqphone_short \"phone\" \"5423789\" \"en_US.UTF-8\")"
+               " )");
 
        setlocale (LC_ADDRESS, "en_GB.UTF-8");
 
-       add_query_test ("/libebook/test-query/sexp/eqphone/gb",
-                       e_book_query_orv (e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
-                                                                  "+1-2215423789"),
-                                         e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
-                                                                  "2215423789"),
-                                         e_book_query_field_test (E_CONTACT_TEL,
-                                                                  E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
-                                                                  "5423789"),
-                                         NULL),
-
-                       "(or (eqphone \"phone\" \"+1-2215423789\" \"en_GB.UTF-8\")"
-                          " (eqphone_national \"phone\" \"2215423789\" \"en_GB.UTF-8\")"
-                          " (eqphone_short \"phone\" \"5423789\" \"en_GB.UTF-8\")"
-                          " )");
-
+       add_query_test (
+               "/libebook/test-query/sexp/eqphone/gb",
+               e_book_query_orv (
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+                               "+1-2215423789"),
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
+                               "2215423789"),
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
+                               "5423789"),
+                       NULL),
+               "(or (eqphone \"phone\" \"+1-2215423789\" \"en_GB.UTF-8\")"
+               " (eqphone_national \"phone\" \"2215423789\" \"en_GB.UTF-8\")"
+               " (eqphone_short \"phone\" \"5423789\" \"en_GB.UTF-8\")"
+               " )");
 
        return g_test_run ();
 }
diff --git a/tests/libecal/client/test-client-get-free-busy.c 
b/tests/libecal/client/test-client-get-free-busy.c
index 4b8a0b7..9663b07 100644
--- a/tests/libecal/client/test-client-get-free-busy.c
+++ b/tests/libecal/client/test-client-get-free-busy.c
@@ -15,10 +15,9 @@ static ETestServerClosure cal_closure =
 
 static gboolean received_free_busy_data = FALSE;
 
-
 static void
 setup_fixture (ETestServerFixture *fixture,
-              gconstpointer user_data)
+               gconstpointer user_data)
 {
        GError *error = NULL;
        ESource *scratch;
@@ -56,7 +55,7 @@ setup_fixture (ETestServerFixture *fixture,
 
 static void
 teardown_fixture (ETestServerFixture *fixture,
-                 gconstpointer user_data)
+                  gconstpointer user_data)
 {
        GError *error = NULL;
        ESource *source;
diff --git a/tests/libecal/test-ecal-get-free-busy.c b/tests/libecal/test-ecal-get-free-busy.c
index c3d3929..f377267 100644
--- a/tests/libecal/test-ecal-get-free-busy.c
+++ b/tests/libecal/test-ecal-get-free-busy.c
@@ -16,7 +16,7 @@ static ETestServerClosure cal_closure =
 
 static void
 setup_fixture (ETestServerFixture *fixture,
-              gconstpointer user_data)
+               gconstpointer user_data)
 {
        GError *error = NULL;
        ESource *scratch;
@@ -54,7 +54,7 @@ setup_fixture (ETestServerFixture *fixture,
 
 static void
 teardown_fixture (ETestServerFixture *fixture,
-                 gconstpointer user_data)
+                  gconstpointer user_data)
 {
        GError *error = NULL;
        ESource *source;
diff --git a/tests/libecal/test-ecal-get-ldap-attribute.c b/tests/libecal/test-ecal-get-ldap-attribute.c
index 4d7734b..9077157 100644
--- a/tests/libecal/test-ecal-get-ldap-attribute.c
+++ b/tests/libecal/test-ecal-get-ldap-attribute.c
@@ -21,9 +21,12 @@ test_get_ldap_attribute (ETestServerFixture *fixture,
        if (e_cal_get_ldap_attribute (cal, &attr, &error))
                g_error ("e_cal_get_ldap_attribute() is dropped but returned TRUE");
        else if (!g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_NOT_SUPPORTED))
-               g_error ("e_cal_get_ldap_attribute() returned unexpected error code '%d' from "
-                        "domain %s: %s",
-                        error->code, g_quark_to_string (error->domain), error->message);
+               g_error (
+                       "e_cal_get_ldap_attribute() returned unexpected "
+                       "error code '%d' from domain %s: %s",
+                       error->code,
+                       g_quark_to_string (error->domain),
+                       error->message);
 }
 
 gint
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index d6c0332..2ee75d3 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -47,7 +47,6 @@ static GTestDBus *global_test_dbus = NULL;
  */
 static gint global_test_source_id = 0;
 
-
 typedef struct {
        ETestServerFixture *fixture;
        ETestServerClosure *closure;
@@ -119,8 +118,8 @@ e_test_server_utils_bootstrap_timeout (FixturePair *pair)
 
 static void
 e_test_server_utils_source_added (ESourceRegistry *registry,
-                                 ESource         *source,
-                                 FixturePair     *pair)
+                                  ESource *source,
+                                  FixturePair *pair)
 {
        GError  *error = NULL;
 
@@ -157,8 +156,9 @@ e_test_server_utils_source_added (ESourceRegistry *registry,
        case E_TEST_SERVER_CALENDAR:
 
                pair->fixture->service.calendar_client = (ECalClient *)
-                       e_cal_client_connect_sync (source,
-                                                  pair->closure->calendar_source_type, NULL, &error);
+                       e_cal_client_connect_sync (
+                               source,
+                               pair->closure->calendar_source_type, NULL, &error);
                if (!pair->fixture->service.calendar_client)
                        g_error ("Unable to create the test calendar: %s", error->message);
 
@@ -194,8 +194,9 @@ e_test_server_utils_bootstrap_idle (FixturePair *pair)
        if (!pair->fixture->registry)
                g_error ("Unable to create the test registry: %s", error->message);
 
-       g_signal_connect (pair->fixture->registry, "source-added",
-                         G_CALLBACK (e_test_server_utils_source_added), pair);
+       g_signal_connect (
+               pair->fixture->registry, "source-added",
+               G_CALLBACK (e_test_server_utils_source_added), pair);
 
        /* Create an address book */
        switch (pair->closure->type) {
diff --git a/tests/test-server-utils/test-fixture.c b/tests/test-server-utils/test-fixture.c
index 33e93a4..d665b59 100644
--- a/tests/test-server-utils/test-fixture.c
+++ b/tests/test-server-utils/test-fixture.c
@@ -62,32 +62,37 @@ main (gint argc,
 
        for (i = 0; i < N_CYCLES; i++) {
                registry_keys[i] = g_strdup_printf ("/Fixture/Registry%d", i);
-               g_test_add (registry_keys[i], ETestServerFixture, &registry_closure,
-                           e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
+               g_test_add (
+                       registry_keys[i], ETestServerFixture, &registry_closure,
+                       e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
        }
 
        for (i = 0; i < N_CYCLES; i++) {
                book_keys[i] = g_strdup_printf ("/Fixture/Book%d", i);
-               g_test_add (book_keys[i], ETestServerFixture, &book_closure,
-                           e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
+               g_test_add (
+                       book_keys[i], ETestServerFixture, &book_closure,
+                       e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
        }
 
        for (i = 0; i < N_CYCLES; i++) {
                calendar_keys[i] = g_strdup_printf ("/Fixture/Calendar%d", i);
-               g_test_add (calendar_keys[i], ETestServerFixture, &calendar_closure,
-                           e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
+               g_test_add (
+                       calendar_keys[i], ETestServerFixture, &calendar_closure,
+                       e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
        }
 
        for (i = 0; i < N_CYCLES; i++) {
                deprecated_book_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Book%d", i);
-               g_test_add (deprecated_book_keys[i], ETestServerFixture, &deprecated_book_closure,
-                           e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
+               g_test_add (
+                       deprecated_book_keys[i], ETestServerFixture, &deprecated_book_closure,
+                       e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
        }
 
        for (i = 0; i < N_CYCLES; i++) {
                deprecated_calendar_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Calendar%d", i);
-               g_test_add (deprecated_calendar_keys[i], ETestServerFixture, &deprecated_calendar_closure,
-                           e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
+               g_test_add (
+                       deprecated_calendar_keys[i], ETestServerFixture, &deprecated_calendar_closure,
+                       e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
        }
 
        ret = e_test_server_utils_run ();


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