[evolution-data-server] Replace deprecated GLib symbols (as of GLib 2.34.x)



commit a22972f4bd76a15729e95a7b9cb75021ed2c38af
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 5 20:19:01 2012 +0100

    Replace deprecated GLib symbols (as of GLib 2.34.x)

 addressbook/backends/file/e-book-backend-file.c    |    8 +-
 .../backends/google/e-gdata-goa-authorizer.c       |   14 +-
 addressbook/backends/ldap/e-book-backend-ldap.c    |  412 ++++++++++----------
 addressbook/backends/ldap/e-source-ldap.c          |   26 +-
 addressbook/backends/vcf/e-book-backend-vcf.c      |   40 +-
 addressbook/backends/vcf/e-source-vcf.c            |   16 +-
 .../backends/webdav/e-book-backend-webdav.c        |    5 +-
 addressbook/libebook/e-book-client.c               |    6 +-
 .../libedata-book/e-book-backend-sqlitedb.c        |   48 ++--
 addressbook/libedata-book/e-book-backend.c         |   60 ++--
 addressbook/libedata-book/e-data-book-factory.c    |   32 +-
 addressbook/libedata-book/e-data-book-view.c       |   34 +-
 addressbook/libedata-book/e-data-book.c            |   22 +-
 calendar/backends/caldav/e-cal-backend-caldav.c    |   89 ++---
 .../backends/contacts/e-cal-backend-contacts.c     |   36 +-
 calendar/backends/file/e-cal-backend-file.c        |  154 ++++----
 calendar/backends/file/e-source-local.c            |   14 +-
 calendar/backends/weather/e-source-weather.c       |   16 +-
 calendar/libecal/e-cal-client.c                    |   26 +-
 calendar/libecal/e-cal-system-timezone.c           |    8 +-
 calendar/libecal/e-cal.c                           |   10 +-
 calendar/libedata-cal/e-cal-backend-file-store.c   |   74 ++--
 calendar/libedata-cal/e-cal-backend-intervaltree.c |   20 +-
 calendar/libedata-cal/e-cal-backend-sync.c         |   18 +-
 calendar/libedata-cal/e-cal-backend.c              |   60 ++--
 calendar/libedata-cal/e-data-cal-factory.c         |   32 +-
 calendar/libedata-cal/e-data-cal-view.c            |   38 +-
 calendar/libedata-cal/e-data-cal.c                 |   22 +-
 camel/camel-block-file.c                           |   44 +-
 camel/camel-certdb.c                               |   50 ++--
 camel/camel-cipher-context.c                       |   10 +-
 camel/camel-data-wrapper.c                         |   10 +-
 camel/camel-db.c                                   |   70 ++--
 camel/camel-debug.c                                |   18 +-
 camel/camel-folder-summary.c                       |   56 ++--
 camel/camel-folder.c                               |   20 +-
 camel/camel-imapx-command.c                        |   26 +-
 camel/camel-imapx-conn-manager.c                   |   44 +-
 camel/camel-imapx-folder.c                         |   28 +-
 camel/camel-imapx-folder.h                         |    4 +-
 camel/camel-imapx-job.c                            |   26 +-
 camel/camel-imapx-server.c                         |   86 ++---
 camel/camel-imapx-server.h                         |    6 +-
 camel/camel-imapx-settings.c                       |   26 +-
 camel/camel-imapx-store.c                          |   18 +-
 camel/camel-imapx-store.h                          |    2 +-
 camel/camel-local-settings.c                       |   16 +-
 camel/camel-lock-client.c                          |    6 +-
 camel/camel-mime-utils.c                           |    6 +-
 camel/camel-msgport.c                              |   12 +-
 camel/camel-msgport.h                              |    3 +-
 camel/camel-net-utils.c                            |    2 +-
 camel/camel-object-bag.c                           |   62 ++--
 camel/camel-operation.c                            |    6 +-
 camel/camel-partition-table.c                      |   20 +-
 camel/camel-provider.c                             |    6 +-
 camel/camel-sasl-popb4smtp.c                       |    6 +-
 camel/camel-service.c                              |   36 +-
 camel/camel-session.c                              |   26 +-
 camel/camel-store-summary.c                        |   30 +-
 camel/camel-store.c                                |   10 +-
 camel/camel-string-utils.c                         |   18 +-
 camel/camel-text-index.c                           |   10 +-
 camel/camel-transport.c                            |   10 +-
 camel/camel-vee-data-cache.c                       |   74 ++--
 camel/camel-vee-folder.c                           |   30 +-
 camel/camel-vee-store.c                            |   38 +-
 camel/providers/imap/camel-imap-command.c          |   18 +-
 camel/providers/imap/camel-imap-folder.c           |    8 +-
 camel/providers/imap/camel-imap-private.h          |   18 +-
 camel/providers/imap/camel-imap-settings.c         |   56 ++--
 camel/providers/imap/camel-imap-store.c            |    4 +-
 camel/providers/imap/camel-imap-store.h            |    2 +-
 camel/providers/imap/camel-imap-wrapper.c          |   10 +-
 camel/providers/local/camel-local-folder.c         |    4 +-
 camel/providers/local/camel-local-private.h        |    6 +-
 camel/providers/local/camel-maildir-summary.c      |   12 +-
 camel/providers/nntp/camel-nntp-folder.c           |    8 +-
 camel/providers/nntp/camel-nntp-private.h          |   13 +-
 camel/providers/sendmail/camel-sendmail-settings.c |   26 +-
 camel/tests/folder/test10.c                        |    6 +-
 camel/tests/folder/test8.c                         |    6 +-
 camel/tests/lib/camel-test.c                       |    6 +-
 configure.ac                                       |   10 +-
 libebackend/e-authentication-mediator.c            |   70 ++--
 libebackend/e-authentication-session.c             |   36 +-
 libebackend/e-collection-backend.c                 |   44 +-
 libebackend/e-data-factory.c                       |   10 +-
 libebackend/e-source-registry-server.c             |   70 ++--
 libebackend/e-sqlite3-vfs.c                        |   28 +-
 libedataserver/e-categories.c                      |    2 +-
 libedataserver/e-client.c                          |   66 ++--
 libedataserver/e-data-server-util.c                |    2 +-
 libedataserver/e-debug-log.c                       |    6 +-
 libedataserver/e-flag.c                            |   60 ++--
 libedataserver/e-flag.h                            |    4 +-
 libedataserver/e-operation-pool.c                  |   16 +-
 libedataserver/e-source-alarms.c                   |   16 +-
 libedataserver/e-source-authentication.c           |   36 +-
 libedataserver/e-source-backend.c                  |   16 +-
 libedataserver/e-source-collection.c               |   16 +-
 libedataserver/e-source-goa.c                      |   16 +-
 libedataserver/e-source-mail-account.c             |   16 +-
 libedataserver/e-source-mail-composition.c         |   46 ++--
 libedataserver/e-source-mail-identity.c            |   56 ++--
 libedataserver/e-source-mail-signature.c           |   16 +-
 libedataserver/e-source-mail-submission.c          |   26 +-
 libedataserver/e-source-openpgp.c                  |   26 +-
 libedataserver/e-source-refresh.c                  |   22 +-
 libedataserver/e-source-registry.c                 |   80 ++--
 libedataserver/e-source-resource.c                 |   16 +-
 libedataserver/e-source-security.c                 |   16 +-
 libedataserver/e-source-selectable.c               |   16 +-
 libedataserver/e-source-smime.c                    |   36 +-
 libedataserver/e-source-webdav.c                   |   62 ++--
 libedataserver/e-source.c                          |   74 ++--
 tests/libebook/client/client-test-utils.c          |   10 +-
 tests/libecal/client/client-test-utils.c           |   10 +-
 118 files changed, 1778 insertions(+), 1788 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index d94398a..3e8a17c 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -1500,6 +1500,8 @@ closure_destroy (FileBackendSearchClosure *closure)
 {
 	d (printf ("destroying search closure\n"));
 	e_flag_free (closure->running);
+	if (closure->thread)
+		g_thread_unref (closure->thread);
 	g_free (closure);
 }
 
@@ -1697,7 +1699,7 @@ e_book_backend_file_start_view (EBookBackend *backend,
 	FileBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_FILE (backend));
 
 	d (printf ("starting book view thread\n"));
-	closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+	closure->thread = g_thread_new (NULL, book_view_thread, book_view);
 
 	e_flag_wait (closure->running);
 
@@ -1719,8 +1721,10 @@ e_book_backend_file_stop_view (EBookBackend *backend,
 	need_join = e_flag_is_set (closure->running);
 	e_flag_clear (closure->running);
 
-	if (need_join)
+	if (need_join) {
 		g_thread_join (closure->thread);
+		closure->thread = NULL;
+	}
 }
 
 /*
diff --git a/addressbook/backends/google/e-gdata-goa-authorizer.c b/addressbook/backends/google/e-gdata-goa-authorizer.c
index abbba5a..74a6059 100644
--- a/addressbook/backends/google/e-gdata-goa-authorizer.c
+++ b/addressbook/backends/google/e-gdata-goa-authorizer.c
@@ -43,7 +43,7 @@ enum {
 };
 
 /* GDataAuthorizer methods must be thread-safe. */
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
 
 /* Forward Declarations */
 static void	e_gdata_goa_authorizer_interface_init
@@ -459,12 +459,12 @@ gdata_goa_authorizer_process_request (GDataAuthorizer *authorizer,
                                       GDataAuthorizationDomain *domain,
                                       SoupMessage *message)
 {
-	g_static_mutex_lock (&mutex);
+	g_mutex_lock (&mutex);
 
 	if (gdata_goa_authorizer_is_authorized (authorizer, domain))
 		gdata_goa_authorizer_add_authorization (authorizer, message);
 
-	g_static_mutex_unlock (&mutex);
+	g_mutex_unlock (&mutex);
 }
 
 static gboolean
@@ -473,11 +473,11 @@ gdata_goa_authorizer_is_authorized_for_domain (GDataAuthorizer *authorizer,
 {
 	gboolean authorized;
 
-	g_static_mutex_lock (&mutex);
+	g_mutex_lock (&mutex);
 
 	authorized = gdata_goa_authorizer_is_authorized (authorizer, domain);
 
-	g_static_mutex_unlock (&mutex);
+	g_mutex_unlock (&mutex);
 
 	return authorized;
 }
@@ -495,7 +495,7 @@ gdata_goa_authorizer_refresh_authorization (GDataAuthorizer *authorizer,
 
 	priv = E_GDATA_GOA_AUTHORIZER_GET_PRIVATE (authorizer);
 
-	g_static_mutex_lock (&mutex);
+	g_mutex_lock (&mutex);
 
 	g_free (priv->access_token);
 	priv->access_token = NULL;
@@ -536,7 +536,7 @@ exit:
 	if (goa_oauth2_based != NULL)
 		g_object_unref (goa_oauth2_based);
 
-	g_static_mutex_unlock (&mutex);
+	g_mutex_unlock (&mutex);
 
 	return success;
 }
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index f232562..60ae178 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -214,7 +214,7 @@ struct _EBookBackendLDAPPrivate {
 	gboolean marked_for_offline;
 
 	/* our operations */
-	GStaticRecMutex op_hash_mutex;
+	GRecMutex op_hash_mutex;
 	GHashTable *id_to_op;
 	gint active_ops;
 	guint poll_timeout;
@@ -245,7 +245,7 @@ struct LDAPOp {
 };
 
 /* every access to priv->ldap should be guarded with this lock */
-static GStaticRecMutex eds_ldap_handler_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex eds_ldap_handler_lock;
 
 static void     ldap_op_add (LDAPOp *op, EBookBackend *backend, EDataBook *book,
 			     EDataBookView *view, gint opid, gint msgid, LDAPOpHandler handler, LDAPOpDtor dtor);
@@ -557,12 +557,12 @@ check_schema_support (EBookBackendLDAP *bl)
 	LDAPMessage *resp;
 	struct timeval timeout;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (!bl->priv->schema_dn)
 		return;
@@ -575,14 +575,14 @@ check_schema_support (EBookBackendLDAP *bl)
 	timeout.tv_sec = 30;
 	timeout.tv_usec = 0;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (ldap_search_ext_s (bl->priv->ldap, bl->priv->schema_dn, LDAP_SCOPE_BASE,
 			       "(objectClass=subschema)", (gchar **) attrs, 0,
 			       NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp) == LDAP_SUCCESS) {
 		gchar **values;
 
 		values = ldap_get_values (bl->priv->ldap, resp, "objectClasses");
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		if (values) {
 			gint i;
@@ -641,7 +641,7 @@ check_schema_support (EBookBackendLDAP *bl)
 		ldap_msgfree (resp);
 	}
 	else {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	}
 }
 
@@ -702,12 +702,12 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 	gint i = 0;
 	struct timeval timeout;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		return ldap_error;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	attrs[i++] = "supportedControl";
 	attrs[i++] = "supportedExtension";
@@ -721,21 +721,21 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 	timeout.tv_sec = 30;
 	timeout.tv_usec = 0;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	ldap_error = ldap_search_ext_s (
 		bl->priv->ldap,
 		LDAP_ROOT_DSE, LDAP_SCOPE_BASE,
 		"(objectclass=*)",
 		(gchar **) attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	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");
 		return ldap_error;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	values = ldap_get_values (bl->priv->ldap, resp, "supportedControl");
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (values) {
 		if (enable_debug) {
 			for (i = 0; values[i]; i++)
@@ -744,9 +744,9 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 		ldap_value_free (values);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	values = ldap_get_values (bl->priv->ldap, resp, "supportedExtension");
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (values) {
 		if (enable_debug) {
 			for (i = 0; values[i]; i++) {
@@ -759,9 +759,9 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 		ldap_value_free (values);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	values = ldap_get_values (bl->priv->ldap, resp, "supportedSASLMechanisms");
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (values) {
 		gchar *auth_method;
 		if (bl->priv->supported_auth_methods) {
@@ -785,14 +785,14 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 		ldap_value_free (values);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	values = ldap_get_values (bl->priv->ldap, resp, "subschemaSubentry");
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (!values || !values[0]) {
 		if (values) ldap_value_free (values);
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		values = ldap_get_values (bl->priv->ldap, resp, "schemaNamingContext");
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	}
 	if (values && values[0]) {
 		g_free (bl->priv->schema_dn);
@@ -827,7 +827,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 	}
 
 	/* close connection first if it's open first */
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (blpriv->ldap) {
 		ldap_unbind (blpriv->ldap);
 	}
@@ -863,7 +863,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 			g_message ("TLS not available (fatal version), v3 protocol could not be established (ldap_error 0x%02x)", ldap_error);
 			ldap_unbind (blpriv->ldap);
 			blpriv->ldap = NULL;
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_propagate_error (error, EDB_ERROR (TLS_NOT_AVAILABLE));
 			return FALSE;
 		}
@@ -912,7 +912,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
-				g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+				g_rec_mutex_unlock (&eds_ldap_handler_lock);
 				g_propagate_error (error, EDB_ERROR (TLS_NOT_AVAILABLE));
 				return FALSE;
 			} else if (enable_debug)
@@ -942,7 +942,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 			}
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_propagate_error (
 				error, e_data_book_create_error (
 				E_DATA_BOOK_STATUS_OTHER_ERROR,
@@ -956,7 +956,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 			}
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_propagate_error (error, EDB_ERROR (REPOSITORY_OFFLINE));
 			return FALSE;
 		} else if (ldap_error == LDAP_INVALID_CREDENTIALS) {
@@ -965,7 +965,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 			}
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_propagate_error (error, EDB_ERROR (AUTHENTICATION_FAILED));
 			return FALSE;
 		}
@@ -988,7 +988,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 		    || ldap_error == LDAP_PARTIAL_RESULTS
 		    || LDAP_NAME_ERROR (ldap_error)) {
 			blpriv->connected = TRUE;
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 			/* check to see if evolutionPerson is supported, if we can (me
 			 * might not be able to if we can't authenticate.  if we
@@ -1011,7 +1011,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 			}
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_propagate_error (error, EDB_ERROR (AUTHENTICATION_FAILED));
 			return FALSE;
 		} else {
@@ -1019,7 +1019,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 			}
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_warning ("Failed to perform root dse query anonymously, (ldap_error 0x%02x)", ldap_error);
 		}
 	} else {
@@ -1027,7 +1027,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
 			ldap_unbind (blpriv->ldap);
 			blpriv->ldap = NULL;
 		}
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	}
 
 	g_warning (
@@ -1056,14 +1056,14 @@ e_book_backend_ldap_reconnect (EBookBackendLDAP *bl,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (enable_debug)
 			printf ("e_book_backend_ldap_reconnect ... ldap handler is NULL\n");
 		return FALSE;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	/* we need to reconnect if we were previously connected */
 	if (bl->priv->connected && ldap_status == LDAP_SERVER_DOWN) {
@@ -1079,12 +1079,12 @@ e_book_backend_ldap_reconnect (EBookBackendLDAP *bl,
 		}
 
 		if (bl->priv->auth_dn) {
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			ldap_error = ldap_simple_bind_s (
 				bl->priv->ldap,
 				bl->priv->auth_dn,
 				bl->priv->auth_secret);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 		book_view_notify_status (bl, book_view, "");
 
@@ -1125,7 +1125,7 @@ ldap_op_add (LDAPOp *op,
 	op->handler = handler;
 	op->dtor = dtor;
 
-	g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_lock (&bl->priv->op_hash_mutex);
 	if (g_hash_table_lookup (bl->priv->id_to_op, &op->id)) {
 		g_warning ("conflicting ldap msgid's");
 	}
@@ -1138,7 +1138,7 @@ ldap_op_add (LDAPOp *op,
 		bl->priv->poll_timeout = g_timeout_add (
 			LDAP_POLL_INTERVAL,
 			(GSourceFunc) poll_ldap, bl);
-	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
 static void
@@ -1147,17 +1147,17 @@ ldap_op_finished (LDAPOp *op)
 	EBookBackend *backend = op->backend;
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
-	g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_lock (&bl->priv->op_hash_mutex);
 	g_hash_table_remove (bl->priv->id_to_op, &op->id);
 
 	/* clear the status message too */
 	book_view_notify_status (bl, find_book_view (bl), "");
 
 	/* should handle errors here */
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (bl->priv->ldap)
 		ldap_abandon (bl->priv->ldap, op->id);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (op->dtor)
 		op->dtor (op);
@@ -1170,7 +1170,7 @@ ldap_op_finished (LDAPOp *op)
 			bl->priv->poll_timeout = 0;
 		}
 	}
-	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
 static void
@@ -1180,13 +1180,13 @@ ldap_op_change_id (LDAPOp *op,
 	EBookBackend *backend = op->backend;
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
-	g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_lock (&bl->priv->op_hash_mutex);
 	g_hash_table_remove (bl->priv->id_to_op, &op->id);
 
 	op->id = msg_id;
 
 	g_hash_table_insert (bl->priv->id_to_op, &op->id, op);
-	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
 static GError *
@@ -1562,9 +1562,9 @@ create_contact_handler (LDAPOp *op,
 	gint ldap_error;
 	GSList added_contacts = {NULL,};
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_create_contacts (
 			op->book,
 			op->opid,
@@ -1573,7 +1573,7 @@ create_contact_handler (LDAPOp *op,
 		ldap_op_finished (op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (LDAP_RES_ADD != ldap_msgtype (res)) {
 		e_data_book_respond_create_contacts (
@@ -1585,11 +1585,11 @@ create_contact_handler (LDAPOp *op,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	ldap_parse_result (
 		bl->priv->ldap, res, &ldap_error,
 		NULL, &ldap_error_msg, NULL, NULL, 0);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (ldap_error != LDAP_SUCCESS) {
 		g_warning (
 			"create_contact_handler: %02X (%s), additional info: %s",
@@ -1655,13 +1655,13 @@ e_book_backend_ldap_create_contacts (EBookBackend *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_create_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	book_view = find_book_view (bl);
 
@@ -1730,11 +1730,11 @@ e_book_backend_ldap_create_contacts (EBookBackend *backend,
 
 	do {
 		book_view_notify_status (bl, book_view, _("Adding contact to LDAP server..."));
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		err = ldap_add_ext (
 			bl->priv->ldap, create_op->dn, ldap_mods,
 			NULL, NULL, &create_contact_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	} while (e_book_backend_ldap_reconnect (bl, book_view, err));
 
@@ -1773,14 +1773,14 @@ remove_contact_handler (LDAPOp *op,
 	gint ldap_error;
 	GSList *ids = NULL;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_remove_contacts (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		ldap_op_finished (op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (LDAP_RES_DELETE != ldap_msgtype (res)) {
 		e_data_book_respond_remove_contacts (
@@ -1792,11 +1792,11 @@ remove_contact_handler (LDAPOp *op,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	ldap_parse_result (
 		bl->priv->ldap, res, &ldap_error,
 		NULL, &ldap_error_msg, NULL, NULL, 0);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (ldap_error != LDAP_SUCCESS) {
 		g_warning (
 			"remove_contact_handler: %02X (%s), additional info: %s",
@@ -1848,14 +1848,14 @@ e_book_backend_ldap_remove_contacts (EBookBackend *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		g_free (remove_op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	book_view = find_book_view (bl);
 
@@ -1869,12 +1869,12 @@ e_book_backend_ldap_remove_contacts (EBookBackend *backend,
 	do {
 		book_view_notify_status (bl, book_view, _("Removing contact from LDAP server..."));
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_delete_ext (
 			bl->priv->ldap,
 			remove_op->id,
 			NULL, NULL, &remove_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
 	if (ldap_error != LDAP_SUCCESS) {
@@ -1927,9 +1927,9 @@ modify_contact_modify_handler (LDAPOp *op,
 	gint ldap_error;
 	GSList modified_contacts = {NULL,};
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_modify_contacts (op->book,
 						     op->opid,
 						     EDB_ERROR_NOT_CONNECTED (),
@@ -1937,7 +1937,7 @@ modify_contact_modify_handler (LDAPOp *op,
 		ldap_op_finished (op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (LDAP_RES_MODIFY != ldap_msgtype (res)) {
 		e_data_book_respond_modify_contacts (op->book,
@@ -1948,11 +1948,11 @@ modify_contact_modify_handler (LDAPOp *op,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	ldap_parse_result (
 		bl->priv->ldap, res, &ldap_error,
 		NULL, &ldap_error_msg, NULL, NULL, 0);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (ldap_error != LDAP_SUCCESS) {
 		g_warning (
 			"modify_contact_modify_handler: %02X (%s), additional info: %s",
@@ -1984,15 +1984,15 @@ modify_contact_search_handler (LDAPOp *op,
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (op->backend);
 	gint msg_type;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_modify_contacts (op->book, op->opid,
 						     EDB_ERROR_NOT_CONNECTED (), NULL);
 		ldap_op_finished (op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	/* if it's successful, we should get called with a
 	 * RES_SEARCH_ENTRY and a RES_SEARCH_RESULT.  if it's
@@ -2002,9 +2002,9 @@ modify_contact_search_handler (LDAPOp *op,
 	if (msg_type == LDAP_RES_SEARCH_ENTRY) {
 		LDAPMessage *e;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		if (!e) {
 			e_data_book_respond_modify_contacts (op->book,
@@ -2027,11 +2027,11 @@ modify_contact_search_handler (LDAPOp *op,
 
 		/* grab the result code, and set up the actual modify (or rename)
 		 * if it was successful */
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"modify_contact_search_handler: %02X (%s), additional info: %s",
@@ -2078,14 +2078,14 @@ modify_contact_search_handler (LDAPOp *op,
 				gint rename_contact_msgid;
 
 				/* actually perform the ldap rename */
-				g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+				g_rec_mutex_lock (&eds_ldap_handler_lock);
 				ldap_error = ldap_rename (
 					bl->priv->ldap, current_dn,
 					new_uid /* newRDN */,
 					NULL    /* NewSuperior */,
 					0       /* deleteOldRDN */,
 					NULL, NULL, &rename_contact_msgid);
-				g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+				g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 				g_free (new_uid);
 
@@ -2133,9 +2133,9 @@ modify_contact_rename_handler (LDAPOp *op,
 	gboolean differences;
 	gint modify_contact_msgid;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_modify_contacts (op->book,
 						     op->opid,
 						     EDB_ERROR_NOT_CONNECTED (),
@@ -2143,7 +2143,7 @@ modify_contact_rename_handler (LDAPOp *op,
 		ldap_op_finished (op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	/* was a rename necessary? */
 	if (modify_op->new_id) {
@@ -2156,11 +2156,11 @@ modify_contact_rename_handler (LDAPOp *op,
 			return;
 		}
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"modify_contact_rename_handler: %02X (%s), additional info: %s",
@@ -2237,11 +2237,11 @@ modify_contact_rename_handler (LDAPOp *op,
 		}
 #endif
 		/* actually perform the ldap modify */
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_modify_ext (
 			bl->priv->ldap, modify_op->id, ldap_mods,
 			NULL, NULL, &modify_contact_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		if (ldap_error == LDAP_SUCCESS) {
 			op->handler = modify_contact_modify_handler;
@@ -2313,14 +2313,14 @@ e_book_backend_ldap_modify_contacts (EBookBackend *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_modify_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		g_free (modify_op);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	book_view = find_book_view (bl);
 
@@ -2332,7 +2332,7 @@ e_book_backend_ldap_modify_contacts (EBookBackend *backend,
 	do {
 		book_view_notify_status (bl, book_view, _("Modifying contact from LDAP server..."));
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_search_ext (
 			bl->priv->ldap, modify_op->id,
 			LDAP_SCOPE_BASE,
@@ -2340,7 +2340,7 @@ e_book_backend_ldap_modify_contacts (EBookBackend *backend,
 			NULL, 0, NULL, NULL,
 			NULL, /* XXX timeout */
 			1, &modify_contact_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
@@ -2376,16 +2376,16 @@ get_contact_handler (LDAPOp *op,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		ldap_op_finished (op);
 		if (enable_debug)
 			printf ("get_contact_handler... ldap handler is NULL \n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	/* the msg_type will be either SEARCH_ENTRY (if we're
 	 * successful) or SEARCH_RESULT (if we're not), so we finish
@@ -2396,9 +2396,9 @@ get_contact_handler (LDAPOp *op,
 		EContact *contact;
 		gchar *vcard;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		if (!e) {
 			e_data_book_respond_get_contact (
@@ -2436,11 +2436,11 @@ get_contact_handler (LDAPOp *op,
 		gchar *ldap_error_msg;
 		gint ldap_error;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"get_contact_handler: %02X (%s), additional info: %s",
@@ -2522,21 +2522,21 @@ e_book_backend_ldap_get_contact (EBookBackend *backend,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		if (enable_debug)
 			printf ("e_book_backend_ldap_get_contact ... ldap handler is NULL\n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	get_contact_op = g_new0 (LDAPGetContactOp, 1);
 	book_view = find_book_view (bl);
 
 	do {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_search_ext (
 			bl->priv->ldap, id,
 			LDAP_SCOPE_BASE,
@@ -2544,7 +2544,7 @@ e_book_backend_ldap_get_contact (EBookBackend *backend,
 			NULL, 0, NULL, NULL,
 			NULL, /* XXX timeout */
 			1, &get_contact_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
 	if (ldap_error == LDAP_SUCCESS) {
@@ -2593,22 +2593,22 @@ contact_list_handler (LDAPOp *op,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact_list (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		ldap_op_finished (op);
 		if (enable_debug)
 			printf ("contact_list_handler ... ldap handler is NULL \n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	msg_type = ldap_msgtype (res);
 	if (msg_type == LDAP_RES_SEARCH_ENTRY) {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		while (NULL != e) {
 			EContact *contact;
@@ -2625,9 +2625,9 @@ contact_list_handler (LDAPOp *op,
 
 			g_object_unref (contact);
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_next_entry (bl->priv->ldap, e);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 	} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
 		/* ignore references */
@@ -2635,11 +2635,11 @@ contact_list_handler (LDAPOp *op,
 		gchar *ldap_error_msg;
 		gint ldap_error;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"contact_list_handler: %02X (%s), additional info: %s",
@@ -2755,15 +2755,15 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		if (enable_debug)
 			printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	contact_list_op = g_new0 (LDAPGetContactListOp, 1);
 	book_view = find_book_view (bl);
@@ -2774,7 +2774,7 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 		printf ("getting contact list with filter: %s\n", ldap_query);
 
 	do {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_search_ext (
 			bl->priv->ldap,
 			bl->priv->ldap_rootdn,
@@ -2783,7 +2783,7 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 			NULL, 0, NULL, NULL,
 			NULL, /* XXX timeout */
 			LDAP_NO_LIMIT, &contact_list_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
 	g_free (ldap_query);
@@ -2833,22 +2833,22 @@ contact_list_uids_handler (LDAPOp *op,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		ldap_op_finished (op);
 		if (enable_debug)
 			printf ("contact_list_uids_handler ... ldap handler is NULL \n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	msg_type = ldap_msgtype (res);
 	if (msg_type == LDAP_RES_SEARCH_ENTRY) {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		while (NULL != e) {
 			EContact *contact;
@@ -2862,9 +2862,9 @@ contact_list_uids_handler (LDAPOp *op,
 
 			contact_list_uids_op->uids = g_slist_append (contact_list_uids_op->uids, uid);
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_next_entry (bl->priv->ldap, e);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 	} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
 		/* ignore references */
@@ -2872,11 +2872,11 @@ contact_list_uids_handler (LDAPOp *op,
 		gchar *ldap_error_msg;
 		gint ldap_error;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"contact_list_uids_handler: %02X (%s), additional info: %s",
@@ -2973,15 +2973,15 @@ e_book_backend_ldap_get_contact_list_uids (EBookBackend *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact_list_uids (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
 		if (enable_debug)
 			printf ("e_book_backend_ldap_get_contact_list_uids... ldap handler is NULL\n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	contact_list_uids_op = g_new0 (LDAPGetContactListUIDsOp, 1);
 	book_view = find_book_view (bl);
@@ -2992,7 +2992,7 @@ e_book_backend_ldap_get_contact_list_uids (EBookBackend *backend,
 		printf ("getting contact list uids with filter: %s\n", ldap_query);
 
 	do {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_search_ext (
 			bl->priv->ldap,
 			bl->priv->ldap_rootdn,
@@ -3001,7 +3001,7 @@ e_book_backend_ldap_get_contact_list_uids (EBookBackend *backend,
 			NULL, 0, NULL, NULL,
 			NULL, /* XXX timeout */
 			LDAP_NO_LIMIT, &contact_list_uids_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
 	g_free (ldap_query);
@@ -4489,28 +4489,28 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 	gchar *attr;
 	BerElement *ber = NULL;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	dn = ldap_get_dn (bl->priv->ldap, e);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	e_contact_set (contact, E_CONTACT_UID, dn);
 	ldap_memfree (dn);
 	if (ldap_uid) *ldap_uid = NULL;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	for (attr = ldap_first_attribute (bl->priv->ldap, e, &ber); attr;
 	     attr = ldap_next_attribute (bl->priv->ldap, e, ber)) {
 		gint i;
 		struct prop_info *info = NULL;
 		gchar **values;
 
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		if (enable_debug)
 			printf ("attr = %s \n", attr);
 		if (ldap_uid && !g_ascii_strcasecmp (attr, "uid")) {
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			values = ldap_get_values (bl->priv->ldap, e, attr);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			if (values) {
 				if (enable_debug)
 					printf ("uid value = %s\n", values[0]);
@@ -4519,9 +4519,9 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 				ldap_value_free (values);
 			}
 		} else if (!g_ascii_strcasecmp (attr, "objectclass")) {
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			values = ldap_get_values (bl->priv->ldap, e, attr);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			for (i = 0; values[i]; i++) {
 				if (enable_debug)
 					printf ("value = %s\n", values[i]);
@@ -4546,16 +4546,16 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 
 			if (info) {
 				if (info->prop_type & PROP_WRITE_ONLY) {
-					g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+					g_rec_mutex_lock (&eds_ldap_handler_lock);
 					continue;
 				}
 
 				if (info->prop_type & PROP_TYPE_BINARY) {
 					struct berval **ber_values;
 
-					g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+					g_rec_mutex_lock (&eds_ldap_handler_lock);
 					ber_values = ldap_get_values_len (bl->priv->ldap, e, attr);
-					g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+					g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 					if (ber_values) {
 						info->binary_populate_contact_func (contact, ber_values);
@@ -4564,9 +4564,9 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 					}
 				}
 				else {
-					g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+					g_rec_mutex_lock (&eds_ldap_handler_lock);
 					values = ldap_get_values (bl->priv->ldap, e, attr);
-					g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+					g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 					if (values) {
 						if (info->prop_type & PROP_TYPE_STRING) {
@@ -4608,7 +4608,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 								if (enable_debug)
 									printf ("value (dn) = %s \n", values[j]);
 								do {
-									g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+									g_rec_mutex_lock (&eds_ldap_handler_lock);
 									if ((ldap_error = ldap_search_ext_s (bl->priv->ldap,
 													values[j],
 													LDAP_SCOPE_BASE,
@@ -4642,7 +4642,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 											ldap_value_free (cn_values);
 										}
 									}
-									g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+									g_rec_mutex_unlock (&eds_ldap_handler_lock);
 								}
 								while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
@@ -4668,9 +4668,9 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 		}
 
 		ldap_memfree (attr);
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (ber)
 		ber_free (ber, 0);
@@ -4687,17 +4687,17 @@ poll_ldap (EBookBackendLDAP *bl)
 	const gchar *ldap_timeout_string;
 	gboolean again;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap || !bl->priv->poll_timeout) {
 		bl->priv->poll_timeout = 0;
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		return FALSE;
 	}
 
 	if (!bl->priv->active_ops) {
 		g_warning ("poll_ldap being called for backend with no active operations");
 		bl->priv->poll_timeout = 0;
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		return FALSE;
 	}
 
@@ -4718,14 +4718,14 @@ poll_ldap (EBookBackendLDAP *bl)
 			if (!bl->priv->poll_timeout || !e_book_backend_ldap_reconnect (bl, book_view, LDAP_SERVER_DOWN)) {
 				if (bl->priv->poll_timeout)
 					g_warning ("%s: Failed to reconnect to LDAP server", G_STRFUNC);
-				g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+				g_rec_mutex_unlock (&eds_ldap_handler_lock);
 				return FALSE;
 			}
 		} else {
 			gint msgid = ldap_msgid (res);
 			LDAPOp *op;
 
-			g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+			g_rec_mutex_lock (&bl->priv->op_hash_mutex);
 			op = g_hash_table_lookup (bl->priv->id_to_op, &msgid);
 
 			d (printf ("looked up msgid %d, got op %p\n", msgid, op));
@@ -4737,7 +4737,7 @@ poll_ldap (EBookBackendLDAP *bl)
 
 			/* XXX should the call to op->handler be
 			 * protected by the lock? */
-			g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+			g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 
 			ldap_msgfree (res);
 		}
@@ -4745,7 +4745,7 @@ poll_ldap (EBookBackendLDAP *bl)
 
 	/* the poll_timeout is set to 0, when finalizing the backend */
 	again = bl->priv->poll_timeout > 0;
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	return again;
 }
@@ -4766,10 +4766,10 @@ ldap_search_handler (LDAPOp *op,
 	if (enable_debug)
 		g_get_current_time (&start);
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
 		GError *edb_err = EDB_ERROR_NOT_CONNECTED ();
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_view_notify_complete (view, edb_err);
 		ldap_op_finished (op);
 		if (enable_debug)
@@ -4777,7 +4777,7 @@ ldap_search_handler (LDAPOp *op,
 		g_error_free (edb_err);
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	if (!search_op->notified_receiving_results) {
 		search_op->notified_receiving_results = TRUE;
@@ -4786,9 +4786,9 @@ ldap_search_handler (LDAPOp *op,
 
 	msg_type = ldap_msgtype (res);
 	if (msg_type == LDAP_RES_SEARCH_ENTRY) {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		while (NULL != e) {
 			EContact *contact = build_contact_from_entry (bl, e, NULL, NULL);
@@ -4796,9 +4796,9 @@ ldap_search_handler (LDAPOp *op,
 			e_data_book_view_notify_update (view, contact);
 			g_object_unref (contact);
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_next_entry (bl->priv->ldap, e);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 	} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
 		/* ignore references */
@@ -4807,11 +4807,11 @@ ldap_search_handler (LDAPOp *op,
 		gchar *ldap_error_msg;
 		gint ldap_error;
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_parse_result (
 			bl->priv->ldap, res, &ldap_error,
 			NULL, &ldap_error_msg, NULL, NULL, 0);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		if (ldap_error != LDAP_SUCCESS) {
 			g_warning (
 				"ldap_search_handler: %02X (%s), additional info: %s",
@@ -4922,13 +4922,13 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 	if (!ldap_query && can_browse ((EBookBackend *) bl))
 		ldap_query = g_strdup ("(cn=*)");
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (ldap_query != NULL && bl->priv->ldap) {
 		gint ldap_err;
 		gint search_msgid;
 		gint view_limit;
 
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		view_limit = bl->priv->ldap_limit;
 		/* if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
@@ -4940,7 +4940,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 		do {
 			book_view_notify_status (bl, view, _("Searching..."));
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			ldap_err = ldap_search_ext (
 				bl->priv->ldap, bl->priv->ldap_rootdn,
 				bl->priv->ldap_scope,
@@ -4950,7 +4950,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 				NULL, /* XXX */
 				NULL, /* XXX timeout */
 				view_limit, &search_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		} while (e_book_backend_ldap_reconnect (bl, view, ldap_err));
 
 		g_free (ldap_query);
@@ -4988,7 +4988,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 		}
 		return;
 	} else {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		/* Ignore NULL query */
 		e_data_book_view_notify_complete (view, NULL /* Success */);
 		return;
@@ -5042,32 +5042,32 @@ generate_cache_handler (LDAPOp *op,
 		g_get_current_time (&start);
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		ldap_op_finished (op);
 		if (enable_debug)
 			printf ("generate_cache_handler ... ldap handler is NULL \n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	book_view = find_book_view (bl);
 
 	msg_type = ldap_msgtype (res);
 	if (msg_type == LDAP_RES_SEARCH_ENTRY) {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		e = ldap_first_entry (bl->priv->ldap, res);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		while (e != NULL) {
 			EContact *contact = build_contact_from_entry (bl, e, NULL, NULL);
 
 			contact_list_op->contacts = g_slist_prepend (contact_list_op->contacts, contact);
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_next_entry (bl->priv->ldap, e);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 	} else {
 		GSList *l;
@@ -5137,18 +5137,18 @@ generate_cache (EBookBackendLDAP *book_backend_ldap)
 
 	priv = book_backend_ldap->priv;
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!priv->ldap) {
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 		g_free (contact_list_op);
 		if (enable_debug)
 			printf ("generating offline cache failed ... ldap handler is NULL\n");
 		return;
 	}
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	do {
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 		ldap_error = ldap_search_ext (
 			priv->ldap,
 			priv->ldap_rootdn,
@@ -5157,7 +5157,7 @@ generate_cache (EBookBackendLDAP *book_backend_ldap)
 			NULL, 0, NULL, NULL,
 			NULL, /* XXX timeout */
 			LDAP_NO_LIMIT, &contact_list_msgid);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	} while (e_book_backend_ldap_reconnect (book_backend_ldap, NULL, ldap_error));
 
 	if (ldap_error == LDAP_SUCCESS) {
@@ -5186,10 +5186,10 @@ ldap_cancel_op (gpointer key,
 	LDAPOp *op = value;
 
 	/* ignore errors, its only best effort? */
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (bl->priv->ldap)
 		ldap_abandon (bl->priv->ldap, op->id);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 }
 
 static void
@@ -5197,9 +5197,9 @@ ldap_cancel_all_operations (EBookBackend *backend)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
-	g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_lock (&bl->priv->op_hash_mutex);
 	g_hash_table_foreach (bl->priv->id_to_op, ldap_cancel_op, bl);
-	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+	g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
 static void
@@ -5426,10 +5426,10 @@ call_dtor (gint msgid,
 
 	bl = E_BOOK_BACKEND_LDAP (op->backend);
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (bl->priv->ldap)
 		ldap_abandon (bl->priv->ldap, op->id);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	op->dtor (op);
 
@@ -5443,11 +5443,11 @@ e_book_backend_ldap_finalize (GObject *object)
 
 	priv = E_BOOK_BACKEND_LDAP_GET_PRIVATE (object);
 
-	g_static_rec_mutex_lock (&priv->op_hash_mutex);
+	g_rec_mutex_lock (&priv->op_hash_mutex);
 	g_hash_table_foreach_remove (priv->id_to_op, (GHRFunc) call_dtor, NULL);
 	g_hash_table_destroy (priv->id_to_op);
-	g_static_rec_mutex_unlock (&priv->op_hash_mutex);
-	g_static_rec_mutex_free (&priv->op_hash_mutex);
+	g_rec_mutex_unlock (&priv->op_hash_mutex);
+	g_rec_mutex_clear (&priv->op_hash_mutex);
 
 	/* Remove the timeout before unbinding to avoid a race. */
 	if (priv->poll_timeout > 0) {
@@ -5455,10 +5455,10 @@ e_book_backend_ldap_finalize (GObject *object)
 		priv->poll_timeout = 0;
 	}
 
-	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	g_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (priv->ldap)
 		ldap_unbind (priv->ldap);
-	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 	g_slist_foreach (priv->supported_fields, (GFunc) g_free, NULL);
 	g_slist_free (priv->supported_fields);
@@ -5525,22 +5525,22 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 			gchar *query = g_strdup_printf ("(mail=%s)", user);
 			gchar *entry_dn;
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			ldap_error = ldap_search_s (
 				bl->priv->ldap,
 				bl->priv->ldap_rootdn,
 				bl->priv->ldap_scope,
 				query,
 				NULL, 0, &res);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			g_free (query);
 
 			if (ldap_error != LDAP_SUCCESS)
 				goto exit;
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_first_entry (bl->priv->ldap, res);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			if (!e) {
 				ldap_msgfree (res);
 				g_set_error (
@@ -5551,10 +5551,10 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 				return E_SOURCE_AUTHENTICATION_ERROR;
 			}
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			g_rec_mutex_lock (&eds_ldap_handler_lock);
 			entry_dn = ldap_get_dn (bl->priv->ldap, e);
 			bl->priv->connected = FALSE; /* to reconnect with credentials */
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 			dn = g_strdup (entry_dn);
 
 			ldap_memfree (entry_dn);
@@ -5574,12 +5574,12 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 		if (enable_debug)
 			printf ("simple auth as %s\n", dn);
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 
 		if (!bl->priv->connected || !bl->priv->ldap) {
 			GError *local_error = NULL;
 
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 			e_book_backend_ldap_connect (bl, &local_error);
 
@@ -5603,7 +5603,7 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 			bl->priv->ldap,
 			bl->priv->auth_dn,
 			bl->priv->auth_secret);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 		/* Some ldap servers are returning (ex active directory ones)
 		 * LDAP_SERVER_DOWN when we try to do an ldap operation after
@@ -5621,12 +5621,12 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 #ifdef ENABLE_SASL_BINDS
 	else if (!g_ascii_strncasecmp (method, SASL_PREFIX, strlen (SASL_PREFIX))) {
 		g_print ("sasl bind (mech = %s) as %s", method + strlen (SASL_PREFIX), user);
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		g_rec_mutex_lock (&eds_ldap_handler_lock);
 
 		if (!bl->priv->connected || !bl->priv->ldap) {
 			GError *local_error = NULL;
 
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+			g_rec_mutex_unlock (&eds_ldap_handler_lock);
 
 			e_book_backend_ldap_connect (bl, &local_error);
 
@@ -5654,7 +5654,7 @@ book_backend_ldap_try_password_sync (ESourceAuthenticator *authenticator,
 			NULL,
 			NULL,
 			NULL);
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		g_rec_mutex_unlock (&eds_ldap_handler_lock);
 	}
 #endif
 	else {
@@ -5758,7 +5758,7 @@ e_book_backend_ldap_init (EBookBackendLDAP *backend)
 	backend->priv->ldap_limit = 100;
 	backend->priv->id_to_op = g_hash_table_new (g_int_hash, g_int_equal);
 
-	g_static_rec_mutex_init (&backend->priv->op_hash_mutex);
+	g_rec_mutex_init (&backend->priv->op_hash_mutex);
 
 	if (g_getenv ("LDAP_DEBUG"))
 		enable_debug = TRUE;
diff --git a/addressbook/backends/ldap/e-source-ldap.c b/addressbook/backends/ldap/e-source-ldap.c
index 18bb104..42d8a08 100644
--- a/addressbook/backends/ldap/e-source-ldap.c
+++ b/addressbook/backends/ldap/e-source-ldap.c
@@ -25,7 +25,7 @@
 	((obj), E_TYPE_SOURCE_LDAP, ESourceLDAPPrivate))
 
 struct _ESourceLDAPPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gboolean can_browse;
 	gchar *filter;
 	guint limit;
@@ -225,7 +225,7 @@ source_ldap_finalize (GObject *object)
 
 	priv = E_SOURCE_LDAP_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->filter);
 	g_free (priv->root_dn);
@@ -386,7 +386,7 @@ static void
 e_source_ldap_init (ESourceLDAP *extension)
 {
 	extension->priv = E_SOURCE_LDAP_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 void
@@ -509,12 +509,12 @@ e_source_ldap_dup_filter (ESourceLDAP *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_LDAP (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_ldap_get_filter (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -533,7 +533,7 @@ e_source_ldap_set_filter (ESourceLDAP *extension,
 		!g_str_has_prefix (filter, "(") &&
 		!g_str_has_suffix (filter, ")");
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (needs_parens)
 		new_filter = g_strdup_printf ("(%s)", filter);
@@ -541,7 +541,7 @@ e_source_ldap_set_filter (ESourceLDAP *extension,
 		new_filter = g_strdup (filter);
 
 	if (g_strcmp0 (extension->priv->filter, new_filter) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		g_free (new_filter);
 		return;
 	}
@@ -549,7 +549,7 @@ e_source_ldap_set_filter (ESourceLDAP *extension,
 	g_free (extension->priv->filter);
 	extension->priv->filter = new_filter;
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "filter");
 }
@@ -592,12 +592,12 @@ e_source_ldap_dup_root_dn (ESourceLDAP *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_LDAP (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_ldap_get_root_dn (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -608,17 +608,17 @@ e_source_ldap_set_root_dn (ESourceLDAP *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_LDAP (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->root_dn, root_dn) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->root_dn);
 	extension->priv->root_dn = e_util_strdup_strip (root_dn);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "root-dn");
 }
diff --git a/addressbook/backends/vcf/e-book-backend-vcf.c b/addressbook/backends/vcf/e-book-backend-vcf.c
index 4eb24a4..2774ac3 100644
--- a/addressbook/backends/vcf/e-book-backend-vcf.c
+++ b/addressbook/backends/vcf/e-book-backend-vcf.c
@@ -61,7 +61,7 @@ typedef struct _EBookBackendVCFSearchContext EBookBackendVCFSearchContext;
 
 struct _EBookBackendVCFPrivate {
 	gchar       *filename;
-	GMutex     *mutex;
+	GMutex     mutex;
 	GHashTable *contacts;
 	GList      *contact_list;
 	gboolean    dirty;
@@ -146,7 +146,7 @@ save_file (EBookBackendVCF *vcf)
 
 	g_warning ("EBookBackendVCF flushing file to disk");
 
-	g_mutex_lock (vcf->priv->mutex);
+	g_mutex_lock (&vcf->priv->mutex);
 
 	new_path = g_strdup_printf ("%s.new", vcf->priv->filename);
 
@@ -190,7 +190,7 @@ out:
 		close (fd);
 	g_free (new_path);
 	vcf->priv->dirty = !retv;
-	g_mutex_unlock (vcf->priv->mutex);
+	g_mutex_unlock (&vcf->priv->mutex);
 
 	return retv;
 }
@@ -241,7 +241,7 @@ do_create (EBookBackendVCF *bvcf,
 	/* at the very least we need the unique_id generation to be
 	 * protected by the lock, even if the actual vcard parsing
 	 * isn't. */
-	g_mutex_lock (bvcf->priv->mutex);
+	g_mutex_lock (&bvcf->priv->mutex);
 	id = e_book_backend_vcf_create_unique_id ();
 
 	contact = e_contact_new_from_vcard_with_uid (vcard_req, id);
@@ -264,7 +264,7 @@ do_create (EBookBackendVCF *bvcf,
 				vcf_flush_file, bvcf);
 	}
 
-	g_mutex_unlock (bvcf->priv->mutex);
+	g_mutex_unlock (&bvcf->priv->mutex);
 
 	return contact;
 }
@@ -324,16 +324,16 @@ e_book_backend_vcf_remove_contacts (EBookBackendSync *backend,
 		return;
 	}
 
-	g_mutex_lock (bvcf->priv->mutex);
+	g_mutex_lock (&bvcf->priv->mutex);
 	elem = g_hash_table_lookup (bvcf->priv->contacts, id);
 	if (!elem) {
-		g_mutex_unlock (bvcf->priv->mutex);
+		g_mutex_unlock (&bvcf->priv->mutex);
 		g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
 		return;
 	}
 
 	if (!g_hash_table_remove (bvcf->priv->contacts, id)) {
-		g_mutex_unlock (bvcf->priv->mutex);
+		g_mutex_unlock (&bvcf->priv->mutex);
 		g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
 		return;
 	}
@@ -346,7 +346,7 @@ e_book_backend_vcf_remove_contacts (EBookBackendSync *backend,
 		bvcf->priv->flush_timeout_tag = g_timeout_add (
 			FILE_FLUSH_TIMEOUT,
 			vcf_flush_file, bvcf);
-	g_mutex_unlock (bvcf->priv->mutex);
+	g_mutex_unlock (&bvcf->priv->mutex);
 
 	*ids = g_slist_append (*ids, g_strdup (id));
 }
@@ -378,10 +378,10 @@ e_book_backend_vcf_modify_contacts (EBookBackendSync *backend,
 	contact = e_contact_new_from_vcard (vcards->data);
 	id = e_contact_get_const (contact, E_CONTACT_UID);
 
-	g_mutex_lock (bvcf->priv->mutex);
+	g_mutex_lock (&bvcf->priv->mutex);
 	elem = g_hash_table_lookup (bvcf->priv->contacts, id);
 	if (!elem) {
-		g_mutex_unlock (bvcf->priv->mutex);
+		g_mutex_unlock (&bvcf->priv->mutex);
 		g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
 		return;
 	}
@@ -393,7 +393,7 @@ e_book_backend_vcf_modify_contacts (EBookBackendSync *backend,
 		bvcf->priv->flush_timeout_tag = g_timeout_add (
 			FILE_FLUSH_TIMEOUT,
 			vcf_flush_file, bvcf);
-	g_mutex_unlock (bvcf->priv->mutex);
+	g_mutex_unlock (&bvcf->priv->mutex);
 
 	*modified_contacts = g_slist_append (*modified_contacts, contact);
 }
@@ -471,6 +471,8 @@ closure_destroy (VCFBackendSearchClosure *closure)
 {
 	d (printf ("destroying search closure\n"));
 	e_flag_free (closure->running);
+	if (closure->thread)
+		g_thread_unref (closure->thread);
 	g_free (closure);
 }
 
@@ -553,7 +555,7 @@ e_book_backend_vcf_start_view (EBookBackend *backend,
 	VCFBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_VCF (backend));
 
 	d (printf ("starting book view thread\n"));
-	closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+	closure->thread = g_thread_new (NULL, book_view_thread, book_view);
 
 	e_flag_wait (closure->running);
 
@@ -573,8 +575,10 @@ e_book_backend_vcf_stop_view (EBookBackend *backend,
 	need_join = e_flag_is_set (closure->running);
 	e_flag_clear (closure->running);
 
-	if (need_join)
+	if (need_join) {
 		g_thread_join (closure->thread);
+		closure->thread = NULL;
+	}
 }
 
 #ifdef CREATE_DEFAULT_VCARD
@@ -722,7 +726,7 @@ e_book_backend_vcf_finalize (GObject *object)
 
 	priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (object);
 
-	g_mutex_lock (priv->mutex);
+	g_mutex_lock (&priv->mutex);
 
 	if (priv->flush_timeout_tag)
 		g_source_remove (priv->flush_timeout_tag);
@@ -735,9 +739,9 @@ e_book_backend_vcf_finalize (GObject *object)
 
 	g_free (priv->filename);
 
-	g_mutex_unlock (priv->mutex);
+	g_mutex_unlock (&priv->mutex);
 
-	g_mutex_free (priv->mutex);
+	g_mutex_clear (&priv->mutex);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_book_backend_vcf_parent_class)->finalize (object);
@@ -777,7 +781,7 @@ static void
 e_book_backend_vcf_init (EBookBackendVCF *backend)
 {
 	backend->priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (backend);
-	backend->priv->mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->mutex);
 
 	g_signal_connect (
 		backend, "notify::online",
diff --git a/addressbook/backends/vcf/e-source-vcf.c b/addressbook/backends/vcf/e-source-vcf.c
index cba2b23..e5a78a4 100644
--- a/addressbook/backends/vcf/e-source-vcf.c
+++ b/addressbook/backends/vcf/e-source-vcf.c
@@ -23,7 +23,7 @@
 	((obj), E_TYPE_SOURCE_VCF, ESourceVCFPrivate))
 
 struct _ESourceVCFPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *path;
 };
 
@@ -79,7 +79,7 @@ source_vcf_finalize (GObject *object)
 
 	priv = E_SOURCE_VCF_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->path);
 
@@ -125,7 +125,7 @@ static void
 e_source_vcf_init (ESourceVCF *extension)
 {
 	extension->priv = E_SOURCE_VCF_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 void
@@ -153,12 +153,12 @@ e_source_vcf_dup_path (ESourceVCF *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_VCF (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_vcf_get_path (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -169,17 +169,17 @@ e_source_vcf_set_path (ESourceVCF *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_VCF (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->path, path) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->path);
 	extension->priv->path = e_util_strdup_strip (path);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "path");
 }
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index 7478d4c..eb0009b 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -111,6 +111,8 @@ static void
 closure_destroy (WebdavBackendSearchClosure *closure)
 {
 	e_flag_free (closure->running);
+	if (closure->thread)
+		g_thread_unref (closure->thread);
 	g_free (closure);
 }
 
@@ -1115,7 +1117,7 @@ e_book_backend_webdav_start_view (EBookBackend *backend,
 			= init_closure (book_view, E_BOOK_BACKEND_WEBDAV (backend));
 
 		closure->thread
-			= g_thread_create (book_view_thread, book_view, TRUE, NULL);
+			= g_thread_new (NULL, book_view_thread, book_view);
 
 		e_flag_wait (closure->running);
 	}
@@ -1140,6 +1142,7 @@ e_book_backend_webdav_stop_view (EBookBackend *backend,
 
 	if (need_join) {
 		g_thread_join (closure->thread);
+		closure->thread = NULL;
 	}
 }
 
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index b10e849..32e0627 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -184,9 +184,9 @@ set_proxy_gone_error (GError **error)
 
 static guint active_book_clients = 0, book_connection_closed_id = 0;
 static EGdbusBookFactory *book_factory = NULL;
-static GStaticRecMutex book_factory_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK_FACTORY()   g_static_rec_mutex_lock (&book_factory_lock)
-#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&book_factory_lock)
+static GRecMutex book_factory_lock;
+#define LOCK_FACTORY()   g_rec_mutex_lock (&book_factory_lock)
+#define UNLOCK_FACTORY() g_rec_mutex_unlock (&book_factory_lock)
 
 static void gdbus_book_factory_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
 
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index dd6c6fa..ddae3b4 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -42,10 +42,10 @@
 #define DB_FILENAME "contacts.db"
 #define FOLDER_VERSION 1
 
-#define READER_LOCK(ebsdb) g_static_rw_lock_reader_lock (&ebsdb->priv->rwlock)
-#define READER_UNLOCK(ebsdb) g_static_rw_lock_reader_unlock (&ebsdb->priv->rwlock)
-#define WRITER_LOCK(ebssdb) g_static_rw_lock_writer_lock (&ebsdb->priv->rwlock)
-#define WRITER_UNLOCK(ebssdb) g_static_rw_lock_writer_unlock (&ebsdb->priv->rwlock)
+#define READER_LOCK(ebsdb) g_rw_lock_reader_lock (&ebsdb->priv->rwlock)
+#define READER_UNLOCK(ebsdb) g_rw_lock_reader_unlock (&ebsdb->priv->rwlock)
+#define WRITER_LOCK(ebssdb) g_rw_lock_writer_lock (&ebsdb->priv->rwlock)
+#define WRITER_UNLOCK(ebssdb) g_rw_lock_writer_unlock (&ebsdb->priv->rwlock)
 
 struct _EBookBackendSqliteDBPrivate {
 	sqlite3 *db;
@@ -53,9 +53,9 @@ struct _EBookBackendSqliteDBPrivate {
 	gchar *hash_key;
 
 	gboolean store_vcard;
-	GStaticRWLock rwlock;
+	GRWLock rwlock;
 
-	GMutex *in_transaction_lock;
+	GMutex in_transaction_lock;
 	guint32 in_transaction;
 };
 
@@ -65,7 +65,7 @@ G_DEFINE_TYPE (EBookBackendSqliteDB, e_book_backend_sqlitedb, G_TYPE_OBJECT)
 	(e_book_backend_sqlitedb_error_quark ())
 
 static GHashTable *db_connections = NULL;
-static GStaticMutex dbcon_lock = G_STATIC_MUTEX_INIT;
+static GMutex dbcon_lock;
 
 typedef struct {
 	EContactField field;            /* The EContact field */
@@ -125,7 +125,7 @@ e_book_backend_sqlitedb_dispose (GObject *object)
 
 	priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
 
-	g_static_mutex_lock (&dbcon_lock);
+	g_mutex_lock (&dbcon_lock);
 	if (db_connections != NULL) {
 		if (priv->hash_key != NULL) {
 			g_hash_table_remove (db_connections, priv->hash_key);
@@ -139,7 +139,7 @@ e_book_backend_sqlitedb_dispose (GObject *object)
 			priv->hash_key = NULL;
 		}
 	}
-	g_static_mutex_unlock (&dbcon_lock);
+	g_mutex_unlock (&dbcon_lock);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_book_backend_sqlitedb_parent_class)->dispose (object);
@@ -152,13 +152,13 @@ e_book_backend_sqlitedb_finalize (GObject *object)
 
 	priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
 
-	g_static_rw_lock_free (&priv->rwlock);
+	g_rw_lock_clear (&priv->rwlock);
 
 	sqlite3_close (priv->db);
 
 	g_free (priv->path);
 
-	g_mutex_free (priv->in_transaction_lock);
+	g_mutex_clear (&priv->in_transaction_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_book_backend_sqlitedb_parent_class)->finalize (object);
@@ -182,10 +182,10 @@ e_book_backend_sqlitedb_init (EBookBackendSqliteDB *ebsdb)
 	ebsdb->priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (ebsdb);
 
 	ebsdb->priv->store_vcard = TRUE;
-	g_static_rw_lock_init (&ebsdb->priv->rwlock);
+	g_rw_lock_init (&ebsdb->priv->rwlock);
 
 	ebsdb->priv->in_transaction = 0;
-	ebsdb->priv->in_transaction_lock = g_mutex_new ();
+	g_mutex_init (&ebsdb->priv->in_transaction_lock);
 }
 
 static void
@@ -287,11 +287,11 @@ book_backend_sqlitedb_start_transaction (EBookBackendSqliteDB *ebsdb,
 	g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
 	g_return_val_if_fail (ebsdb->priv->db != NULL, FALSE);
 
-	g_mutex_lock (ebsdb->priv->in_transaction_lock);
+	g_mutex_lock (&ebsdb->priv->in_transaction_lock);
 
 	ebsdb->priv->in_transaction++;
 	if (ebsdb->priv->in_transaction == 0) {
-		g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+		g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
 
 		g_return_val_if_fail (ebsdb->priv->in_transaction != 0, FALSE);
 		return FALSE;
@@ -303,7 +303,7 @@ book_backend_sqlitedb_start_transaction (EBookBackendSqliteDB *ebsdb,
 		res = book_backend_sql_exec (ebsdb->priv->db, "BEGIN", NULL, NULL, error);
 	}
 
-	g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+	g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
 
 	return res;
 }
@@ -320,9 +320,9 @@ book_backend_sqlitedb_end_transaction (EBookBackendSqliteDB *ebsdb,
 	g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
 	g_return_val_if_fail (ebsdb->priv->db != NULL, FALSE);
 
-	g_mutex_lock (ebsdb->priv->in_transaction_lock);
+	g_mutex_lock (&ebsdb->priv->in_transaction_lock);
 	if (ebsdb->priv->in_transaction == 0) {
-		g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+		g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
 
 		g_return_val_if_fail (ebsdb->priv->in_transaction > 0, FALSE);
 		return FALSE;
@@ -336,7 +336,7 @@ book_backend_sqlitedb_end_transaction (EBookBackendSqliteDB *ebsdb,
 		WRITER_UNLOCK (ebsdb);
 	}
 
-	g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+	g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
 
 	return res;
 }
@@ -558,7 +558,7 @@ e_book_backend_sqlitedb_new (const gchar *path,
 	g_return_val_if_fail (folderid != NULL, NULL);
 	g_return_val_if_fail (folder_name != NULL, NULL);
 
-	g_static_mutex_lock (&dbcon_lock);
+	g_mutex_lock (&dbcon_lock);
 
 	hash_key = g_strdup_printf ("%s %s", emailid, path);
 	if (db_connections != NULL) {
@@ -566,7 +566,7 @@ e_book_backend_sqlitedb_new (const gchar *path,
 
 		if (ebsdb) {
 			g_object_ref (ebsdb);
-			g_static_mutex_unlock (&dbcon_lock);
+			g_mutex_unlock (&dbcon_lock);
 			g_free (hash_key);
 			goto exit;
 		}
@@ -576,7 +576,7 @@ e_book_backend_sqlitedb_new (const gchar *path,
 	ebsdb->priv->path = g_strdup (path);
 	ebsdb->priv->store_vcard = store_vcard;
 	if (g_mkdir_with_parents (path, 0777) < 0) {
-		g_static_mutex_unlock (&dbcon_lock);
+		g_mutex_unlock (&dbcon_lock);
 		g_set_error (
 			error, E_BOOK_SDB_ERROR, 0,
 			"Can not make parent directory: errno %d", errno);
@@ -585,7 +585,7 @@ e_book_backend_sqlitedb_new (const gchar *path,
 	filename = g_build_filename (path, DB_FILENAME, NULL);
 
 	if (!book_backend_sqlitedb_load (ebsdb, filename, &err)) {
-		g_static_mutex_unlock (&dbcon_lock);
+		g_mutex_unlock (&dbcon_lock);
 		g_propagate_error (error, err);
 		g_object_unref (ebsdb);
 		g_free (filename);
@@ -598,7 +598,7 @@ e_book_backend_sqlitedb_new (const gchar *path,
 	g_hash_table_insert (db_connections, hash_key, ebsdb);
 	ebsdb->priv->hash_key = g_strdup (hash_key);
 
-	g_static_mutex_unlock (&dbcon_lock);
+	g_mutex_unlock (&dbcon_lock);
 
 exit:
 	if (!err)
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 96ec351..5c6525f 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -24,12 +24,12 @@
 struct _EBookBackendPrivate {
 	ESourceRegistry *registry;
 
-	GMutex *clients_mutex;
+	GMutex clients_mutex;
 	GList *clients;
 
 	gboolean opening, opened, readonly, removed, online;
 
-	GMutex *views_mutex;
+	GMutex views_mutex;
 	GList *views;
 
 	gchar *cache_dir;
@@ -193,8 +193,8 @@ book_backend_finalize (GObject *object)
 
 	g_list_free (priv->clients);
 
-	g_mutex_free (priv->clients_mutex);
-	g_mutex_free (priv->views_mutex);
+	g_mutex_clear (&priv->clients_mutex);
+	g_mutex_clear (&priv->views_mutex);
 
 	g_free (priv->cache_dir);
 
@@ -287,10 +287,10 @@ e_book_backend_init (EBookBackend *backend)
 	backend->priv = E_BOOK_BACKEND_GET_PRIVATE (backend);
 
 	backend->priv->clients = NULL;
-	backend->priv->clients_mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->clients_mutex);
 
 	backend->priv->views = NULL;
-	backend->priv->views_mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->views_mutex);
 }
 
 /**
@@ -423,22 +423,22 @@ e_book_backend_open (EBookBackend *backend,
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 
-	g_mutex_lock (backend->priv->clients_mutex);
+	g_mutex_lock (&backend->priv->clients_mutex);
 
 	if (e_book_backend_is_opened (backend)) {
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		e_data_book_report_readonly (book, backend->priv->readonly);
 		e_data_book_report_online (book, backend->priv->online);
 
 		e_book_backend_respond_opened (backend, book, opid, NULL);
 	} else if (e_book_backend_is_opening (backend)) {
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		e_data_book_respond_open (book, opid, EDB_OPENING_ERROR);
 	} else {
 		backend->priv->opening = TRUE;
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		/* Subclasses may need to call e_book_backend_get_cache_dir() in
 		 * their open() methods, so get the "cache-dir" property
@@ -742,12 +742,12 @@ e_book_backend_add_view (EBookBackend *backend,
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	g_object_ref (view);
 	backend->priv->views = g_list_append (backend->priv->views, view);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 }
 
 /**
@@ -763,12 +763,12 @@ e_book_backend_remove_view (EBookBackend *backend,
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	backend->priv->views = g_list_remove (backend->priv->views, view);
 	g_object_unref (view);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 }
 
 /**
@@ -787,9 +787,9 @@ e_book_backend_add_client (EBookBackend *backend,
 	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
 	g_return_val_if_fail (E_IS_DATA_BOOK (book), FALSE);
 
-	g_mutex_lock (backend->priv->clients_mutex);
+	g_mutex_lock (&backend->priv->clients_mutex);
 	backend->priv->clients = g_list_prepend (backend->priv->clients, book);
-	g_mutex_unlock (backend->priv->clients_mutex);
+	g_mutex_unlock (&backend->priv->clients_mutex);
 
 	return TRUE;
 }
@@ -812,13 +812,13 @@ e_book_backend_remove_client (EBookBackend *backend,
 	g_object_ref (backend);
 
 	/* Disconnect */
-	g_mutex_lock (backend->priv->clients_mutex);
+	g_mutex_lock (&backend->priv->clients_mutex);
 	backend->priv->clients = g_list_remove (backend->priv->clients, book);
 
 	if (backend->priv->clients == NULL)
 		backend->priv->opening = FALSE;
 
-	g_mutex_unlock (backend->priv->clients_mutex);
+	g_mutex_unlock (&backend->priv->clients_mutex);
 
 	g_object_unref (backend);
 }
@@ -851,13 +851,13 @@ e_book_backend_list_views (EBookBackend *backend)
 
 	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	/* XXX Use g_list_copy_deep() once we require GLib >= 2.34. */
 	list = g_list_copy (backend->priv->views);
 	g_list_foreach (list, (GFunc) g_object_ref, NULL);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 
 	return list;
 }
@@ -1181,12 +1181,12 @@ e_book_backend_notify_error (EBookBackend *backend,
 
 	priv = backend->priv;
 
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_book_report_error (E_DATA_BOOK (clients->data), message);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
@@ -1207,12 +1207,12 @@ e_book_backend_notify_readonly (EBookBackend *backend,
 
 	priv = backend->priv;
 	priv->readonly = is_readonly;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_book_report_readonly (E_DATA_BOOK (clients->data), is_readonly);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 
 }
 
@@ -1235,12 +1235,12 @@ e_book_backend_notify_online (EBookBackend *backend,
 
 	priv = backend->priv;
 	priv->online = is_online;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_book_report_online (E_DATA_BOOK (clients->data), is_online);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
@@ -1272,7 +1272,7 @@ e_book_backend_notify_opened (EBookBackend *backend,
 	GList *clients;
 
 	priv = backend->priv;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	priv->opening = FALSE;
 	priv->opened = error == NULL;
@@ -1280,7 +1280,7 @@ e_book_backend_notify_opened (EBookBackend *backend,
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_book_report_opened (E_DATA_BOOK (clients->data), error);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 
 	if (error)
 		g_error_free (error);
@@ -1310,12 +1310,12 @@ e_book_backend_notify_property_changed (EBookBackend *backend,
 	g_return_if_fail (prop_value != NULL);
 
 	priv = backend->priv;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_book_report_backend_property_changed (E_DATA_BOOK (clients->data), prop_name, prop_value);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index cca4c02..047dcf3 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -48,11 +48,11 @@ struct _EDataBookFactoryPrivate {
 	ESourceRegistry *registry;
 	EGdbusBookFactory *gdbus_object;
 
-	GMutex *books_lock;
+	GMutex books_lock;
 	/* A hash of object paths for book URIs to EDataBooks */
 	GHashTable *books;
 
-	GMutex *connections_lock;
+	GMutex connections_lock;
 	/* This is a hash of client addresses to GList* of EDataBooks */
 	GHashTable *connections;
 
@@ -150,8 +150,8 @@ book_freed_cb (EDataBookFactory *factory,
 
 	d (g_debug ("in factory %p (%p) is dead", factory, dead));
 
-	g_mutex_lock (priv->books_lock);
-	g_mutex_lock (priv->connections_lock);
+	g_mutex_lock (&priv->books_lock);
+	g_mutex_lock (&priv->connections_lock);
 
 	g_hash_table_foreach_remove (
 		priv->books, remove_dead_pointer_cb, dead);
@@ -173,8 +173,8 @@ book_freed_cb (EDataBookFactory *factory,
 		}
 	}
 
-	g_mutex_unlock (priv->connections_lock);
-	g_mutex_unlock (priv->books_lock);
+	g_mutex_unlock (&priv->connections_lock);
+	g_mutex_unlock (&priv->books_lock);
 
 	e_dbus_server_release (E_DBUS_SERVER (factory));
 }
@@ -364,10 +364,10 @@ impl_BookFactory_get_book (EGdbusBookFactory *object,
 		connection, object_path, &error);
 
 	if (book != NULL) {
-		g_mutex_lock (priv->books_lock);
+		g_mutex_lock (&priv->books_lock);
 		g_hash_table_insert (
 			priv->books, g_strdup (object_path), book);
-		g_mutex_unlock (priv->books_lock);
+		g_mutex_unlock (&priv->books_lock);
 
 		e_book_backend_add_client (E_BOOK_BACKEND (backend), book);
 
@@ -376,12 +376,12 @@ impl_BookFactory_get_book (EGdbusBookFactory *object,
 			book_freed_cb, factory);
 
 		/* Update the hash of open connections. */
-		g_mutex_lock (priv->connections_lock);
+		g_mutex_lock (&priv->connections_lock);
 		list = g_hash_table_lookup (priv->connections, sender);
 		list = g_list_prepend (list, book);
 		g_hash_table_insert (
 			priv->connections, g_strdup (sender), list);
-		g_mutex_unlock (priv->connections_lock);
+		g_mutex_unlock (&priv->connections_lock);
 	}
 
 	g_object_unref (backend);
@@ -468,8 +468,8 @@ data_book_factory_finalize (GObject *object)
 	g_hash_table_destroy (priv->books);
 	g_hash_table_destroy (priv->connections);
 
-	g_mutex_free (priv->books_lock);
-	g_mutex_free (priv->connections_lock);
+	g_mutex_clear (&priv->books_lock);
+	g_mutex_clear (&priv->connections_lock);
 
 #ifdef HAVE_GOA
 	g_hash_table_destroy (priv->goa_accounts);
@@ -519,7 +519,7 @@ data_book_factory_bus_name_lost (EDBusServer *server,
 
 	priv = E_DATA_BOOK_FACTORY_GET_PRIVATE (server);
 
-	g_mutex_lock (priv->connections_lock);
+	g_mutex_lock (&priv->connections_lock);
 
 	while (g_hash_table_lookup_extended (
 		priv->connections,
@@ -536,7 +536,7 @@ data_book_factory_bus_name_lost (EDBusServer *server,
 		g_list_free (copy);
 	}
 
-	g_mutex_unlock (priv->connections_lock);
+	g_mutex_unlock (&priv->connections_lock);
 
 	/* Chain up to parent's bus_name_lost() method. */
 	E_DBUS_SERVER_CLASS (e_data_book_factory_parent_class)->
@@ -629,13 +629,13 @@ e_data_book_factory_init (EDataBookFactory *factory)
 		factory->priv->gdbus_object, "handle-get-book",
 		G_CALLBACK (impl_BookFactory_get_book), factory);
 
-	factory->priv->books_lock = g_mutex_new ();
+	g_mutex_init (&factory->priv->books_lock);
 	factory->priv->books = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) NULL);
 
-	factory->priv->connections_lock = g_mutex_new ();
+	g_mutex_init (&factory->priv->connections_lock);
 	factory->priv->connections = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c
index 9fa5bc4..471349e 100644
--- a/addressbook/libedata-book/e-data-book-view.c
+++ b/addressbook/libedata-book/e-data-book-view.c
@@ -56,7 +56,7 @@ struct _EDataBookViewPrivate {
 
 	gboolean running;
 	gboolean complete;
-	GMutex *pending_mutex;
+	GMutex pending_mutex;
 
 	GArray *adds;
 	GArray *changes;
@@ -184,7 +184,7 @@ pending_flush_timeout_cb (gpointer data)
 {
 	EDataBookView *view = data;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	view->priv->flush_id = 0;
 
@@ -192,7 +192,7 @@ pending_flush_timeout_cb (gpointer data)
 	send_pending_changes (view);
 	send_pending_removes (view);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 
 	return FALSE;
 }
@@ -500,14 +500,14 @@ data_book_view_dispose (GObject *object)
 		priv->sexp = NULL;
 	}
 
-	g_mutex_lock (priv->pending_mutex);
+	g_mutex_lock (&priv->pending_mutex);
 
 	if (priv->flush_id > 0) {
 		g_source_remove (priv->flush_id);
 		priv->flush_id = 0;
 	}
 
-	g_mutex_unlock (priv->pending_mutex);
+	g_mutex_unlock (&priv->pending_mutex);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_data_book_view_parent_class)->dispose (object);
@@ -532,7 +532,7 @@ data_book_view_finalize (GObject *object)
 	if (priv->fields_of_interest)
 		g_hash_table_destroy (priv->fields_of_interest);
 
-	g_mutex_free (priv->pending_mutex);
+	g_mutex_clear (&priv->pending_mutex);
 
 	g_hash_table_destroy (priv->ids);
 
@@ -653,7 +653,7 @@ e_data_book_view_init (EDataBookView *view)
 	view->priv->fields_of_interest = NULL;
 	view->priv->running = FALSE;
 	view->priv->complete = FALSE;
-	view->priv->pending_mutex = g_mutex_new ();
+	g_mutex_init (&view->priv->pending_mutex);
 
 	/* THRESHOLD_ITEMS * 2 because we store UID and vcard */
 	view->priv->adds = g_array_sized_new (
@@ -932,7 +932,7 @@ e_data_book_view_notify_update (EDataBookView *view,
 	if (!view->priv->running)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	id = e_contact_get_const ((EContact *) contact, E_CONTACT_UID);
 
@@ -957,7 +957,7 @@ e_data_book_view_notify_update (EDataBookView *view,
 		/* else nothing; we're removing a card that wasn't there */
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -988,7 +988,7 @@ e_data_book_view_notify_update_vcard (EDataBookView *view,
 	if (!view->priv->running)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	contact = e_contact_new_from_vcard_with_uid (vcard, id);
 	currently_in_view = id_is_in_view (view, id);
@@ -1008,7 +1008,7 @@ e_data_book_view_notify_update_vcard (EDataBookView *view,
 	/* Do this last so that id is still valid when notify_ is called */
 	g_object_unref (contact);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1046,7 +1046,7 @@ e_data_book_view_notify_update_prefiltered_vcard (EDataBookView *view,
 	if (!view->priv->running)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	currently_in_view = id_is_in_view (view, id);
 
@@ -1055,7 +1055,7 @@ e_data_book_view_notify_update_prefiltered_vcard (EDataBookView *view,
 	else
 		notify_add (view, id, vcard);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1076,12 +1076,12 @@ e_data_book_view_notify_remove (EDataBookView *view,
 	if (!view->priv->running)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	if (id_is_in_view (view, id))
 		notify_remove (view, id);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1107,13 +1107,13 @@ e_data_book_view_notify_complete (EDataBookView *view,
 	/* View is complete */
 	view->priv->complete = TRUE;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	send_pending_adds (view);
 	send_pending_changes (view);
 	send_pending_removes (view);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 
 	strv_error = e_gdbus_templates_encode_error (error);
 	e_gdbus_book_view_emit_complete (
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index ca7fe18..e6286e2 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -45,7 +45,7 @@ struct _EDataBookPrivate {
 	EBookBackend *backend;
 	gchar *object_path;
 
-	GStaticRecMutex pending_ops_lock;
+	GRecMutex pending_ops_lock;
 	GHashTable *pending_ops; /* opid to GCancellable for still running operations */
 };
 
@@ -244,7 +244,7 @@ operation_thread (gpointer data,
 		g_free (op->d.query);
 		break;
 	case OP_CANCEL_OPERATION:
-		g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+		g_rec_mutex_lock (&op->book->priv->pending_ops_lock);
 
 		if (g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
 			GCancellable *cancellable = g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
@@ -252,15 +252,15 @@ operation_thread (gpointer data,
 			g_cancellable_cancel (cancellable);
 		}
 
-		g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
+		g_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
 		break;
 	case OP_CLOSE:
 		/* close just cancels all pending ops and frees data book */
 		e_book_backend_remove_client (backend, op->book);
 	case OP_CANCEL_ALL:
-		g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+		g_rec_mutex_lock (&op->book->priv->pending_ops_lock);
 		g_hash_table_foreach (op->book->priv->pending_ops, cancel_ops_cb, NULL);
-		g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
+		g_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
 		break;
 	}
 
@@ -281,9 +281,9 @@ op_new (OperationID op,
 	data->id = e_operation_pool_reserve_opid (ops_pool);
 	data->cancellable = g_cancellable_new ();
 
-	g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+	g_rec_mutex_lock (&book->priv->pending_ops_lock);
 	g_hash_table_insert (book->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
-	g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
+	g_rec_mutex_unlock (&book->priv->pending_ops_lock);
 
 	return data;
 }
@@ -296,9 +296,9 @@ op_complete (EDataBook *book,
 
 	e_operation_pool_release_opid (ops_pool, opid);
 
-	g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+	g_rec_mutex_lock (&book->priv->pending_ops_lock);
 	g_hash_table_remove (book->priv->pending_ops, GUINT_TO_POINTER (opid));
-	g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
+	g_rec_mutex_unlock (&book->priv->pending_ops_lock);
 }
 
 /**
@@ -1289,7 +1289,7 @@ data_book_finalize (GObject *object)
 		priv->pending_ops = NULL;
 	}
 
-	g_static_rec_mutex_free (&priv->pending_ops_lock);
+	g_rec_mutex_clear (&priv->pending_ops_lock);
 
 	if (priv->dbus_interface) {
 		g_object_unref (priv->dbus_interface);
@@ -1387,7 +1387,7 @@ e_data_book_init (EDataBook *ebook)
 	ebook->priv->dbus_interface = e_gdbus_book_stub_new ();
 	ebook->priv->pending_ops = g_hash_table_new_full (
 		g_direct_hash, g_direct_equal, NULL, g_object_unref);
-	g_static_rec_mutex_init (&ebook->priv->pending_ops_lock);
+	g_rec_mutex_init (&ebook->priv->pending_ops_lock);
 
 	dbus_interface = ebook->priv->dbus_interface;
 	g_signal_connect (
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index c4e1131..05c5985 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -78,13 +78,13 @@ struct _ECalBackendCalDAVPrivate {
 	gboolean opened;
 
 	/* lock to indicate a busy state */
-	GMutex *busy_lock;
+	GMutex busy_lock;
 
 	/* cond to synch threads */
-	GCond *cond;
+	GCond cond;
 
 	/* cond to know the slave gone */
-	GCond *slave_gone_cond;
+	GCond slave_gone_cond;
 
 	/* BG synch thread */
 	const GThread *synch_slave; /* just for a reference, whether thread exists */
@@ -1761,7 +1761,7 @@ caldav_server_put_object (ECalBackendCalDAV *cbdav,
 							/* not sure what can happen, but do not need to guess for ever,
 							 * thus report success and update the calendar to get fresh info */
 							update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
-							g_cond_signal (cbdav->priv->cond);
+							g_cond_signal (&cbdav->priv->cond);
 						}
 					}
 				}
@@ -2333,7 +2333,7 @@ time_to_refresh_caldav_calendar_cb (ESource *source,
 
 	g_return_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav));
 
-	g_cond_signal (cbdav->priv->cond);
+	g_cond_signal (&cbdav->priv->cond);
 }
 
 /* ************************************************************************* */
@@ -2348,14 +2348,14 @@ caldav_synch_slave_loop (gpointer data)
 
 	cbdav = E_CAL_BACKEND_CALDAV (data);
 
-	g_mutex_lock (cbdav->priv->busy_lock);
+	g_mutex_lock (&cbdav->priv->busy_lock);
 
 	know_unreachable = !cbdav->priv->opened;
 
 	while (cbdav->priv->slave_cmd != SLAVE_SHOULD_DIE) {
 		if (cbdav->priv->slave_cmd == SLAVE_SHOULD_SLEEP) {
 			/* just sleep until we get woken up again */
-			g_cond_wait (cbdav->priv->cond, cbdav->priv->busy_lock);
+			g_cond_wait (&cbdav->priv->cond, &cbdav->priv->busy_lock);
 
 			/* check if we should die, work or sleep again */
 			continue;
@@ -2374,7 +2374,7 @@ caldav_synch_slave_loop (gpointer data)
 			if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
 				cbdav->priv->opened = TRUE;
 				update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
-				g_cond_signal (cbdav->priv->cond);
+				g_cond_signal (&cbdav->priv->cond);
 
 				cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
 				know_unreachable = FALSE;
@@ -2431,16 +2431,16 @@ caldav_synch_slave_loop (gpointer data)
 		cbdav->priv->slave_busy = FALSE;
 
 		/* puhh that was hard, get some rest :) */
-		g_cond_wait (cbdav->priv->cond, cbdav->priv->busy_lock);
+		g_cond_wait (&cbdav->priv->cond, &cbdav->priv->busy_lock);
 	}
 
 	/* signal we are done */
-	g_cond_signal (cbdav->priv->slave_gone_cond);
+	g_cond_signal (&cbdav->priv->slave_gone_cond);
 
 	cbdav->priv->synch_slave = NULL;
 
 	/* we got killed ... */
-	g_mutex_unlock (cbdav->priv->busy_lock);
+	g_mutex_unlock (&cbdav->priv->busy_lock);
 	return NULL;
 }
 
@@ -2710,13 +2710,10 @@ initialize_backend (ECalBackendCalDAV *cbdav,
 		GThread *slave;
 
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
-		slave = g_thread_create (caldav_synch_slave_loop, cbdav, FALSE, NULL);
-
-		if (slave == NULL) {
-			g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create synch slave thread")));
-		}
+		slave = g_thread_new (NULL, caldav_synch_slave_loop, cbdav);
 
 		cbdav->priv->synch_slave = slave;
+		g_thread_unref (slave);
 	}
 
 	if (cbdav->priv->refresh_id == 0) {
@@ -2745,7 +2742,7 @@ open_calendar (ECalBackendCalDAV *cbdav,
 
 	if (success) {
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
-		g_cond_signal (cbdav->priv->cond);
+		g_cond_signal (&cbdav->priv->cond);
 
 		cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
 	} else if (server_unreachable) {
@@ -2779,20 +2776,20 @@ caldav_do_open (ECalBackendSync *backend,
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
 
-	g_mutex_lock (cbdav->priv->busy_lock);
+	g_mutex_lock (&cbdav->priv->busy_lock);
 
 	/* let it decide the 'getctag' extension availability again */
 	cbdav->priv->ctag_supported = TRUE;
 
 	if (!cbdav->priv->loaded && !initialize_backend (cbdav, perror)) {
-		g_mutex_unlock (cbdav->priv->busy_lock);
+		g_mutex_unlock (&cbdav->priv->busy_lock);
 		return;
 	}
 
 	online = e_backend_get_online (E_BACKEND (backend));
 
 	if (!cbdav->priv->do_offline && !online) {
-		g_mutex_unlock (cbdav->priv->busy_lock);
+		g_mutex_unlock (&cbdav->priv->busy_lock);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
 	}
@@ -2826,7 +2823,7 @@ caldav_do_open (ECalBackendSync *backend,
 		E_CAL_BACKEND (backend), cbdav->priv->read_only);
 	e_cal_backend_notify_online (E_CAL_BACKEND (backend), online);
 
-	g_mutex_unlock (cbdav->priv->busy_lock);
+	g_mutex_unlock (&cbdav->priv->busy_lock);
 }
 
 static void
@@ -2840,21 +2837,21 @@ caldav_refresh (ECalBackendSync *backend,
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
 
-	g_mutex_lock (cbdav->priv->busy_lock);
+	g_mutex_lock (&cbdav->priv->busy_lock);
 
 	if (!cbdav->priv->loaded
 	    || cbdav->priv->slave_cmd == SLAVE_SHOULD_DIE
 	    || !check_state (cbdav, &online, NULL)
 	    || !online) {
-		g_mutex_unlock (cbdav->priv->busy_lock);
+		g_mutex_unlock (&cbdav->priv->busy_lock);
 		return;
 	}
 
 	update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
 
 	/* wake it up */
-	g_cond_signal (cbdav->priv->cond);
-	g_mutex_unlock (cbdav->priv->busy_lock);
+	g_cond_signal (&cbdav->priv->cond);
+	g_mutex_unlock (&cbdav->priv->busy_lock);
 }
 
 static void
@@ -4344,16 +4341,16 @@ _func_name _params							\
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);	\
 	}								\
 									\
-	g_mutex_lock (cbdav->priv->busy_lock);				\
+	g_mutex_lock (&cbdav->priv->busy_lock);				\
 	_call_func _call_params;					\
 									\
 	/* this is done before unlocking */				\
 	if (was_slave_busy) {						\
 		update_slave_cmd (cbdav->priv, old_slave_cmd);		\
-		g_cond_signal (cbdav->priv->cond);			\
+		g_cond_signal (&cbdav->priv->cond);			\
 	}								\
 									\
-	g_mutex_unlock (cbdav->priv->busy_lock);			\
+	g_mutex_unlock (&cbdav->priv->busy_lock);			\
 }
 
 caldav_busy_stub (
@@ -4803,20 +4800,20 @@ caldav_notify_online_cb (ECalBackend *backend,
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
 
-	/*g_mutex_lock (cbdav->priv->busy_lock);*/
+	/*g_mutex_lock (&cbdav->priv->busy_lock);*/
 
 	online = e_backend_get_online (E_BACKEND (backend));
 
 	if (!cbdav->priv->loaded) {
 		e_cal_backend_notify_online (backend, online);
-		/*g_mutex_unlock (cbdav->priv->busy_lock);*/
+		/*g_mutex_unlock (&cbdav->priv->busy_lock);*/
 		return;
 	}
 
 	if (online) {
 		/* Wake up the slave thread */
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
-		g_cond_signal (cbdav->priv->cond);
+		g_cond_signal (&cbdav->priv->cond);
 	} else {
 		soup_session_abort (cbdav->priv->session);
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
@@ -4824,7 +4821,7 @@ caldav_notify_online_cb (ECalBackend *backend,
 
 	e_cal_backend_notify_online (backend, online);
 
-	/*g_mutex_unlock (cbdav->priv->busy_lock);*/
+	/*g_mutex_unlock (&cbdav->priv->busy_lock);*/
 }
 
 static icaltimezone *
@@ -4859,17 +4856,17 @@ caldav_source_changed_thread (gpointer data)
 	old_slave_busy = cbdav->priv->slave_busy;
 	if (old_slave_busy) {
 		update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
-		g_mutex_lock (cbdav->priv->busy_lock);
+		g_mutex_lock (&cbdav->priv->busy_lock);
 	}
 
 	initialize_backend (cbdav, NULL);
 
 	/* always wakeup thread, even when it was sleeping */
-	g_cond_signal (cbdav->priv->cond);
+	g_cond_signal (&cbdav->priv->cond);
 
 	if (old_slave_busy) {
 		update_slave_cmd (cbdav->priv, old_slave_cmd);
-		g_mutex_unlock (cbdav->priv->busy_lock);
+		g_mutex_unlock (&cbdav->priv->busy_lock);
 	}
 
 	cbdav->priv->updating_source = FALSE;
@@ -4958,10 +4955,10 @@ e_cal_backend_caldav_dispose (GObject *object)
 	 * as it can work at the moment, and lock can be locked */
 	update_slave_cmd (priv, SLAVE_SHOULD_DIE);
 
-	g_mutex_lock (priv->busy_lock);
+	g_mutex_lock (&priv->busy_lock);
 
 	if (priv->disposed) {
-		g_mutex_unlock (priv->busy_lock);
+		g_mutex_unlock (&priv->busy_lock);
 		return;
 	}
 
@@ -4977,10 +4974,10 @@ e_cal_backend_caldav_dispose (GObject *object)
 
 	/* stop the slave  */
 	if (priv->synch_slave) {
-		g_cond_signal (priv->cond);
+		g_cond_signal (&priv->cond);
 
 		/* wait until the slave died */
-		g_cond_wait (priv->slave_gone_cond, priv->busy_lock);
+		g_cond_wait (&priv->slave_gone_cond, &priv->busy_lock);
 	}
 
 	g_object_unref (priv->session);
@@ -4994,7 +4991,7 @@ e_cal_backend_caldav_dispose (GObject *object)
 	}
 
 	priv->disposed = TRUE;
-	g_mutex_unlock (priv->busy_lock);
+	g_mutex_unlock (&priv->busy_lock);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -5007,9 +5004,9 @@ e_cal_backend_caldav_finalize (GObject *object)
 
 	priv = E_CAL_BACKEND_CALDAV_GET_PRIVATE (object);
 
-	g_mutex_free (priv->busy_lock);
-	g_cond_free (priv->cond);
-	g_cond_free (priv->slave_gone_cond);
+	g_mutex_clear (&priv->busy_lock);
+	g_cond_clear (&priv->cond);
+	g_cond_clear (&priv->slave_gone_cond);
 
 	g_free (priv->password);
 
@@ -5068,9 +5065,9 @@ e_cal_backend_caldav_init (ECalBackendCalDAV *cbdav)
 
 	cbdav->priv->is_google = FALSE;
 
-	cbdav->priv->busy_lock = g_mutex_new ();
-	cbdav->priv->cond = g_cond_new ();
-	cbdav->priv->slave_gone_cond = g_cond_new ();
+	g_mutex_init (&cbdav->priv->busy_lock);
+	g_cond_init (&cbdav->priv->cond);
+	g_cond_init (&cbdav->priv->slave_gone_cond);
 
 	/* Slave control ... */
 	cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index 2587a79..ad84f84 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -79,7 +79,7 @@ struct _ECalBackendContactsPrivate {
 typedef struct _BookRecord {
 	volatile gint ref_count;
 
-	GMutex *lock;
+	GMutex lock;
 	ECalBackendContacts *cbc;
 	EBookClient *book_client;
 	EBookClientView *book_view;
@@ -139,7 +139,7 @@ book_record_new (ECalBackendContacts *cbc,
 
 	br = g_slice_new0 (BookRecord);
 	br->ref_count = 1;
-	br->lock = g_mutex_new ();
+	g_mutex_init (&br->lock);
 	br->cbc = g_object_ref (cbc);
 	br->book_client = book_client;  /* takes ownership */
 
@@ -175,7 +175,7 @@ book_record_unref (BookRecord *br)
 			br->cbc->priv->tracked_contacts,
 			remove_by_book, br->book_client);
 
-		g_mutex_free (br->lock);
+		g_mutex_clear (&br->lock);
 		g_object_unref (br->cbc);
 		g_object_unref (br->book_client);
 
@@ -192,7 +192,7 @@ book_record_set_book_view (BookRecord *br,
 {
 	g_return_if_fail (br != NULL);
 
-	g_mutex_lock (br->lock);
+	g_mutex_lock (&br->lock);
 
 	if (book_view != NULL)
 		g_object_ref (book_view);
@@ -202,7 +202,7 @@ book_record_set_book_view (BookRecord *br,
 
 	br->book_view = book_view;
 
-	g_mutex_unlock (br->lock);
+	g_mutex_unlock (&br->lock);
 }
 
 static void
@@ -269,27 +269,21 @@ cbc_reopen_book_client_thread (gpointer user_data)
 static void
 cbc_reopen_book_client (BookRecord *br)
 {
-	GError *error = NULL;
+	GThread *thread;
 
-	g_mutex_lock (br->lock);
+	g_mutex_lock (&br->lock);
 
 	g_warn_if_fail (br->book_client_opened_id == 0);
 	br->book_client_opened_id = g_signal_connect (
 		br->book_client, "opened",
 		G_CALLBACK (book_client_opened_cb), br);
 
-	g_thread_create (
+	thread = g_thread_new (NULL,
 		cbc_reopen_book_client_thread,
-		br->book_client, FALSE, &error);
-
-	if (error != NULL) {
-		g_warning (
-			"%s: Cannot create thread to reload source! (%s)",
-			G_STRFUNC, error->message);
-		g_error_free (error);
-	}
+		br->book_client);
+	g_thread_unref (thread);
 
-	g_mutex_unlock (br->lock);
+	g_mutex_unlock (&br->lock);
 }
 
 static void
@@ -303,12 +297,12 @@ book_client_opened_cb (EBookClient *book_client,
 	g_return_if_fail (book_client != NULL);
 	g_return_if_fail (br != NULL);
 
-	g_mutex_lock (br->lock);
+	g_mutex_lock (&br->lock);
 	g_signal_handler_disconnect (
 		br->book_client,
 		br->book_client_opened_id);
 	br->book_client_opened_id = 0;
-	g_mutex_unlock (br->lock);
+	g_mutex_unlock (&br->lock);
 
 	source = e_client_get_source (E_CLIENT (book_client));
 	source_uid = e_source_get_uid (source);
@@ -372,12 +366,12 @@ client_open_cb (GObject *source_object,
 	if (error != NULL) {
 		ESource *source;
 
-		g_mutex_lock (br->lock);
+		g_mutex_lock (&br->lock);
 		g_signal_handler_disconnect (
 			br->book_client,
 			br->book_client_opened_id);
 		br->book_client_opened_id = 0;
-		g_mutex_unlock (br->lock);
+		g_mutex_unlock (&br->lock);
 
 		g_warning (
 			"%s: Failed to open book: %s",
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index b9ab454..00fa8d0 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -74,7 +74,7 @@ struct _ECalBackendFilePrivate {
 	 * may call other high-level functions the mutex must allow
 	 * recursive locking
 	 */
-	GStaticRecMutex idle_save_rmutex;
+	GRecMutex idle_save_rmutex;
 
 	/* Toplevel VCALENDAR component */
 	icalcomponent *icalcomp;
@@ -91,7 +91,7 @@ struct _ECalBackendFilePrivate {
 	GList *comp;
 
 	/* guards refresh members */
-	GMutex *refresh_lock;
+	GMutex refresh_lock;
 	/* set to TRUE to indicate thread should stop */
 	gboolean refresh_thread_stop;
 	/* condition for refreshing, not NULL when thread exists */
@@ -152,11 +152,11 @@ save_file_when_idle (gpointer user_data)
 	g_assert (priv->path != NULL);
 	g_assert (priv->icalcomp != NULL);
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 	if (!priv->is_dirty || priv->read_only) {
 		priv->dirty_idle_id = 0;
 		priv->is_dirty = FALSE;
-		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_rec_mutex_unlock (&priv->idle_save_rmutex);
 		return FALSE;
 	}
 
@@ -225,18 +225,18 @@ save_file_when_idle (gpointer user_data)
 	priv->is_dirty = FALSE;
 	priv->dirty_idle_id = 0;
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	return FALSE;
 
  error_malformed_uri:
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 	e_cal_backend_notify_error (E_CAL_BACKEND (cbfile),
 				  _("Cannot save calendar data: Malformed URI."));
 	return FALSE;
 
  error:
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	if (e) {
 		gchar *msg = g_strdup_printf ("%s: %s", _("Cannot save calendar data"), e->message);
@@ -261,13 +261,13 @@ save (ECalBackendFile *cbfile,
 
 	priv = cbfile->priv;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 	priv->is_dirty = TRUE;
 
 	if (!priv->dirty_idle_id)
 		priv->dirty_idle_id = g_idle_add ((GSourceFunc) save_file_when_idle, cbfile);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 static void
@@ -339,10 +339,9 @@ e_cal_backend_file_finalize (GObject *object)
 
 	free_refresh_data (E_CAL_BACKEND_FILE (object));
 
-	if (priv->refresh_lock)
-		g_mutex_free (priv->refresh_lock);
+	g_mutex_clear (&priv->refresh_lock);
 
-	g_static_rec_mutex_free (&priv->idle_save_rmutex);
+	g_rec_mutex_clear (&priv->idle_save_rmutex);
 
 	g_free (priv->path);
 	g_free (priv->file_name);
@@ -917,15 +916,15 @@ refresh_thread_func (gpointer data)
 	last_modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
 	g_object_unref (info);
 
-	g_mutex_lock (priv->refresh_lock);
+	g_mutex_lock (&priv->refresh_lock);
 	while (!priv->refresh_thread_stop) {
-		g_cond_wait (priv->refresh_cond, priv->refresh_lock);
+		g_cond_wait (priv->refresh_cond, &priv->refresh_lock);
 
-		g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+		g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 		if (priv->refresh_skip > 0) {
 			priv->refresh_skip--;
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			continue;
 		}
 
@@ -939,7 +938,7 @@ refresh_thread_func (gpointer data)
 			priv->refresh_skip = 0;
 		}
 
-		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 		info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 		if (!info)
@@ -956,7 +955,7 @@ refresh_thread_func (gpointer data)
 
 	g_object_unref (file);
 	g_cond_signal (priv->refresh_gone_cond);
-	g_mutex_unlock (priv->refresh_lock);
+	g_mutex_unlock (&priv->refresh_lock);
 
 	return NULL;
 }
@@ -985,7 +984,7 @@ prepare_refresh_data (ECalBackendFile *cbfile)
 
 	priv = cbfile->priv;
 
-	g_mutex_lock (priv->refresh_lock);
+	g_mutex_lock (&priv->refresh_lock);
 
 	priv->refresh_thread_stop = FALSE;
 	priv->refresh_skip = 0;
@@ -1016,13 +1015,16 @@ prepare_refresh_data (ECalBackendFile *cbfile)
 	}
 
 	if (priv->refresh_monitor) {
-		priv->refresh_cond = g_cond_new ();
-		priv->refresh_gone_cond = g_cond_new ();
+		GThread *thread;
 
-		g_thread_create (refresh_thread_func, cbfile, FALSE, NULL);
+		priv->refresh_cond = g_new0 (GCond, 1);
+		priv->refresh_gone_cond = g_new0 (GCond, 1);
+
+		thread = g_thread_new (NULL, refresh_thread_func, cbfile);
+		g_thread_unref (thread);
 	}
 
-	g_mutex_unlock (priv->refresh_lock);
+	g_mutex_unlock (&priv->refresh_lock);
 }
 
 static void
@@ -1034,7 +1036,7 @@ free_refresh_data (ECalBackendFile *cbfile)
 
 	priv = cbfile->priv;
 
-	g_mutex_lock (priv->refresh_lock);
+	g_mutex_lock (&priv->refresh_lock);
 
 	if (priv->refresh_monitor)
 		g_object_unref (priv->refresh_monitor);
@@ -1043,17 +1045,17 @@ free_refresh_data (ECalBackendFile *cbfile)
 	if (priv->refresh_cond) {
 		priv->refresh_thread_stop = TRUE;
 		g_cond_signal (priv->refresh_cond);
-		g_cond_wait (priv->refresh_gone_cond, priv->refresh_lock);
+		g_cond_wait (priv->refresh_gone_cond, &priv->refresh_lock);
 
-		g_cond_free (priv->refresh_cond);
+		g_cond_clear (priv->refresh_cond);
 		priv->refresh_cond = NULL;
-		g_cond_free (priv->refresh_gone_cond);
+		g_cond_clear (priv->refresh_gone_cond);
 		priv->refresh_gone_cond = NULL;
 	}
 
 	priv->refresh_skip = 0;
 
-	g_mutex_unlock (priv->refresh_lock);
+	g_mutex_unlock (&priv->refresh_lock);
 }
 
 /* Parses an open iCalendar file and loads it into the backend */
@@ -1341,7 +1343,7 @@ e_cal_backend_file_open (ECalBackendSync *backend,
 
 	cbfile = E_CAL_BACKEND_FILE (backend);
 	priv = cbfile->priv;
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	/* Claim a succesful open if we are already open */
 	if (priv->path && priv->comp_uid_hash) {
@@ -1385,7 +1387,7 @@ e_cal_backend_file_open (ECalBackendSync *backend,
 	g_free (str_uri);
 
   done:
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), priv->read_only);
 	e_cal_backend_notify_online (E_CAL_BACKEND (backend), TRUE);
 
@@ -1429,11 +1431,11 @@ e_cal_backend_file_get_object (ECalBackendSync *backend,
 	e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
 	g_assert (priv->comp_uid_hash != NULL);
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
 	if (!obj_data) {
-		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_rec_mutex_unlock (&priv->idle_save_rmutex);
 		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 		return;
 	}
@@ -1449,7 +1451,7 @@ e_cal_backend_file_get_object (ECalBackendSync *backend,
 			struct icaltimetype itt;
 
 			if (!obj_data->full_object) {
-				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_rec_mutex_unlock (&priv->idle_save_rmutex);
 				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 				return;
 			}
@@ -1459,7 +1461,7 @@ e_cal_backend_file_get_object (ECalBackendSync *backend,
 				e_cal_component_get_icalcomponent (obj_data->full_object),
 				itt);
 			if (!icalcomp) {
-				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_rec_mutex_unlock (&priv->idle_save_rmutex);
 				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 				return;
 			}
@@ -1491,7 +1493,7 @@ e_cal_backend_file_get_object (ECalBackendSync *backend,
 			*object = e_cal_component_get_as_string (obj_data->full_object);
 	}
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 /* Add_timezone handler for the file backend */
@@ -1525,14 +1527,14 @@ e_cal_backend_file_add_timezone (ECalBackendSync *backend,
 		zone = icaltimezone_new ();
 		icaltimezone_set_component (zone, tz_comp);
 
-		g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+		g_rec_mutex_lock (&priv->idle_save_rmutex);
 		if (!icalcomponent_get_timezone (priv->icalcomp,
 						 icaltimezone_get_tzid (zone))) {
 			icalcomponent_add_component (priv->icalcomp, tz_comp);
 
 			save (cbfile, TRUE);
 		}
-		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 		icaltimezone_free (zone, 1);
 	}
@@ -1649,7 +1651,7 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (
 		match_data.obj_sexp,
@@ -1670,7 +1672,7 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend,
 			       &match_data);
 	}
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	*objects = g_slist_reverse (match_data.comps_list);
 
@@ -1750,11 +1752,11 @@ e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend,
 	e_return_data_cal_error_if_fail (attachment_uris != NULL, InvalidArg);
 	g_assert (priv->comp_uid_hash != NULL);
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
 	if (!obj_data) {
-		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_rec_mutex_unlock (&priv->idle_save_rmutex);
 		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 		return;
 	}
@@ -1770,7 +1772,7 @@ e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend,
 			struct icaltimetype itt;
 
 			if (!obj_data->full_object) {
-				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_rec_mutex_unlock (&priv->idle_save_rmutex);
 				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 				return;
 			}
@@ -1780,7 +1782,7 @@ e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend,
 				e_cal_component_get_icalcomponent (obj_data->full_object),
 				itt);
 			if (!icalcomp) {
-				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_rec_mutex_unlock (&priv->idle_save_rmutex);
 				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 				return;
 			}
@@ -1803,7 +1805,7 @@ e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend,
 
 	*attachment_uris = g_slist_reverse (*attachment_uris);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 /* get_query handler for the file backend */
@@ -1850,7 +1852,7 @@ e_cal_backend_file_start_view (ECalBackend *backend,
 
 	objs_occuring_in_tw = NULL;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	if (!prunning_by_time) {
 		/* full scan */
@@ -1875,7 +1877,7 @@ e_cal_backend_file_start_view (ECalBackend *backend,
 			g_list_length (objs_occuring_in_tw));
 	}
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	/* notify listeners of all objects */
 	if (match_data.comps_list) {
@@ -2036,7 +2038,7 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend,
 	e_return_data_cal_error_if_fail (start != -1 && end != -1, InvalidRange);
 	e_return_data_cal_error_if_fail (start <= end, InvalidRange);
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	*freebusy = NULL;
 
@@ -2064,7 +2066,7 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend,
 		}
 	}
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 static icaltimezone *
@@ -2080,7 +2082,7 @@ e_cal_backend_file_internal_get_timezone (ECalBackend *backend,
 
 	g_return_val_if_fail (priv->icalcomp != NULL, NULL);
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	if (!strcmp (tzid, "UTC"))
 		zone = icaltimezone_get_utc_timezone ();
@@ -2091,7 +2093,7 @@ e_cal_backend_file_internal_get_timezone (ECalBackend *backend,
 			zone = E_CAL_BACKEND_CLASS (e_cal_backend_file_parent_class)->internal_get_timezone (backend, tzid);
 	}
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 	return zone;
 }
 
@@ -2165,7 +2167,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 	if (uids)
 		*uids = NULL;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	/* First step, parse input strings and do uid verification: may fail */
 	for (l = in_calobjs; l; l = l->next) {
@@ -2176,7 +2178,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 		icalcomp = icalparser_parse_string ((gchar *) l->data);
 		if (!icalcomp) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (InvalidObject));
 			return;
 		}
@@ -2187,7 +2189,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 		/* Check kind with the parent */
 		if (icalcomponent_isa (icalcomp) != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (InvalidObject));
 			return;
 		}
@@ -2200,7 +2202,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 			new_uid = e_cal_component_gen_uid ();
 			if (!new_uid) {
 				g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_rec_mutex_unlock (&priv->idle_save_rmutex);
 				g_propagate_error (error, EDC_ERROR (InvalidObject));
 				return;
 			}
@@ -2214,7 +2216,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 		/* check that the object is not in our cache */
 		if (uid_in_use (cbfile, comp_uid)) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (ObjectIdAlreadyExists));
 			return;
 		}
@@ -2255,7 +2257,7 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
 	/* Save the file */
 	save (cbfile, TRUE);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	if (uids)
 		*uids = g_slist_reverse (*uids);
@@ -2336,7 +2338,7 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
 	if (new_components)
 		*new_components = NULL;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	/* First step, parse input strings and do uid verification: may fail */
 	for (l = calobjs; l; l = l->next) {
@@ -2347,7 +2349,7 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
 		icalcomp = icalparser_parse_string (l->data);
 		if (!icalcomp) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (InvalidObject));
 			return;
 		}
@@ -2357,7 +2359,7 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
 		/* Check kind with the parent */
 		if (icalcomponent_isa (icalcomp) != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (InvalidObject));
 			return;
 		}
@@ -2368,7 +2370,7 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
 		/* Get the object from our cache */
 		if (!g_hash_table_lookup (priv->comp_uid_hash, comp_uid)) {
 			g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 			return;
 		}
@@ -2579,7 +2581,7 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
 	/* All the components were updated, now we save the file */
 	save (cbfile, TRUE);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	if (old_components)
 		*old_components = g_slist_reverse (*old_components);
@@ -2822,14 +2824,14 @@ e_cal_backend_file_remove_objects (ECalBackendSync *backend,
 
 	*old_components = *new_components = NULL;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	/* First step, validate the input */
 	for (l = ids; l; l = l->next) {
 		ECalComponentId *id = l->data;
 				/* Make the ID contains a uid */
 		if (!id || !id->uid) {
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 			return;
 		}
@@ -2837,13 +2839,13 @@ e_cal_backend_file_remove_objects (ECalBackendSync *backend,
 					 or CALOBJ_MOD_THISANDFUTURE */
 		if ((mod == CALOBJ_MOD_THISANDPRIOR || mod == CALOBJ_MOD_THISANDFUTURE) &&
 			(!id->rid || !*(id->rid))) {
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 			return;
 		}
 				/* Make sure the uid exists in the local hash table */
 		if (!g_hash_table_lookup (priv->comp_uid_hash, id->uid)) {
-			g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+			g_rec_mutex_unlock (&priv->idle_save_rmutex);
 			g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 			return;
 		}
@@ -2928,7 +2930,7 @@ e_cal_backend_file_remove_objects (ECalBackendSync *backend,
 
 	save (cbfile, TRUE);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	*old_components = g_slist_reverse (*old_components);
 	*new_components = g_slist_reverse (*new_components);
@@ -3093,7 +3095,7 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
 		return;
 	}
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	registry = e_cal_backend_get_registry (E_CAL_BACKEND (backend));
 
@@ -3337,7 +3339,7 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
 
  error:
 	g_hash_table_destroy (tzdata.zones);
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	if (err)
 		g_propagate_error (error, err);
@@ -3364,9 +3366,9 @@ e_cal_backend_file_init (ECalBackendFile *cbfile)
 
 	cbfile->priv->file_name = g_strdup ("calendar.ics");
 
-	g_static_rec_mutex_init (&cbfile->priv->idle_save_rmutex);
+	g_rec_mutex_init (&cbfile->priv->idle_save_rmutex);
 
-	cbfile->priv->refresh_lock = g_mutex_new ();
+	g_mutex_init (&cbfile->priv->refresh_lock);
 
 	/*
 	 * data access is serialized via idle_save_rmutex, so locking at the
@@ -3488,14 +3490,14 @@ e_cal_backend_file_set_file_name (ECalBackendFile *cbfile,
 	g_return_if_fail (file_name != NULL);
 
 	priv = cbfile->priv;
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	if (priv->file_name)
 		g_free (priv->file_name);
 
 	priv->file_name = g_strdup (file_name);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 const gchar *
@@ -3520,7 +3522,7 @@ e_cal_backend_file_reload (ECalBackendFile *cbfile,
 	GError *err = NULL;
 
 	priv = cbfile->priv;
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	str_uri = get_uri_string (E_CAL_BACKEND (cbfile));
 	if (!str_uri) {
@@ -3547,7 +3549,7 @@ e_cal_backend_file_reload (ECalBackendFile *cbfile,
 			priv->read_only = TRUE;
 	}
   done:
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 	e_cal_backend_notify_readonly (E_CAL_BACKEND (cbfile), cbfile->priv->read_only);
 
 	if (err)
@@ -3579,7 +3581,7 @@ test_query_by_scanning_all_objects (ECalBackendFile *cbfile,
 	if (!match_data.obj_sexp)
 		return;
 
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+	g_rec_mutex_lock (&priv->idle_save_rmutex);
 
 	if (!match_data.obj_sexp)
 	{
@@ -3590,7 +3592,7 @@ test_query_by_scanning_all_objects (ECalBackendFile *cbfile,
 	g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) match_object_sexp,
 			&match_data);
 
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	g_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	*objects = g_slist_reverse (match_data.comps_list);
 
diff --git a/calendar/backends/file/e-source-local.c b/calendar/backends/file/e-source-local.c
index 6877cf0..10b737a 100644
--- a/calendar/backends/file/e-source-local.c
+++ b/calendar/backends/file/e-source-local.c
@@ -23,7 +23,7 @@
 	((obj), E_TYPE_SOURCE_LOCAL, ESourceLocalPrivate))
 
 struct _ESourceLocalPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	GFile *custom_file;
 };
 
@@ -95,7 +95,7 @@ source_local_finalize (GObject *object)
 
 	priv = E_SOURCE_LOCAL_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_source_local_parent_class)->finalize (object);
@@ -140,7 +140,7 @@ static void
 e_source_local_init (ESourceLocal *extension)
 {
 	extension->priv = E_SOURCE_LOCAL_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 void
@@ -168,12 +168,12 @@ e_source_local_dup_custom_file (ESourceLocal *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_LOCAL (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_local_get_custom_file (extension);
 	duplicate = (protected != NULL) ? g_file_dup (protected) : NULL;
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -189,14 +189,14 @@ e_source_local_set_custom_file (ESourceLocal *extension,
 		g_object_ref (custom_file);
 	}
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (extension->priv->custom_file != NULL)
 		g_object_unref (extension->priv->custom_file);
 
 	extension->priv->custom_file = custom_file;
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "custom-file");
 }
diff --git a/calendar/backends/weather/e-source-weather.c b/calendar/backends/weather/e-source-weather.c
index 93975d5..fb0ede7 100644
--- a/calendar/backends/weather/e-source-weather.c
+++ b/calendar/backends/weather/e-source-weather.c
@@ -23,7 +23,7 @@
 	((obj), E_TYPE_SOURCE_WEATHER, ESourceWeatherPrivate))
 
 struct _ESourceWeatherPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	ESourceWeatherUnits units;
 	gchar *location;
 };
@@ -96,7 +96,7 @@ source_weather_finalize (GObject *object)
 
 	priv = E_SOURCE_WEATHER_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->location);
 
@@ -155,7 +155,7 @@ static void
 e_source_weather_init (ESourceWeather *extension)
 {
 	extension->priv = E_SOURCE_WEATHER_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 void
@@ -198,12 +198,12 @@ e_source_weather_dup_location (ESourceWeather *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_WEATHER (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_weather_get_location (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -214,17 +214,17 @@ e_source_weather_set_location (ESourceWeather *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_WEATHER (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->location, location) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->location);
 	extension->priv->location = e_util_strdup_strip (location);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "location");
 }
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index dc7fcd9..4ed00b0 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -51,7 +51,7 @@ struct _ECalClientPrivate {
 	icaltimezone *default_zone;
 	gchar *cache_dir;
 
-	GMutex *zone_cache_lock;
+	GMutex zone_cache_lock;
 	GHashTable *zone_cache;
 };
 
@@ -205,9 +205,9 @@ set_proxy_gone_error (GError **error)
 
 static guint active_cal_clients = 0, cal_connection_closed_id = 0;
 static EGdbusCalFactory *cal_factory = NULL;
-static GStaticRecMutex cal_factory_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK_FACTORY()   g_static_rec_mutex_lock (&cal_factory_lock)
-#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&cal_factory_lock)
+static GRecMutex cal_factory_lock;
+#define LOCK_FACTORY()   g_rec_mutex_lock (&cal_factory_lock)
+#define UNLOCK_FACTORY() g_rec_mutex_unlock (&cal_factory_lock)
 
 static void gdbus_cal_factory_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
 
@@ -606,12 +606,11 @@ cal_client_finalize (GObject *object)
 		icaltimezone_free (priv->default_zone, 1);
 	priv->default_zone = NULL;
 
-	g_mutex_lock (priv->zone_cache_lock);
+	g_mutex_lock (&priv->zone_cache_lock);
 	g_hash_table_destroy (priv->zone_cache);
 	priv->zone_cache = NULL;
-	g_mutex_unlock (priv->zone_cache_lock);
-	g_mutex_free (priv->zone_cache_lock);
-	priv->zone_cache_lock = NULL;
+	g_mutex_unlock (&priv->zone_cache_lock);
+	g_mutex_clear (&priv->zone_cache_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_cal_client_parent_class)->finalize (object);
@@ -947,7 +946,7 @@ e_cal_client_init (ECalClient *client)
 	client->priv->source_type = E_CAL_CLIENT_SOURCE_TYPE_LAST;
 	client->priv->default_zone = icaltimezone_get_utc_timezone ();
 	client->priv->cache_dir = NULL;
-	client->priv->zone_cache_lock = g_mutex_new ();
+	g_mutex_init (&client->priv->zone_cache_lock);
 	client->priv->zone_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone_cb);
 }
 
@@ -4883,12 +4882,11 @@ cal_client_get_timezone_from_cache (ECalClient *client,
 	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
 	g_return_val_if_fail (tzid != NULL, NULL);
 	g_return_val_if_fail (client->priv->zone_cache != NULL, NULL);
-	g_return_val_if_fail (client->priv->zone_cache_lock != NULL, NULL);
 
 	if (!*tzid)
 		return NULL;
 
-	g_mutex_lock (client->priv->zone_cache_lock);
+	g_mutex_lock (&client->priv->zone_cache_lock);
 	if (g_str_equal (tzid, "UTC")) {
 		zone = icaltimezone_get_utc_timezone ();
 	} else {
@@ -4945,7 +4943,7 @@ cal_client_get_timezone_from_cache (ECalClient *client,
 		}
 	}
 
-	g_mutex_unlock (client->priv->zone_cache_lock);
+	g_mutex_unlock (&client->priv->zone_cache_lock);
 
 	return zone;
 }
@@ -5038,9 +5036,9 @@ complete_get_timezone (ECalClient *client,
 				res = FALSE;
 				g_propagate_error (error, e_cal_client_error_create (E_CAL_CLIENT_ERROR_INVALID_OBJECT, NULL));
 			} else {
-				g_mutex_lock (client->priv->zone_cache_lock);
+				g_mutex_lock (&client->priv->zone_cache_lock);
 				g_hash_table_insert (client->priv->zone_cache, g_strdup (icaltimezone_get_tzid (*zone)), *zone);
-				g_mutex_unlock (client->priv->zone_cache_lock);
+				g_mutex_unlock (&client->priv->zone_cache_lock);
 			}
 		} else {
 			res = FALSE;
diff --git a/calendar/libecal/e-cal-system-timezone.c b/calendar/libecal/e-cal-system-timezone.c
index 0244f22..57d6a30 100644
--- a/calendar/libecal/e-cal-system-timezone.c
+++ b/calendar/libecal/e-cal-system-timezone.c
@@ -412,7 +412,7 @@ system_timezone_read_etc_localtime_content (GHashTable *ical_zones)
 	static gchar *last_localtime_content = NULL;
 	static gsize last_localtime_content_len = -1;
 	static gchar *last_timezone = NULL;
-	static GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
+	static GRecMutex mutex;
 
 	struct stat stat_localtime;
 	gchar *localtime_content = NULL;
@@ -431,7 +431,7 @@ system_timezone_read_etc_localtime_content (GHashTable *ical_zones)
 				  NULL))
 		return NULL;
 
-	g_static_rec_mutex_lock (&mutex);
+	g_rec_mutex_lock (&mutex);
 
 	if (last_localtime_content) {
 		if (localtime_content_len != last_localtime_content_len
@@ -443,7 +443,7 @@ system_timezone_read_etc_localtime_content (GHashTable *ical_zones)
 			last_timezone = NULL;
 		} else {
 			retval = g_strdup (last_timezone);
-			g_static_rec_mutex_unlock (&mutex);
+			g_rec_mutex_unlock (&mutex);
 
 			g_free (localtime_content);
 			return retval;
@@ -473,7 +473,7 @@ system_timezone_read_etc_localtime_content (GHashTable *ical_zones)
 		g_free (localtime_content);
 	}
 
-	g_static_rec_mutex_unlock (&mutex);
+	g_rec_mutex_unlock (&mutex);
 
 	return retval;
 }
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 40bc848..60116a4 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -75,7 +75,7 @@ struct _ECalPrivate {
 	ECalSourceType type;
 
 	GList **free_busy_data;
-	GMutex *free_busy_data_lock;
+	GMutex free_busy_data_lock;
 };
 
 enum {
@@ -393,15 +393,15 @@ cal_finalize (GObject *object)
 	priv->load_state = E_CAL_LOAD_NOT_LOADED;
 
 	if (priv->free_busy_data) {
-		g_mutex_lock (priv->free_busy_data_lock);
+		g_mutex_lock (&priv->free_busy_data_lock);
 		g_list_foreach (*priv->free_busy_data, (GFunc) g_object_unref, NULL);
 		g_list_free (*priv->free_busy_data);
 		*priv->free_busy_data = NULL;
 		priv->free_busy_data = NULL;
-		g_mutex_unlock (priv->free_busy_data_lock);
+		g_mutex_unlock (&priv->free_busy_data_lock);
 	}
 
-	g_mutex_free (priv->free_busy_data_lock);
+	g_mutex_clear (&priv->free_busy_data_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_cal_parent_class)->finalize (object);
@@ -554,7 +554,7 @@ e_cal_init (ECal *ecal)
 
 	ecal->priv->load_state = E_CAL_LOAD_NOT_LOADED;
 
-	ecal->priv->free_busy_data_lock = g_mutex_new ();
+	g_mutex_init (&ecal->priv->free_busy_data_lock);
 }
 
 static void async_open_report_result (ECal *ecal, const GError *error);
diff --git a/calendar/libedata-cal/e-cal-backend-file-store.c b/calendar/libedata-cal/e-cal-backend-file-store.c
index 2f3491a..e6d11f0 100644
--- a/calendar/libedata-cal/e-cal-backend-file-store.c
+++ b/calendar/libedata-cal/e-cal-backend-file-store.c
@@ -45,7 +45,7 @@ struct _ECalBackendFileStorePrivate {
 	GHashTable *comp_uid_hash;
 	EFileCache *keys_cache;
 
-	GStaticRWLock lock;
+	GRWLock lock;
 
 	gchar *cache_file_name;
 	gchar *key_file_name;
@@ -120,7 +120,7 @@ put_component (ECalBackendFileStore *fstore,
 		return FALSE;
 	}
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 	obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
 	if (obj == NULL) {
 		obj = create_new_full_object ();
@@ -140,7 +140,7 @@ put_component (ECalBackendFileStore *fstore,
 	}
 
 	g_object_ref (comp);
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	return TRUE;
 }
@@ -154,7 +154,7 @@ remove_component (ECalBackendFileStore *fstore,
 	gboolean ret_val = TRUE;
 	gboolean remove_completely = FALSE;
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 
 	obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
 	if (obj == NULL) {
@@ -174,7 +174,7 @@ remove_component (ECalBackendFileStore *fstore,
 		g_hash_table_remove (fstore->priv->comp_uid_hash, uid);
 
 end:
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	return ret_val;
 
@@ -188,7 +188,7 @@ get_component (ECalBackendFileStore *fstore,
 	FullCompObject *obj = NULL;
 	ECalComponent *comp = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 
 	obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
 	if (obj == NULL)
@@ -203,7 +203,7 @@ get_component (ECalBackendFileStore *fstore,
 		g_object_ref (comp);
 
 end:
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 	return comp;
 }
 
@@ -226,7 +226,7 @@ e_cal_backend_file_store_has_component (ECalBackendStore *store,
 	gboolean ret_val = FALSE;
 	FullCompObject *obj = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 
 	obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
 	if (obj == NULL) {
@@ -242,7 +242,7 @@ e_cal_backend_file_store_has_component (ECalBackendStore *store,
 		ret_val = TRUE;
 
 end:
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 	return ret_val;
 }
 
@@ -292,9 +292,9 @@ e_cal_backend_file_store_get_timezone (ECalBackendStore *store,
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	const icaltimezone *zone = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 	zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 
 	return zone;
 }
@@ -309,13 +309,13 @@ e_cal_backend_file_store_put_timezone (ECalBackendStore *store,
 	g_return_val_if_fail (fstore != NULL, FALSE);
 	g_return_val_if_fail (zone != NULL, FALSE);
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 	copy = copy_timezone ((icaltimezone *) zone);
 	g_hash_table_insert (
 		fstore->priv->timezones,
 		g_strdup (icaltimezone_get_tzid ((icaltimezone *) zone)),
 		copy);
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	fstore->priv->dirty = TRUE;
 
@@ -332,9 +332,9 @@ e_cal_backend_file_store_remove_timezone (ECalBackendStore *store,
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	gboolean ret_val = FALSE;
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 	ret_val = g_hash_table_remove (fstore->priv->timezones, tzid);
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	if (ret_val) {
 		fstore->priv->dirty = TRUE;
@@ -353,9 +353,9 @@ e_cal_backend_file_store_get_key_value (ECalBackendStore *store,
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	const gchar *value;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 	value = e_file_cache_get_object (fstore->priv->keys_cache, key);
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 
 	return value;
 }
@@ -368,7 +368,7 @@ e_cal_backend_file_store_put_key_value (ECalBackendStore *store,
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	gboolean ret_val = FALSE;
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 
 	if (!value)
 		ret_val = e_file_cache_remove_object (
@@ -382,7 +382,7 @@ e_cal_backend_file_store_put_key_value (ECalBackendStore *store,
 				fstore->priv->keys_cache, key, value);
 	}
 
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	return ret_val;
 }
@@ -394,14 +394,14 @@ e_cal_backend_file_store_get_default_timezone (ECalBackendStore *store)
 	const gchar *tzid;
 	const icaltimezone *zone = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 
 	tzid = e_file_cache_get_object (
 		fstore->priv->keys_cache, "default-zone");
 	if (tzid)
 		zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
 
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 
 	return zone;
 }
@@ -415,7 +415,7 @@ e_cal_backend_file_store_set_default_timezone (ECalBackendStore *store,
 	icaltimezone *copy;
 	const gchar *key = "default-zone";
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 
 	tzid = icaltimezone_get_tzid ((icaltimezone *) zone);
 	copy = copy_timezone ((icaltimezone *) zone);
@@ -428,7 +428,7 @@ e_cal_backend_file_store_set_default_timezone (ECalBackendStore *store,
 		e_file_cache_add_object (
 			fstore->priv->keys_cache, key, tzid);
 
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	return TRUE;
 }
@@ -475,7 +475,7 @@ e_cal_backend_file_store_get_components_by_uid (ECalBackendStore *store,
 	FullCompObject *obj = NULL;
 	GSList *comps = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 
 	obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
 	if (obj == NULL) {
@@ -489,7 +489,7 @@ e_cal_backend_file_store_get_components_by_uid (ECalBackendStore *store,
 
 	g_hash_table_foreach (obj->recurrences, (GHFunc) add_comp_to_slist, &comps);
 end:
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 	return comps;
 }
 
@@ -516,11 +516,11 @@ e_cal_backend_file_store_get_components (ECalBackendStore *store)
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	GSList *comps = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 	g_hash_table_foreach (
 		fstore->priv->comp_uid_hash,
 		(GHFunc) add_full_comp_to_slist, &comps);
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 
 	return comps;
 }
@@ -561,11 +561,11 @@ e_cal_backend_file_store_get_component_ids (ECalBackendStore *store)
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 	GSList *comp_ids = NULL;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 	g_hash_table_foreach (
 		fstore->priv->comp_uid_hash,
 		(GHFunc) add_comp_ids_to_slist, &comp_ids);
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 
 	return comp_ids;
 }
@@ -592,9 +592,9 @@ add_timezone (ECalBackendFileStore *fstore,
 		return;
 	}
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 	g_hash_table_insert (fstore->priv->timezones, g_strdup (tzid), zone);
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 }
 
 static icaltimezone *
@@ -727,13 +727,13 @@ e_cal_backend_file_store_clean (ECalBackendStore *store)
 {
 	ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
 
-	g_static_rw_lock_writer_lock (&fstore->priv->lock);
+	g_rw_lock_writer_lock (&fstore->priv->lock);
 
 	e_file_cache_clean (fstore->priv->keys_cache);
 	g_hash_table_remove_all (fstore->priv->comp_uid_hash);
 	g_hash_table_remove_all (fstore->priv->timezones);
 
-	g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+	g_rw_lock_writer_unlock (&fstore->priv->lock);
 
 	save_cache (fstore);
 	return TRUE;
@@ -788,7 +788,7 @@ timeout_save_cache (gpointer user_data)
 	gsize len, nwrote;
 	FILE *f;
 
-	g_static_rw_lock_reader_lock (&fstore->priv->lock);
+	g_rw_lock_reader_lock (&fstore->priv->lock);
 
 	fstore->priv->save_timeout_id = 0;
 
@@ -814,7 +814,7 @@ timeout_save_cache (gpointer user_data)
 		g_unlink (tmpfile);
 
 error:
-	g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+	g_rw_lock_reader_unlock (&fstore->priv->lock);
 	g_free (tmpfile);
 	g_free (data);
 	return FALSE;
@@ -879,7 +879,7 @@ cal_backend_file_store_finalize (GObject *object)
 
 	priv->dirty = FALSE;
 	priv->freeze_changes = FALSE;
-	g_static_rw_lock_free (&priv->lock);
+	g_rw_lock_clear (&priv->lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_cal_backend_file_store_parent_class)->finalize (object);
@@ -948,7 +948,7 @@ e_cal_backend_file_store_init (ECalBackendFileStore *store)
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) destroy_full_object);
 	store->priv->keys_cache = NULL;
-	g_static_rw_lock_init (&store->priv->lock);
+	g_rw_lock_init (&store->priv->lock);
 	store->priv->cache_file_name = NULL;
 	store->priv->key_file_name = NULL;
 	store->priv->dirty = FALSE;
diff --git a/calendar/libedata-cal/e-cal-backend-intervaltree.c b/calendar/libedata-cal/e-cal-backend-intervaltree.c
index b574cf5..90e87c7 100644
--- a/calendar/libedata-cal/e-cal-backend-intervaltree.c
+++ b/calendar/libedata-cal/e-cal-backend-intervaltree.c
@@ -75,7 +75,7 @@ struct _EIntervalTreePrivate
 	EIntervalNode *root;
 	EIntervalNode *nil;
 	GHashTable *id_node_hash;
-	GStaticRecMutex mutex;
+	GRecMutex mutex;
 };
 
 static inline gint
@@ -303,7 +303,7 @@ e_intervaltree_insert (EIntervalTree *tree,
 
 	priv = tree->priv;
 
-	g_static_rec_mutex_lock (&priv->mutex);
+	g_rec_mutex_lock (&priv->mutex);
 
 	e_cal_component_get_uid (comp, &uid);
 	rid = e_cal_component_get_recurid_as_string (comp);
@@ -375,7 +375,7 @@ e_intervaltree_insert (EIntervalTree *tree,
 	g_hash_table_insert (priv->id_node_hash, component_key (uid, rid), newNode);
 	g_free (rid);
 
-	g_static_rec_mutex_unlock (&priv->mutex);
+	g_rec_mutex_unlock (&priv->mutex);
 
 	return TRUE;
 }
@@ -562,7 +562,7 @@ e_intervaltree_search (EIntervalTree *tree,
 	g_return_val_if_fail (tree != NULL, NULL);
 
 	priv = tree->priv;
-	g_static_rec_mutex_lock (&priv->mutex);
+	g_rec_mutex_lock (&priv->mutex);
 
 	stack_start = pos = g_list_insert (stack_start, priv->root->left, -1);
 
@@ -590,7 +590,7 @@ e_intervaltree_search (EIntervalTree *tree,
 
 	g_list_free (stack_start);
 
-	g_static_rec_mutex_unlock (&priv->mutex);
+	g_rec_mutex_unlock (&priv->mutex);
 
 	return list;
 }
@@ -689,12 +689,12 @@ e_intervaltree_remove (EIntervalTree *tree,
 	priv = tree->priv;
 	nil = priv->nil;
 	root = priv->root;
-	g_static_rec_mutex_lock (&priv->mutex);
+	g_rec_mutex_lock (&priv->mutex);
 
 	z = e_intervaltree_search_component (tree, uid, rid);
 
 	if (!z || z == nil) {
-		g_static_rec_mutex_unlock (&priv->mutex);
+		g_rec_mutex_unlock (&priv->mutex);
 		return FALSE;
 	}
 
@@ -757,7 +757,7 @@ e_intervaltree_remove (EIntervalTree *tree,
 
 	g_object_unref (z->comp);
 	g_free (z);
-	g_static_rec_mutex_unlock (&priv->mutex);
+	g_rec_mutex_unlock (&priv->mutex);
 
 	return TRUE;
 }
@@ -782,7 +782,7 @@ intervaltree_finalize (GObject *object)
 		priv->id_node_hash = NULL;
 	}
 
-	g_static_rec_mutex_free (&priv->mutex);
+	g_rec_mutex_clear (&priv->mutex);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
@@ -820,7 +820,7 @@ e_intervaltree_init (EIntervalTree *tree)
 	root->max = _TIME_MAX;
 	root->min = _TIME_MIN;
 
-	g_static_rec_mutex_init (&tree->priv->mutex);
+	g_rec_mutex_init (&tree->priv->mutex);
 
 	tree->priv->id_node_hash = g_hash_table_new_full (
 		(GHashFunc) g_str_hash,
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index a3ef565..df42717 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -22,7 +22,7 @@
 G_DEFINE_TYPE (ECalBackendSync, e_cal_backend_sync, E_TYPE_CAL_BACKEND)
 
 struct _ECalBackendSyncPrivate {
-	GMutex *sync_mutex;
+	GMutex sync_mutex;
 
 	gboolean mutex_lock;
 };
@@ -31,20 +31,20 @@ struct _ECalBackendSyncPrivate {
 	gboolean locked = backend->priv->mutex_lock;								\
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func, NotSupported);		\
 	if (locked)												\
-		g_mutex_lock (backend->priv->sync_mutex);							\
+		g_mutex_lock (&backend->priv->sync_mutex);							\
 	(* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args;							\
 	if (locked)												\
-		g_mutex_unlock (backend->priv->sync_mutex);							\
+		g_mutex_unlock (&backend->priv->sync_mutex);							\
 	} G_STMT_END
 
 #define LOCK_WRAPPER_RET_VAL(func, args) G_STMT_START {								\
 	gboolean locked = backend->priv->mutex_lock;								\
 	e_return_data_cal_error_val_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func, NotSupported);	\
 	if (locked)												\
-		g_mutex_lock (backend->priv->sync_mutex);							\
+		g_mutex_lock (&backend->priv->sync_mutex);							\
 	res = (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args;						\
 	if (locked)												\
-		g_mutex_unlock (backend->priv->sync_mutex);							\
+		g_mutex_unlock (&backend->priv->sync_mutex);							\
 	} G_STMT_END
 
 /**
@@ -503,10 +503,10 @@ e_cal_backend_sync_get_timezone (ECalBackendSync *backend,
 		icaltimezone *zone = NULL;
 
 		if (backend->priv->mutex_lock)
-			g_mutex_lock (backend->priv->sync_mutex);
+			g_mutex_lock (&backend->priv->sync_mutex);
 		zone = e_cal_backend_internal_get_timezone (E_CAL_BACKEND (backend), tzid);
 		if (backend->priv->mutex_lock)
-			g_mutex_unlock (backend->priv->sync_mutex);
+			g_mutex_unlock (&backend->priv->sync_mutex);
 
 		if (!zone) {
 			g_propagate_error (error, e_data_cal_create_error (ObjectNotFound, NULL));
@@ -960,7 +960,7 @@ e_cal_backend_sync_finalize (GObject *object)
 
 	priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (object);
 
-	g_mutex_free (priv->sync_mutex);
+	g_mutex_clear (&priv->sync_mutex);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_cal_backend_sync_parent_class)->finalize (object);
@@ -1004,6 +1004,6 @@ static void
 e_cal_backend_sync_init (ECalBackendSync *backend)
 {
 	backend->priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (backend);
-	backend->priv->sync_mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->sync_mutex);
 }
 
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index d434e40..e1526cc 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -48,10 +48,10 @@ struct _ECalBackendPrivate {
 	gchar *cache_dir;
 
 	/* List of Cal objects */
-	GMutex *clients_mutex;
+	GMutex clients_mutex;
 	GList *clients;
 
-	GMutex *views_mutex;
+	GMutex views_mutex;
 	GList *views;
 
 	/* ECalBackend to pass notifications on to */
@@ -256,8 +256,8 @@ cal_backend_finalize (GObject *object)
 	/* should be NULL, anyway */
 	g_list_free (priv->clients);
 
-	g_mutex_free (priv->clients_mutex);
-	g_mutex_free (priv->views_mutex);
+	g_mutex_clear (&priv->clients_mutex);
+	g_mutex_clear (&priv->views_mutex);
 
 	g_free (priv->cache_dir);
 
@@ -357,10 +357,10 @@ e_cal_backend_init (ECalBackend *backend)
 	backend->priv = E_CAL_BACKEND_GET_PRIVATE (backend);
 
 	backend->priv->clients = NULL;
-	backend->priv->clients_mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->clients_mutex);
 
 	backend->priv->views = NULL;
-	backend->priv->views_mutex = g_mutex_new ();
+	g_mutex_init (&backend->priv->views_mutex);
 
 	backend->priv->readonly = TRUE;
 }
@@ -666,9 +666,9 @@ e_cal_backend_add_client (ECalBackend *backend,
 
 	g_object_weak_ref (G_OBJECT (cal), cal_destroy_cb, backend);
 
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 	priv->clients = g_list_append (priv->clients, cal);
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 static void
@@ -686,13 +686,13 @@ e_cal_backend_remove_client_private (ECalBackend *backend,
 	g_object_ref (backend);
 
 	/* Disconnect */
-	g_mutex_lock (backend->priv->clients_mutex);
+	g_mutex_lock (&backend->priv->clients_mutex);
 	backend->priv->clients = g_list_remove (backend->priv->clients, cal);
 
 	if (backend->priv->clients == NULL)
 		backend->priv->opening = FALSE;
 
-	g_mutex_unlock (backend->priv->clients_mutex);
+	g_mutex_unlock (&backend->priv->clients_mutex);
 
 	g_object_unref (backend);
 }
@@ -729,11 +729,11 @@ e_cal_backend_add_view (ECalBackend *backend,
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	backend->priv->views = g_list_append (backend->priv->views, view);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 }
 
 /**
@@ -752,11 +752,11 @@ e_cal_backend_remove_view (ECalBackend *backend,
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	backend->priv->views = g_list_remove (backend->priv->views, view);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 }
 
 /**
@@ -787,13 +787,13 @@ e_cal_backend_list_views (ECalBackend *backend)
 
 	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
 
-	g_mutex_lock (backend->priv->views_mutex);
+	g_mutex_lock (&backend->priv->views_mutex);
 
 	/* XXX Use g_list_copy_deep() once we require GLib >= 2.34. */
 	list = g_list_copy (backend->priv->views);
 	g_list_foreach (list, (GFunc) g_object_ref, NULL);
 
-	g_mutex_unlock (backend->priv->views_mutex);
+	g_mutex_unlock (&backend->priv->views_mutex);
 
 	return list;
 }
@@ -917,12 +917,12 @@ e_cal_backend_open (ECalBackend *backend,
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->open != NULL);
 
-	g_mutex_lock (backend->priv->clients_mutex);
+	g_mutex_lock (&backend->priv->clients_mutex);
 
 	if (e_cal_backend_is_opened (backend)) {
 		gboolean online;
 
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		e_data_cal_report_readonly (cal, backend->priv->readonly);
 
@@ -931,12 +931,12 @@ e_cal_backend_open (ECalBackend *backend,
 
 		e_cal_backend_respond_opened (backend, cal, opid, NULL);
 	} else if (e_cal_backend_is_opening (backend)) {
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		e_data_cal_respond_open (cal, opid, EDC_OPENING_ERROR);
 	} else {
 		backend->priv->opening = TRUE;
-		g_mutex_unlock (backend->priv->clients_mutex);
+		g_mutex_unlock (&backend->priv->clients_mutex);
 
 		(* E_CAL_BACKEND_GET_CLASS (backend)->open) (backend, cal, opid, cancellable, only_if_exists);
 	}
@@ -1634,12 +1634,12 @@ e_cal_backend_notify_error (ECalBackend *backend,
 		return;
 	}
 
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (l = priv->clients; l; l = l->next)
 		e_data_cal_report_error (l->data, message);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
@@ -1665,12 +1665,12 @@ e_cal_backend_notify_readonly (ECalBackend *backend,
 		return;
 	}
 
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (l = priv->clients; l; l = l->next)
 		e_data_cal_report_readonly (l->data, is_readonly);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
@@ -1697,12 +1697,12 @@ e_cal_backend_notify_online (ECalBackend *backend,
 		return;
 	}
 
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_cal_report_online (E_DATA_CAL (clients->data), is_online);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
@@ -1734,7 +1734,7 @@ e_cal_backend_notify_opened (ECalBackend *backend,
 	GList *clients;
 
 	priv = backend->priv;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	priv->opening = FALSE;
 	priv->opened = error == NULL;
@@ -1742,7 +1742,7 @@ e_cal_backend_notify_opened (ECalBackend *backend,
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_cal_report_opened (E_DATA_CAL (clients->data), error);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 
 	if (error)
 		g_error_free (error);
@@ -1772,12 +1772,12 @@ e_cal_backend_notify_property_changed (ECalBackend *backend,
 	g_return_if_fail (prop_value != NULL);
 
 	priv = backend->priv;
-	g_mutex_lock (priv->clients_mutex);
+	g_mutex_lock (&priv->clients_mutex);
 
 	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
 		e_data_cal_report_backend_property_changed (E_DATA_CAL (clients->data), prop_name, prop_value);
 
-	g_mutex_unlock (priv->clients_mutex);
+	g_mutex_unlock (&priv->clients_mutex);
 }
 
 /**
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index bbe6b45..435b688 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -49,11 +49,11 @@ struct _EDataCalFactoryPrivate {
 	ESourceRegistry *registry;
 	EGdbusCalFactory *gdbus_object;
 
-	GMutex *calendars_lock;
+	GMutex calendars_lock;
 	/* A hash of object paths for calendar URIs to EDataCals */
 	GHashTable *calendars;
 
-	GMutex *connections_lock;
+	GMutex connections_lock;
 	/* This is a hash of client addresses to GList* of EDataCals */
 	GHashTable *connections;
 };
@@ -162,8 +162,8 @@ calendar_freed_cb (EDataCalFactory *factory,
 
 	d (g_debug ("in factory %p (%p) is dead", factory, dead));
 
-	g_mutex_lock (priv->calendars_lock);
-	g_mutex_lock (priv->connections_lock);
+	g_mutex_lock (&priv->calendars_lock);
+	g_mutex_lock (&priv->connections_lock);
 
 	g_hash_table_foreach_remove (
 		priv->calendars, remove_dead_calendar_cb, dead);
@@ -185,8 +185,8 @@ calendar_freed_cb (EDataCalFactory *factory,
 		}
 	}
 
-	g_mutex_unlock (priv->connections_lock);
-	g_mutex_unlock (priv->calendars_lock);
+	g_mutex_unlock (&priv->connections_lock);
+	g_mutex_unlock (&priv->calendars_lock);
 
 	e_dbus_server_release (E_DBUS_SERVER (factory));
 }
@@ -271,10 +271,10 @@ impl_CalFactory_get_cal (EGdbusCalFactory *object,
 		connection, object_path, &error);
 
 	if (calendar != NULL) {
-		g_mutex_lock (priv->calendars_lock);
+		g_mutex_lock (&priv->calendars_lock);
 		g_hash_table_insert (
 			priv->calendars, g_strdup (object_path), calendar);
-		g_mutex_unlock (priv->calendars_lock);
+		g_mutex_unlock (&priv->calendars_lock);
 
 		e_cal_backend_add_client (E_CAL_BACKEND (backend), calendar);
 
@@ -283,12 +283,12 @@ impl_CalFactory_get_cal (EGdbusCalFactory *object,
 			calendar_freed_cb, factory);
 
 		/* Update the hash of open connections. */
-		g_mutex_lock (priv->connections_lock);
+		g_mutex_lock (&priv->connections_lock);
 		list = g_hash_table_lookup (priv->connections, sender);
 		list = g_list_prepend (list, calendar);
 		g_hash_table_insert (
 			priv->connections, g_strdup (sender), list);
-		g_mutex_unlock (priv->connections_lock);
+		g_mutex_unlock (&priv->connections_lock);
 	}
 
 	g_object_unref (backend);
@@ -367,8 +367,8 @@ data_cal_factory_finalize (GObject *object)
 	g_hash_table_destroy (priv->calendars);
 	g_hash_table_destroy (priv->connections);
 
-	g_mutex_free (priv->calendars_lock);
-	g_mutex_free (priv->connections_lock);
+	g_mutex_clear (&priv->calendars_lock);
+	g_mutex_clear (&priv->connections_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_data_cal_factory_parent_class)->finalize (object);
@@ -414,7 +414,7 @@ data_cal_factory_bus_name_lost (EDBusServer *server,
 
 	priv = E_DATA_CAL_FACTORY_GET_PRIVATE (server);
 
-	g_mutex_lock (priv->connections_lock);
+	g_mutex_lock (&priv->connections_lock);
 
 	while (g_hash_table_lookup_extended (
 		priv->connections,
@@ -431,7 +431,7 @@ data_cal_factory_bus_name_lost (EDBusServer *server,
 		g_list_free (copy);
 	}
 
-	g_mutex_unlock (priv->connections_lock);
+	g_mutex_unlock (&priv->connections_lock);
 
 	/* Chain up to parent's bus_name_lost() method. */
 	E_DBUS_SERVER_CLASS (e_data_cal_factory_parent_class)->
@@ -520,13 +520,13 @@ e_data_cal_factory_init (EDataCalFactory *factory)
 		factory->priv->gdbus_object, "handle-get-cal",
 		G_CALLBACK (impl_CalFactory_get_cal), factory);
 
-	factory->priv->calendars_lock = g_mutex_new ();
+	g_mutex_init (&factory->priv->calendars_lock);
 	factory->priv->calendars = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) NULL);
 
-	factory->priv->connections_lock = g_mutex_new ();
+	g_mutex_init (&factory->priv->connections_lock);
 	factory->priv->connections = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index f23d6c4..c162962 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -62,7 +62,7 @@ struct _EDataCalViewPrivate {
 
 	GHashTable *ids;
 
-	GMutex *pending_mutex;
+	GMutex pending_mutex;
 	guint flush_id;
 
 	/* view flags */
@@ -437,14 +437,14 @@ data_cal_view_dispose (GObject *object)
 		priv->sexp = NULL;
 	}
 
-	g_mutex_lock (priv->pending_mutex);
+	g_mutex_lock (&priv->pending_mutex);
 
 	if (priv->flush_id > 0) {
 		g_source_remove (priv->flush_id);
 		priv->flush_id = 0;
 	}
 
-	g_mutex_unlock (priv->pending_mutex);
+	g_mutex_unlock (&priv->pending_mutex);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_data_cal_view_parent_class)->dispose (object);
@@ -472,7 +472,7 @@ data_cal_view_finalize (GObject *object)
 	if (priv->fields_of_interest != NULL)
 		g_hash_table_destroy (priv->fields_of_interest);
 
-	g_mutex_free (priv->pending_mutex);
+	g_mutex_clear (&priv->pending_mutex);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_data_cal_view_parent_class)->finalize (object);
@@ -608,7 +608,7 @@ e_data_cal_view_init (EDataCalView *view)
 		(GDestroyNotify) e_cal_component_free_id,
 		(GDestroyNotify) NULL);
 
-	view->priv->pending_mutex = g_mutex_new ();
+	g_mutex_init (&view->priv->pending_mutex);
 	view->priv->flush_id = 0;
 }
 
@@ -675,7 +675,7 @@ pending_flush_timeout_cb (gpointer data)
 {
 	EDataCalView *view = data;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	view->priv->flush_id = 0;
 
@@ -683,7 +683,7 @@ pending_flush_timeout_cb (gpointer data)
 	send_pending_changes (view);
 	send_pending_removes (view);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 
 	return FALSE;
 }
@@ -1183,7 +1183,7 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
 	if (ecalcomponents == NULL)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	for (l = ecalcomponents; l; l = l->next) {
 		ECalComponent *comp = l->data;
@@ -1193,7 +1193,7 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
 		notify_add_component (view, comp);
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1248,7 +1248,7 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
 	if (ecalcomponents == NULL)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	for (l = ecalcomponents; l; l = l->next) {
 		ECalComponent *comp = l->data;
@@ -1258,7 +1258,7 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
 		notify_change_component (view, comp);
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1309,13 +1309,13 @@ e_data_cal_view_notify_objects_added (EDataCalView *view,
 	if (objects == NULL)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	for (l = objects; l; l = l->next) {
 		notify_add (view, e_util_utf8_make_valid (l->data));
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1362,14 +1362,14 @@ e_data_cal_view_notify_objects_modified (EDataCalView *view,
 	if (objects == NULL)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	for (l = objects; l; l = l->next) {
 		/* TODO: send add/remove/change as relevant, based on ->ids */
 		notify_change (view, e_util_utf8_make_valid (l->data));
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1413,7 +1413,7 @@ e_data_cal_view_notify_objects_removed (EDataCalView *view,
 	if (ids == NULL)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	for (l = ids; l; l = l->next) {
 		ECalComponentId *id = l->data;
@@ -1421,7 +1421,7 @@ e_data_cal_view_notify_objects_removed (EDataCalView *view,
 		    notify_remove (view, id);
 	}
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
 /**
@@ -1492,7 +1492,7 @@ e_data_cal_view_notify_complete (EDataCalView *view,
 	if (!view->priv->started || view->priv->stopped)
 		return;
 
-	g_mutex_lock (view->priv->pending_mutex);
+	g_mutex_lock (&view->priv->pending_mutex);
 
 	view->priv->complete = TRUE;
 
@@ -1508,6 +1508,6 @@ e_data_cal_view_notify_complete (EDataCalView *view,
 
 	g_strfreev (error_strv);
 
-	g_mutex_unlock (view->priv->pending_mutex);
+	g_mutex_unlock (&view->priv->pending_mutex);
 }
 
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index c85c63f..152556b 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -50,7 +50,7 @@ struct _EDataCalPrivate {
 	ECalBackend *backend;
 	gchar *object_path;
 
-	GStaticRecMutex pending_ops_lock;
+	GRecMutex pending_ops_lock;
 	GHashTable *pending_ops; /* opid to GCancellable for still running operations */
 };
 
@@ -309,7 +309,7 @@ operation_thread (gpointer data,
 		g_free (op->d.tzobject);
 		break;
 	case OP_CANCEL_OPERATION:
-		g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+		g_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
 
 		if (g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
 			GCancellable *cancellable = g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
@@ -317,15 +317,15 @@ operation_thread (gpointer data,
 			g_cancellable_cancel (cancellable);
 		}
 
-		g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+		g_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
 		break;
 	case OP_CLOSE:
 		/* close just cancels all pending ops and frees data cal */
 		e_cal_backend_remove_client (backend, op->cal);
 	case OP_CANCEL_ALL:
-		g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+		g_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
 		g_hash_table_foreach (op->cal->priv->pending_ops, cancel_ops_cb, NULL);
-		g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+		g_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
 		break;
 	}
 
@@ -346,9 +346,9 @@ op_new (OperationID op,
 	data->id = e_operation_pool_reserve_opid (ops_pool);
 	data->cancellable = g_cancellable_new ();
 
-	g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+	g_rec_mutex_lock (&cal->priv->pending_ops_lock);
 	g_hash_table_insert (cal->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
-	g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+	g_rec_mutex_unlock (&cal->priv->pending_ops_lock);
 
 	return data;
 }
@@ -361,9 +361,9 @@ op_complete (EDataCal *cal,
 
 	e_operation_pool_release_opid (ops_pool, opid);
 
-	g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+	g_rec_mutex_lock (&cal->priv->pending_ops_lock);
 	g_hash_table_remove (cal->priv->pending_ops, GUINT_TO_POINTER (opid));
-	g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+	g_rec_mutex_unlock (&cal->priv->pending_ops_lock);
 }
 
 /* Create the EDataCal error quark */
@@ -1641,7 +1641,7 @@ data_cal_finalize (GObject *object)
 		priv->pending_ops = NULL;
 	}
 
-	g_static_rec_mutex_free (&priv->pending_ops_lock);
+	g_rec_mutex_clear (&priv->pending_ops_lock);
 
 	if (priv->dbus_interface) {
 		g_object_unref (priv->dbus_interface);
@@ -1739,7 +1739,7 @@ e_data_cal_init (EDataCal *ecal)
 	ecal->priv->dbus_interface = e_gdbus_cal_stub_new ();
 	ecal->priv->pending_ops = g_hash_table_new_full (
 		g_direct_hash, g_direct_equal, NULL, g_object_unref);
-	g_static_rec_mutex_init (&ecal->priv->pending_ops_lock);
+	g_rec_mutex_init (&ecal->priv->pending_ops_lock);
 
 	dbus_interface = ecal->priv->dbus_interface;
 	g_signal_connect (
diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c
index e1e939b..a1d8968 100644
--- a/camel/camel-block-file.c
+++ b/camel/camel-block-file.c
@@ -43,21 +43,21 @@
 struct _CamelBlockFilePrivate {
 	struct _CamelBlockFile *base;
 
-	GStaticMutex root_lock; /* for modifying the root block */
-	GStaticMutex cache_lock; /* for refcounting, flag manip, cache manip */
-	GStaticMutex io_lock; /* for all io ops */
+	GMutex root_lock; /* for modifying the root block */
+	GMutex cache_lock; /* for refcounting, flag manip, cache manip */
+	GMutex io_lock; /* for all io ops */
 
 	guint deleted : 1;
 };
 
-#define CAMEL_BLOCK_FILE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_BLOCK_FILE_TRYLOCK(kf, lock) (g_static_mutex_trylock(&(kf)->priv->lock))
-#define CAMEL_BLOCK_FILE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_LOCK(kf, lock) (g_mutex_lock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_TRYLOCK(kf, lock) (g_mutex_trylock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_UNLOCK(kf, lock) (g_mutex_unlock(&(kf)->priv->lock))
 
-#define LOCK(x) g_static_mutex_lock(&x)
-#define UNLOCK(x) g_static_mutex_unlock(&x)
+#define LOCK(x) g_mutex_lock(&x)
+#define UNLOCK(x) g_mutex_unlock(&x)
 
-static GStaticMutex block_file_lock = G_STATIC_MUTEX_INIT;
+static GMutex block_file_lock;
 
 /* lru cache of block files */
 static GQueue block_file_list = G_QUEUE_INIT;
@@ -173,9 +173,9 @@ block_file_finalize (GObject *object)
 	if (bs->fd != -1)
 		close (bs->fd);
 
-	g_static_mutex_free (&bs->priv->io_lock);
-	g_static_mutex_free (&bs->priv->cache_lock);
-	g_static_mutex_free (&bs->priv->root_lock);
+	g_mutex_clear (&bs->priv->io_lock);
+	g_mutex_clear (&bs->priv->cache_lock);
+	g_mutex_clear (&bs->priv->root_lock);
 
 	g_free (bs->priv);
 
@@ -215,9 +215,9 @@ camel_block_file_init (CamelBlockFile *bs)
 	bs->priv = g_malloc0 (sizeof (*bs->priv));
 	bs->priv->base = bs;
 
-	g_static_mutex_init (&bs->priv->root_lock);
-	g_static_mutex_init (&bs->priv->cache_lock);
-	g_static_mutex_init (&bs->priv->io_lock);
+	g_mutex_init (&bs->priv->root_lock);
+	g_mutex_init (&bs->priv->cache_lock);
+	g_mutex_init (&bs->priv->io_lock);
 
 	/* link into lru list */
 	LOCK (block_file_lock);
@@ -840,15 +840,15 @@ camel_block_file_sync (CamelBlockFile *bs)
 
 struct _CamelKeyFilePrivate {
 	struct _CamelKeyFile *base;
-	GStaticMutex lock;
+	GMutex lock;
 	guint deleted : 1;
 };
 
-#define CAMEL_KEY_FILE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_KEY_FILE_TRYLOCK(kf, lock) (g_static_mutex_trylock(&(kf)->priv->lock))
-#define CAMEL_KEY_FILE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_LOCK(kf, lock) (g_mutex_lock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_TRYLOCK(kf, lock) (g_mutex_trylock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_UNLOCK(kf, lock) (g_mutex_unlock(&(kf)->priv->lock))
 
-static GStaticMutex key_file_lock = G_STATIC_MUTEX_INIT;
+static GMutex key_file_lock;
 
 /* lru cache of block files */
 static GQueue key_file_list = G_QUEUE_INIT;
@@ -880,7 +880,7 @@ key_file_finalize (GObject *object)
 
 	g_free (bs->path);
 
-	g_static_mutex_free (&bs->priv->lock);
+	g_mutex_clear (&bs->priv->lock);
 
 	g_free (bs->priv);
 
@@ -903,7 +903,7 @@ camel_key_file_init (CamelKeyFile *bs)
 	bs->priv = g_malloc0 (sizeof (*bs->priv));
 	bs->priv->base = bs;
 
-	g_static_mutex_init (&bs->priv->lock);
+	g_mutex_init (&bs->priv->lock);
 
 	LOCK (key_file_lock);
 	g_queue_push_head (&key_file_list, bs->priv);
diff --git a/camel/camel-certdb.c b/camel/camel-certdb.c
index 94508fb..fc38ebd 100644
--- a/camel/camel-certdb.c
+++ b/camel/camel-certdb.c
@@ -45,10 +45,10 @@
 	((obj), CAMEL_TYPE_CERTDB, CamelCertDBPrivate))
 
 struct _CamelCertDBPrivate {
-	GMutex *db_lock;	/* for the db hashtable/array */
-	GMutex *io_lock;	/* load/save lock, for access to saved_count, etc */
-	GMutex *alloc_lock;	/* for setting up and using allocators */
-	GMutex *ref_lock;	/* for reffing/unreffing certs */
+	GMutex db_lock;		/* for the db hashtable/array */
+	GMutex io_lock;		/* load/save lock, for access to saved_count, etc */
+	GMutex alloc_lock;	/* for setting up and using allocators */
+	GMutex ref_lock;	/* for reffing/unreffing certs */
 };
 
 static gint certdb_header_load (CamelCertDB *certdb, FILE *istream);
@@ -152,10 +152,10 @@ certdb_finalize (GObject *object)
 	if (certdb->cert_chunks)
 		camel_memchunk_destroy (certdb->cert_chunks);
 
-	g_mutex_free (priv->db_lock);
-	g_mutex_free (priv->io_lock);
-	g_mutex_free (priv->alloc_lock);
-	g_mutex_free (priv->ref_lock);
+	g_mutex_clear (&priv->db_lock);
+	g_mutex_clear (&priv->io_lock);
+	g_mutex_clear (&priv->alloc_lock);
+	g_mutex_clear (&priv->ref_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_certdb_parent_class)->finalize (object);
@@ -198,10 +198,10 @@ camel_certdb_init (CamelCertDB *certdb)
 	certdb->certs = g_ptr_array_new ();
 	certdb->cert_hash = g_hash_table_new_full (certdb_key_hash, certdb_key_equal, certdb_key_free, NULL);
 
-	certdb->priv->db_lock = g_mutex_new ();
-	certdb->priv->io_lock = g_mutex_new ();
-	certdb->priv->alloc_lock = g_mutex_new ();
-	certdb->priv->ref_lock = g_mutex_new ();
+	g_mutex_init (&certdb->priv->db_lock);
+	g_mutex_init (&certdb->priv->io_lock);
+	g_mutex_init (&certdb->priv->alloc_lock);
+	g_mutex_init (&certdb->priv->ref_lock);
 }
 
 CamelCertDB *
@@ -211,12 +211,12 @@ camel_certdb_new (void)
 }
 
 static CamelCertDB *default_certdb = NULL;
-static GStaticMutex default_certdb_lock = G_STATIC_MUTEX_INIT;
+static GMutex default_certdb_lock;
 
 void
 camel_certdb_set_default (CamelCertDB *certdb)
 {
-	g_static_mutex_lock (&default_certdb_lock);
+	g_mutex_lock (&default_certdb_lock);
 
 	if (default_certdb)
 		g_object_unref (default_certdb);
@@ -226,7 +226,7 @@ camel_certdb_set_default (CamelCertDB *certdb)
 
 	default_certdb = certdb;
 
-	g_static_mutex_unlock (&default_certdb_lock);
+	g_mutex_unlock (&default_certdb_lock);
 }
 
 CamelCertDB *
@@ -234,14 +234,14 @@ camel_certdb_get_default (void)
 {
 	CamelCertDB *certdb;
 
-	g_static_mutex_lock (&default_certdb_lock);
+	g_mutex_lock (&default_certdb_lock);
 
 	if (default_certdb)
 		g_object_ref (default_certdb);
 
 	certdb = default_certdb;
 
-	g_static_mutex_unlock (&default_certdb_lock);
+	g_mutex_unlock (&default_certdb_lock);
 
 	return certdb;
 }
@@ -844,16 +844,16 @@ camel_certdb_lock (CamelCertDB *certdb,
 
 	switch (lock) {
 	case CAMEL_CERTDB_DB_LOCK:
-		g_mutex_lock (certdb->priv->db_lock);
+		g_mutex_lock (&certdb->priv->db_lock);
 		break;
 	case CAMEL_CERTDB_IO_LOCK:
-		g_mutex_lock (certdb->priv->io_lock);
+		g_mutex_lock (&certdb->priv->io_lock);
 		break;
 	case CAMEL_CERTDB_ALLOC_LOCK:
-		g_mutex_lock (certdb->priv->alloc_lock);
+		g_mutex_lock (&certdb->priv->alloc_lock);
 		break;
 	case CAMEL_CERTDB_REF_LOCK:
-		g_mutex_lock (certdb->priv->ref_lock);
+		g_mutex_lock (&certdb->priv->ref_lock);
 		break;
 	default:
 		g_return_if_reached ();
@@ -877,16 +877,16 @@ camel_certdb_unlock (CamelCertDB *certdb,
 
 	switch (lock) {
 	case CAMEL_CERTDB_DB_LOCK:
-		g_mutex_unlock (certdb->priv->db_lock);
+		g_mutex_unlock (&certdb->priv->db_lock);
 		break;
 	case CAMEL_CERTDB_IO_LOCK:
-		g_mutex_unlock (certdb->priv->io_lock);
+		g_mutex_unlock (&certdb->priv->io_lock);
 		break;
 	case CAMEL_CERTDB_ALLOC_LOCK:
-		g_mutex_unlock (certdb->priv->alloc_lock);
+		g_mutex_unlock (&certdb->priv->alloc_lock);
 		break;
 	case CAMEL_CERTDB_REF_LOCK:
-		g_mutex_unlock (certdb->priv->ref_lock);
+		g_mutex_unlock (&certdb->priv->ref_lock);
 		break;
 	default:
 		g_return_if_reached ();
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index fa46bd6..e7be3ac 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -46,9 +46,9 @@
 	((obj), CAMEL_TYPE_CIPHER_CONTEXT, CamelCipherContextPrivate))
 
 #define CIPHER_LOCK(ctx) \
-	g_mutex_lock (((CamelCipherContext *) ctx)->priv->lock)
+	g_mutex_lock (&((CamelCipherContext *) ctx)->priv->lock)
 #define CIPHER_UNLOCK(ctx) \
-	g_mutex_unlock (((CamelCipherContext *) ctx)->priv->lock);
+	g_mutex_unlock (&((CamelCipherContext *) ctx)->priv->lock);
 
 #define d(x)
 
@@ -56,7 +56,7 @@ typedef struct _AsyncContext AsyncContext;
 
 struct _CamelCipherContextPrivate {
 	CamelSession *session;
-	GMutex *lock;
+	GMutex lock;
 };
 
 struct _AsyncContext {
@@ -172,7 +172,7 @@ cipher_context_finalize (GObject *object)
 
 	priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
 
-	g_mutex_free (priv->lock);
+	g_mutex_clear (&priv->lock);
 
 	/* Chain up to parent's finalize () method. */
 	G_OBJECT_CLASS (camel_cipher_context_parent_class)->finalize (object);
@@ -768,7 +768,7 @@ static void
 camel_cipher_context_init (CamelCipherContext *context)
 {
 	context->priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (context);
-	context->priv->lock = g_mutex_new ();
+	g_mutex_init (&context->priv->lock);
 }
 
 /**
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 5c25faf..e335d65 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -43,7 +43,7 @@
 typedef struct _AsyncContext AsyncContext;
 
 struct _CamelDataWrapperPrivate {
-	GStaticMutex stream_lock;
+	GMutex stream_lock;
 	GByteArray *byte_array;
 };
 
@@ -87,7 +87,7 @@ data_wrapper_finalize (GObject *object)
 
 	priv = CAMEL_DATA_WRAPPER_GET_PRIVATE (object);
 
-	g_static_mutex_free (&priv->stream_lock);
+	g_mutex_clear (&priv->stream_lock);
 	g_byte_array_free (priv->byte_array, TRUE);
 
 	/* Chain up to parent's finalize() method. */
@@ -510,7 +510,7 @@ camel_data_wrapper_init (CamelDataWrapper *data_wrapper)
 {
 	data_wrapper->priv = CAMEL_DATA_WRAPPER_GET_PRIVATE (data_wrapper);
 
-	g_static_mutex_init (&data_wrapper->priv->stream_lock);
+	g_mutex_init (&data_wrapper->priv->stream_lock);
 	data_wrapper->priv->byte_array = g_byte_array_new ();
 
 	data_wrapper->mime_type = camel_content_type_new (
@@ -679,7 +679,7 @@ camel_data_wrapper_lock (CamelDataWrapper *data_wrapper,
 
 	switch (lock) {
 	case CAMEL_DATA_WRAPPER_STREAM_LOCK:
-		g_static_mutex_lock (&data_wrapper->priv->stream_lock);
+		g_mutex_lock (&data_wrapper->priv->stream_lock);
 		break;
 	default:
 		g_return_if_reached ();
@@ -704,7 +704,7 @@ camel_data_wrapper_unlock (CamelDataWrapper *data_wrapper,
 
 	switch (lock) {
 	case CAMEL_DATA_WRAPPER_STREAM_LOCK:
-		g_static_mutex_unlock (&data_wrapper->priv->stream_lock);
+		g_mutex_unlock (&data_wrapper->priv->stream_lock);
 		break;
 	default:
 		g_return_if_reached ();
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 3ca8b29..1d55884 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -41,10 +41,10 @@
 /* how long to wait before invoking sync on the file */
 #define SYNC_TIMEOUT_SECONDS 5
 
-#define READER_LOCK(cdb) g_static_rw_lock_reader_lock (&cdb->priv->rwlock)
-#define READER_UNLOCK(cdb) g_static_rw_lock_reader_unlock (&cdb->priv->rwlock)
-#define WRITER_LOCK(cdb) g_static_rw_lock_writer_lock (&cdb->priv->rwlock)
-#define WRITER_UNLOCK(cdb) g_static_rw_lock_writer_unlock (&cdb->priv->rwlock)
+#define READER_LOCK(cdb) g_rw_lock_reader_lock (&cdb->priv->rwlock)
+#define READER_UNLOCK(cdb) g_rw_lock_reader_unlock (&cdb->priv->rwlock)
+#define WRITER_LOCK(cdb) g_rw_lock_writer_lock (&cdb->priv->rwlock)
+#define WRITER_UNLOCK(cdb) g_rw_lock_writer_unlock (&cdb->priv->rwlock)
 
 static sqlite3_vfs *old_vfs = NULL;
 static GThreadPool *sync_pool = NULL;
@@ -52,7 +52,7 @@ static GThreadPool *sync_pool = NULL;
 typedef struct {
 	sqlite3_file parent;
 	sqlite3_file *old_vfs_file; /* pointer to old_vfs' file */
-	GStaticRecMutex sync_mutex;
+	GRecMutex sync_mutex;
 	guint timeout_id;
 	gint flags;
 } CamelSqlite3File;
@@ -69,8 +69,8 @@ call_old_file_Sync (CamelSqlite3File *cFile,
 }
 
 typedef struct {
-	GCond *cond;
-	GMutex *mutex;
+	GCond cond;
+	GMutex mutex;
 	gboolean is_set;
 } SyncDone;
 
@@ -97,10 +97,10 @@ sync_request_thread_cb (gpointer task_data,
 	g_free (sync_data);
 
 	if (done != NULL) {
-		g_mutex_lock (done->mutex);
+		g_mutex_lock (&done->mutex);
 		done->is_set = TRUE;
-		g_cond_broadcast (done->cond);
-		g_mutex_unlock (done->mutex);
+		g_cond_broadcast (&done->cond);
+		g_mutex_unlock (&done->mutex);
 	}
 }
 
@@ -115,12 +115,12 @@ sync_push_request (CamelSqlite3File *cFile,
 	g_return_if_fail (cFile != NULL);
 	g_return_if_fail (sync_pool != NULL);
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	if (wait_for_finish) {
 		done = g_slice_new (SyncDone);
-		done->cond = g_cond_new ();
-		done->mutex = g_mutex_new ();
+		g_cond_init (&done->cond);
+		g_mutex_init (&done->mutex);
 		done->is_set = FALSE;
 	}
 
@@ -131,7 +131,7 @@ sync_push_request (CamelSqlite3File *cFile,
 
 	cFile->flags = 0;
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	g_thread_pool_push (sync_pool, data, &error);
 
@@ -140,8 +140,8 @@ sync_push_request (CamelSqlite3File *cFile,
 		g_error_free (error);
 
 		if (done != NULL) {
-			g_cond_free (done->cond);
-			g_mutex_free (done->mutex);
+			g_cond_clear (&done->cond);
+			g_mutex_clear (&done->mutex);
 			g_slice_free (SyncDone, done);
 		}
 
@@ -149,13 +149,13 @@ sync_push_request (CamelSqlite3File *cFile,
 	}
 
 	if (done != NULL) {
-		g_mutex_lock (done->mutex);
+		g_mutex_lock (&done->mutex);
 		while (!done->is_set)
-			g_cond_wait (done->cond, done->mutex);
-		g_mutex_unlock (done->mutex);
+			g_cond_wait (&done->cond, &done->mutex);
+		g_mutex_unlock (&done->mutex);
 
-		g_cond_free (done->cond);
-		g_mutex_free (done->mutex);
+		g_cond_clear (&done->cond);
+		g_mutex_clear (&done->mutex);
 		g_slice_free (SyncDone, done);
 	}
 }
@@ -163,14 +163,14 @@ sync_push_request (CamelSqlite3File *cFile,
 static gboolean
 sync_push_request_timeout (CamelSqlite3File *cFile)
 {
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	if (cFile->timeout_id != 0) {
 		sync_push_request (cFile, FALSE);
 		cFile->timeout_id = 0;
 	}
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	return FALSE;
 }
@@ -231,7 +231,7 @@ camel_sqlite3_file_xClose (sqlite3_file *pFile)
 
 	cFile = (CamelSqlite3File *) pFile;
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	/* Cancel any pending sync requests. */
 	if (cFile->timeout_id > 0) {
@@ -239,7 +239,7 @@ camel_sqlite3_file_xClose (sqlite3_file *pFile)
 		cFile->timeout_id = 0;
 	}
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	/* Make the last sync. */
 	sync_push_request (cFile, TRUE);
@@ -252,7 +252,7 @@ camel_sqlite3_file_xClose (sqlite3_file *pFile)
 	g_free (cFile->old_vfs_file);
 	cFile->old_vfs_file = NULL;
 
-	g_static_rec_mutex_free (&cFile->sync_mutex);
+	g_rec_mutex_clear (&cFile->sync_mutex);
 
 	return res;
 }
@@ -268,7 +268,7 @@ camel_sqlite3_file_xSync (sqlite3_file *pFile,
 
 	cFile = (CamelSqlite3File *) pFile;
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	/* If a sync request is already scheduled, accumulate flags. */
 	cFile->flags |= flags;
@@ -282,7 +282,7 @@ camel_sqlite3_file_xSync (sqlite3_file *pFile,
 		SYNC_TIMEOUT_SECONDS, (GSourceFunc)
 		sync_push_request_timeout, cFile);
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	return SQLITE_OK;
 }
@@ -294,7 +294,7 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
                          gint flags,
                          gint *pOutFlags)
 {
-	static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
+	static GRecMutex only_once_lock;
 	static sqlite3_io_methods io_methods = {0};
 	CamelSqlite3File *cFile;
 	gint res;
@@ -311,9 +311,9 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
 		return res;
 	}
 
-	g_static_rec_mutex_init (&cFile->sync_mutex);
+	g_rec_mutex_init (&cFile->sync_mutex);
 
-	g_static_rec_mutex_lock (&only_once_lock);
+	g_rec_mutex_lock (&only_once_lock);
 
 	if (!sync_pool)
 		sync_pool = g_thread_pool_new (sync_request_thread_cb, NULL, 2, FALSE, NULL);
@@ -346,7 +346,7 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
 		#undef use_subclassed
 	}
 
-	g_static_rec_mutex_unlock (&only_once_lock);
+	g_rec_mutex_unlock (&only_once_lock);
 
 	cFile->parent.pMethods = &io_methods;
 
@@ -380,7 +380,7 @@ init_sqlite_vfs (void)
 
 struct _CamelDBPrivate {
 	GTimer *timer;
-	GStaticRWLock rwlock;
+	GRWLock rwlock;
 	gchar *file_name;
 	gboolean transaction_is_on;
 };
@@ -517,7 +517,7 @@ camel_db_open (const gchar *path,
 	cdb->db = db;
 	cdb->priv = g_new (CamelDBPrivate, 1);
 	cdb->priv->file_name = g_strdup (path);
-	g_static_rw_lock_init (&cdb->priv->rwlock);
+	g_rw_lock_init (&cdb->priv->rwlock);
 	cdb->priv->timer = NULL;
 	d (g_print ("\nDatabase succesfully opened  \n"));
 
@@ -567,7 +567,7 @@ camel_db_close (CamelDB *cdb)
 {
 	if (cdb) {
 		sqlite3_close (cdb->db);
-		g_static_rw_lock_free (&cdb->priv->rwlock);
+		g_rw_lock_clear (&cdb->priv->rwlock);
 		g_free (cdb->priv->file_name);
 		g_free (cdb->priv);
 		g_free (cdb);
diff --git a/camel/camel-debug.c b/camel/camel-debug.c
index 47e80e1..cbcd77a 100644
--- a/camel/camel-debug.c
+++ b/camel/camel-debug.c
@@ -122,7 +122,7 @@ gboolean camel_debug (const gchar *mode)
 	return FALSE;
 }
 
-static GStaticMutex debug_lock = G_STATIC_MUTEX_INIT;
+static GMutex debug_lock;
 /**
  * camel_debug_start:
  * @mode:
@@ -137,7 +137,7 @@ gboolean
 camel_debug_start (const gchar *mode)
 {
 	if (camel_debug (mode)) {
-		g_static_mutex_lock (&debug_lock);
+		g_mutex_lock (&debug_lock);
 		printf ("Thread %p >\n", g_thread_self ());
 		return TRUE;
 	}
@@ -155,7 +155,7 @@ void
 camel_debug_end (void)
 {
 	printf ("< %p >\n", g_thread_self ());
-	g_static_mutex_unlock (&debug_lock);
+	g_mutex_unlock (&debug_lock);
 }
 
 #if 0
@@ -409,18 +409,18 @@ dwfl_get (gboolean reload)
 	static gchar *debuginfo_path = NULL;
 	static Dwfl *dwfl = NULL;
 	static gboolean checked_for_dwfl = FALSE;
-	static GStaticMutex dwfl_mutex = G_STATIC_MUTEX_INIT;
+	static GMutex dwfl_mutex;
 	static const Dwfl_Callbacks proc_callbacks = {
 		.find_debuginfo = dwfl_standard_find_debuginfo,
 		.debuginfo_path = &debuginfo_path,
 		.find_elf = dwfl_linux_proc_find_elf
 	};
 
-	g_static_mutex_lock (&dwfl_mutex);
+	g_mutex_lock (&dwfl_mutex);
 
 	if (checked_for_dwfl) {
 		if (!reload) {
-			g_static_mutex_unlock (&dwfl_mutex);
+			g_mutex_unlock (&dwfl_mutex);
 			return dwfl;
 		}
 
@@ -432,7 +432,7 @@ dwfl_get (gboolean reload)
 
 	dwfl = dwfl_begin (&proc_callbacks);
 	if (!dwfl) {
-		g_static_mutex_unlock (&dwfl_mutex);
+		g_mutex_unlock (&dwfl_mutex);
 		return NULL;
 	}
 
@@ -442,7 +442,7 @@ dwfl_get (gboolean reload)
 		dwfl = NULL;
 	}
 
-	g_static_mutex_unlock (&dwfl_mutex);
+	g_mutex_unlock (&dwfl_mutex);
 
 	return dwfl;
 }
@@ -612,7 +612,7 @@ camel_pointer_tracker_track_with_info (gpointer ptr,
 	G_LOCK (ptr_tracker);
 	if (!ptr_tracker) {
 		ptr_tracker = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, free_pt_data);
-		g_atexit (dump_left_at_exit_cb);
+		atexit (dump_left_at_exit_cb);
 	}
 
 	ptd = g_new0 (struct pt_data, 1);
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 34e59ba..455289c 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -80,11 +80,11 @@ struct _CamelFolderSummaryPrivate {
 
 	struct _CamelIndex *index;
 
-	GStaticRecMutex summary_lock;	/* for the summary hashtable/array */
-	GStaticRecMutex io_lock;	/* load/save lock, for access to saved_count, etc */
-	GStaticRecMutex filter_lock;	/* for accessing any of the filtering/indexing stuff, since we share them */
-	GStaticRecMutex alloc_lock;	/* for setting up and using allocators */
-	GStaticRecMutex ref_lock;	/* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
+	GRecMutex summary_lock;	/* for the summary hashtable/array */
+	GRecMutex io_lock;	/* load/save lock, for access to saved_count, etc */
+	GRecMutex filter_lock;	/* for accessing any of the filtering/indexing stuff, since we share them */
+	GRecMutex alloc_lock;	/* for setting up and using allocators */
+	GRecMutex ref_lock;	/* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
 
 	gboolean need_preview;
 	GHashTable *preview_updates;
@@ -107,11 +107,11 @@ struct _CamelFolderSummaryPrivate {
 	guint timeout_handle;
 };
 
-static GStaticMutex info_lock = G_STATIC_MUTEX_INIT;
+static GMutex info_lock;
 
 /* this lock is ONLY for the standalone messageinfo stuff */
-#define GLOBAL_INFO_LOCK(i) g_static_mutex_lock(&info_lock)
-#define GLOBAL_INFO_UNLOCK(i) g_static_mutex_unlock(&info_lock)
+#define GLOBAL_INFO_LOCK(i) g_mutex_lock(&info_lock)
+#define GLOBAL_INFO_UNLOCK(i) g_mutex_unlock(&info_lock)
 
 /* this should probably be conditional on it existing */
 #define USE_BSEARCH
@@ -285,11 +285,11 @@ folder_summary_finalize (GObject *object)
 
 	g_hash_table_destroy (priv->preview_updates);
 
-	g_static_rec_mutex_free (&priv->summary_lock);
-	g_static_rec_mutex_free (&priv->io_lock);
-	g_static_rec_mutex_free (&priv->filter_lock);
-	g_static_rec_mutex_free (&priv->alloc_lock);
-	g_static_rec_mutex_free (&priv->ref_lock);
+	g_rec_mutex_clear (&priv->summary_lock);
+	g_rec_mutex_clear (&priv->io_lock);
+	g_rec_mutex_clear (&priv->filter_lock);
+	g_rec_mutex_clear (&priv->alloc_lock);
+	g_rec_mutex_clear (&priv->ref_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_folder_summary_parent_class)->finalize (object);
@@ -1379,11 +1379,11 @@ camel_folder_summary_init (CamelFolderSummary *summary)
 	summary->priv->uids = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) camel_pstring_free, NULL);
 	summary->priv->loaded_infos = g_hash_table_new (g_str_hash, g_str_equal);
 
-	g_static_rec_mutex_init (&summary->priv->summary_lock);
-	g_static_rec_mutex_init (&summary->priv->io_lock);
-	g_static_rec_mutex_init (&summary->priv->filter_lock);
-	g_static_rec_mutex_init (&summary->priv->alloc_lock);
-	g_static_rec_mutex_init (&summary->priv->ref_lock);
+	g_rec_mutex_init (&summary->priv->summary_lock);
+	g_rec_mutex_init (&summary->priv->io_lock);
+	g_rec_mutex_init (&summary->priv->filter_lock);
+	g_rec_mutex_init (&summary->priv->alloc_lock);
+	g_rec_mutex_init (&summary->priv->ref_lock);
 
 	summary->priv->cache_load_time = 0;
 	summary->priv->timeout_handle = 0;
@@ -4946,19 +4946,19 @@ camel_folder_summary_lock (CamelFolderSummary *summary,
 
 	switch (lock) {
 		case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->summary_lock);
+			g_rec_mutex_lock (&summary->priv->summary_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_IO_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->io_lock);
+			g_rec_mutex_lock (&summary->priv->io_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_FILTER_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->filter_lock);
+			g_rec_mutex_lock (&summary->priv->filter_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_ALLOC_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->alloc_lock);
+			g_rec_mutex_lock (&summary->priv->alloc_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_REF_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->ref_lock);
+			g_rec_mutex_lock (&summary->priv->ref_lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -4982,19 +4982,19 @@ camel_folder_summary_unlock (CamelFolderSummary *summary,
 
 	switch (lock) {
 		case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->summary_lock);
+			g_rec_mutex_unlock (&summary->priv->summary_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_IO_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->io_lock);
+			g_rec_mutex_unlock (&summary->priv->io_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_FILTER_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->filter_lock);
+			g_rec_mutex_unlock (&summary->priv->filter_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_ALLOC_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->alloc_lock);
+			g_rec_mutex_unlock (&summary->priv->alloc_lock);
 			break;
 		case CAMEL_FOLDER_SUMMARY_REF_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->ref_lock);
+			g_rec_mutex_unlock (&summary->priv->ref_lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index a262b02..a9bd5cd 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -54,8 +54,8 @@ typedef struct _SignalData SignalData;
 typedef struct _FolderFilterData FolderFilterData;
 
 struct _CamelFolderPrivate {
-	GStaticRecMutex lock;
-	GStaticMutex change_lock;
+	GRecMutex lock;
+	GMutex change_lock;
 	/* must require the 'change_lock' to access this */
 	gint frozen;
 	CamelFolderChangeInfo *changed_frozen; /* queues changed events */
@@ -579,8 +579,8 @@ folder_finalize (GObject *object)
 	if (priv->pending_changes != NULL)
 		camel_folder_change_info_free (priv->pending_changes);
 
-	g_static_rec_mutex_free (&priv->lock);
-	g_static_mutex_free (&priv->change_lock);
+	g_rec_mutex_clear (&priv->lock);
+	g_mutex_clear (&priv->change_lock);
 
 	/* Chain up to parent's finalize () method. */
 	G_OBJECT_CLASS (camel_folder_parent_class)->finalize (object);
@@ -1913,8 +1913,8 @@ camel_folder_init (CamelFolder *folder)
 	folder->priv->frozen = 0;
 	folder->priv->changed_frozen = camel_folder_change_info_new ();
 
-	g_static_rec_mutex_init (&folder->priv->lock);
-	g_static_mutex_init (&folder->priv->change_lock);
+	g_rec_mutex_init (&folder->priv->lock);
+	g_mutex_init (&folder->priv->change_lock);
 }
 
 GQuark
@@ -3169,11 +3169,11 @@ camel_folder_lock (CamelFolder *folder,
 
 	switch (lock) {
 		case CAMEL_FOLDER_CHANGE_LOCK:
-			g_static_mutex_lock (&folder->priv->change_lock);
+			g_mutex_lock (&folder->priv->change_lock);
 			break;
 		case CAMEL_FOLDER_REC_LOCK:
 			if (folder->priv->skip_folder_lock == FALSE)
-				g_static_rec_mutex_lock (&folder->priv->lock);
+				g_rec_mutex_lock (&folder->priv->lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -3197,11 +3197,11 @@ camel_folder_unlock (CamelFolder *folder,
 
 	switch (lock) {
 		case CAMEL_FOLDER_CHANGE_LOCK:
-			g_static_mutex_unlock (&folder->priv->change_lock);
+			g_mutex_unlock (&folder->priv->change_lock);
 			break;
 		case CAMEL_FOLDER_REC_LOCK:
 			if (folder->priv->skip_folder_lock == FALSE)
-				g_static_rec_mutex_unlock (&folder->priv->lock);
+				g_rec_mutex_unlock (&folder->priv->lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-imapx-command.c b/camel/camel-imapx-command.c
index b866412..de1de70 100644
--- a/camel/camel-imapx-command.c
+++ b/camel/camel-imapx-command.c
@@ -43,8 +43,8 @@ struct _CamelIMAPXRealCommand {
 	GString *buffer;
 
 	/* Used for running some commands synchronously. */
-	GCond *done_sync_cond;
-	GMutex *done_sync_mutex;
+	GCond done_sync_cond;
+	GMutex done_sync_mutex;
 	gboolean done_sync_flag;
 };
 
@@ -69,8 +69,8 @@ camel_imapx_command_new (CamelIMAPXServer *is,
 	/* Initialize private bits. */
 	real_ic->ref_count = 1;
 	real_ic->buffer = g_string_sized_new (512);
-	real_ic->done_sync_cond = g_cond_new ();
-	real_ic->done_sync_mutex = g_mutex_new ();
+	g_cond_init (&real_ic->done_sync_cond);
+	g_mutex_init (&real_ic->done_sync_mutex);
 
 	/* Initialize public bits. */
 	real_ic->public.is = is;
@@ -141,8 +141,8 @@ camel_imapx_command_unref (CamelIMAPXCommand *ic)
 
 		g_string_free (real_ic->buffer, TRUE);
 
-		g_cond_free (real_ic->done_sync_cond);
-		g_mutex_free (real_ic->done_sync_mutex);
+		g_cond_clear (&real_ic->done_sync_cond);
+		g_mutex_clear (&real_ic->done_sync_mutex);
 
 		/* Do NOT try to free the GError.  If set it should have been
 		 * propagated to the CamelIMAPXJob, so it's either NULL or the
@@ -554,12 +554,12 @@ camel_imapx_command_wait (CamelIMAPXCommand *ic)
 
 	real_ic = (CamelIMAPXRealCommand *) ic;
 
-	g_mutex_lock (real_ic->done_sync_mutex);
+	g_mutex_lock (&real_ic->done_sync_mutex);
 	while (!real_ic->done_sync_flag)
 		g_cond_wait (
-			real_ic->done_sync_cond,
-			real_ic->done_sync_mutex);
-	g_mutex_unlock (real_ic->done_sync_mutex);
+			&real_ic->done_sync_cond,
+			&real_ic->done_sync_mutex);
+	g_mutex_unlock (&real_ic->done_sync_mutex);
 }
 
 void
@@ -571,10 +571,10 @@ camel_imapx_command_done (CamelIMAPXCommand *ic)
 
 	real_ic = (CamelIMAPXRealCommand *) ic;
 
-	g_mutex_lock (real_ic->done_sync_mutex);
+	g_mutex_lock (&real_ic->done_sync_mutex);
 	real_ic->done_sync_flag = TRUE;
-	g_cond_broadcast (real_ic->done_sync_cond);
-	g_mutex_unlock (real_ic->done_sync_mutex);
+	g_cond_broadcast (&real_ic->done_sync_cond);
+	g_mutex_unlock (&real_ic->done_sync_mutex);
 }
 
 gboolean
diff --git a/camel/camel-imapx-conn-manager.c b/camel/camel-imapx-conn-manager.c
index 7a75a87..6f2934f 100644
--- a/camel/camel-imapx-conn-manager.c
+++ b/camel/camel-imapx-conn-manager.c
@@ -27,13 +27,13 @@
 #define c(...) camel_imapx_debug(conman, __VA_ARGS__)
 
 #define CON_READ_LOCK(x) \
-	(g_static_rw_lock_reader_lock (&(x)->priv->rw_lock))
+	(g_rw_lock_reader_lock (&(x)->priv->rw_lock))
 #define CON_READ_UNLOCK(x) \
-	(g_static_rw_lock_reader_unlock (&(x)->priv->rw_lock))
+	(g_rw_lock_reader_unlock (&(x)->priv->rw_lock))
 #define CON_WRITE_LOCK(x) \
-	(g_static_rw_lock_writer_lock (&(x)->priv->rw_lock))
+	(g_rw_lock_writer_lock (&(x)->priv->rw_lock))
 #define CON_WRITE_UNLOCK(x) \
-	(g_static_rw_lock_writer_unlock (&(x)->priv->rw_lock))
+	(g_rw_lock_writer_unlock (&(x)->priv->rw_lock))
 
 #define CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -46,11 +46,11 @@ struct _CamelIMAPXConnManagerPrivate {
 	 *     with CamelIMAPXServer pointers as the keys. */
 	GList *connections;
 	gpointer store;  /* weak pointer */
-	GStaticRWLock rw_lock;
+	GRWLock rw_lock;
 };
 
 struct _ConnectionInfo {
-	GMutex *lock;
+	GMutex lock;
 	CamelIMAPXServer *is;
 	GHashTable *folder_names;
 	gchar *selected_folder;
@@ -88,7 +88,7 @@ connection_info_new (CamelIMAPXServer *is)
 		(GDestroyNotify) NULL);
 
 	cinfo = g_slice_new0 (ConnectionInfo);
-	cinfo->lock = g_mutex_new ();
+	g_mutex_init (&cinfo->lock);
 	cinfo->is = g_object_ref (is);
 	cinfo->folder_names = folder_names;
 	cinfo->ref_count = 1;
@@ -115,7 +115,7 @@ connection_info_unref (ConnectionInfo *cinfo)
 
 	if (g_atomic_int_dec_and_test (&cinfo->ref_count)) {
 		camel_imapx_server_connect (cinfo->is, NULL, NULL);
-		g_mutex_free (cinfo->lock);
+		g_mutex_clear (&cinfo->lock);
 		g_object_unref (cinfo->is);
 		g_hash_table_destroy (cinfo->folder_names);
 		g_free (cinfo->selected_folder);
@@ -143,12 +143,12 @@ connection_info_is_available (ConnectionInfo *cinfo)
 
 	g_return_val_if_fail (cinfo != NULL, FALSE);
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	/* Available means it's not tracking any folder names. */
 	available = (g_hash_table_size (cinfo->folder_names) == 0);
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 
 	return available;
 }
@@ -164,11 +164,11 @@ connection_info_has_folder_name (ConnectionInfo *cinfo,
 	if (folder_name == NULL)
 		return FALSE;
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	value = g_hash_table_lookup (cinfo->folder_names, folder_name);
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 
 	return (value != NULL);
 }
@@ -180,14 +180,14 @@ connection_info_insert_folder_name (ConnectionInfo *cinfo,
 	g_return_if_fail (cinfo != NULL);
 	g_return_if_fail (folder_name != NULL);
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	g_hash_table_insert (
 		cinfo->folder_names,
 		g_strdup (folder_name),
 		GINT_TO_POINTER (1));
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 }
 
 static void
@@ -197,11 +197,11 @@ connection_info_remove_folder_name (ConnectionInfo *cinfo,
 	g_return_if_fail (cinfo != NULL);
 	g_return_if_fail (folder_name != NULL);
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	g_hash_table_remove (cinfo->folder_names, folder_name);
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 }
 
 static gchar *
@@ -211,11 +211,11 @@ connection_info_dup_selected_folder (ConnectionInfo *cinfo)
 
 	g_return_val_if_fail (cinfo != NULL, NULL);
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	selected_folder = g_strdup (cinfo->selected_folder);
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 
 	return selected_folder;
 }
@@ -226,12 +226,12 @@ connection_info_set_selected_folder (ConnectionInfo *cinfo,
 {
 	g_return_if_fail (cinfo != NULL);
 
-	g_mutex_lock (cinfo->lock);
+	g_mutex_lock (&cinfo->lock);
 
 	g_free (cinfo->selected_folder);
 	cinfo->selected_folder = g_strdup (selected_folder);
 
-	g_mutex_unlock (cinfo->lock);
+	g_mutex_unlock (&cinfo->lock);
 }
 
 static GList *
@@ -384,7 +384,7 @@ imapx_conn_manager_finalize (GObject *object)
 
 	priv = CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE (object);
 
-	g_static_rw_lock_free (&priv->rw_lock);
+	g_rw_lock_clear (&priv->rw_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_imapx_conn_manager_parent_class)->finalize (object);
@@ -421,7 +421,7 @@ camel_imapx_conn_manager_init (CamelIMAPXConnManager *con_man)
 {
 	con_man->priv = CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE (con_man);
 
-	g_static_rw_lock_init (&con_man->priv->rw_lock);
+	g_rw_lock_init (&con_man->priv->rw_lock);
 }
 
 /* Static functions go here */
diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c
index c4d45fb..b9bc966 100644
--- a/camel/camel-imapx-folder.c
+++ b/camel/camel-imapx-folder.c
@@ -120,8 +120,8 @@ camel_imapx_folder_new (CamelStore *store,
 	camel_object_state_read (CAMEL_OBJECT (folder));
 
 	ifolder->search = camel_folder_search_new ();
-	ifolder->search_lock = g_mutex_new ();
-	ifolder->stream_lock = g_mutex_new ();
+	g_mutex_init (&ifolder->search_lock);
+	g_mutex_init (&ifolder->stream_lock);
 	ifolder->ignore_recent = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
 	ifolder->exists_on_server = 0;
 	ifolder->unread_on_server = 0;
@@ -241,8 +241,8 @@ imapx_folder_finalize (GObject *object)
 	if (folder->ignore_recent != NULL)
 		g_hash_table_unref (folder->ignore_recent);
 
-	g_mutex_free (folder->search_lock);
-	g_mutex_free (folder->stream_lock);
+	g_mutex_clear (&folder->search_lock);
+	g_mutex_clear (&folder->stream_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_imapx_folder_parent_class)->finalize (object);
@@ -322,11 +322,11 @@ imapx_search_free (CamelFolder *folder,
 
 	g_return_if_fail (ifolder->search);
 
-	g_mutex_lock (ifolder->search_lock);
+	g_mutex_lock (&ifolder->search_lock);
 
 	camel_folder_search_free_result (ifolder->search, uids);
 
-	g_mutex_unlock (ifolder->search_lock);
+	g_mutex_unlock (&ifolder->search_lock);
 }
 
 static GPtrArray *
@@ -342,12 +342,12 @@ imapx_search_by_uids (CamelFolder *folder,
 	if (uids->len == 0)
 		return g_ptr_array_new ();
 
-	g_mutex_lock (ifolder->search_lock);
+	g_mutex_lock (&ifolder->search_lock);
 
 	camel_folder_search_set_folder (ifolder->search, folder);
 	matches = camel_folder_search_search (ifolder->search, expression, uids, cancellable, error);
 
-	g_mutex_unlock (ifolder->search_lock);
+	g_mutex_unlock (&ifolder->search_lock);
 
 	return matches;
 }
@@ -361,12 +361,12 @@ imapx_count_by_expression (CamelFolder *folder,
 	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
 	guint32 matches;
 
-	g_mutex_lock (ifolder->search_lock);
+	g_mutex_lock (&ifolder->search_lock);
 
 	camel_folder_search_set_folder (ifolder->search, folder);
 	matches = camel_folder_search_count (ifolder->search, expression, cancellable, error);
 
-	g_mutex_unlock (ifolder->search_lock);
+	g_mutex_unlock (&ifolder->search_lock);
 
 	return matches;
 }
@@ -380,12 +380,12 @@ imapx_search_by_expression (CamelFolder *folder,
 	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
 	GPtrArray *matches;
 
-	g_mutex_lock (ifolder->search_lock);
+	g_mutex_lock (&ifolder->search_lock);
 
 	camel_folder_search_set_folder (ifolder->search, folder);
 	matches = camel_folder_search_search (ifolder->search, expression, NULL, cancellable, error);
 
-	g_mutex_unlock (ifolder->search_lock);
+	g_mutex_unlock (&ifolder->search_lock);
 
 	return matches;
 }
@@ -551,13 +551,13 @@ imapx_get_message_sync (CamelFolder *folder,
 	if (stream != NULL) {
 		msg = camel_mime_message_new ();
 
-		g_mutex_lock (ifolder->stream_lock);
+		g_mutex_lock (&ifolder->stream_lock);
 		if (!camel_data_wrapper_construct_from_stream_sync (
 			(CamelDataWrapper *) msg, stream, cancellable, error)) {
 			g_object_unref (msg);
 			msg = NULL;
 		}
-		g_mutex_unlock (ifolder->stream_lock);
+		g_mutex_unlock (&ifolder->stream_lock);
 		g_object_unref (stream);
 
 		if (msg) {
diff --git a/camel/camel-imapx-folder.h b/camel/camel-imapx-folder.h
index 16c187b..0b9c0d2 100644
--- a/camel/camel-imapx-folder.h
+++ b/camel/camel-imapx-folder.h
@@ -73,8 +73,8 @@ struct _CamelIMAPXFolder {
 	/* hash table of UIDs to ignore as recent when updating folder */
 	GHashTable *ignore_recent;
 
-	GMutex *search_lock;
-	GMutex *stream_lock;
+	GMutex search_lock;
+	GMutex stream_lock;
 
 	gboolean apply_filters;		/* persistent property */
 };
diff --git a/camel/camel-imapx-job.c b/camel/camel-imapx-job.c
index 18c7136..03e8ef5 100644
--- a/camel/camel-imapx-job.c
+++ b/camel/camel-imapx-job.c
@@ -31,8 +31,8 @@ struct _CamelIMAPXRealJob {
 	GCancellable *cancellable;
 
 	/* Used for running some jobs synchronously. */
-	GCond *done_cond;
-	GMutex *done_mutex;
+	GCond done_cond;
+	GMutex done_mutex;
 	gboolean done_flag;
 
 	/* Extra job-specific data. */
@@ -61,8 +61,8 @@ camel_imapx_job_new (GCancellable *cancellable)
 
 	/* Initialize private bits. */
 	real_job->ref_count = 1;
-	real_job->done_cond = g_cond_new ();
-	real_job->done_mutex = g_mutex_new ();
+	g_cond_init (&real_job->done_cond);
+	g_mutex_init (&real_job->done_mutex);
 
 	if (cancellable != NULL)
 		g_object_ref (cancellable);
@@ -106,8 +106,8 @@ camel_imapx_job_unref (CamelIMAPXJob *job)
 
 		/* Free the private stuff. */
 
-		g_cond_free (real_job->done_cond);
-		g_mutex_free (real_job->done_mutex);
+		g_cond_clear (&real_job->done_cond);
+		g_mutex_clear (&real_job->done_mutex);
 
 		if (real_job->destroy_data != NULL)
 			real_job->destroy_data (real_job->data);
@@ -156,12 +156,12 @@ camel_imapx_job_wait (CamelIMAPXJob *job)
 
 	real_job = (CamelIMAPXRealJob *) job;
 
-	g_mutex_lock (real_job->done_mutex);
+	g_mutex_lock (&real_job->done_mutex);
 	while (!real_job->done_flag)
 		g_cond_wait (
-			real_job->done_cond,
-			real_job->done_mutex);
-	g_mutex_unlock (real_job->done_mutex);
+			&real_job->done_cond,
+			&real_job->done_mutex);
+	g_mutex_unlock (&real_job->done_mutex);
 }
 
 void
@@ -173,10 +173,10 @@ camel_imapx_job_done (CamelIMAPXJob *job)
 
 	real_job = (CamelIMAPXRealJob *) job;
 
-	g_mutex_lock (real_job->done_mutex);
+	g_mutex_lock (&real_job->done_mutex);
 	real_job->done_flag = TRUE;
-	g_cond_broadcast (real_job->done_cond);
-	g_mutex_unlock (real_job->done_mutex);
+	g_cond_broadcast (&real_job->done_cond);
+	g_mutex_unlock (&real_job->done_mutex);
 }
 
 gboolean
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 0e46105..488c702 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -59,11 +59,11 @@
 
 #define CIF(x) ((CamelIMAPXFolder *)x)
 
-#define QUEUE_LOCK(x) (g_static_rec_mutex_lock(&(x)->queue_lock))
-#define QUEUE_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->queue_lock))
+#define QUEUE_LOCK(x) (g_rec_mutex_lock(&(x)->queue_lock))
+#define QUEUE_UNLOCK(x) (g_rec_mutex_unlock(&(x)->queue_lock))
 
-#define IDLE_LOCK(x) (g_mutex_lock((x)->idle_lock))
-#define IDLE_UNLOCK(x) (g_mutex_unlock((x)->idle_lock))
+#define IDLE_LOCK(x) (g_mutex_lock(&(x)->idle_lock))
+#define IDLE_UNLOCK(x) (g_mutex_unlock(&(x)->idle_lock))
 
 /* Try pipelining fetch requests, 'in bits' */
 #define MULTI_SIZE (20480)
@@ -441,11 +441,11 @@ enum _idle_state {
 				     queued, before actually sending IDLE */
 
 struct _CamelIMAPXIdle {
-	GMutex *idle_lock;
+	GMutex idle_lock;
 	GThread *idle_thread;
 
-	GCond *start_watch_cond;
-	GMutex *start_watch_mutex;
+	GCond start_watch_cond;
+	GMutex start_watch_mutex;
 	gboolean start_watch_is_set;
 
 	time_t started;
@@ -2850,9 +2850,9 @@ imapx_idle_thread (gpointer data)
 	while (TRUE) {
 		CamelIMAPXFolder *ifolder;
 
-		g_mutex_lock (is->idle->start_watch_mutex);
+		g_mutex_lock (&is->idle->start_watch_mutex);
 		is->idle->start_watch_is_set = FALSE;
-		g_mutex_unlock (is->idle->start_watch_mutex);
+		g_mutex_unlock (&is->idle->start_watch_mutex);
 
 		IDLE_LOCK (is->idle);
 		while ((ifolder = (CamelIMAPXFolder *) is->select_folder) &&
@@ -2883,12 +2883,12 @@ imapx_idle_thread (gpointer data)
 		}
 		IDLE_UNLOCK (is->idle);
 
-		g_mutex_lock (is->idle->start_watch_mutex);
+		g_mutex_lock (&is->idle->start_watch_mutex);
 		while (!is->idle->start_watch_is_set)
 			g_cond_wait (
-				is->idle->start_watch_cond,
-				is->idle->start_watch_mutex);
-		g_mutex_unlock (is->idle->start_watch_mutex);
+				&is->idle->start_watch_cond,
+				&is->idle->start_watch_mutex);
+		g_mutex_unlock (&is->idle->start_watch_mutex);
 
 		if (is->idle->idle_exit)
 			break;
@@ -2956,7 +2956,7 @@ static void
 imapx_init_idle (CamelIMAPXServer *is)
 {
 	is->idle = g_new0 (CamelIMAPXIdle, 1);
-	is->idle->idle_lock = g_mutex_new ();
+	g_mutex_init (&is->idle->idle_lock);
 }
 
 static void
@@ -2973,13 +2973,13 @@ imapx_exit_idle (CamelIMAPXServer *is)
 	if (idle->idle_thread) {
 		idle->idle_exit = TRUE;
 
-		g_mutex_lock (idle->start_watch_mutex);
+		g_mutex_lock (&idle->start_watch_mutex);
 		idle->start_watch_is_set = TRUE;
-		g_cond_broadcast (idle->start_watch_cond);
-		g_mutex_unlock (idle->start_watch_mutex);
+		g_cond_broadcast (&idle->start_watch_cond);
+		g_mutex_unlock (&idle->start_watch_mutex);
 
 		thread = idle->idle_thread;
-		idle->idle_thread = 0;
+		idle->idle_thread = NULL;
 	}
 
 	idle->idle_thread = NULL;
@@ -2988,13 +2988,9 @@ imapx_exit_idle (CamelIMAPXServer *is)
 	if (thread)
 		g_thread_join (thread);
 
-	g_mutex_free (idle->idle_lock);
-
-	if (idle->start_watch_cond != NULL)
-		g_cond_free (idle->start_watch_cond);
-
-	if (idle->start_watch_mutex != NULL)
-		g_mutex_free (idle->start_watch_mutex);
+	g_mutex_clear (&idle->idle_lock);
+	g_cond_clear (&idle->start_watch_cond);
+	g_mutex_clear (&idle->start_watch_mutex);
 
 	g_free (is->idle);
 	is->idle = NULL;
@@ -3015,17 +3011,17 @@ imapx_start_idle (CamelIMAPXServer *is)
 	idle->state = IMAPX_IDLE_PENDING;
 
 	if (!idle->idle_thread) {
-		idle->start_watch_cond = g_cond_new ();
-		idle->start_watch_mutex = g_mutex_new ();
+		g_cond_init (&idle->start_watch_cond);
+		g_mutex_init (&idle->start_watch_mutex);
 		idle->start_watch_is_set = FALSE;
 
-		idle->idle_thread = g_thread_create (
-			(GThreadFunc) imapx_idle_thread, is, TRUE, NULL);
+		idle->idle_thread = g_thread_new (NULL,
+			(GThreadFunc) imapx_idle_thread, is);
 	} else {
-		g_mutex_lock (idle->start_watch_mutex);
+		g_mutex_lock (&idle->start_watch_mutex);
 		idle->start_watch_is_set = TRUE;
-		g_cond_broadcast (idle->start_watch_cond);
-		g_mutex_unlock (idle->start_watch_mutex);
+		g_cond_broadcast (&idle->start_watch_cond);
+		g_mutex_unlock (&idle->start_watch_mutex);
 	}
 
 	IDLE_UNLOCK (idle);
@@ -6409,9 +6405,9 @@ imapx_server_finalize (GObject *object)
 	is->active = NULL;
 	is->done = NULL;
 
-	g_static_rec_mutex_free (&is->queue_lock);
-	g_mutex_free (is->fetch_mutex);
-	g_cond_free (is->fetch_cond);
+	g_rec_mutex_clear (&is->queue_lock);
+	g_mutex_clear (&is->fetch_mutex);
+	g_cond_clear (&is->fetch_cond);
 
 	camel_folder_change_info_free (is->changes);
 
@@ -6524,7 +6520,7 @@ camel_imapx_server_init (CamelIMAPXServer *is)
 	/* not used at the moment. Use it in future */
 	is->job_timeout = 29 * 60 * 1000 * 1000;
 
-	g_static_rec_mutex_init (&is->queue_lock);
+	g_rec_mutex_init (&is->queue_lock);
 
 	is->state = IMAPX_DISCONNECTED;
 
@@ -6532,8 +6528,8 @@ camel_imapx_server_init (CamelIMAPXServer *is)
 	is->changes = camel_folder_change_info_new ();
 	is->parser_quit = FALSE;
 
-	is->fetch_mutex = g_mutex_new ();
-	is->fetch_cond = g_cond_new ();
+	g_mutex_init (&is->fetch_mutex);
+	g_cond_init (&is->fetch_cond);
 }
 
 CamelIMAPXServer *
@@ -6645,7 +6641,7 @@ camel_imapx_server_connect (CamelIMAPXServer *is,
 	if (!imapx_reconnect (is, cancellable, error))
 		return FALSE;
 
-	is->parser_thread = g_thread_create ((GThreadFunc) imapx_parser_thread, is, TRUE, NULL);
+	is->parser_thread = g_thread_new (NULL, (GThreadFunc) imapx_parser_thread, is);
 
 	return TRUE;
 }
@@ -6678,15 +6674,15 @@ imapx_server_get_message (CamelIMAPXServer *is,
 		do {
 			gint this;
 
-			g_mutex_lock (is->fetch_mutex);
+			g_mutex_lock (&is->fetch_mutex);
 			this = is->fetch_count;
 
 			QUEUE_UNLOCK (is);
 
 			while (is->fetch_count == this)
-				g_cond_wait (is->fetch_cond, is->fetch_mutex);
+				g_cond_wait (&is->fetch_cond, &is->fetch_mutex);
 
-			g_mutex_unlock (is->fetch_mutex);
+			g_mutex_unlock (&is->fetch_mutex);
 
 			QUEUE_LOCK (is);
 
@@ -6743,10 +6739,10 @@ imapx_server_get_message (CamelIMAPXServer *is,
 
 	camel_imapx_job_unref (job);
 
-	g_mutex_lock (is->fetch_mutex);
+	g_mutex_lock (&is->fetch_mutex);
 	is->fetch_count++;
-	g_cond_broadcast (is->fetch_cond);
-	g_mutex_unlock (is->fetch_mutex);
+	g_cond_broadcast (&is->fetch_cond);
+	g_mutex_unlock (&is->fetch_mutex);
 
 	return stream;
 }
diff --git a/camel/camel-imapx-server.h b/camel/camel-imapx-server.h
index 5d68e81..02cc44a 100644
--- a/camel/camel-imapx-server.h
+++ b/camel/camel-imapx-server.h
@@ -125,7 +125,7 @@ struct _CamelIMAPXServer {
 
 	/* Current command/work queue.  All commands are stored in one list,
 	 * all the time, so they can be cleaned up in exception cases */
-	GStaticRecMutex queue_lock;
+	GRecMutex queue_lock;
 	CamelIMAPXCommand *literal;
 	CamelIMAPXCommandQueue *queue;
 	CamelIMAPXCommandQueue *active;
@@ -160,8 +160,8 @@ struct _CamelIMAPXServer {
 	gboolean use_qresync;
 
 	/* used to synchronize duplicate get_message requests */
-	GCond *fetch_cond;
-	GMutex *fetch_mutex;
+	GCond fetch_cond;
+	GMutex fetch_mutex;
 	gint fetch_count;
 };
 
diff --git a/camel/camel-imapx-settings.c b/camel/camel-imapx-settings.c
index 44214c4..99d8a88 100644
--- a/camel/camel-imapx-settings.c
+++ b/camel/camel-imapx-settings.c
@@ -26,7 +26,7 @@
 	((obj), CAMEL_TYPE_IMAPX_SETTINGS, CamelIMAPXSettingsPrivate))
 
 struct _CamelIMAPXSettingsPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *namespace;
 	gchar *shell_command;
 
@@ -382,7 +382,7 @@ imapx_settings_finalize (GObject *object)
 
 	priv = CAMEL_IMAPX_SETTINGS_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->namespace);
 	g_free (priv->shell_command);
@@ -636,7 +636,7 @@ static void
 camel_imapx_settings_init (CamelIMAPXSettings *settings)
 {
 	settings->priv = CAMEL_IMAPX_SETTINGS_GET_PRIVATE (settings);
-	settings->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&settings->priv->property_lock);
 }
 
 /**
@@ -1072,12 +1072,12 @@ camel_imapx_settings_dup_namespace (CamelIMAPXSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imapx_settings_get_namespace (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1102,17 +1102,17 @@ camel_imapx_settings_set_namespace (CamelIMAPXSettings *settings,
 	if (namespace_ == NULL)
 		namespace_ = "";
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->namespace, namespace_) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->namespace);
 	settings->priv->namespace = g_strdup (namespace_);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "namespace");
 }
@@ -1163,12 +1163,12 @@ camel_imapx_settings_dup_shell_command (CamelIMAPXSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imapx_settings_get_shell_command (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1199,17 +1199,17 @@ camel_imapx_settings_set_shell_command (CamelIMAPXSettings *settings,
 	if (shell_command != NULL && *shell_command == '\0')
 		shell_command = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->shell_command, shell_command) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->shell_command);
 	settings->priv->shell_command = g_strdup (shell_command);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "shell-command");
 }
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index e33deb8..94489db 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -128,7 +128,7 @@ imapx_store_finalize (GObject *object)
 {
 	CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
 
-	g_mutex_free (imapx_store->get_finfo_lock);
+	g_mutex_clear (&imapx_store->get_finfo_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_imapx_store_parent_class)->finalize (object);
@@ -1237,12 +1237,12 @@ imapx_store_get_folder_info_sync (CamelStore *store,
 	if (top == NULL)
 		top = "";
 
-	g_mutex_lock (istore->get_finfo_lock);
+	g_mutex_lock (&istore->get_finfo_lock);
 
 	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
 		fi = get_folder_info_offline (store, top, flags, error);
 
-		g_mutex_unlock (istore->get_finfo_lock);
+		g_mutex_unlock (&istore->get_finfo_lock);
 		return fi;
 	}
 
@@ -1263,19 +1263,19 @@ imapx_store_get_folder_info_sync (CamelStore *store,
 		}
 
 		fi = get_folder_info_offline (store, top, flags, error);
-		g_mutex_unlock (istore->get_finfo_lock);
+		g_mutex_unlock (&istore->get_finfo_lock);
 		return fi;
 	}
 
 	if (!camel_service_connect_sync (
 		CAMEL_SERVICE (store), cancellable, error)) {
-		g_mutex_unlock (istore->get_finfo_lock);
+		g_mutex_unlock (&istore->get_finfo_lock);
 		return NULL;
 	}
 
 	if (*top && flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) {
 		fi = get_folder_info_offline (store, top, flags, error);
-		g_mutex_unlock (istore->get_finfo_lock);
+		g_mutex_unlock (&istore->get_finfo_lock);
 		return fi;
 	}
 
@@ -1297,7 +1297,7 @@ imapx_store_get_folder_info_sync (CamelStore *store,
 	}
 
 	if (!sync_folders (istore, pattern, TRUE, cancellable, error)) {
-		g_mutex_unlock (istore->get_finfo_lock);
+		g_mutex_unlock (&istore->get_finfo_lock);
 		return NULL;
 	}
 
@@ -1308,7 +1308,7 @@ imapx_store_get_folder_info_sync (CamelStore *store,
 		discover_inbox (store, cancellable);
 
 	fi = get_folder_info_offline (store, top, flags, error);
-	g_mutex_unlock (istore->get_finfo_lock);
+	g_mutex_unlock (&istore->get_finfo_lock);
 	return fi;
 }
 
@@ -1812,7 +1812,7 @@ camel_subscribable_init (CamelSubscribableInterface *interface)
 static void
 camel_imapx_store_init (CamelIMAPXStore *istore)
 {
-	istore->get_finfo_lock = g_mutex_new ();
+	g_mutex_init (&istore->get_finfo_lock);
 	istore->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
 	istore->dir_sep = '/';
 	istore->con_man = camel_imapx_conn_manager_new (CAMEL_STORE (istore));
diff --git a/camel/camel-imapx-store.h b/camel/camel-imapx-store.h
index 9255f75..dd7fc90 100644
--- a/camel/camel-imapx-store.h
+++ b/camel/camel-imapx-store.h
@@ -73,7 +73,7 @@ struct _CamelIMAPXStore {
 
 	/* Used for syncronizing get_folder_info. Check for re-use of any other lock. At the
 	 * moment, could not find anything suitable for this */
-	GMutex *get_finfo_lock;
+	GMutex get_finfo_lock;
 	time_t last_refresh_time;
 
 	/* hash table of UIDs to ignore as recent when updating folder */
diff --git a/camel/camel-local-settings.c b/camel/camel-local-settings.c
index 34f6ddf..0593af4 100644
--- a/camel/camel-local-settings.c
+++ b/camel/camel-local-settings.c
@@ -25,7 +25,7 @@
 	((obj), CAMEL_TYPE_LOCAL_SETTINGS, CamelLocalSettingsPrivate))
 
 struct _CamelLocalSettingsPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *path;
 };
 
@@ -81,7 +81,7 @@ local_settings_finalize (GObject *object)
 
 	priv = CAMEL_LOCAL_SETTINGS_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->path);
 
@@ -118,7 +118,7 @@ static void
 camel_local_settings_init (CamelLocalSettings *settings)
 {
 	settings->priv = CAMEL_LOCAL_SETTINGS_GET_PRIVATE (settings);
-	settings->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&settings->priv->property_lock);
 }
 
 /**
@@ -160,12 +160,12 @@ camel_local_settings_dup_path (CamelLocalSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_LOCAL_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_local_settings_get_path (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -201,12 +201,12 @@ camel_local_settings_set_path (CamelLocalSettings *settings,
 		}
 	}
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	new_path = g_strndup (path, length);
 
 	if (g_strcmp0 (settings->priv->path, new_path) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		g_free (new_path);
 		return;
 	}
@@ -214,7 +214,7 @@ camel_local_settings_set_path (CamelLocalSettings *settings,
 	g_free (settings->priv->path);
 	settings->priv->path = new_path;
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "path");
 }
diff --git a/camel/camel-lock-client.c b/camel/camel-lock-client.c
index 88aacb6..3844aeb 100644
--- a/camel/camel-lock-client.c
+++ b/camel/camel-lock-client.c
@@ -43,9 +43,9 @@
 /* see also camel-lock.c */
 #define _(x) (x)
 
-static GStaticMutex lock_lock = G_STATIC_MUTEX_INIT;
-#define LOCK() g_static_mutex_lock(&lock_lock)
-#define UNLOCK() g_static_mutex_unlock(&lock_lock)
+static GMutex lock_lock;
+#define LOCK() g_mutex_lock(&lock_lock)
+#define UNLOCK() g_mutex_unlock(&lock_lock)
 
 static gint lock_sequence;
 static gint lock_helper_pid = -1;
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index f4395b1..3cc92bc 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -4669,9 +4669,9 @@ camel_header_raw_clear (struct _camel_header_raw **list)
 gchar *
 camel_header_msgid_generate (void)
 {
-	static GStaticMutex count_lock = G_STATIC_MUTEX_INIT;
-#define COUNT_LOCK() g_static_mutex_lock (&count_lock)
-#define COUNT_UNLOCK() g_static_mutex_unlock (&count_lock)
+	static GMutex count_lock;
+#define COUNT_LOCK() g_mutex_lock (&count_lock)
+#define COUNT_UNLOCK() g_mutex_unlock (&count_lock)
 	gchar host[MAXHOSTNAMELEN];
 	const gchar *name;
 	static gint count = 0;
diff --git a/camel/camel-msgport.c b/camel/camel-msgport.c
index 0c42dfe..2e0050f 100644
--- a/camel/camel-msgport.c
+++ b/camel/camel-msgport.c
@@ -432,15 +432,15 @@ camel_msgport_try_pop (CamelMsgPort *msgport)
 }
 
 /**
- * camel_msgport_timed_pop:
+ * camel_msgport_timeout_pop:
  * @msgport: a #CamelMsgPort
- * @end_time: a #GTimeVal
+ * @timeout: number of microseconds to wait
  *
- * Since: 2.30
+ * Since: 3.8
  **/
 CamelMsg *
-camel_msgport_timed_pop (CamelMsgPort *msgport,
-                         GTimeVal *end_time)
+camel_msgport_timeout_pop (CamelMsgPort *msgport,
+                           guint64 timeout)
 {
 	CamelMsg *msg;
 
@@ -448,7 +448,7 @@ camel_msgport_timed_pop (CamelMsgPort *msgport,
 
 	g_async_queue_lock (msgport->queue);
 
-	msg = g_async_queue_timed_pop_unlocked (msgport->queue, end_time);
+	msg = g_async_queue_timeout_pop_unlocked (msgport->queue, timeout);
 
 	if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
 		msgport_sync_with_pipe (msgport->pipe[0]);
diff --git a/camel/camel-msgport.h b/camel/camel-msgport.h
index b7604b4..8cf930c 100644
--- a/camel/camel-msgport.h
+++ b/camel/camel-msgport.h
@@ -55,7 +55,8 @@ void		camel_msgport_push		(CamelMsgPort *msgport,
 						 CamelMsg *msg);
 CamelMsg *	camel_msgport_pop		(CamelMsgPort *msgport);
 CamelMsg *	camel_msgport_try_pop		(CamelMsgPort *msgport);
-CamelMsg *	camel_msgport_timed_pop		(CamelMsgPort *msgport, GTimeVal *end_time);
+CamelMsg *	camel_msgport_timeout_pop	(CamelMsgPort *msgport,
+						 guint64 timeout);
 void		camel_msgport_reply		(CamelMsg *msg);
 
 struct PRFileDesc * camel_msgport_prfd		(CamelMsgPort *msgport);
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
index 6c98fd5..2b1eed6 100644
--- a/camel/camel-net-utils.c
+++ b/camel/camel-net-utils.c
@@ -472,7 +472,7 @@ cs_waitinfo (gpointer (worker)(gpointer),
 
 	reply_port = msg->msg.reply_port = camel_msgport_new ();
 	fd = camel_msgport_fd (msg->msg.reply_port);
-	if ((thread = g_thread_create (worker, msg, TRUE, error)) != NULL) {
+	if ((thread = g_thread_new (NULL, worker, msg)) != NULL) {
 		gint status;
 #ifndef G_OS_WIN32
 		GPollFD polls[2];
diff --git a/camel/camel-object-bag.c b/camel/camel-object-bag.c
index 31215d1..cd8e1e6 100644
--- a/camel/camel-object-bag.c
+++ b/camel/camel-object-bag.c
@@ -27,7 +27,7 @@ struct _KeyReservation {
 	gpointer key;
 	gint waiters;
 	GThread *owner;
-	GCond *cond;
+	GCond cond;
 };
 
 struct _CamelObjectBag {
@@ -37,7 +37,7 @@ struct _CamelObjectBag {
 	CamelCopyFunc key_copy_func;
 	GFreeFunc key_free_func;
 	GList *reserved;  /* list of KeyReservations */
-	GMutex *mutex;
+	GMutex mutex;
 };
 
 static KeyReservation *
@@ -49,7 +49,7 @@ key_reservation_new (CamelObjectBag *bag,
 	reservation = g_slice_new0 (KeyReservation);
 	reservation->key = bag->key_copy_func (key);
 	reservation->owner = g_thread_self ();
-	reservation->cond = g_cond_new ();
+	g_cond_init (&reservation->cond);
 
 	bag->reserved = g_list_prepend (bag->reserved, reservation);
 
@@ -82,7 +82,7 @@ key_reservation_free (CamelObjectBag *bag,
 	bag->reserved = g_list_remove (bag->reserved, reservation);
 
 	bag->key_free_func (reservation->key);
-	g_cond_free (reservation->cond);
+	g_cond_clear (&reservation->cond);
 	g_slice_free (KeyReservation, reservation);
 }
 
@@ -95,7 +95,7 @@ object_bag_toggle_notify (gpointer user_data,
 	gpointer key;
 
 	if (is_last_ref) {
-		g_mutex_lock (bag->mutex);
+		g_mutex_lock (&bag->mutex);
 
 		/* first remove from bag */
 		key = g_hash_table_lookup (bag->key_table, object);
@@ -104,7 +104,7 @@ object_bag_toggle_notify (gpointer user_data,
 			g_hash_table_remove (bag->object_table, key);
 		}
 
-		g_mutex_unlock (bag->mutex);
+		g_mutex_unlock (&bag->mutex);
 
 		/* then free the object */
 		g_object_remove_toggle_ref (object, object_bag_toggle_notify, bag);
@@ -131,7 +131,7 @@ object_bag_unreserve (CamelObjectBag *bag,
 
 	if (reservation->waiters > 0) {
 		reservation->owner = NULL;
-		g_cond_signal (reservation->cond);
+		g_cond_signal (&reservation->cond);
 	} else
 		key_reservation_free (bag, reservation);
 }
@@ -180,7 +180,7 @@ camel_object_bag_new (GHashFunc key_hash_func,
 	bag->key_equal_func = key_equal_func;
 	bag->key_copy_func = key_copy_func;
 	bag->key_free_func = key_free_func;
-	bag->mutex = g_mutex_new ();
+	g_mutex_init (&bag->mutex);
 
 	return bag;
 }
@@ -207,13 +207,13 @@ camel_object_bag_get (CamelObjectBag *bag,
 	g_return_val_if_fail (bag != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	/* Look for the key in the bag. */
 	object = g_hash_table_lookup (bag->object_table, key);
 	if (object != NULL) {
 		g_object_ref (object);
-		g_mutex_unlock (bag->mutex);
+		g_mutex_unlock (&bag->mutex);
 		return object;
 	}
 
@@ -221,14 +221,14 @@ camel_object_bag_get (CamelObjectBag *bag,
 	reservation = key_reservation_lookup (bag, key);
 	if (reservation == NULL) {
 		/* No such key, so return NULL. */
-		g_mutex_unlock (bag->mutex);
+		g_mutex_unlock (&bag->mutex);
 		return NULL;
 	}
 
 	/* Wait for the key to be unreserved. */
 	reservation->waiters++;
 	while (reservation->owner != NULL)
-		g_cond_wait (reservation->cond, bag->mutex);
+		g_cond_wait (&reservation->cond, &bag->mutex);
 	reservation->waiters--;
 
 	/* Check if an object was added by another thread. */
@@ -240,7 +240,7 @@ camel_object_bag_get (CamelObjectBag *bag,
 	reservation->owner = g_thread_self ();
 	object_bag_unreserve (bag, key);
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 
 	return object;
 }
@@ -268,13 +268,13 @@ camel_object_bag_peek (CamelObjectBag *bag,
 	g_return_val_if_fail (bag != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	object = g_hash_table_lookup (bag->object_table, key);
 	if (object != NULL)
 		g_object_ref (object);
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 
 	return object;
 }
@@ -304,13 +304,13 @@ camel_object_bag_reserve (CamelObjectBag *bag,
 	g_return_val_if_fail (bag != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	/* If object for key already exists, return it immediately. */
 	object = g_hash_table_lookup (bag->object_table, key);
 	if (object != NULL) {
 		g_object_ref (object);
-		g_mutex_unlock (bag->mutex);
+		g_mutex_unlock (&bag->mutex);
 		return object;
 	}
 
@@ -318,14 +318,14 @@ camel_object_bag_reserve (CamelObjectBag *bag,
 	reservation = key_reservation_lookup (bag, key);
 	if (reservation == NULL) {
 		key_reservation_new (bag, key);
-		g_mutex_unlock (bag->mutex);
+		g_mutex_unlock (&bag->mutex);
 		return NULL;
 	}
 
 	/* Wait for the reservation to be committed or aborted. */
 	reservation->waiters++;
 	while (reservation->owner != NULL)
-		g_cond_wait (reservation->cond, bag->mutex);
+		g_cond_wait (&reservation->cond, &bag->mutex);
 	reservation->owner = g_thread_self ();
 	reservation->waiters--;
 
@@ -337,7 +337,7 @@ camel_object_bag_reserve (CamelObjectBag *bag,
 		g_object_ref (object);
 	}
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 
 	return object;
 }
@@ -360,7 +360,7 @@ camel_object_bag_add (CamelObjectBag *bag,
 	g_return_if_fail (key != NULL);
 	g_return_if_fail (G_IS_OBJECT (object));
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	if (g_hash_table_lookup (bag->key_table, object) == NULL) {
 		gpointer copied_key;
@@ -375,7 +375,7 @@ camel_object_bag_add (CamelObjectBag *bag,
 			object_bag_toggle_notify, bag);
 	}
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 }
 
 /**
@@ -392,11 +392,11 @@ camel_object_bag_abort (CamelObjectBag *bag,
 	g_return_if_fail (bag != NULL);
 	g_return_if_fail (key != NULL);
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	object_bag_unreserve (bag, key);
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 }
 
 /**
@@ -421,7 +421,7 @@ camel_object_bag_rekey (CamelObjectBag *bag,
 	g_return_if_fail (G_IS_OBJECT (object));
 	g_return_if_fail (new_key != NULL);
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	key = g_hash_table_lookup (bag->key_table, object);
 	if (key != NULL) {
@@ -436,7 +436,7 @@ camel_object_bag_rekey (CamelObjectBag *bag,
 	} else
 		g_warn_if_reached ();
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 }
 
 /**
@@ -467,7 +467,7 @@ camel_object_bag_list (CamelObjectBag *bag)
 
 	array = g_ptr_array_new ();
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	values = g_hash_table_get_values (bag->object_table);
 	while (values != NULL) {
@@ -475,7 +475,7 @@ camel_object_bag_list (CamelObjectBag *bag)
 		values = g_list_delete_link (values, values);
 	}
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 
 	return array;
 }
@@ -496,7 +496,7 @@ camel_object_bag_remove (CamelObjectBag *bag,
 	g_return_if_fail (bag != NULL);
 	g_return_if_fail (G_IS_OBJECT (object));
 
-	g_mutex_lock (bag->mutex);
+	g_mutex_lock (&bag->mutex);
 
 	key = g_hash_table_lookup (bag->key_table, object);
 	if (key != NULL) {
@@ -505,7 +505,7 @@ camel_object_bag_remove (CamelObjectBag *bag,
 		g_hash_table_remove (bag->object_table, key);
 	}
 
-	g_mutex_unlock (bag->mutex);
+	g_mutex_unlock (&bag->mutex);
 }
 
 /**
@@ -528,6 +528,6 @@ camel_object_bag_destroy (CamelObjectBag *bag)
 
 	g_hash_table_destroy (bag->key_table);
 	g_hash_table_destroy (bag->object_table);
-	g_mutex_free (bag->mutex);
+	g_mutex_clear (&bag->mutex);
 	g_slice_free (CamelObjectBag, bag);
 }
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 1380e9e..8646627 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -56,9 +56,9 @@ enum {
 	LAST_SIGNAL
 };
 
-static GStaticRecMutex operation_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK() g_static_rec_mutex_lock (&operation_lock)
-#define UNLOCK() g_static_rec_mutex_unlock (&operation_lock)
+static GRecMutex operation_lock;
+#define LOCK() g_rec_mutex_lock (&operation_lock)
+#define UNLOCK() g_rec_mutex_unlock (&operation_lock)
 
 static GQueue operation_list = G_QUEUE_INIT;
 
diff --git a/camel/camel-partition-table.c b/camel/camel-partition-table.c
index 7bafd18..a6e9295 100644
--- a/camel/camel-partition-table.c
+++ b/camel/camel-partition-table.c
@@ -43,16 +43,16 @@
 #define k(x) /*(printf ("%s (%d):%s: ",  __FILE__, __LINE__, __PRETTY_FUNCTION__),(x))*/
 
 #define CAMEL_PARTITION_TABLE_LOCK(kf, lock) \
-	(g_static_mutex_lock (&(kf)->priv->lock))
+	(g_mutex_lock (&(kf)->priv->lock))
 #define CAMEL_PARTITION_TABLE_UNLOCK(kf, lock) \
-	(g_static_mutex_unlock (&(kf)->priv->lock))
+	(g_mutex_unlock (&(kf)->priv->lock))
 
 #define CAMEL_PARTITION_TABLE_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), CAMEL_TYPE_PARTITION_TABLE, CamelPartitionTablePrivate))
 
 struct _CamelPartitionTablePrivate {
-	GStaticMutex lock;	/* for locking partition */
+	GMutex lock;	/* for locking partition */
 };
 
 G_DEFINE_TYPE (CamelPartitionTable, camel_partition_table, CAMEL_TYPE_OBJECT)
@@ -73,7 +73,7 @@ partition_table_finalize (GObject *object)
 		g_object_unref (table->blocks);
 	}
 
-	g_static_mutex_free (&table->priv->lock);
+	g_mutex_clear (&table->priv->lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_partition_table_parent_class)->finalize (object);
@@ -96,7 +96,7 @@ camel_partition_table_init (CamelPartitionTable *cpi)
 	cpi->priv = CAMEL_PARTITION_TABLE_GET_PRIVATE (cpi);
 
 	g_queue_init (&cpi->partition);
-	g_static_mutex_init (&cpi->priv->lock);
+	g_mutex_init (&cpi->priv->lock);
 }
 
 /* ********************************************************************** */
@@ -622,12 +622,12 @@ fail:
 	((obj), CAMEL_TYPE_KEY_TABLE, CamelKeyTablePrivate))
 
 #define CAMEL_KEY_TABLE_LOCK(kf, lock) \
-	(g_static_mutex_lock (&(kf)->priv->lock))
+	(g_mutex_lock (&(kf)->priv->lock))
 #define CAMEL_KEY_TABLE_UNLOCK(kf, lock) \
-	(g_static_mutex_unlock (&(kf)->priv->lock))
+	(g_mutex_unlock (&(kf)->priv->lock))
 
 struct _CamelKeyTablePrivate {
-	GStaticMutex lock;	/* for locking key */
+	GMutex lock;	/* for locking key */
 };
 
 G_DEFINE_TYPE (CamelKeyTable, camel_key_table, CAMEL_TYPE_OBJECT)
@@ -646,7 +646,7 @@ key_table_finalize (GObject *object)
 		g_object_unref (table->blocks);
 	}
 
-	g_static_mutex_free (&table->priv->lock);
+	g_mutex_clear (&table->priv->lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_key_table_parent_class)->finalize (object);
@@ -667,7 +667,7 @@ static void
 camel_key_table_init (CamelKeyTable *table)
 {
 	table->priv = CAMEL_KEY_TABLE_GET_PRIVATE (table);
-	g_static_mutex_init (&table->priv->lock);
+	g_mutex_init (&table->priv->lock);
 }
 
 CamelKeyTable *
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
index 6b74699..807ba0b 100644
--- a/camel/camel-provider.c
+++ b/camel/camel-provider.c
@@ -47,10 +47,10 @@
 static GHashTable *module_table;
 /* table of CamelProvider's */
 static GHashTable *provider_table;
-static GStaticRecMutex provider_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex provider_lock;
 
-#define LOCK()		(g_static_rec_mutex_lock(&provider_lock))
-#define UNLOCK()	(g_static_rec_mutex_unlock(&provider_lock))
+#define LOCK()		(g_rec_mutex_lock(&provider_lock))
+#define UNLOCK()	(g_rec_mutex_unlock(&provider_lock))
 
 /* The vfolder provider is always available */
 static CamelProvider vee_provider = {
diff --git a/camel/camel-sasl-popb4smtp.c b/camel/camel-sasl-popb4smtp.c
index 61e8fe6..fcb59fb 100644
--- a/camel/camel-sasl-popb4smtp.c
+++ b/camel/camel-sasl-popb4smtp.c
@@ -57,9 +57,9 @@ static GHashTable *poplast;
 /* use 1 hour as our pop timeout */
 #define POPB4SMTP_TIMEOUT (60*60)
 
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define POPB4SMTP_LOCK(l) g_static_mutex_lock(&l)
-#define POPB4SMTP_UNLOCK(l) g_static_mutex_unlock(&l)
+static GMutex lock;
+#define POPB4SMTP_LOCK(l) g_mutex_lock(&l)
+#define POPB4SMTP_UNLOCK(l) g_mutex_unlock(&l)
 
 G_DEFINE_TYPE (CamelSaslPOPB4SMTP, camel_sasl_popb4smtp, CAMEL_TYPE_SASL)
 
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 316b688..ab89ac0 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -58,7 +58,7 @@ struct _CamelServicePrivate {
 	gpointer session;  /* weak pointer */
 
 	CamelSettings *settings;
-	GMutex *settings_lock;
+	GMutex settings_lock;
 
 	CamelProvider *provider;
 
@@ -68,7 +68,7 @@ struct _CamelServicePrivate {
 	gchar *uid;
 	gchar *password;
 
-	GMutex *connection_lock;
+	GMutex connection_lock;
 	ConnectionOp *connection_op;
 	CamelServiceConnectionStatus status;
 };
@@ -437,7 +437,7 @@ service_shared_connect_cb (GObject *source_object,
 	success = class->connect_finish (service, result, &error);
 	CAMEL_CHECK_GERROR (service, connect_sync, success, p_error);
 
-	g_mutex_lock (service->priv->connection_lock);
+	g_mutex_lock (&service->priv->connection_lock);
 
 	if (service->priv->connection_op == op) {
 		connection_op_unref (service->priv->connection_op);
@@ -452,7 +452,7 @@ service_shared_connect_cb (GObject *source_object,
 	connection_op_complete (op, error);
 	connection_op_complete_pending (op, error);
 
-	g_mutex_unlock (service->priv->connection_lock);
+	g_mutex_unlock (&service->priv->connection_lock);
 
 	connection_op_unref (op);
 	g_clear_error (&error);
@@ -480,7 +480,7 @@ service_shared_disconnect_cb (GObject *source_object,
 	success = class->disconnect_finish (service, result, &error);
 	CAMEL_CHECK_GERROR (service, disconnect_sync, success, p_error);
 
-	g_mutex_lock (service->priv->connection_lock);
+	g_mutex_lock (&service->priv->connection_lock);
 
 	if (service->priv->connection_op == op) {
 		connection_op_unref (service->priv->connection_op);
@@ -495,7 +495,7 @@ service_shared_disconnect_cb (GObject *source_object,
 	connection_op_complete (op, error);
 	connection_op_complete_pending (op, error);
 
-	g_mutex_unlock (service->priv->connection_lock);
+	g_mutex_unlock (&service->priv->connection_lock);
 
 	connection_op_unref (op);
 	g_clear_error (&error);
@@ -667,7 +667,7 @@ service_finalize (GObject *object)
 		CAMEL_SERVICE_GET_CLASS (object)->disconnect_sync (
 			CAMEL_SERVICE (object), TRUE, NULL, NULL);
 
-	g_mutex_free (priv->settings_lock);
+	g_mutex_clear (&priv->settings_lock);
 
 	g_free (priv->display_name);
 	g_free (priv->user_data_dir);
@@ -677,7 +677,7 @@ service_finalize (GObject *object)
 
 	/* There should be no outstanding connection operations. */
 	g_warn_if_fail (priv->connection_op == NULL);
-	g_mutex_free (priv->connection_lock);
+	g_mutex_clear (&priv->connection_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_service_parent_class)->finalize (object);
@@ -1137,8 +1137,8 @@ camel_service_init (CamelService *service)
 {
 	service->priv = CAMEL_SERVICE_GET_PRIVATE (service);
 
-	service->priv->settings_lock = g_mutex_new ();
-	service->priv->connection_lock = g_mutex_new ();
+	g_mutex_init (&service->priv->settings_lock);
+	g_mutex_init (&service->priv->connection_lock);
 	service->priv->status = CAMEL_SERVICE_DISCONNECTED;
 }
 
@@ -1490,11 +1490,11 @@ camel_service_ref_settings (CamelService *service)
 	/* Every service should have a settings object. */
 	g_return_val_if_fail (service->priv->settings != NULL, NULL);
 
-	g_mutex_lock (service->priv->settings_lock);
+	g_mutex_lock (&service->priv->settings_lock);
 
 	settings = g_object_ref (service->priv->settings);
 
-	g_mutex_unlock (service->priv->settings_lock);
+	g_mutex_unlock (&service->priv->settings_lock);
 
 	return settings;
 }
@@ -1537,14 +1537,14 @@ camel_service_set_settings (CamelService *service,
 		settings = g_object_new (class->settings_type, NULL);
 	}
 
-	g_mutex_lock (service->priv->settings_lock);
+	g_mutex_lock (&service->priv->settings_lock);
 
 	if (service->priv->settings != NULL)
 		g_object_unref (service->priv->settings);
 
 	service->priv->settings = settings;  /* takes ownership */
 
-	g_mutex_unlock (service->priv->settings_lock);
+	g_mutex_unlock (&service->priv->settings_lock);
 
 	g_object_notify (G_OBJECT (service), "settings");
 }
@@ -1654,7 +1654,7 @@ camel_service_connect (CamelService *service,
 
 	g_simple_async_result_set_check_cancellable (simple, cancellable);
 
-	g_mutex_lock (service->priv->connection_lock);
+	g_mutex_lock (&service->priv->connection_lock);
 
 	switch (service->priv->status) {
 
@@ -1708,7 +1708,7 @@ camel_service_connect (CamelService *service,
 			g_warn_if_reached ();
 	}
 
-	g_mutex_unlock (service->priv->connection_lock);
+	g_mutex_unlock (&service->priv->connection_lock);
 
 	g_object_unref (simple);
 }
@@ -1833,7 +1833,7 @@ camel_service_disconnect (CamelService *service,
 
 	g_simple_async_result_set_check_cancellable (simple, cancellable);
 
-	g_mutex_lock (service->priv->connection_lock);
+	g_mutex_lock (&service->priv->connection_lock);
 
 	switch (service->priv->status) {
 
@@ -1887,7 +1887,7 @@ camel_service_disconnect (CamelService *service,
 			g_warn_if_reached ();
 	}
 
-	g_mutex_unlock (service->priv->connection_lock);
+	g_mutex_unlock (&service->priv->connection_lock);
 
 	g_object_unref (simple);
 }
diff --git a/camel/camel-session.c b/camel/camel-session.c
index abcf34f..94fce5b 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -65,7 +65,7 @@ struct _CamelSessionPrivate {
 	gchar *user_cache_dir;
 
 	GHashTable *services;
-	GMutex *services_lock;
+	GMutex services_lock;
 
 	GHashTable *junk_headers;
 	CamelJunkFilter *junk_filter;
@@ -365,7 +365,7 @@ session_finalize (GObject *object)
 	if (priv->main_context != NULL)
 		g_main_context_unref (priv->main_context);
 
-	g_mutex_free (priv->services_lock);
+	g_mutex_clear (&priv->services_lock);
 
 	if (priv->junk_headers) {
 		g_hash_table_remove_all (priv->junk_headers);
@@ -423,14 +423,14 @@ session_add_service (CamelSession *session,
 		session, "uid", uid, NULL);
 
 	if (service != NULL) {
-		g_mutex_lock (session->priv->services_lock);
+		g_mutex_lock (&session->priv->services_lock);
 
 		g_hash_table_insert (
 			session->priv->services,
 			g_strdup (uid),
 			g_object_ref (service));
 
-		g_mutex_unlock (session->priv->services_lock);
+		g_mutex_unlock (&session->priv->services_lock);
 	}
 
 	return service;
@@ -442,12 +442,12 @@ session_remove_service (CamelSession *session,
 {
 	const gchar *uid;
 
-	g_mutex_lock (session->priv->services_lock);
+	g_mutex_lock (&session->priv->services_lock);
 
 	uid = camel_service_get_uid (service);
 	g_hash_table_remove (session->priv->services, uid);
 
-	g_mutex_unlock (session->priv->services_lock);
+	g_mutex_unlock (&session->priv->services_lock);
 }
 
 static void
@@ -860,7 +860,7 @@ camel_session_init (CamelSession *session)
 	session->priv = CAMEL_SESSION_GET_PRIVATE (session);
 
 	session->priv->services = services;
-	session->priv->services_lock = g_mutex_new ();
+	g_mutex_init (&session->priv->services_lock);
 	session->priv->junk_headers = NULL;
 
 	session->priv->main_context = g_main_context_ref_thread_default ();
@@ -1024,14 +1024,14 @@ camel_session_ref_service (CamelSession *session,
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
 	g_return_val_if_fail (uid != NULL, NULL);
 
-	g_mutex_lock (session->priv->services_lock);
+	g_mutex_lock (&session->priv->services_lock);
 
 	service = g_hash_table_lookup (session->priv->services, uid);
 
 	if (service != NULL)
 		g_object_ref (service);
 
-	g_mutex_unlock (session->priv->services_lock);
+	g_mutex_unlock (&session->priv->services_lock);
 
 	return service;
 }
@@ -1142,13 +1142,13 @@ camel_session_list_services (CamelSession *session)
 
 	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
 
-	g_mutex_lock (session->priv->services_lock);
+	g_mutex_lock (&session->priv->services_lock);
 
 	list = g_hash_table_get_values (session->priv->services);
 
 	g_list_foreach (list, (GFunc) g_object_ref, NULL);
 
-	g_mutex_unlock (session->priv->services_lock);
+	g_mutex_unlock (&session->priv->services_lock);
 
 	return list;
 }
@@ -1170,11 +1170,11 @@ camel_session_remove_services (CamelSession *session)
 {
 	g_return_if_fail (CAMEL_IS_SESSION (session));
 
-	g_mutex_lock (session->priv->services_lock);
+	g_mutex_lock (&session->priv->services_lock);
 
 	g_hash_table_remove_all (session->priv->services);
 
-	g_mutex_unlock (session->priv->services_lock);
+	g_mutex_unlock (&session->priv->services_lock);
 }
 
 /**
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index 81baa91..ce4d79e 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -55,9 +55,9 @@
 	((obj), CAMEL_TYPE_STORE_SUMMARY, CamelStoreSummaryPrivate))
 
 struct _CamelStoreSummaryPrivate {
-	GStaticRecMutex summary_lock;	/* for the summary hashtable/array */
-	GStaticRecMutex io_lock;	/* load/save lock, for access to saved_count, etc */
-	GStaticRecMutex ref_lock;	/* for reffing/unreffing messageinfo's ALWAYS obtain before CAMEL_STORE_SUMMARY_SUMMARY_LOCK */
+	GRecMutex summary_lock;	/* for the summary hashtable/array */
+	GRecMutex io_lock;	/* load/save lock, for access to saved_count, etc */
+	GRecMutex ref_lock;	/* for reffing/unreffing messageinfo's ALWAYS obtain before CAMEL_STORE_SUMMARY_SUMMARY_LOCK */
 
 	GHashTable *folder_summaries; /* CamelFolderSummary->path; doesn't add reference to CamelFolderSummary */
 
@@ -81,9 +81,9 @@ store_summary_finalize (GObject *object)
 	if (summary->store_info_chunks != NULL)
 		camel_memchunk_destroy (summary->store_info_chunks);
 
-	g_static_rec_mutex_free (&summary->priv->summary_lock);
-	g_static_rec_mutex_free (&summary->priv->io_lock);
-	g_static_rec_mutex_free (&summary->priv->ref_lock);
+	g_rec_mutex_clear (&summary->priv->summary_lock);
+	g_rec_mutex_clear (&summary->priv->io_lock);
+	g_rec_mutex_clear (&summary->priv->ref_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_store_summary_parent_class)->finalize (object);
@@ -346,9 +346,9 @@ camel_store_summary_init (CamelStoreSummary *summary)
 	summary->priv->folder_summaries = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
 	summary->priv->scheduled_save_id = 0;
 
-	g_static_rec_mutex_init (&summary->priv->summary_lock);
-	g_static_rec_mutex_init (&summary->priv->io_lock);
-	g_static_rec_mutex_init (&summary->priv->ref_lock);
+	g_rec_mutex_init (&summary->priv->summary_lock);
+	g_rec_mutex_init (&summary->priv->io_lock);
+	g_rec_mutex_init (&summary->priv->ref_lock);
 }
 
 /**
@@ -1087,13 +1087,13 @@ camel_store_summary_lock (CamelStoreSummary *summary,
 
 	switch (lock) {
 		case CAMEL_STORE_SUMMARY_SUMMARY_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->summary_lock);
+			g_rec_mutex_lock (&summary->priv->summary_lock);
 			break;
 		case CAMEL_STORE_SUMMARY_IO_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->io_lock);
+			g_rec_mutex_lock (&summary->priv->io_lock);
 			break;
 		case CAMEL_STORE_SUMMARY_REF_LOCK:
-			g_static_rec_mutex_lock (&summary->priv->ref_lock);
+			g_rec_mutex_lock (&summary->priv->ref_lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -1117,13 +1117,13 @@ camel_store_summary_unlock (CamelStoreSummary *summary,
 
 	switch (lock) {
 		case CAMEL_STORE_SUMMARY_SUMMARY_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->summary_lock);
+			g_rec_mutex_unlock (&summary->priv->summary_lock);
 			break;
 		case CAMEL_STORE_SUMMARY_IO_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->io_lock);
+			g_rec_mutex_unlock (&summary->priv->io_lock);
 			break;
 		case CAMEL_STORE_SUMMARY_REF_LOCK:
-			g_static_rec_mutex_unlock (&summary->priv->ref_lock);
+			g_rec_mutex_unlock (&summary->priv->ref_lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 593b426..2337a2d 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -55,7 +55,7 @@ typedef struct _AsyncContext AsyncContext;
 typedef struct _SignalData SignalData;
 
 struct _CamelStorePrivate {
-	GStaticRecMutex folder_lock;	/* for locking folder operations */
+	GRecMutex folder_lock;	/* for locking folder operations */
 };
 
 struct _AsyncContext {
@@ -261,7 +261,7 @@ store_finalize (GObject *object)
 	if (store->folders != NULL)
 		camel_object_bag_destroy (store->folders);
 
-	g_static_rec_mutex_free (&store->priv->folder_lock);
+	g_rec_mutex_clear (&store->priv->folder_lock);
 
 	if (store->cdb_r != NULL) {
 		camel_db_close (store->cdb_r);
@@ -1241,7 +1241,7 @@ camel_store_init (CamelStore *store)
 
 	store->mode = CAMEL_STORE_READ | CAMEL_STORE_WRITE;
 
-	g_static_rec_mutex_init (&store->priv->folder_lock);
+	g_rec_mutex_init (&store->priv->folder_lock);
 }
 
 GQuark
@@ -1765,7 +1765,7 @@ camel_store_lock (CamelStore *store,
 
 	switch (lock) {
 		case CAMEL_STORE_FOLDER_LOCK:
-			g_static_rec_mutex_lock (&store->priv->folder_lock);
+			g_rec_mutex_lock (&store->priv->folder_lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -1789,7 +1789,7 @@ camel_store_unlock (CamelStore *store,
 
 	switch (lock) {
 		case CAMEL_STORE_FOLDER_LOCK:
-			g_static_rec_mutex_unlock (&store->priv->folder_lock);
+			g_rec_mutex_unlock (&store->priv->folder_lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-string-utils.c b/camel/camel-string-utils.c
index cd92d8a..1eede40 100644
--- a/camel/camel-string-utils.c
+++ b/camel/camel-string-utils.c
@@ -141,7 +141,7 @@ gchar camel_toupper (gchar c)
 }
 
 /* working stuff for pstrings */
-static GStaticMutex string_pool_lock = G_STATIC_MUTEX_INIT;
+static GMutex string_pool_lock;
 static GHashTable *string_pool = NULL;
 
 typedef struct _StringPoolNode StringPoolNode;
@@ -226,7 +226,7 @@ camel_pstring_add (gchar *string,
 		return "";
 	}
 
-	g_static_mutex_lock (&string_pool_lock);
+	g_mutex_lock (&string_pool_lock);
 
 	string_pool_init ();
 
@@ -245,7 +245,7 @@ camel_pstring_add (gchar *string,
 
 	interned = node->string;
 
-	g_static_mutex_unlock (&string_pool_lock);
+	g_mutex_unlock (&string_pool_lock);
 
 	return interned;
 }
@@ -277,7 +277,7 @@ camel_pstring_peek (const gchar *string)
 	if (*string == '\0')
 		return "";
 
-	g_static_mutex_lock (&string_pool_lock);
+	g_mutex_lock (&string_pool_lock);
 
 	string_pool_init ();
 
@@ -290,7 +290,7 @@ camel_pstring_peek (const gchar *string)
 
 	interned = node->string;
 
-	g_static_mutex_unlock (&string_pool_lock);
+	g_mutex_unlock (&string_pool_lock);
 
 	return interned;
 }
@@ -334,7 +334,7 @@ camel_pstring_free (const gchar *string)
 	if (string == NULL || *string == '\0')
 		return;
 
-	g_static_mutex_lock (&string_pool_lock);
+	g_mutex_lock (&string_pool_lock);
 
 	node = g_hash_table_lookup (string_pool, &static_node);
 
@@ -350,7 +350,7 @@ camel_pstring_free (const gchar *string)
 			g_hash_table_remove (string_pool, node);
 	}
 
-	g_static_mutex_unlock (&string_pool_lock);
+	g_mutex_unlock (&string_pool_lock);
 }
 
 /**
@@ -363,7 +363,7 @@ camel_pstring_free (const gchar *string)
 void
 camel_pstring_dump_stat (void)
 {
-	g_static_mutex_lock (&string_pool_lock);
+	g_mutex_lock (&string_pool_lock);
 
 	g_print ("   String Pool Statistics: ");
 
@@ -391,5 +391,5 @@ camel_pstring_dump_stat (void)
 		g_free (format_size);
 	}
 
-	g_static_mutex_unlock (&string_pool_lock);
+	g_mutex_unlock (&string_pool_lock);
 }
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 1d76e3b..a97589c 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -51,9 +51,9 @@
 #define CAMEL_TEXT_INDEX_MAX_WORDLEN  (36)
 
 #define CAMEL_TEXT_INDEX_LOCK(kf, lock) \
-	(g_static_rec_mutex_lock (&((CamelTextIndex *) kf)->priv->lock))
+	(g_rec_mutex_lock (&((CamelTextIndex *) kf)->priv->lock))
 #define CAMEL_TEXT_INDEX_UNLOCK(kf, lock) \
-	(g_static_rec_mutex_unlock (&((CamelTextIndex *) kf)->priv->lock))
+	(g_rec_mutex_unlock (&((CamelTextIndex *) kf)->priv->lock))
 
 static gint text_index_compress_nosync (CamelIndex *idx);
 
@@ -131,7 +131,7 @@ struct _CamelTextIndexPrivate {
 	guint word_cache_limit;
 	GQueue word_cache;
 	GHashTable *words;
-	GStaticRecMutex lock;
+	GRecMutex lock;
 };
 
 /* Root block of text index */
@@ -222,7 +222,7 @@ text_index_finalize (GObject *object)
 
 	g_hash_table_destroy (priv->words);
 
-	g_static_rec_mutex_free (&priv->lock);
+	g_rec_mutex_clear (&priv->lock);
 
 	/* Chain up to parent's finalize () method. */
 	G_OBJECT_CLASS (camel_text_index_parent_class)->finalize (object);
@@ -859,7 +859,7 @@ camel_text_index_init (CamelTextIndex *text_index)
 	 * usage barely affects performance. */
 	text_index->priv->word_cache_limit = 4096; /* 1024 = 128K */
 
-	g_static_rec_mutex_init (&text_index->priv->lock);
+	g_rec_mutex_init (&text_index->priv->lock);
 }
 
 static gchar *
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index c935918..8511e69 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -39,7 +39,7 @@
 typedef struct _AsyncContext AsyncContext;
 
 struct _CamelTransportPrivate {
-	GMutex *send_lock;   /* for locking send operations */
+	GMutex send_lock;   /* for locking send operations */
 };
 
 struct _AsyncContext {
@@ -73,7 +73,7 @@ transport_finalize (GObject *object)
 
 	priv = CAMEL_TRANSPORT_GET_PRIVATE (object);
 
-	g_mutex_free (priv->send_lock);
+	g_mutex_clear (&priv->send_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_transport_parent_class)->finalize (object);
@@ -166,7 +166,7 @@ camel_transport_init (CamelTransport *transport)
 {
 	transport->priv = CAMEL_TRANSPORT_GET_PRIVATE (transport);
 
-	transport->priv->send_lock = g_mutex_new ();
+	g_mutex_init (&transport->priv->send_lock);
 }
 
 /**
@@ -186,7 +186,7 @@ camel_transport_lock (CamelTransport *transport,
 
 	switch (lock) {
 		case CAMEL_TRANSPORT_SEND_LOCK:
-			g_mutex_lock (transport->priv->send_lock);
+			g_mutex_lock (&transport->priv->send_lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -210,7 +210,7 @@ camel_transport_unlock (CamelTransport *transport,
 
 	switch (lock) {
 		case CAMEL_TRANSPORT_SEND_LOCK:
-			g_mutex_unlock (transport->priv->send_lock);
+			g_mutex_unlock (&transport->priv->send_lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-vee-data-cache.c b/camel/camel-vee-data-cache.c
index 4b42987..812c871 100644
--- a/camel/camel-vee-data-cache.c
+++ b/camel/camel-vee-data-cache.c
@@ -293,10 +293,10 @@ camel_vee_message_info_data_get_vee_message_uid (CamelVeeMessageInfoData *data)
 /* ----------------------------------------------------------------------- */
 
 struct _CamelVeeDataCachePrivate {
-	GMutex *sf_mutex; /* guards subfolder_hash */
+	GMutex sf_mutex; /* guards subfolder_hash */
 	GHashTable *subfolder_hash; /* CamelFolder * => CamelVeeSubfolderData * */
 
-	GMutex *mi_mutex; /* guards message_info_hash */
+	GMutex mi_mutex; /* guards message_info_hash */
 	GHashTable *orig_message_uid_hash; /* VeeData * => CamelVeeMessageInfoData * */
 	GHashTable *vee_message_uid_hash; /* const gchar *vee_uid => CamelVeeMessageInfoData * */
 };
@@ -353,14 +353,6 @@ camel_vee_data_cache_dispose (GObject *object)
 		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 (data_cache->priv->sf_mutex)
-			g_mutex_free (data_cache->priv->sf_mutex);
-		data_cache->priv->sf_mutex = NULL;
-
-		if (data_cache->priv->mi_mutex)
-			g_mutex_free (data_cache->priv->mi_mutex);
-		data_cache->priv->mi_mutex = NULL;
 	}
 
 	/* Chain up to parent's dispose () method. */
@@ -368,6 +360,21 @@ camel_vee_data_cache_dispose (GObject *object)
 }
 
 static void
+camel_vee_data_cache_finalize (GObject *object)
+{
+	CamelVeeDataCache *data_cache;
+
+	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);
+	}
+
+	/* Chain up to parent's finalize () method. */
+	G_OBJECT_CLASS (camel_vee_data_cache_parent_class)->finalize (object);
+}
+
+static void
 camel_vee_data_cache_class_init (CamelVeeDataCacheClass *class)
 {
 	GObjectClass *object_class;
@@ -376,6 +383,7 @@ camel_vee_data_cache_class_init (CamelVeeDataCacheClass *class)
 
 	object_class = G_OBJECT_CLASS (class);
 	object_class->dispose = camel_vee_data_cache_dispose;
+	object_class->finalize = camel_vee_data_cache_finalize;
 }
 
 static void
@@ -383,10 +391,10 @@ 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->sf_mutex = g_mutex_new ();
+	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);
 
-	data_cache->priv->mi_mutex = g_mutex_new ();
+	g_mutex_init (&data_cache->priv->mi_mutex);
 	data_cache->priv->orig_message_uid_hash = g_hash_table_new_full (vee_data_hash, vee_data_equal, g_free, g_object_unref);
 	data_cache->priv->vee_message_uid_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
 }
@@ -420,8 +428,8 @@ camel_vee_data_cache_add_subfolder (CamelVeeDataCache *data_cache,
 	g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
 	g_return_if_fail (CAMEL_IS_FOLDER (subfolder));
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
-	g_mutex_lock (data_cache->priv->sf_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->sf_mutex);
 
 	sf_data = g_hash_table_lookup (data_cache->priv->subfolder_hash, subfolder);
 	if (!sf_data) {
@@ -469,8 +477,8 @@ camel_vee_data_cache_add_subfolder (CamelVeeDataCache *data_cache,
 		}
 	}
 
-	g_mutex_unlock (data_cache->priv->sf_mutex);
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->sf_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 }
 
 static gboolean
@@ -514,15 +522,15 @@ camel_vee_data_cache_remove_subfolder (CamelVeeDataCache *data_cache,
 	g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
 	g_return_if_fail (CAMEL_IS_FOLDER (subfolder));
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
-	g_mutex_lock (data_cache->priv->sf_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->sf_mutex);
 
 	g_hash_table_foreach_remove (data_cache->priv->vee_message_uid_hash, remove_vee_by_folder_cb, subfolder);
 	g_hash_table_foreach_remove (data_cache->priv->orig_message_uid_hash, remove_orig_by_folder_cb, subfolder);
 	g_hash_table_remove (data_cache->priv->subfolder_hash, subfolder);
 
-	g_mutex_unlock (data_cache->priv->sf_mutex);
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->sf_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 }
 
 /**
@@ -541,7 +549,7 @@ camel_vee_data_cache_get_subfolder_data (CamelVeeDataCache *data_cache,
 	g_return_val_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache), NULL);
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 
-	g_mutex_lock (data_cache->priv->sf_mutex);
+	g_mutex_lock (&data_cache->priv->sf_mutex);
 
 	res = g_hash_table_lookup (data_cache->priv->subfolder_hash, folder);
 	if (!res) {
@@ -551,7 +559,7 @@ camel_vee_data_cache_get_subfolder_data (CamelVeeDataCache *data_cache,
 
 	g_object_ref (res);
 
-	g_mutex_unlock (data_cache->priv->sf_mutex);
+	g_mutex_unlock (&data_cache->priv->sf_mutex);
 
 	return res;
 }
@@ -578,7 +586,7 @@ camel_vee_data_cache_contains_message_info_data (CamelVeeDataCache *data_cache,
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
 	g_return_val_if_fail (orig_message_uid != NULL, FALSE);
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
 
 	/* make sure the orig_message_uid comes from the string pool */
 	vdata.folder = folder;
@@ -588,7 +596,7 @@ camel_vee_data_cache_contains_message_info_data (CamelVeeDataCache *data_cache,
 
 	camel_pstring_free (vdata.orig_message_uid);
 
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 
 	return res;
 }
@@ -612,7 +620,7 @@ camel_vee_data_cache_get_message_info_data (CamelVeeDataCache *data_cache,
 	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
 	g_return_val_if_fail (orig_message_uid != NULL, NULL);
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
 
 	/* make sure the orig_message_uid comes from the string pool */
 	vdata.folder = folder;
@@ -627,7 +635,7 @@ camel_vee_data_cache_get_message_info_data (CamelVeeDataCache *data_cache,
 		sf_data = camel_vee_data_cache_get_subfolder_data (data_cache, folder);
 		if (!sf_data) {
 			camel_pstring_free (vdata.orig_message_uid);
-			g_mutex_unlock (data_cache->priv->mi_mutex);
+			g_mutex_unlock (&data_cache->priv->mi_mutex);
 			g_return_val_if_fail (sf_data != NULL, NULL);
 		}
 
@@ -650,7 +658,7 @@ camel_vee_data_cache_get_message_info_data (CamelVeeDataCache *data_cache,
 	camel_pstring_free (vdata.orig_message_uid);
 	g_object_ref (res);
 
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 
 	return res;
 }
@@ -672,7 +680,7 @@ camel_vee_data_cache_get_message_info_data_by_vuid (CamelVeeDataCache *data_cach
 	g_return_val_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache), NULL);
 	g_return_val_if_fail (vee_message_uid != NULL, NULL);
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
 
 	/* make sure vee_message_uid comes from the string pool */
 	vuid = camel_pstring_strdup (vee_message_uid);
@@ -681,7 +689,7 @@ camel_vee_data_cache_get_message_info_data_by_vuid (CamelVeeDataCache *data_cach
 	if (res)
 		g_object_ref (res);
 
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 
 	camel_pstring_free (vuid);
 
@@ -733,7 +741,7 @@ camel_vee_data_cache_foreach_message_info_data (CamelVeeDataCache *data_cache,
 	g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
 	g_return_if_fail (func != NULL);
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
 
 	fmd.fromfolder = fromfolder;
 	fmd.func = func;
@@ -741,7 +749,7 @@ camel_vee_data_cache_foreach_message_info_data (CamelVeeDataCache *data_cache,
 
 	g_hash_table_foreach (data_cache->priv->orig_message_uid_hash, cvdc_foreach_mi_data_cb, &fmd);
 
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 }
 
 /**
@@ -762,7 +770,7 @@ camel_vee_data_cache_remove_message_info_data (CamelVeeDataCache *data_cache,
 	g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
 	g_return_if_fail (CAMEL_IS_VEE_MESSAGE_INFO_DATA (mi_data));
 
-	g_mutex_lock (data_cache->priv->mi_mutex);
+	g_mutex_lock (&data_cache->priv->mi_mutex);
 
 	g_object_ref (mi_data);
 
@@ -777,5 +785,5 @@ camel_vee_data_cache_remove_message_info_data (CamelVeeDataCache *data_cache,
 
 	g_object_unref (mi_data);
 
-	g_mutex_unlock (data_cache->priv->mi_mutex);
+	g_mutex_unlock (&data_cache->priv->mi_mutex);
 }
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 8b40a02..9e77460 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -62,9 +62,9 @@ struct _CamelVeeFolderPrivate {
 	GAsyncQueue *change_queue;
 	gboolean change_queue_busy;
 
-	GStaticRecMutex summary_lock;	/* for locking vfolder summary */
-	GStaticRecMutex subfolder_lock;	/* for locking the subfolder list */
-	GStaticRecMutex changed_lock;	/* for locking the folders-changed list */
+	GRecMutex summary_lock;	/* for locking vfolder summary */
+	GRecMutex subfolder_lock;	/* for locking the subfolder list */
+	GRecMutex changed_lock;	/* for locking the folders-changed list */
 
 	gchar *expression;	/* query expression */
 
@@ -593,9 +593,9 @@ vee_folder_finalize (GObject *object)
 
 	g_hash_table_foreach (vf->priv->skipped_changes, free_change_info_cb, NULL);
 
-	g_static_rec_mutex_free (&vf->priv->summary_lock);
-	g_static_rec_mutex_free (&vf->priv->subfolder_lock);
-	g_static_rec_mutex_free (&vf->priv->changed_lock);
+	g_rec_mutex_clear (&vf->priv->summary_lock);
+	g_rec_mutex_clear (&vf->priv->subfolder_lock);
+	g_rec_mutex_clear (&vf->priv->changed_lock);
 	g_hash_table_destroy (vf->priv->ignore_changed);
 	g_hash_table_destroy (vf->priv->skipped_changes);
 	g_hash_table_destroy (vf->priv->unmatched_add_changed);
@@ -1188,9 +1188,9 @@ camel_vee_folder_init (CamelVeeFolder *vee_folder)
 		CAMEL_MESSAGE_FLAGGED |
 		CAMEL_MESSAGE_SEEN;
 
-	g_static_rec_mutex_init (&vee_folder->priv->summary_lock);
-	g_static_rec_mutex_init (&vee_folder->priv->subfolder_lock);
-	g_static_rec_mutex_init (&vee_folder->priv->changed_lock);
+	g_rec_mutex_init (&vee_folder->priv->summary_lock);
+	g_rec_mutex_init (&vee_folder->priv->subfolder_lock);
+	g_rec_mutex_init (&vee_folder->priv->changed_lock);
 
 	vee_folder->priv->auto_update = TRUE;
 	vee_folder->priv->ignore_changed = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -1722,13 +1722,13 @@ camel_vee_folder_lock (CamelVeeFolder *folder,
 
 	switch (lock) {
 		case CAMEL_VEE_FOLDER_SUMMARY_LOCK:
-			g_static_rec_mutex_lock (&folder->priv->summary_lock);
+			g_rec_mutex_lock (&folder->priv->summary_lock);
 			break;
 		case CAMEL_VEE_FOLDER_SUBFOLDER_LOCK:
-			g_static_rec_mutex_lock (&folder->priv->subfolder_lock);
+			g_rec_mutex_lock (&folder->priv->subfolder_lock);
 			break;
 		case CAMEL_VEE_FOLDER_CHANGED_LOCK:
-			g_static_rec_mutex_lock (&folder->priv->changed_lock);
+			g_rec_mutex_lock (&folder->priv->changed_lock);
 			break;
 		default:
 			g_return_if_reached ();
@@ -1752,13 +1752,13 @@ camel_vee_folder_unlock (CamelVeeFolder *folder,
 
 	switch (lock) {
 		case CAMEL_VEE_FOLDER_SUMMARY_LOCK:
-			g_static_rec_mutex_unlock (&folder->priv->summary_lock);
+			g_rec_mutex_unlock (&folder->priv->summary_lock);
 			break;
 		case CAMEL_VEE_FOLDER_SUBFOLDER_LOCK:
-			g_static_rec_mutex_unlock (&folder->priv->subfolder_lock);
+			g_rec_mutex_unlock (&folder->priv->subfolder_lock);
 			break;
 		case CAMEL_VEE_FOLDER_CHANGED_LOCK:
-			g_static_rec_mutex_unlock (&folder->priv->changed_lock);
+			g_rec_mutex_unlock (&folder->priv->changed_lock);
 			break;
 		default:
 			g_return_if_reached ();
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 077b27d..5cd8a63 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -62,10 +62,10 @@ struct _CamelVeeStorePrivate
 	CamelVeeFolder *unmatched_folder;
 	gboolean unmatched_enabled;
 
-	GMutex *sf_counts_mutex;
+	GMutex sf_counts_mutex;
 	GHashTable *subfolder_usage_counts; /* CamelFolder * (subfolder) => gint of usages, for unmatched_folder */
 
-	GMutex *vu_counts_mutex;
+	GMutex vu_counts_mutex;
 	GHashTable *vuid_usage_counts; /* gchar * (vuid) => gint of usages, those with 0 comes to unmatched_folder */
 };
 
@@ -121,8 +121,8 @@ vee_store_finalize (GObject *object)
 	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_free (vee_store->priv->sf_counts_mutex);
-	g_mutex_free (vee_store->priv->vu_counts_mutex);
+	g_mutex_clear (&vee_store->priv->sf_counts_mutex);
+	g_mutex_clear (&vee_store->priv->vu_counts_mutex);
 
 	/* Chain up to parent's finalize () method. */
 	G_OBJECT_CLASS (camel_vee_store_parent_class)->finalize (object);
@@ -148,8 +148,8 @@ vee_store_constructed (GObject *object)
 		vee_store->priv->unmatched_folder, CAMEL_STORE_FOLDER_PRIVATE);
 	vee_store->priv->subfolder_usage_counts = g_hash_table_new (g_direct_hash, g_direct_equal);
 	vee_store->priv->vuid_usage_counts = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify) camel_pstring_free, NULL);
-	vee_store->priv->sf_counts_mutex = g_mutex_new ();
-	vee_store->priv->vu_counts_mutex = g_mutex_new ();
+	g_mutex_init (&vee_store->priv->sf_counts_mutex);
+	g_mutex_init (&vee_store->priv->vu_counts_mutex);
 }
 
 static void
@@ -691,7 +691,7 @@ camel_vee_store_note_subfolder_used (CamelVeeStore *vstore,
 	    used_by == vstore->priv->unmatched_folder)
 		return;
 
-	g_mutex_lock (vstore->priv->sf_counts_mutex);
+	g_mutex_lock (&vstore->priv->sf_counts_mutex);
 
 	counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->subfolder_usage_counts, subfolder));
 	counts++;
@@ -705,7 +705,7 @@ camel_vee_store_note_subfolder_used (CamelVeeStore *vstore,
 
 		camel_vee_data_cache_add_subfolder (vstore->priv->vee_data_cache, subfolder);
 
-		g_mutex_lock (vstore->priv->vu_counts_mutex);
+		g_mutex_lock (&vstore->priv->vu_counts_mutex);
 
 		/* all messages from the folder are unmatched at the beginning */
 		atud.unmatched_folder = vstore->priv->unmatched_folder;
@@ -724,14 +724,14 @@ camel_vee_store_note_subfolder_used (CamelVeeStore *vstore,
 			add_to_unmatched_folder_cb, &atud);
 
 		camel_folder_thaw (unmatched_folder);
-		g_mutex_unlock (vstore->priv->vu_counts_mutex);
+		g_mutex_unlock (&vstore->priv->vu_counts_mutex);
 
 		if (camel_folder_change_info_changed (atud.changes))
 			camel_folder_changed (unmatched_folder, atud.changes);
 		camel_folder_change_info_free (atud.changes);
 	}
 
-	g_mutex_unlock (vstore->priv->sf_counts_mutex);
+	g_mutex_unlock (&vstore->priv->sf_counts_mutex);
 }
 
 static void
@@ -770,7 +770,7 @@ camel_vee_store_note_subfolder_unused (CamelVeeStore *vstore,
 	    unused_by == vstore->priv->unmatched_folder)
 		return;
 
-	g_mutex_lock (vstore->priv->sf_counts_mutex);
+	g_mutex_lock (&vstore->priv->sf_counts_mutex);
 
 	counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->subfolder_usage_counts, subfolder));
 	g_return_if_fail (counts > 0);
@@ -781,10 +781,10 @@ camel_vee_store_note_subfolder_unused (CamelVeeStore *vstore,
 		if (camel_vee_store_get_unmatched_enabled (vstore))
 			camel_vee_folder_remove_folder (vstore->priv->unmatched_folder, subfolder, NULL);
 
-		g_mutex_lock (vstore->priv->vu_counts_mutex);
+		g_mutex_lock (&vstore->priv->vu_counts_mutex);
 		camel_vee_data_cache_foreach_message_info_data (vstore->priv->vee_data_cache, subfolder,
 			remove_vuid_count_record_cb, vstore->priv->vuid_usage_counts);
-		g_mutex_unlock (vstore->priv->vu_counts_mutex);
+		g_mutex_unlock (&vstore->priv->vu_counts_mutex);
 
 		camel_vee_data_cache_remove_subfolder (vstore->priv->vee_data_cache, subfolder);
 	} else {
@@ -793,7 +793,7 @@ camel_vee_store_note_subfolder_unused (CamelVeeStore *vstore,
 			subfolder, GINT_TO_POINTER (counts));
 	}
 
-	g_mutex_unlock (vstore->priv->sf_counts_mutex);
+	g_mutex_unlock (&vstore->priv->sf_counts_mutex);
 }
 
 /**
@@ -827,7 +827,7 @@ camel_vee_store_note_vuid_used (CamelVeeStore *vstore,
 	if (CAMEL_IS_VEE_FOLDER (subfolder))
 		return;
 
-	g_mutex_lock (vstore->priv->vu_counts_mutex);
+	g_mutex_lock (&vstore->priv->vu_counts_mutex);
 
 	vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
 
@@ -850,7 +850,7 @@ camel_vee_store_note_vuid_used (CamelVeeStore *vstore,
 		camel_folder_change_info_free (changes);
 	}
 
-	g_mutex_unlock (vstore->priv->vu_counts_mutex);
+	g_mutex_unlock (&vstore->priv->vu_counts_mutex);
 }
 
 /**
@@ -884,14 +884,14 @@ camel_vee_store_note_vuid_unused (CamelVeeStore *vstore,
 	if (CAMEL_IS_VEE_FOLDER (subfolder))
 		return;
 
-	g_mutex_lock (vstore->priv->vu_counts_mutex);
+	g_mutex_lock (&vstore->priv->vu_counts_mutex);
 
 	vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
 
 	counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->vuid_usage_counts, vuid));
 	counts--;
 	if (counts < 0) {
-		g_mutex_unlock (vstore->priv->vu_counts_mutex);
+		g_mutex_unlock (&vstore->priv->vu_counts_mutex);
 		g_return_if_fail (counts >= 0);
 		return;
 	}
@@ -913,7 +913,7 @@ camel_vee_store_note_vuid_unused (CamelVeeStore *vstore,
 		camel_folder_change_info_free (changes);
 	}
 
-	g_mutex_unlock (vstore->priv->vu_counts_mutex);
+	g_mutex_unlock (&vstore->priv->vu_counts_mutex);
 }
 
 struct RebuildUnmatchedData {
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index aca7ee5..4584413 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -95,7 +95,7 @@ camel_imap_command (CamelImapStore *store,
 	va_list ap;
 	gchar *cmd;
 
-	g_static_rec_mutex_lock (&store->command_and_response_lock);
+	g_rec_mutex_lock (&store->command_and_response_lock);
 
 	if (fmt) {
 		va_start (ap, fmt);
@@ -115,7 +115,7 @@ camel_imap_command (CamelImapStore *store,
 
 	if (!imap_command_start (store, folder, cmd, cancellable, error)) {
 		g_free (cmd);
-		g_static_rec_mutex_unlock (&store->command_and_response_lock);
+		g_rec_mutex_unlock (&store->command_and_response_lock);
 		return NULL;
 	}
 	g_free (cmd);
@@ -173,12 +173,12 @@ camel_imap_command_start (CamelImapStore *store,
 	cmd = imap_command_strdup_vprintf (store, fmt, ap);
 	va_end (ap);
 
-	g_static_rec_mutex_lock (&store->command_and_response_lock);
+	g_rec_mutex_lock (&store->command_and_response_lock);
 	ok = imap_command_start (store, folder, cmd, cancellable, error);
 	g_free (cmd);
 
 	if (!ok)
-		g_static_rec_mutex_unlock (&store->command_and_response_lock);
+		g_rec_mutex_unlock (&store->command_and_response_lock);
 
 	return ok;
 }
@@ -314,7 +314,7 @@ camel_imap_command_continuation (CamelImapStore *store,
 		 * the cancellable cancelled, thus there will be no I/O */
 		camel_service_disconnect_sync (
 			CAMEL_SERVICE (store), FALSE, NULL, NULL);
-		g_static_rec_mutex_unlock (&store->command_and_response_lock);
+		g_rec_mutex_unlock (&store->command_and_response_lock);
 		return NULL;
 	}
 
@@ -366,7 +366,7 @@ camel_imap_command_response (CamelImapStore *store,
 	g_object_unref (settings);
 
 	if (camel_imap_store_readline (store, &respbuf, cancellable, error) < 0) {
-		g_static_rec_mutex_unlock (&store->command_and_response_lock);
+		g_rec_mutex_unlock (&store->command_and_response_lock);
 		type = CAMEL_IMAP_RESPONSE_ERROR;
 		goto exit;
 	}
@@ -447,7 +447,7 @@ camel_imap_command_response (CamelImapStore *store,
 
 	if (type == CAMEL_IMAP_RESPONSE_ERROR ||
 	    type == CAMEL_IMAP_RESPONSE_TAGGED)
-		g_static_rec_mutex_unlock (&store->command_and_response_lock);
+		g_rec_mutex_unlock (&store->command_and_response_lock);
 
 exit:
 	g_free (host);
@@ -471,7 +471,7 @@ imap_read_response (CamelImapStore *store,
 	 * we're still locked. This lock is owned by response
 	 * and gets unlocked when response is freed.
 	 */
-	g_static_rec_mutex_lock (&store->command_and_response_lock);
+	g_rec_mutex_lock (&store->command_and_response_lock);
 
 	response = g_new0 (CamelImapResponse, 1);
 /*FIXME	if (store->current_folder && camel_disco_store_status (CAMEL_DISCO_STORE (store)) != CAMEL_DISCO_STORE_RESYNCING) {
@@ -749,7 +749,7 @@ camel_imap_response_free (CamelImapStore *store,
 	}
 
 	g_free (response);
-	g_static_rec_mutex_unlock (&store->command_and_response_lock);
+	g_rec_mutex_unlock (&store->command_and_response_lock);
 }
 
 /**
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 21aa6e0..3a09c07 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -270,8 +270,8 @@ imap_folder_finalize (GObject *object)
 
 	imap_folder = CAMEL_IMAP_FOLDER (object);
 
-	g_static_mutex_free (&imap_folder->priv->search_lock);
-	g_static_rec_mutex_free (&imap_folder->priv->cache_lock);
+	g_mutex_clear (&imap_folder->priv->search_lock);
+	g_rec_mutex_clear (&imap_folder->priv->cache_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_imap_folder_parent_class)->finalize (object);
@@ -382,8 +382,8 @@ camel_imap_folder_init (CamelImapFolder *imap_folder)
 
 	folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
 
-	g_static_mutex_init (&imap_folder->priv->search_lock);
-	g_static_rec_mutex_init (&imap_folder->priv->cache_lock);
+	g_mutex_init (&imap_folder->priv->search_lock);
+	g_rec_mutex_init (&imap_folder->priv->cache_lock);
 	imap_folder->priv->ignore_recent = NULL;
 
 	imap_folder->journal = NULL;
diff --git a/camel/providers/imap/camel-imap-private.h b/camel/providers/imap/camel-imap-private.h
index 0ca3728..16ed3c3 100644
--- a/camel/providers/imap/camel-imap-private.h
+++ b/camel/providers/imap/camel-imap-private.h
@@ -11,30 +11,30 @@
 G_BEGIN_DECLS
 
 struct _CamelImapFolderPrivate {
-	GStaticMutex search_lock;	/* for locking the search object */
-	GStaticRecMutex cache_lock;	/* for locking the cache object */
+	GMutex search_lock;		/* for locking the search object */
+	GRecMutex cache_lock;		/* for locking the cache object */
 	GHashTable *ignore_recent;	/* hash table of UIDs to ignore as recent when updating folder */
 	gboolean check_folder;		/* persistent property */
 	gboolean apply_filters;		/* persistent property */
 };
 
 #define CAMEL_IMAP_FOLDER_LOCK(f, l) \
-	(g_static_mutex_lock (&((CamelImapFolder *) f)->priv->l))
+	(g_mutex_lock (&((CamelImapFolder *) f)->priv->l))
 #define CAMEL_IMAP_FOLDER_UNLOCK(f, l) \
-	(g_static_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
+	(g_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
 #define CAMEL_IMAP_FOLDER_REC_LOCK(f, l) \
-	(g_static_rec_mutex_lock (&((CamelImapFolder *) f)->priv->l))
+	(g_rec_mutex_lock (&((CamelImapFolder *) f)->priv->l))
 #define CAMEL_IMAP_FOLDER_REC_UNLOCK(f, l) \
-	(g_static_rec_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
+	(g_rec_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
 
 struct _CamelImapWrapperPrivate {
-	GMutex *lock;
+	GMutex lock;
 };
 
 #define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
-	(g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+	(g_mutex_lock (&((CamelImapWrapper *) f)->priv->l))
 #define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
-	(g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
+	(g_mutex_unlock (&((CamelImapWrapper *) f)->priv->l))
 
 G_END_DECLS
 
diff --git a/camel/providers/imap/camel-imap-settings.c b/camel/providers/imap/camel-imap-settings.c
index c26ff16..54d45f5 100644
--- a/camel/providers/imap/camel-imap-settings.c
+++ b/camel/providers/imap/camel-imap-settings.c
@@ -23,7 +23,7 @@
 	((obj), CAMEL_TYPE_IMAP_SETTINGS, CamelImapSettingsPrivate))
 
 struct _CamelImapSettingsPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *namespace;
 	gchar *shell_command;
 	gchar *real_junk_path;
@@ -378,7 +378,7 @@ imap_settings_finalize (GObject *object)
 
 	priv = CAMEL_IMAP_SETTINGS_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->namespace);
 	g_free (priv->shell_command);
@@ -631,7 +631,7 @@ static void
 camel_imap_settings_init (CamelImapSettings *settings)
 {
 	settings->priv = CAMEL_IMAP_SETTINGS_GET_PRIVATE (settings);
-	settings->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&settings->priv->property_lock);
 
 	/* The default namespace is an empty string. */
 	settings->priv->namespace = g_strdup ("");
@@ -811,12 +811,12 @@ camel_imap_settings_dup_fetch_headers_extra (CamelImapSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imap_settings_get_fetch_headers_extra (settings);
 	duplicate = g_strdupv ((gchar **) protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -857,12 +857,12 @@ camel_imap_settings_set_fetch_headers_extra (CamelImapSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_IMAP_SETTINGS (settings));
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (fetch_headers_equal (
 		(const gchar * const *) settings->priv->fetch_headers_extra,
 		fetch_headers_extra)) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
@@ -870,7 +870,7 @@ camel_imap_settings_set_fetch_headers_extra (CamelImapSettings *settings,
 	settings->priv->fetch_headers_extra =
 		g_strdupv ((gchar **) fetch_headers_extra);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "fetch-headers-extra");
 }
@@ -1041,12 +1041,12 @@ camel_imap_settings_dup_namespace (CamelImapSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imap_settings_get_namespace (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1071,17 +1071,17 @@ camel_imap_settings_set_namespace (CamelImapSettings *settings,
 	if (namespace == NULL)
 		namespace = "";
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->namespace, namespace) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->namespace);
 	settings->priv->namespace = g_strdup (namespace);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "namespace");
 }
@@ -1126,12 +1126,12 @@ camel_imap_settings_dup_real_junk_path (CamelImapSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imap_settings_get_real_junk_path (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1156,17 +1156,17 @@ camel_imap_settings_set_real_junk_path (CamelImapSettings *settings,
 	if (real_junk_path != NULL && *real_junk_path == '\0')
 		real_junk_path = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->real_junk_path, real_junk_path) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->real_junk_path);
 	settings->priv->real_junk_path = g_strdup (real_junk_path);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "real-junk-path");
 }
@@ -1211,12 +1211,12 @@ camel_imap_settings_dup_real_trash_path (CamelImapSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imap_settings_get_real_trash_path (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1241,17 +1241,17 @@ camel_imap_settings_set_real_trash_path (CamelImapSettings *settings,
 	if (real_trash_path != NULL && *real_trash_path == '\0')
 		real_trash_path = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->real_trash_path, real_trash_path) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->real_trash_path);
 	settings->priv->real_trash_path = g_strdup (real_trash_path);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "real-trash-path");
 }
@@ -1302,12 +1302,12 @@ camel_imap_settings_dup_shell_command (CamelImapSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_imap_settings_get_shell_command (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -1338,17 +1338,17 @@ camel_imap_settings_set_shell_command (CamelImapSettings *settings,
 	if (shell_command != NULL && *shell_command == '\0')
 		shell_command = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->shell_command, shell_command) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->shell_command);
 	settings->priv->shell_command = g_strdup (shell_command);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "shell-command");
 }
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 0bd0700..e4656e2 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -797,7 +797,7 @@ imap_store_finalize (GObject *object)
 {
 	CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
 
-	g_static_rec_mutex_free (&imap_store->command_and_response_lock);
+	g_rec_mutex_clear (&imap_store->command_and_response_lock);
 	g_hash_table_destroy (imap_store->known_alerts);
 
 	/* Chain up to parent's finalize() method. */
@@ -1567,7 +1567,7 @@ camel_subscribable_init (CamelSubscribableInterface *interface)
 static void
 camel_imap_store_init (CamelImapStore *imap_store)
 {
-	g_static_rec_mutex_init (&imap_store->command_and_response_lock);
+	g_rec_mutex_init (&imap_store->command_and_response_lock);
 
 	imap_store->istream = NULL;
 	imap_store->ostream = NULL;
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index d4f8c12..e38c4ae 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -81,7 +81,7 @@ struct _CamelImapStore {
 	CamelImapStorePrivate *priv;
 
 	/* For processing IMAP commands and responses. */
-	GStaticRecMutex command_and_response_lock;
+	GRecMutex command_and_response_lock;
 
 	CamelStream *istream;
 	CamelStream *ostream;
diff --git a/camel/providers/imap/camel-imap-wrapper.c b/camel/providers/imap/camel-imap-wrapper.c
index 04191ed..82c315f 100644
--- a/camel/providers/imap/camel-imap-wrapper.c
+++ b/camel/providers/imap/camel-imap-wrapper.c
@@ -36,13 +36,13 @@
 	((obj), CAMEL_TYPE_IMAP_WRAPPER, CamelImapWrapperPrivate))
 
 struct _CamelImapWrapperPrivate {
-	GMutex *lock;
+	GMutex lock;
 };
 
 #define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
-	(g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+	(g_mutex_lock (&((CamelImapWrapper *) f)->priv->l))
 #define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
-	(g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
+	(g_mutex_unlock (&((CamelImapWrapper *) f)->priv->l))
 
 G_DEFINE_TYPE (CamelImapWrapper, camel_imap_wrapper, CAMEL_TYPE_DATA_WRAPPER)
 
@@ -94,7 +94,7 @@ imap_wrapper_finalize (GObject *object)
 	g_free (imap_wrapper->uid);
 	g_free (imap_wrapper->part_spec);
 
-	g_mutex_free (imap_wrapper->priv->lock);
+	g_mutex_clear (&imap_wrapper->priv->lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_imap_wrapper_parent_class)->finalize (object);
@@ -156,7 +156,7 @@ static void
 camel_imap_wrapper_init (CamelImapWrapper *imap_wrapper)
 {
 	imap_wrapper->priv = CAMEL_IMAP_WRAPPER_GET_PRIVATE (imap_wrapper);
-	imap_wrapper->priv->lock = g_mutex_new ();
+	g_mutex_init (&imap_wrapper->priv->lock);
 }
 
 CamelDataWrapper *
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 1547b43..8e414b9 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -145,7 +145,7 @@ local_folder_finalize (GObject *object)
 
 	camel_folder_change_info_free (local_folder->changes);
 
-	g_mutex_free (local_folder->priv->search_lock);
+	g_mutex_clear (&local_folder->priv->search_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_local_folder_parent_class)->finalize (object);
@@ -508,7 +508,7 @@ camel_local_folder_init (CamelLocalFolder *local_folder)
 	CamelFolder *folder = CAMEL_FOLDER (local_folder);
 
 	local_folder->priv = CAMEL_LOCAL_FOLDER_GET_PRIVATE (local_folder);
-	local_folder->priv->search_lock = g_mutex_new ();
+	g_mutex_init (&local_folder->priv->search_lock);
 
 	folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
 
diff --git a/camel/providers/local/camel-local-private.h b/camel/providers/local/camel-local-private.h
index 9121b28..4c32bf0 100644
--- a/camel/providers/local/camel-local-private.h
+++ b/camel/providers/local/camel-local-private.h
@@ -35,13 +35,13 @@
 G_BEGIN_DECLS
 
 struct _CamelLocalFolderPrivate {
-	GMutex *search_lock;	/* for locking the search object */
+	GMutex search_lock;	/* for locking the search object */
 };
 
 #define CAMEL_LOCAL_FOLDER_LOCK(f, l) \
-	(g_mutex_lock (((CamelLocalFolder *) f)->priv->l))
+	(g_mutex_lock (&((CamelLocalFolder *) f)->priv->l))
 #define CAMEL_LOCAL_FOLDER_UNLOCK(f, l) \
-	(g_mutex_unlock (((CamelLocalFolder *) f)->priv->l))
+	(g_mutex_unlock (&((CamelLocalFolder *) f)->priv->l))
 
 gint		camel_local_frompos_sort	(gpointer enc,
 						 gint len1,
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 9b51054..46f1e56 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -68,7 +68,7 @@ struct _CamelMaildirSummaryPrivate {
 	gchar *hostname;
 
 	GHashTable *load_map;
-	GMutex *summary_lock;
+	GMutex summary_lock;
 };
 
 G_DEFINE_TYPE (CamelMaildirSummary, camel_maildir_summary, CAMEL_TYPE_LOCAL_SUMMARY)
@@ -81,7 +81,7 @@ maildir_summary_finalize (GObject *object)
 	priv = CAMEL_MAILDIR_SUMMARY_GET_PRIVATE (object);
 
 	g_free (priv->hostname);
-	g_mutex_free (priv->summary_lock);
+	g_mutex_clear (&priv->summary_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_maildir_summary_parent_class)->finalize (object);
@@ -135,7 +135,7 @@ camel_maildir_summary_init (CamelMaildirSummary *maildir_summary)
 	} else {
 		maildir_summary->priv->hostname = g_strdup ("localhost");
 	}
-	maildir_summary->priv->summary_lock = g_mutex_new ();
+	g_mutex_init (&maildir_summary->priv->summary_lock);
 }
 
 /**
@@ -547,7 +547,7 @@ maildir_summary_check (CamelLocalSummary *cls,
 	struct _remove_data rd = { cls, changes };
 	GPtrArray *known_uids;
 
-	g_mutex_lock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+	g_mutex_lock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
 
 	new = g_strdup_printf ("%s/new", cls->folder_path);
 	cur = g_strdup_printf ("%s/cur", cls->folder_path);
@@ -569,7 +569,7 @@ maildir_summary_check (CamelLocalSummary *cls,
 		g_free (cur);
 		g_free (new);
 		camel_operation_pop_message (cancellable);
-		g_mutex_unlock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+		g_mutex_unlock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
 		return -1;
 	}
 
@@ -717,7 +717,7 @@ maildir_summary_check (CamelLocalSummary *cls,
 	g_free (cur);
 
 	camel_folder_summary_free_array (known_uids);
-	g_mutex_unlock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+	g_mutex_unlock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
 
 	return 0;
 }
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 5894ade..f1604f1 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -133,8 +133,8 @@ nntp_folder_finalize (GObject *object)
 {
 	CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (object);
 
-	g_mutex_free (nntp_folder->priv->search_lock);
-	g_mutex_free (nntp_folder->priv->cache_lock);
+	g_mutex_clear (&nntp_folder->priv->search_lock);
+	g_mutex_clear (&nntp_folder->priv->cache_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (camel_nntp_folder_parent_class)->finalize (object);
@@ -747,8 +747,8 @@ camel_nntp_folder_init (CamelNNTPFolder *nntp_folder)
 	nntp_folder->priv = CAMEL_NNTP_FOLDER_GET_PRIVATE (nntp_folder);
 
 	nntp_folder->changes = camel_folder_change_info_new ();
-	nntp_folder->priv->search_lock = g_mutex_new ();
-	nntp_folder->priv->cache_lock = g_mutex_new ();
+	g_mutex_init (&nntp_folder->priv->search_lock);
+	g_mutex_init (&nntp_folder->priv->cache_lock);
 }
 
 CamelFolder *
diff --git a/camel/providers/nntp/camel-nntp-private.h b/camel/providers/nntp/camel-nntp-private.h
index 6a0bd7a..0dfea18 100644
--- a/camel/providers/nntp/camel-nntp-private.h
+++ b/camel/providers/nntp/camel-nntp-private.h
@@ -32,22 +32,17 @@
 
 G_BEGIN_DECLS
 
-#define CAMEL_NNTP_STORE_LOCK(f, l) \
-	(e_mutex_lock (((CamelNNTPStore *) f)->priv->l))
-#define CAMEL_NNTP_STORE_UNLOCK(f, l) \
-	(e_mutex_unlock (((CamelNNTPStore *) f)->priv->l))
-
 struct _CamelNNTPFolderPrivate {
-	GMutex *search_lock;	/* for locking the search object */
-	GMutex *cache_lock;     /* for locking the cache object */
+	GMutex search_lock;	/* for locking the search object */
+	GMutex cache_lock;     /* for locking the cache object */
 
 	gboolean apply_filters;		/* persistent property */
 };
 
 #define CAMEL_NNTP_FOLDER_LOCK(f, l) \
-	(g_mutex_lock (((CamelNNTPFolder *) f)->priv->l))
+	(g_mutex_lock (&((CamelNNTPFolder *) f)->priv->l))
 #define CAMEL_NNTP_FOLDER_UNLOCK(f, l) \
-	(g_mutex_unlock (((CamelNNTPFolder *) f)->priv->l))
+	(g_mutex_unlock (&((CamelNNTPFolder *) f)->priv->l))
 
 G_END_DECLS
 
diff --git a/camel/providers/sendmail/camel-sendmail-settings.c b/camel/providers/sendmail/camel-sendmail-settings.c
index 5c3d753..e5221d3 100644
--- a/camel/providers/sendmail/camel-sendmail-settings.c
+++ b/camel/providers/sendmail/camel-sendmail-settings.c
@@ -23,7 +23,7 @@
 	((obj), CAMEL_TYPE_SENDMAIL_SETTINGS, CamelSendmailSettingsPrivate))
 
 struct _CamelSendmailSettingsPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *custom_binary;
 	gchar *custom_args;
 
@@ -122,7 +122,7 @@ sendmail_settings_finalize (GObject *object)
 
 	priv = CAMEL_SENDMAIL_SETTINGS_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->custom_binary);
 	g_free (priv->custom_args);
@@ -196,7 +196,7 @@ static void
 camel_sendmail_settings_init (CamelSendmailSettings *settings)
 {
 	settings->priv = CAMEL_SENDMAIL_SETTINGS_GET_PRIVATE (settings);
-	settings->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&settings->priv->property_lock);
 }
 
 /**
@@ -320,12 +320,12 @@ camel_sendmail_settings_dup_custom_binary (CamelSendmailSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_SENDMAIL_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_sendmail_settings_get_custom_binary (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -349,17 +349,17 @@ camel_sendmail_settings_set_custom_binary (CamelSendmailSettings *settings,
 	if (custom_binary && !*custom_binary)
 		custom_binary = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->custom_binary, custom_binary) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->custom_binary);
 	settings->priv->custom_binary = g_strdup (custom_binary);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "custom-binary");
 }
@@ -403,12 +403,12 @@ camel_sendmail_settings_dup_custom_args (CamelSendmailSettings *settings)
 
 	g_return_val_if_fail (CAMEL_IS_SENDMAIL_SETTINGS (settings), NULL);
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	protected = camel_sendmail_settings_get_custom_args (settings);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	return duplicate;
 }
@@ -432,17 +432,17 @@ camel_sendmail_settings_set_custom_args (CamelSendmailSettings *settings,
 	if (custom_args && !*custom_args)
 		custom_args = NULL;
 
-	g_mutex_lock (settings->priv->property_lock);
+	g_mutex_lock (&settings->priv->property_lock);
 
 	if (g_strcmp0 (settings->priv->custom_args, custom_args) == 0) {
-		g_mutex_unlock (settings->priv->property_lock);
+		g_mutex_unlock (&settings->priv->property_lock);
 		return;
 	}
 
 	g_free (settings->priv->custom_args);
 	settings->priv->custom_args = g_strdup (custom_args);
 
-	g_mutex_unlock (settings->priv->property_lock);
+	g_mutex_unlock (&settings->priv->property_lock);
 
 	g_object_notify (G_OBJECT (settings), "custom-args");
 }
diff --git a/camel/tests/folder/test10.c b/camel/tests/folder/test10.c
index 3fef140..1e3e00e 100644
--- a/camel/tests/folder/test10.c
+++ b/camel/tests/folder/test10.c
@@ -87,11 +87,7 @@ main (gint argc,
 			for (i = 0; i < MAX_THREADS; i++) {
 				GError *error = NULL;
 
-				threads[i] = g_thread_create (worker, NULL, TRUE, &error);
-				if (error) {
-					fprintf (stderr, "%s: Failed to create a thread: %s\n", G_STRFUNC, error->message);
-					g_error_free (error);
-				}
+				threads[i] = g_thread_new (NULL, worker, NULL);
 			}
 
 			for (i = 0; i < MAX_THREADS; i++) {
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
index e35a135..1feedaa 100644
--- a/camel/tests/folder/test8.c
+++ b/camel/tests/folder/test8.c
@@ -179,11 +179,7 @@ gint main (gint argc, gchar **argv)
 				info->id = i * MAX_MESSAGES;
 				info->folder = folder;
 
-				threads[i] = g_thread_create (worker, info, TRUE, &error);
-				if (error) {
-					fprintf (stderr, "%s: Failed to create a thread: %s\n", G_STRFUNC, error->message);
-					g_error_free (error);
-				}
+				threads[i] = g_thread_new (NULL, worker, info);
 			}
 
 			for (i = 0; i < MAX_THREADS; i++) {
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
index 27837ce..280a455 100644
--- a/camel/tests/lib/camel-test.c
+++ b/camel/tests/lib/camel-test.c
@@ -12,9 +12,9 @@
 /* well i dunno, doesn't seem to be in the headers but hte manpage mentions it */
 /* a nonportable checking mutex for glibc, not really needed, just validates
  * the test harness really */
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define CAMEL_TEST_LOCK g_static_mutex_lock(&lock)
-#define CAMEL_TEST_UNLOCK g_static_mutex_unlock(&lock)
+static GMutex lock;
+#define CAMEL_TEST_LOCK g_mutex_lock(&lock)
+#define CAMEL_TEST_UNLOCK g_mutex_unlock(&lock)
 #define CAMEL_TEST_ID (g_thread_self())
 
 static gint setup;
diff --git a/configure.ac b/configure.ac
index 8a0623c..b7a7ba1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ AC_SUBST(SOURCES_DBUS_SERVICE_NAME)
 dnl ******************************
 dnl Libtool versioning
 dnl ******************************
-LIBEDATASERVER_CURRENT=17
+LIBEDATASERVER_CURRENT=18
 LIBEDATASERVER_REVISION=0
 LIBEDATASERVER_AGE=0
 
@@ -111,7 +111,7 @@ LIBEBOOK_CURRENT=17
 LIBEBOOK_REVISION=1
 LIBEBOOK_AGE=3
 
-LIBCAMEL_CURRENT=41
+LIBCAMEL_CURRENT=42
 LIBCAMEL_REVISION=0
 LIBCAMEL_AGE=0
 
@@ -179,6 +179,12 @@ dnl	-Wshadow
 dnl	-Wstrict-aliasing=2
 
 AM_CPPFLAGS="$WARNING_FLAGS -fno-strict-aliasing"
+
+dnl Be strict when compiling with .git subdirectory
+if test -d .git ; then
+	AM_CPPFLAGS="$AM_CPPFLAGS -DG_DISABLE_DEPRECATED"
+fi
+
 AC_SUBST(AM_CPPFLAGS)
 
 dnl ******************************
diff --git a/libebackend/e-authentication-mediator.c b/libebackend/e-authentication-mediator.c
index dea9b2d..3ffb8c1 100644
--- a/libebackend/e-authentication-mediator.c
+++ b/libebackend/e-authentication-mediator.c
@@ -61,7 +61,7 @@ struct _EAuthenticationMediatorPrivate {
 
 	ThreadClosure *thread_closure;
 
-	GMutex *shared_data_lock;
+	GMutex shared_data_lock;
 
 	GQueue try_password_queue;
 	GQueue wait_for_client_queue;
@@ -89,8 +89,8 @@ struct _ThreadClosure {
 	GWeakRef mediator;
 	GMainContext *main_context;
 	GMainLoop *main_loop;
-	GCond *main_loop_cond;
-	GMutex *main_loop_mutex;
+	GCond main_loop_cond;
+	GMutex main_loop_mutex;
 	GError *export_error;
 };
 
@@ -147,8 +147,8 @@ thread_closure_new (EAuthenticationMediator *mediator)
 	 * we wait for the main loop to start running as a way of
 	 * synchronizing with the manager thread. */
 	closure->main_loop = g_main_loop_new (closure->main_context, FALSE);
-	closure->main_loop_cond = g_cond_new ();
-	closure->main_loop_mutex = g_mutex_new ();
+	g_cond_init (&closure->main_loop_cond);
+	g_mutex_init (&closure->main_loop_mutex);
 
 	return closure;
 }
@@ -174,8 +174,8 @@ thread_closure_unref (ThreadClosure *closure)
 		g_weak_ref_set (&closure->mediator, NULL);
 		g_main_context_unref (closure->main_context);
 		g_main_loop_unref (closure->main_loop);
-		g_cond_free (closure->main_loop_cond);
-		g_mutex_free (closure->main_loop_mutex);
+		g_cond_clear (&closure->main_loop_cond);
+		g_mutex_clear (&closure->main_loop_mutex);
 
 		g_slice_free (ThreadClosure, closure);
 	}
@@ -192,7 +192,7 @@ authentication_mediator_name_vanished_cb (GDBusConnection *connection,
 
 	mediator = E_AUTHENTICATION_MEDIATOR (user_data);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	mediator->priv->client_vanished = TRUE;
 
@@ -221,7 +221,7 @@ authentication_mediator_name_vanished_cb (GDBusConnection *connection,
 	g_bus_unwatch_name (mediator->priv->watcher_id);
 	mediator->priv->watcher_id = 0;
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 }
 
 static void
@@ -285,7 +285,7 @@ authentication_mediator_handle_ready (EDBusAuthenticator *interface,
 	mediator = g_weak_ref_get (&closure->mediator);
 	g_return_val_if_fail (mediator != NULL, FALSE);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	mediator->priv->client_is_ready = TRUE;
 
@@ -300,7 +300,7 @@ authentication_mediator_handle_ready (EDBusAuthenticator *interface,
 		g_object_unref (simple);
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	e_dbus_authenticator_complete_ready (interface, invocation);
 
@@ -321,7 +321,7 @@ authentication_mediator_handle_cancel (EDBusAuthenticator *interface,
 	mediator = g_weak_ref_get (&closure->mediator);
 	g_return_val_if_fail (mediator != NULL, FALSE);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	mediator->priv->client_cancelled = TRUE;
 
@@ -347,7 +347,7 @@ authentication_mediator_handle_cancel (EDBusAuthenticator *interface,
 		g_object_unref (simple);
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	e_dbus_authenticator_complete_cancel (interface, invocation);
 
@@ -368,7 +368,7 @@ authentication_mediator_handle_accepted (EDBusAuthenticator *interface,
 	mediator = g_weak_ref_get (&closure->mediator);
 	g_return_val_if_fail (mediator != NULL, FALSE);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	queue = &mediator->priv->try_password_queue;
 
@@ -381,7 +381,7 @@ authentication_mediator_handle_accepted (EDBusAuthenticator *interface,
 		g_object_unref (simple);
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	e_dbus_authenticator_complete_accepted (interface, invocation);
 
@@ -402,7 +402,7 @@ authentication_mediator_handle_rejected (EDBusAuthenticator *interface,
 	mediator = g_weak_ref_get (&closure->mediator);
 	g_return_val_if_fail (mediator != NULL, FALSE);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	queue = &mediator->priv->try_password_queue;
 
@@ -418,7 +418,7 @@ authentication_mediator_handle_rejected (EDBusAuthenticator *interface,
 		g_object_unref (simple);
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	e_dbus_authenticator_complete_rejected (interface, invocation);
 
@@ -432,9 +432,9 @@ authentication_mediator_authenticator_running (gpointer data)
 {
 	ThreadClosure *closure = data;
 
-	g_mutex_lock (closure->main_loop_mutex);
-	g_cond_broadcast (closure->main_loop_cond);
-	g_mutex_unlock (closure->main_loop_mutex);
+	g_mutex_lock (&closure->main_loop_mutex);
+	g_cond_broadcast (&closure->main_loop_cond);
+	g_mutex_unlock (&closure->main_loop_mutex);
 
 	return FALSE;
 }
@@ -688,7 +688,7 @@ authentication_mediator_finalize (GObject *object)
 
 	priv = E_AUTHENTICATION_MEDIATOR_GET_PRIVATE (object);
 
-	g_mutex_free (priv->shared_data_lock);
+	g_mutex_clear (&priv->shared_data_lock);
 
 	g_free (priv->object_path);
 	g_free (priv->sender);
@@ -743,23 +743,25 @@ authentication_mediator_initable_init (GInitable *initable,
 	 * main loop will signal the thread itself to terminate. */
 	mediator->priv->thread_closure = thread_closure_ref (closure);
 
-	thread = g_thread_create (
+	thread = g_thread_new (NULL,
 		authentication_mediator_authenticator_thread,
-		closure, FALSE /* joinable */, error);
+		closure);
 
 	if (thread == NULL) {
 		thread_closure_unref (closure);
 		return FALSE;
 	}
 
+	g_thread_unref (thread);
+
 	/* Wait for notification that the Authenticator interface
 	 * has been exported and the thread's main loop started. */
-	g_mutex_lock (closure->main_loop_mutex);
+	g_mutex_lock (&closure->main_loop_mutex);
 	while (!g_main_loop_is_running (closure->main_loop))
 		g_cond_wait (
-			closure->main_loop_cond,
-			closure->main_loop_mutex);
-	g_mutex_unlock (closure->main_loop_mutex);
+			&closure->main_loop_cond,
+			&closure->main_loop_mutex);
+	g_mutex_unlock (&closure->main_loop_mutex);
 
 	/* Check whether the interface failed to export. */
 	if (closure->export_error != NULL) {
@@ -811,7 +813,7 @@ authentication_mediator_try_password (ESourceAuthenticator *auth,
 	mediator = E_AUTHENTICATION_MEDIATOR (auth);
 
 	async_context = g_slice_new0 (AsyncContext);
-	async_context->shared_data_lock = mediator->priv->shared_data_lock;
+	async_context->shared_data_lock = &mediator->priv->shared_data_lock;
 	async_context->operation_queue = &mediator->priv->try_password_queue;
 
 	simple = g_simple_async_result_new (
@@ -835,7 +837,7 @@ authentication_mediator_try_password (ESourceAuthenticator *auth,
 		INACTIVITY_TIMEOUT,
 		authentication_mediator_timeout_cb, simple);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	if (mediator->priv->client_cancelled) {
 		g_simple_async_result_set_error (
@@ -865,7 +867,7 @@ authentication_mediator_try_password (ESourceAuthenticator *auth,
 		g_free (encrypted_secret);
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	g_object_unref (simple);
 }
@@ -969,7 +971,7 @@ e_authentication_mediator_init (EAuthenticationMediator *mediator)
 	mediator->priv->interface = e_dbus_authenticator_skeleton_new ();
 	mediator->priv->secret_exchange = gcr_secret_exchange_new (NULL);
 
-	mediator->priv->shared_data_lock = g_mutex_new ();
+	g_mutex_init (&mediator->priv->shared_data_lock);
 }
 
 /**
@@ -1139,7 +1141,7 @@ e_authentication_mediator_wait_for_client (EAuthenticationMediator *mediator,
 	g_return_if_fail (E_IS_AUTHENTICATION_MEDIATOR (mediator));
 
 	async_context = g_slice_new0 (AsyncContext);
-	async_context->shared_data_lock = mediator->priv->shared_data_lock;
+	async_context->shared_data_lock = &mediator->priv->shared_data_lock;
 	async_context->operation_queue = &mediator->priv->wait_for_client_queue;
 
 	simple = g_simple_async_result_new (
@@ -1162,7 +1164,7 @@ e_authentication_mediator_wait_for_client (EAuthenticationMediator *mediator,
 	async_context->timeout_id = g_timeout_add_seconds (
 		INACTIVITY_TIMEOUT, authentication_mediator_timeout_cb, simple);
 
-	g_mutex_lock (mediator->priv->shared_data_lock);
+	g_mutex_lock (&mediator->priv->shared_data_lock);
 
 	if (mediator->priv->client_is_ready) {
 		g_simple_async_result_complete_in_idle (simple);
@@ -1185,7 +1187,7 @@ e_authentication_mediator_wait_for_client (EAuthenticationMediator *mediator,
 			g_object_ref (simple));
 	}
 
-	g_mutex_unlock (mediator->priv->shared_data_lock);
+	g_mutex_unlock (&mediator->priv->shared_data_lock);
 
 	g_object_unref (simple);
 }
diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index 27c4bf0..d83e01a 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -81,7 +81,7 @@ struct _EAuthenticationSessionPrivate {
 	gchar *source_uid;
 
 	/* These are for configuring system prompts. */
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *prompt_title;
 	gchar *prompt_message;
 	gchar *prompt_description;
@@ -313,7 +313,7 @@ authentication_session_finalize (GObject *object)
 
 	priv = E_AUTHENTICATION_SESSION_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->source_uid);
 	g_free (priv->prompt_title);
@@ -812,7 +812,7 @@ static void
 e_authentication_session_init (EAuthenticationSession *session)
 {
 	session->priv = E_AUTHENTICATION_SESSION_GET_PRIVATE (session);
-	session->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&session->priv->property_lock);
 }
 
 GQuark
@@ -959,12 +959,12 @@ e_authentication_session_dup_prompt_title (EAuthenticationSession *session)
 
 	g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	protected = e_authentication_session_get_prompt_title (session);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	return duplicate;
 }
@@ -985,17 +985,17 @@ e_authentication_session_set_prompt_title (EAuthenticationSession *session,
 {
 	g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	if (g_strcmp0 (session->priv->prompt_title, prompt_title) == 0) {
-		g_mutex_unlock (session->priv->property_lock);
+		g_mutex_unlock (&session->priv->property_lock);
 		return;
 	}
 
 	g_free (session->priv->prompt_title);
 	session->priv->prompt_title = g_strdup (prompt_title);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	g_object_notify (G_OBJECT (session), "prompt-title");
 }
@@ -1040,12 +1040,12 @@ e_authentication_session_dup_prompt_message (EAuthenticationSession *session)
 
 	g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	protected = e_authentication_session_get_prompt_message (session);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	return duplicate;
 }
@@ -1066,17 +1066,17 @@ e_authentication_session_set_prompt_message (EAuthenticationSession *session,
 {
 	g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	if (g_strcmp0 (session->priv->prompt_message, prompt_message) == 0) {
-		g_mutex_unlock (session->priv->property_lock);
+		g_mutex_unlock (&session->priv->property_lock);
 		return;
 	}
 
 	g_free (session->priv->prompt_message);
 	session->priv->prompt_message = g_strdup (prompt_message);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	g_object_notify (G_OBJECT (session), "prompt-message");
 }
@@ -1122,12 +1122,12 @@ e_authentication_session_dup_prompt_description (EAuthenticationSession *session
 
 	g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	protected = e_authentication_session_get_prompt_description (session);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	return duplicate;
 }
@@ -1148,17 +1148,17 @@ e_authentication_session_set_prompt_description (EAuthenticationSession *session
 {
 	g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
 
-	g_mutex_lock (session->priv->property_lock);
+	g_mutex_lock (&session->priv->property_lock);
 
 	if (g_strcmp0 (session->priv->prompt_description, prompt_description) == 0) {
-		g_mutex_unlock (session->priv->property_lock);
+		g_mutex_unlock (&session->priv->property_lock);
 		return;
 	}
 
 	g_free (session->priv->prompt_description);
 	session->priv->prompt_description = g_strdup (prompt_description);
 
-	g_mutex_unlock (session->priv->property_lock);
+	g_mutex_unlock (&session->priv->property_lock);
 
 	g_object_notify (G_OBJECT (session), "prompt-description");
 }
diff --git a/libebackend/e-collection-backend.c b/libebackend/e-collection-backend.c
index 4593f00..1b783e7 100644
--- a/libebackend/e-collection-backend.c
+++ b/libebackend/e-collection-backend.c
@@ -58,13 +58,13 @@ struct _ECollectionBackendPrivate {
 
 	/* Set of ESources */
 	GHashTable *children;
-	GMutex *children_lock;
+	GMutex children_lock;
 
 	gchar *cache_dir;
 
 	/* Resource ID -> ESource */
 	GHashTable *unclaimed_resources;
-	GMutex *unclaimed_resources_lock;
+	GMutex unclaimed_resources_lock;
 
 	gulong source_added_handler_id;
 	gulong source_removed_handler_id;
@@ -92,11 +92,11 @@ static void
 collection_backend_children_insert (ECollectionBackend *backend,
                                     ESource *source)
 {
-	g_mutex_lock (backend->priv->children_lock);
+	g_mutex_lock (&backend->priv->children_lock);
 
 	g_hash_table_add (backend->priv->children, g_object_ref (source));
 
-	g_mutex_unlock (backend->priv->children_lock);
+	g_mutex_unlock (&backend->priv->children_lock);
 }
 
 static gboolean
@@ -105,11 +105,11 @@ collection_backend_children_remove (ECollectionBackend *backend,
 {
 	gboolean removed;
 
-	g_mutex_lock (backend->priv->children_lock);
+	g_mutex_lock (&backend->priv->children_lock);
 
 	removed = g_hash_table_remove (backend->priv->children, source);
 
-	g_mutex_unlock (backend->priv->children_lock);
+	g_mutex_unlock (&backend->priv->children_lock);
 
 	return removed;
 }
@@ -119,14 +119,14 @@ collection_backend_children_list (ECollectionBackend *backend)
 {
 	GList *list, *link;
 
-	g_mutex_lock (backend->priv->children_lock);
+	g_mutex_lock (&backend->priv->children_lock);
 
 	list = g_hash_table_get_keys (backend->priv->children);
 
 	for (link = list; link != NULL; link = g_list_next (link))
 		g_object_ref (link->data);
 
-	g_mutex_unlock (backend->priv->children_lock);
+	g_mutex_unlock (&backend->priv->children_lock);
 
 	return list;
 }
@@ -229,7 +229,7 @@ collection_backend_load_resources (ECollectionBackend *backend)
 	file = g_file_new_for_path (cache_dir);
 	server = e_collection_backend_ref_server (backend);
 
-	g_mutex_lock (backend->priv->unclaimed_resources_lock);
+	g_mutex_lock (&backend->priv->unclaimed_resources_lock);
 
 	while ((name = g_dir_read_name (dir)) != NULL) {
 		GFile *child;
@@ -264,7 +264,7 @@ collection_backend_load_resources (ECollectionBackend *backend)
 		g_object_unref (source);
 	}
 
-	g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+	g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
 
 	g_object_unref (file);
 	g_object_unref (server);
@@ -278,7 +278,7 @@ collection_backend_claim_resource (ECollectionBackend *backend,
 	GHashTable *unclaimed_resources;
 	ESource *source;
 
-	g_mutex_lock (backend->priv->unclaimed_resources_lock);
+	g_mutex_lock (&backend->priv->unclaimed_resources_lock);
 
 	unclaimed_resources = backend->priv->unclaimed_resources;
 	source = g_hash_table_lookup (unclaimed_resources, resource_id);
@@ -292,7 +292,7 @@ collection_backend_claim_resource (ECollectionBackend *backend,
 		g_object_unref (file);
 	}
 
-	g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+	g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
 
 	return source;
 }
@@ -550,13 +550,13 @@ collection_backend_dispose (GObject *object)
 		g_object_unref (server);
 	}
 
-	g_mutex_lock (priv->children_lock);
+	g_mutex_lock (&priv->children_lock);
 	g_hash_table_remove_all (priv->children);
-	g_mutex_unlock (priv->children_lock);
+	g_mutex_unlock (&priv->children_lock);
 
-	g_mutex_lock (priv->unclaimed_resources_lock);
+	g_mutex_lock (&priv->unclaimed_resources_lock);
 	g_hash_table_remove_all (priv->unclaimed_resources);
-	g_mutex_unlock (priv->unclaimed_resources_lock);
+	g_mutex_unlock (&priv->unclaimed_resources_lock);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_collection_backend_parent_class)->dispose (object);
@@ -570,10 +570,10 @@ collection_backend_finalize (GObject *object)
 	priv = E_COLLECTION_BACKEND_GET_PRIVATE (object);
 
 	g_hash_table_destroy (priv->children);
-	g_mutex_free (priv->children_lock);
+	g_mutex_clear (&priv->children_lock);
 
 	g_hash_table_destroy (priv->unclaimed_resources);
-	g_mutex_free (priv->unclaimed_resources_lock);
+	g_mutex_clear (&priv->unclaimed_resources_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_collection_backend_parent_class)->finalize (object);
@@ -949,9 +949,9 @@ e_collection_backend_init (ECollectionBackend *backend)
 
 	backend->priv = E_COLLECTION_BACKEND_GET_PRIVATE (backend);
 	backend->priv->children = children;
-	backend->priv->children_lock = g_mutex_new ();
+	g_mutex_init (&backend->priv->children_lock);
 	backend->priv->unclaimed_resources = unclaimed_resources;
-	backend->priv->unclaimed_resources_lock = g_mutex_new ();
+	g_mutex_init (&backend->priv->unclaimed_resources_lock);
 }
 
 /**
@@ -1138,14 +1138,14 @@ e_collection_backend_claim_all_resources (ECollectionBackend *backend)
 
 	g_return_val_if_fail (E_IS_COLLECTION_BACKEND (backend), NULL);
 
-	g_mutex_lock (backend->priv->unclaimed_resources_lock);
+	g_mutex_lock (&backend->priv->unclaimed_resources_lock);
 
 	unclaimed_resources = backend->priv->unclaimed_resources;
 	resources = g_hash_table_get_values (unclaimed_resources);
 	g_list_foreach (resources, (GFunc) g_object_ref, NULL);
 	g_hash_table_remove_all (unclaimed_resources);
 
-	g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+	g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
 
 	return resources;
 }
diff --git a/libebackend/e-data-factory.c b/libebackend/e-data-factory.c
index 56a4e20..99ce551 100644
--- a/libebackend/e-data-factory.c
+++ b/libebackend/e-data-factory.c
@@ -38,7 +38,7 @@ struct _EDataFactoryPrivate {
 	 * 'backend_factories' hash table doesn't really need
 	 * guarding since it gets populated during construction
 	 * and is read-only thereafter. */
-	GMutex *mutex;
+	GMutex mutex;
 
 	/* ESource UID -> GWeakRef (EBackend) */
 	GHashTable *backends;
@@ -104,7 +104,7 @@ data_factory_finalize (GObject *object)
 
 	priv = E_DATA_FACTORY_GET_PRIVATE (object);
 
-	g_mutex_free (priv->mutex);
+	g_mutex_clear (&priv->mutex);
 
 	g_hash_table_destroy (priv->backends);
 	g_hash_table_destroy (priv->backend_factories);
@@ -173,7 +173,7 @@ e_data_factory_init (EDataFactory *data_factory)
 {
 	data_factory->priv = E_DATA_FACTORY_GET_PRIVATE (data_factory);
 
-	data_factory->priv->mutex = g_mutex_new ();
+	g_mutex_init (&data_factory->priv->mutex);
 
 	data_factory->priv->backends = g_hash_table_new_full (
 		(GHashFunc) g_str_hash,
@@ -227,7 +227,7 @@ e_data_factory_ref_backend (EDataFactory *data_factory,
 	uid = e_source_get_uid (source);
 	g_return_val_if_fail (uid != NULL, NULL);
 
-	g_mutex_lock (data_factory->priv->mutex);
+	g_mutex_lock (&data_factory->priv->mutex);
 
 	/* The weak ref is already inserted in the hash table. */
 	weak_ref = data_factory_backends_lookup (data_factory, uid);
@@ -254,7 +254,7 @@ e_data_factory_ref_backend (EDataFactory *data_factory,
 	g_object_unref (backend_factory);
 
 exit:
-	g_mutex_unlock (data_factory->priv->mutex);
+	g_mutex_unlock (&data_factory->priv->mutex);
 
 	return backend;
 }
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index b91ede9..202cfba 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -69,8 +69,8 @@ struct _ESourceRegistryServerPrivate {
 	GHashTable *orphans;  /* sources waiting for parent */
 	GHashTable *monitors;
 
-	GMutex *sources_lock;
-	GMutex *orphans_lock;
+	GMutex sources_lock;
+	GMutex orphans_lock;
 
 	/* In pseudo-Python notation:
 	 *
@@ -85,7 +85,7 @@ struct _ESourceRegistryServerPrivate {
 	 * the user decides not to cache the secret at all, in which case
 	 * he gets what he asked for: lots of annoying prompts.
 	 */
-	GMutex *auth_lock;
+	GMutex auth_lock;
 	GHashTable *running_auths;
 	GHashTable *waiting_auths;
 
@@ -208,13 +208,13 @@ source_registry_server_sources_insert (ESourceRegistryServer *server,
 	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (server->priv->sources_lock);
+	g_mutex_lock (&server->priv->sources_lock);
 
 	g_hash_table_insert (
 		server->priv->sources,
 		g_strdup (uid), g_object_ref (source));
 
-	g_mutex_unlock (server->priv->sources_lock);
+	g_mutex_unlock (&server->priv->sources_lock);
 }
 
 static gboolean
@@ -227,11 +227,11 @@ source_registry_server_sources_remove (ESourceRegistryServer *server,
 	uid = e_source_get_uid (source);
 	g_return_val_if_fail (uid != NULL, FALSE);
 
-	g_mutex_lock (server->priv->sources_lock);
+	g_mutex_lock (&server->priv->sources_lock);
 
 	removed = g_hash_table_remove (server->priv->sources, uid);
 
-	g_mutex_unlock (server->priv->sources_lock);
+	g_mutex_unlock (&server->priv->sources_lock);
 
 	return removed;
 }
@@ -244,14 +244,14 @@ source_registry_server_sources_lookup (ESourceRegistryServer *server,
 
 	g_return_val_if_fail (uid != NULL, NULL);
 
-	g_mutex_lock (server->priv->sources_lock);
+	g_mutex_lock (&server->priv->sources_lock);
 
 	source = g_hash_table_lookup (server->priv->sources, uid);
 
 	if (source != NULL)
 		g_object_ref (source);
 
-	g_mutex_unlock (server->priv->sources_lock);
+	g_mutex_unlock (&server->priv->sources_lock);
 
 	return source;
 }
@@ -261,13 +261,13 @@ source_registry_server_sources_get_values (ESourceRegistryServer *server)
 {
 	GList *values;
 
-	g_mutex_lock (server->priv->sources_lock);
+	g_mutex_lock (&server->priv->sources_lock);
 
 	values = g_hash_table_get_values (server->priv->sources);
 
 	g_list_foreach (values, (GFunc) g_object_ref, NULL);
 
-	g_mutex_unlock (server->priv->sources_lock);
+	g_mutex_unlock (&server->priv->sources_lock);
 
 	return values;
 }
@@ -280,7 +280,7 @@ source_registry_server_orphans_insert (ESourceRegistryServer *server,
 	GPtrArray *array;
 	gchar *parent_uid;
 
-	g_mutex_lock (server->priv->orphans_lock);
+	g_mutex_lock (&server->priv->orphans_lock);
 
 	orphans = server->priv->orphans;
 
@@ -305,7 +305,7 @@ source_registry_server_orphans_insert (ESourceRegistryServer *server,
 
 	g_free (parent_uid);
 
-	g_mutex_unlock (server->priv->orphans_lock);
+	g_mutex_unlock (&server->priv->orphans_lock);
 }
 
 static gboolean
@@ -317,7 +317,7 @@ source_registry_server_orphans_remove (ESourceRegistryServer *server,
 	gchar *parent_uid;
 	gboolean removed = FALSE;
 
-	g_mutex_lock (server->priv->orphans_lock);
+	g_mutex_lock (&server->priv->orphans_lock);
 
 	orphans = server->priv->orphans;
 
@@ -337,7 +337,7 @@ source_registry_server_orphans_remove (ESourceRegistryServer *server,
 
 	g_free (parent_uid);
 
-	g_mutex_unlock (server->priv->orphans_lock);
+	g_mutex_unlock (&server->priv->orphans_lock);
 
 	return removed;
 }
@@ -353,7 +353,7 @@ source_registry_server_orphans_steal (ESourceRegistryServer *server,
 	parent_uid = e_source_get_uid (parent_source);
 	g_return_val_if_fail (parent_uid != NULL, NULL);
 
-	g_mutex_lock (server->priv->orphans_lock);
+	g_mutex_lock (&server->priv->orphans_lock);
 
 	orphans = server->priv->orphans;
 
@@ -366,7 +366,7 @@ source_registry_server_orphans_steal (ESourceRegistryServer *server,
 		g_hash_table_remove (orphans, parent_uid);
 	}
 
-	g_mutex_unlock (server->priv->orphans_lock);
+	g_mutex_unlock (&server->priv->orphans_lock);
 
 	return array;
 }
@@ -377,7 +377,7 @@ source_request_server_auth_request_cancel_all (ESourceRegistryServer *server)
 	GHashTableIter iter;
 	gpointer value;
 
-	g_mutex_lock (server->priv->auth_lock);
+	g_mutex_lock (&server->priv->auth_lock);
 
 	g_hash_table_iter_init (&iter, server->priv->waiting_auths);
 
@@ -400,7 +400,7 @@ source_request_server_auth_request_cancel_all (ESourceRegistryServer *server)
 		g_cancellable_cancel (request->cancellable);
 	}
 
-	g_mutex_unlock (server->priv->auth_lock);
+	g_mutex_unlock (&server->priv->auth_lock);
 }
 
 static void
@@ -412,7 +412,7 @@ source_registry_server_auth_request_push (ESourceRegistryServer *server,
 
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (server->priv->auth_lock);
+	g_mutex_lock (&server->priv->auth_lock);
 
 	queue = g_hash_table_lookup (server->priv->waiting_auths, uid);
 
@@ -425,7 +425,7 @@ source_registry_server_auth_request_push (ESourceRegistryServer *server,
 
 	g_queue_push_tail (queue, auth_request_ref (request));
 
-	g_mutex_unlock (server->priv->auth_lock);
+	g_mutex_unlock (&server->priv->auth_lock);
 }
 
 static AuthRequest *
@@ -436,7 +436,7 @@ source_registry_server_auth_request_next (ESourceRegistryServer *server,
 
 	g_return_val_if_fail (uid != NULL, NULL);
 
-	g_mutex_lock (server->priv->auth_lock);
+	g_mutex_lock (&server->priv->auth_lock);
 
 	/* If we're already busy processing an authentication request
 	 * for this UID, the next request will have to wait in line. */
@@ -456,7 +456,7 @@ source_registry_server_auth_request_next (ESourceRegistryServer *server,
 				auth_request_ref (request));
 	}
 
-	g_mutex_unlock (server->priv->auth_lock);
+	g_mutex_unlock (&server->priv->auth_lock);
 
 	return request;
 }
@@ -467,11 +467,11 @@ source_registry_server_auth_request_done (ESourceRegistryServer *server,
 {
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (server->priv->auth_lock);
+	g_mutex_lock (&server->priv->auth_lock);
 
 	g_hash_table_remove (server->priv->running_auths, uid);
 
-	g_mutex_unlock (server->priv->auth_lock);
+	g_mutex_unlock (&server->priv->auth_lock);
 }
 
 static void
@@ -1080,10 +1080,10 @@ source_registry_server_finalize (GObject *object)
 	g_hash_table_destroy (priv->orphans);
 	g_hash_table_destroy (priv->monitors);
 
-	g_mutex_free (priv->sources_lock);
-	g_mutex_free (priv->orphans_lock);
+	g_mutex_clear (&priv->sources_lock);
+	g_mutex_clear (&priv->orphans_lock);
 
-	g_mutex_free (priv->auth_lock);
+	g_mutex_clear (&priv->auth_lock);
 	g_hash_table_destroy (priv->running_auths);
 	g_hash_table_destroy (priv->waiting_auths);
 
@@ -1388,9 +1388,9 @@ e_source_registry_server_init (ESourceRegistryServer *server)
 	server->priv->sources = sources;
 	server->priv->orphans = orphans;
 	server->priv->monitors = monitors;
-	server->priv->sources_lock = g_mutex_new ();
-	server->priv->orphans_lock = g_mutex_new ();
-	server->priv->auth_lock = g_mutex_new ();
+	g_mutex_init (&server->priv->sources_lock);
+	g_mutex_init (&server->priv->orphans_lock);
+	g_mutex_init (&server->priv->auth_lock);
 	server->priv->waiting_auths = waiting_auths;
 	server->priv->running_auths = running_auths;
 
@@ -1455,21 +1455,21 @@ e_source_registry_server_add_source (ESourceRegistryServer *server,
 	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (server->priv->sources_lock);
+	g_mutex_lock (&server->priv->sources_lock);
 
 	/* Check if we already have this object in the hierarchy. */
 	if (g_hash_table_lookup (server->priv->sources, uid) != NULL) {
-		g_mutex_unlock (server->priv->sources_lock);
+		g_mutex_unlock (&server->priv->sources_lock);
 		return;
 	}
 
 	/* Make sure the parent object (if any) is in the hierarchy. */
 	if (!source_registry_server_find_parent (server, source)) {
-		g_mutex_unlock (server->priv->sources_lock);
+		g_mutex_unlock (&server->priv->sources_lock);
 		return;
 	}
 
-	g_mutex_unlock (server->priv->sources_lock);
+	g_mutex_unlock (&server->priv->sources_lock);
 
 	/* Before we emit, make sure the EDBusSource's "data" property
 	 * is up-to-date.  ESource changes get propagated to the "data"
diff --git a/libebackend/e-sqlite3-vfs.c b/libebackend/e-sqlite3-vfs.c
index 2307499..b5bce58 100644
--- a/libebackend/e-sqlite3-vfs.c
+++ b/libebackend/e-sqlite3-vfs.c
@@ -39,7 +39,7 @@ static GThreadPool *sync_pool = NULL;
 typedef struct {
 	sqlite3_file parent;
 	sqlite3_file *old_vfs_file; /* pointer to old_vfs' file */
-	GStaticRecMutex sync_mutex;
+	GRecMutex sync_mutex;
 	guint timeout_id;
 	gint flags;
 } ESqlite3File;
@@ -92,7 +92,7 @@ sync_push_request (ESqlite3File *cFile,
 	g_return_if_fail (cFile != NULL);
 	g_return_if_fail (sync_pool != NULL);
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	if (wait_for_finish)
 		sync_op = e_flag_new ();
@@ -104,7 +104,7 @@ sync_push_request (ESqlite3File *cFile,
 
 	cFile->flags = 0;
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	g_thread_pool_push (sync_pool, data, &error);
 
@@ -127,14 +127,14 @@ sync_push_request (ESqlite3File *cFile,
 static gboolean
 sync_push_request_timeout (ESqlite3File *cFile)
 {
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	if (cFile->timeout_id != 0) {
 		sync_push_request (cFile, FALSE);
 		cFile->timeout_id = 0;
 	}
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	return FALSE;
 }
@@ -195,7 +195,7 @@ e_sqlite3_file_xClose (sqlite3_file *pFile)
 
 	cFile = (ESqlite3File *) pFile;
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	/* Cancel any pending sync requests. */
 	if (cFile->timeout_id > 0) {
@@ -203,7 +203,7 @@ e_sqlite3_file_xClose (sqlite3_file *pFile)
 		cFile->timeout_id = 0;
 	}
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	/* Make the last sync. */
 	sync_push_request (cFile, TRUE);
@@ -216,7 +216,7 @@ e_sqlite3_file_xClose (sqlite3_file *pFile)
 	g_free (cFile->old_vfs_file);
 	cFile->old_vfs_file = NULL;
 
-	g_static_rec_mutex_free (&cFile->sync_mutex);
+	g_rec_mutex_clear (&cFile->sync_mutex);
 
 	return res;
 }
@@ -232,7 +232,7 @@ e_sqlite3_file_xSync (sqlite3_file *pFile,
 
 	cFile = (ESqlite3File *) pFile;
 
-	g_static_rec_mutex_lock (&cFile->sync_mutex);
+	g_rec_mutex_lock (&cFile->sync_mutex);
 
 	/* If a sync request is already scheduled, accumulate flags. */
 	cFile->flags |= flags;
@@ -246,7 +246,7 @@ e_sqlite3_file_xSync (sqlite3_file *pFile,
 		SYNC_TIMEOUT_SECONDS, (GSourceFunc)
 		sync_push_request_timeout, cFile);
 
-	g_static_rec_mutex_unlock (&cFile->sync_mutex);
+	g_rec_mutex_unlock (&cFile->sync_mutex);
 
 	return SQLITE_OK;
 }
@@ -258,7 +258,7 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
                      gint flags,
                      gint *pOutFlags)
 {
-	static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
+	static GRecMutex only_once_lock;
 	static sqlite3_io_methods io_methods = {0};
 	ESqlite3File *cFile;
 	gint res;
@@ -275,9 +275,9 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
 		return res;
 	}
 
-	g_static_rec_mutex_init (&cFile->sync_mutex);
+	g_rec_mutex_init (&cFile->sync_mutex);
 
-	g_static_rec_mutex_lock (&only_once_lock);
+	g_rec_mutex_lock (&only_once_lock);
 
 	if (!sync_pool)
 		sync_pool = g_thread_pool_new (sync_request_thread_cb, NULL, 2, FALSE, NULL);
@@ -310,7 +310,7 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
 		#undef use_subclassed
 	}
 
-	g_static_rec_mutex_unlock (&only_once_lock);
+	g_rec_mutex_unlock (&only_once_lock);
 
 	cFile->parent.pMethods = &io_methods;
 
diff --git a/libedataserver/e-categories.c b/libedataserver/e-categories.c
index d944d02..29ccff3 100644
--- a/libedataserver/e-categories.c
+++ b/libedataserver/e-categories.c
@@ -471,7 +471,7 @@ initialize_categories (void)
 
 	listeners = g_object_new (e_changed_listener_get_type (), NULL);
 
-	g_atexit (finalize_categories);
+	atexit (finalize_categories);
 
 	n_added = load_categories ();
 	if (n_added > 0) {
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index 22b9ab8..eeb0589 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -38,7 +38,7 @@
 	((obj), E_TYPE_CLIENT, EClientPrivate))
 
 struct _EClientPrivate {
-	GStaticRecMutex prop_mutex;
+	GRecMutex prop_mutex;
 
 	ESource *source;
 	gchar *uri;
@@ -50,7 +50,7 @@ struct _EClientPrivate {
 
 	GHashTable *backend_property_cache;
 
-	GStaticRecMutex ops_mutex;
+	GRecMutex ops_mutex;
 	guint32 last_opid;
 	GHashTable *ops; /* opid to GCancellable */
 };
@@ -195,10 +195,10 @@ e_client_init (EClient *client)
 
 	client->priv->readonly = TRUE;
 
-	g_static_rec_mutex_init (&client->priv->prop_mutex);
+	g_rec_mutex_init (&client->priv->prop_mutex);
 	client->priv->backend_property_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
-	g_static_rec_mutex_init (&client->priv->ops_mutex);
+	g_rec_mutex_init (&client->priv->ops_mutex);
 	client->priv->last_opid = 0;
 	client->priv->ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
 }
@@ -226,7 +226,7 @@ client_finalize (GObject *object)
 
 	priv = client->priv;
 
-	g_static_rec_mutex_lock (&priv->prop_mutex);
+	g_rec_mutex_lock (&priv->prop_mutex);
 
 	if (priv->source) {
 		g_object_unref (priv->source);
@@ -254,9 +254,9 @@ client_finalize (GObject *object)
 		priv->ops = NULL;
 	}
 
-	g_static_rec_mutex_unlock (&priv->prop_mutex);
-	g_static_rec_mutex_free (&priv->prop_mutex);
-	g_static_rec_mutex_free (&priv->ops_mutex);
+	g_rec_mutex_unlock (&priv->prop_mutex);
+	g_rec_mutex_clear (&priv->prop_mutex);
+	g_rec_mutex_clear (&priv->ops_mutex);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_client_parent_class)->finalize (object);
@@ -522,7 +522,7 @@ client_ensure_capabilities (EClient *client)
 	if (client->priv->capabilities_retrieved || client->priv->capabilities)
 		return;
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 
 	capabilities = NULL;
 	e_client_retrieve_capabilities_sync (client, &capabilities, NULL, NULL);
@@ -531,7 +531,7 @@ client_ensure_capabilities (EClient *client)
 
 	client->priv->capabilities_retrieved = TRUE;
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 }
 
 /**
@@ -578,7 +578,7 @@ e_client_check_capability (EClient *client,
 	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
 	g_return_val_if_fail (capability, FALSE);
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 
 	client_ensure_capabilities (client);
 
@@ -586,12 +586,12 @@ e_client_check_capability (EClient *client,
 		const gchar *cap = iter->data;
 
 		if (cap && g_ascii_strcasecmp (cap, capability) == 0) {
-			g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+			g_rec_mutex_unlock (&client->priv->prop_mutex);
 			return TRUE;
 		}
 	}
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 
 	return FALSE;
 }
@@ -622,7 +622,7 @@ e_client_set_capabilities (EClient *client,
 {
 	g_return_if_fail (E_IS_CLIENT (client));
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 
 	if (!capabilities)
 		client->priv->capabilities_retrieved = FALSE;
@@ -631,7 +631,7 @@ e_client_set_capabilities (EClient *client,
 	g_slist_free (client->priv->capabilities);
 	client->priv->capabilities = e_client_util_parse_comma_strings (capabilities);
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 
 	g_object_notify (G_OBJECT (client), "capabilities");
 }
@@ -660,15 +660,15 @@ e_client_set_readonly (EClient *client,
 {
 	g_return_if_fail (E_IS_CLIENT (client));
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 	if ((readonly ? 1 : 0) == (client->priv->readonly ? 1 : 0)) {
-		g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+		g_rec_mutex_unlock (&client->priv->prop_mutex);
 		return;
 	}
 
 	client->priv->readonly = readonly;
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 
 	g_object_notify (G_OBJECT (client), "readonly");
 }
@@ -700,15 +700,15 @@ e_client_set_online (EClient *client,
 	/* newly connected/disconnected => make sure capabilities will be correct */
 	e_client_set_capabilities (client, NULL);
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 	if ((is_online ? 1: 0) == (client->priv->online ? 1 : 0)) {
-		g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+		g_rec_mutex_unlock (&client->priv->prop_mutex);
 		return;
 	}
 
 	client->priv->online = is_online;
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 
 	g_object_notify (G_OBJECT (client), "online");
 }
@@ -755,13 +755,13 @@ client_cancel_op (EClient *client,
 	g_return_if_fail (E_IS_CLIENT (client));
 	g_return_if_fail (client->priv->ops != NULL);
 
-	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+	g_rec_mutex_lock (&client->priv->ops_mutex);
 
 	cancellable = g_hash_table_lookup (client->priv->ops, GINT_TO_POINTER (opid));
 	if (cancellable)
 		g_cancellable_cancel (cancellable);
 
-	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+	g_rec_mutex_unlock (&client->priv->ops_mutex);
 }
 
 static void
@@ -799,14 +799,14 @@ e_client_cancel_all (EClient *client)
 	g_return_if_fail (E_IS_CLIENT (client));
 	g_return_if_fail (client->priv->ops != NULL);
 
-	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+	g_rec_mutex_lock (&client->priv->ops_mutex);
 
 	g_hash_table_foreach (client->priv->ops, gather_opids_cb, &opids);
 
 	g_slist_foreach (opids, cancel_op_cb, client);
 	g_slist_free (opids);
 
-	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+	g_rec_mutex_unlock (&client->priv->ops_mutex);
 }
 
 guint32
@@ -819,7 +819,7 @@ e_client_register_op (EClient *client,
 	g_return_val_if_fail (client->priv->ops != NULL, 0);
 	g_return_val_if_fail (cancellable != NULL, 0);
 
-	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+	g_rec_mutex_lock (&client->priv->ops_mutex);
 
 	client->priv->last_opid++;
 	if (!client->priv->last_opid)
@@ -833,7 +833,7 @@ e_client_register_op (EClient *client,
 	opid = client->priv->last_opid;
 	g_hash_table_insert (client->priv->ops, GINT_TO_POINTER (opid), g_object_ref (cancellable));
 
-	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+	g_rec_mutex_unlock (&client->priv->ops_mutex);
 
 	return opid;
 }
@@ -845,9 +845,9 @@ e_client_unregister_op (EClient *client,
 	g_return_if_fail (E_IS_CLIENT (client));
 	g_return_if_fail (client->priv->ops != NULL);
 
-	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+	g_rec_mutex_lock (&client->priv->ops_mutex);
 	g_hash_table_remove (client->priv->ops, GINT_TO_POINTER (opid));
-	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+	g_rec_mutex_unlock (&client->priv->ops_mutex);
 }
 
 void
@@ -915,12 +915,12 @@ e_client_update_backend_property_cache (EClient *client,
 	g_return_if_fail (*prop_name);
 	g_return_if_fail (prop_value != NULL);
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 
 	if (client->priv->backend_property_cache)
 		g_hash_table_insert (client->priv->backend_property_cache, g_strdup (prop_name), g_strdup (prop_value));
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 }
 
 gchar *
@@ -933,12 +933,12 @@ e_client_get_backend_property_from_cache (EClient *client,
 	g_return_val_if_fail (prop_name != NULL, NULL);
 	g_return_val_if_fail (*prop_name, NULL);
 
-	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	g_rec_mutex_lock (&client->priv->prop_mutex);
 
 	if (client->priv->backend_property_cache)
 		prop_value = g_strdup (g_hash_table_lookup (client->priv->backend_property_cache, prop_name));
 
-	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+	g_rec_mutex_unlock (&client->priv->prop_mutex);
 
 	return prop_value;
 }
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index e5539be..e0aaa6b 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -287,7 +287,7 @@ stripped_char (gunichar ch)
 	case G_UNICODE_CONTROL:
 	case G_UNICODE_FORMAT:
 	case G_UNICODE_UNASSIGNED:
-	case G_UNICODE_COMBINING_MARK:
+	case G_UNICODE_SPACING_MARK:
 		/* Ignore those */
 		return 0;
 	default:
diff --git a/libedataserver/e-debug-log.c b/libedataserver/e-debug-log.c
index f4cc9f4..db62664 100644
--- a/libedataserver/e-debug-log.c
+++ b/libedataserver/e-debug-log.c
@@ -35,7 +35,7 @@
 #define KEY_FILE_DOMAINS_KEY	"enable domains"
 #define KEY_FILE_MAX_LINES_KEY	"max lines"
 
-static GStaticMutex log_mutex = G_STATIC_MUTEX_INIT;
+static GMutex log_mutex;
 
 static GHashTable *domains_hash;
 static gchar **ring_buffer;
@@ -49,13 +49,13 @@ static GSList *milestones_tail;
 static void
 lock (void)
 {
-	g_static_mutex_lock (&log_mutex);
+	g_mutex_lock (&log_mutex);
 }
 
 static void
 unlock (void)
 {
-	g_static_mutex_unlock (&log_mutex);
+	g_mutex_unlock (&log_mutex);
 }
 
 /**
diff --git a/libedataserver/e-flag.c b/libedataserver/e-flag.c
index ccffd88..05008e4 100644
--- a/libedataserver/e-flag.c
+++ b/libedataserver/e-flag.c
@@ -20,8 +20,8 @@
 #include "e-flag.h"
 
 struct _EFlag {
-	GCond *cond;
-	GMutex *mutex;
+	GCond cond;
+	GMutex mutex;
 	gboolean is_set;
 };
 
@@ -40,8 +40,8 @@ e_flag_new (void)
 	EFlag *flag;
 
 	flag = g_slice_new (EFlag);
-	flag->cond = g_cond_new ();
-	flag->mutex = g_mutex_new ();
+	g_cond_init (&flag->cond);
+	g_mutex_init (&flag->mutex);
 	flag->is_set = FALSE;
 
 	return flag;
@@ -64,9 +64,9 @@ e_flag_is_set (EFlag *flag)
 
 	g_return_val_if_fail (flag != NULL, FALSE);
 
-	g_mutex_lock (flag->mutex);
+	g_mutex_lock (&flag->mutex);
 	is_set = flag->is_set;
-	g_mutex_unlock (flag->mutex);
+	g_mutex_unlock (&flag->mutex);
 
 	return is_set;
 }
@@ -76,7 +76,7 @@ e_flag_is_set (EFlag *flag)
  * @flag: an #EFlag
  *
  * Sets @flag.  All threads waiting on @flag are woken up.  Threads that
- * call e_flag_wait() or e_flag_timed_wait() once @flag is set will not
+ * call e_flag_wait() or e_flag_wait_until() once @flag is set will not
  * block at all.
  *
  * Since: 1.12
@@ -86,17 +86,17 @@ e_flag_set (EFlag *flag)
 {
 	g_return_if_fail (flag != NULL);
 
-	g_mutex_lock (flag->mutex);
+	g_mutex_lock (&flag->mutex);
 	flag->is_set = TRUE;
-	g_cond_broadcast (flag->cond);
-	g_mutex_unlock (flag->mutex);
+	g_cond_broadcast (&flag->cond);
+	g_mutex_unlock (&flag->mutex);
 }
 
 /**
  * e_flag_clear:
  * @flag: an #EFlag
  *
- * Unsets @flag.  Subsequent calls to e_flag_wait() or e_flag_timed_wait()
+ * Unsets @flag.  Subsequent calls to e_flag_wait() or e_flag_wait_until()
  * will block until @flag is set.
  *
  * Since: 1.12
@@ -106,9 +106,9 @@ e_flag_clear (EFlag *flag)
 {
 	g_return_if_fail (flag != NULL);
 
-	g_mutex_lock (flag->mutex);
+	g_mutex_lock (&flag->mutex);
 	flag->is_set = FALSE;
-	g_mutex_unlock (flag->mutex);
+	g_mutex_unlock (&flag->mutex);
 }
 
 /**
@@ -125,44 +125,42 @@ e_flag_wait (EFlag *flag)
 {
 	g_return_if_fail (flag != NULL);
 
-	g_mutex_lock (flag->mutex);
+	g_mutex_lock (&flag->mutex);
 	while (!flag->is_set)
-		g_cond_wait (flag->cond, flag->mutex);
-	g_mutex_unlock (flag->mutex);
+		g_cond_wait (&flag->cond, &flag->mutex);
+	g_mutex_unlock (&flag->mutex);
 }
 
 /**
- * e_flag_timed_wait:
+ * e_flag_wait_until:
  * @flag: an #EFlag
- * @abs_time: a #GTimeVal, determining the final time
+ * @end_time: the monotonic time to wait until
  *
- * Blocks until @flag is set, or until the time specified by @abs_time.
+ * Blocks until @flag is set, or until the time specified by @end_time.
  * If @flag is already set, the function returns immediately.  The return
  * value indicates the state of @flag after waiting.
  *
- * If @abs_time is %NULL, e_flag_timed_wait() acts like e_flag_wait().
- *
- * To easily calculate @abs_time, a combination of g_get_current_time() and
- * g_time_val_add() can be used.
+ * To easily calculate @end_time, a combination of g_get_monotonic_time() and
+ * G_TIME_SPAN_SECOND macro.
  *
  * Returns: %TRUE if @flag is now set
  *
- * Since: 1.12
+ * Since: 3.8
  **/
 gboolean
-e_flag_timed_wait (EFlag *flag,
-                   GTimeVal *abs_time)
+e_flag_wait_until (EFlag *flag,
+                   gint64 end_time)
 {
 	gboolean is_set;
 
 	g_return_val_if_fail (flag != NULL, FALSE);
 
-	g_mutex_lock (flag->mutex);
+	g_mutex_lock (&flag->mutex);
 	while (!flag->is_set)
-		if (!g_cond_timed_wait (flag->cond, flag->mutex, abs_time))
+		if (!g_cond_wait_until (&flag->cond, &flag->mutex, end_time))
 			break;
 	is_set = flag->is_set;
-	g_mutex_unlock (flag->mutex);
+	g_mutex_unlock (&flag->mutex);
 
 	return is_set;
 }
@@ -180,7 +178,7 @@ e_flag_free (EFlag *flag)
 {
 	g_return_if_fail (flag != NULL);
 
-	g_cond_free (flag->cond);
-	g_mutex_free (flag->mutex);
+	g_cond_clear (&flag->cond);
+	g_mutex_clear (&flag->mutex);
 	g_slice_free (EFlag, flag);
 }
diff --git a/libedataserver/e-flag.h b/libedataserver/e-flag.h
index b10d9b9..43d4aaa 100644
--- a/libedataserver/e-flag.h
+++ b/libedataserver/e-flag.h
@@ -46,8 +46,8 @@ gboolean	e_flag_is_set			(EFlag *flag);
 void		e_flag_set			(EFlag *flag);
 void		e_flag_clear			(EFlag *flag);
 void		e_flag_wait			(EFlag *flag);
-gboolean	e_flag_timed_wait		(EFlag *flag,
-						 GTimeVal *abs_time);
+gboolean	e_flag_wait_until		(EFlag *flag,
+						 gint64 end_time);
 void		e_flag_free			(EFlag *flag);
 
 G_END_DECLS
diff --git a/libedataserver/e-operation-pool.c b/libedataserver/e-operation-pool.c
index 10098ad..3672271 100644
--- a/libedataserver/e-operation-pool.c
+++ b/libedataserver/e-operation-pool.c
@@ -24,7 +24,7 @@
 struct _EOperationPool {
 	GThreadPool *pool;
 
-	GMutex *ops_lock;
+	GMutex ops_lock;
 	GHashTable *ops;
 	guint32 last_opid;
 };
@@ -59,7 +59,7 @@ e_operation_pool_new (guint max_threads,
 
 	pool = g_new0 (EOperationPool, 1);
 	pool->pool = thread_pool;
-	pool->ops_lock = g_mutex_new ();
+	g_mutex_init (&pool->ops_lock);
 	pool->ops = g_hash_table_new (g_direct_hash, g_direct_equal);
 	pool->last_opid = 0;
 
@@ -82,7 +82,7 @@ e_operation_pool_free (EOperationPool *pool)
 	g_return_if_fail (pool != NULL);
 
 	g_thread_pool_free (pool->pool, FALSE, FALSE);
-	g_mutex_free (pool->ops_lock);
+	g_mutex_clear (&pool->ops_lock);
 	g_hash_table_destroy (pool->ops);
 	g_free (pool);
 }
@@ -106,9 +106,8 @@ e_operation_pool_reserve_opid (EOperationPool *pool)
 
 	g_return_val_if_fail (pool != NULL, 0);
 	g_return_val_if_fail (pool->ops != NULL, 0);
-	g_return_val_if_fail (pool->ops_lock != NULL, 0);
 
-	g_mutex_lock (pool->ops_lock);
+	g_mutex_lock (&pool->ops_lock);
 
 	pool->last_opid++;
 	if (!pool->last_opid)
@@ -121,7 +120,7 @@ e_operation_pool_reserve_opid (EOperationPool *pool)
 	if (opid)
 		g_hash_table_insert (pool->ops, GUINT_TO_POINTER (opid), GUINT_TO_POINTER (1));
 
-	g_mutex_unlock (pool->ops_lock);
+	g_mutex_unlock (&pool->ops_lock);
 
 	g_return_val_if_fail (opid != 0, 0);
 
@@ -143,11 +142,10 @@ e_operation_pool_release_opid (EOperationPool *pool,
 {
 	g_return_if_fail (pool != NULL);
 	g_return_if_fail (pool->ops != NULL);
-	g_return_if_fail (pool->ops_lock != NULL);
 
-	g_mutex_lock (pool->ops_lock);
+	g_mutex_lock (&pool->ops_lock);
 	g_hash_table_remove (pool->ops, GUINT_TO_POINTER (opid));
-	g_mutex_unlock (pool->ops_lock);
+	g_mutex_unlock (&pool->ops_lock);
 }
 
 /**
diff --git a/libedataserver/e-source-alarms.c b/libedataserver/e-source-alarms.c
index 6d77734..f8a128e 100644
--- a/libedataserver/e-source-alarms.c
+++ b/libedataserver/e-source-alarms.c
@@ -41,7 +41,7 @@
 	((obj), E_TYPE_SOURCE_ALARMS, ESourceAlarmsPrivate))
 
 struct _ESourceAlarmsPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gboolean include_me;
 	gchar *last_notified;
 };
@@ -112,7 +112,7 @@ source_alarms_finalize (GObject *object)
 
 	priv = E_SOURCE_ALARMS_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->last_notified);
 
@@ -167,7 +167,7 @@ static void
 e_source_alarms_init (ESourceAlarms *extension)
 {
 	extension->priv = E_SOURCE_ALARMS_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -261,12 +261,12 @@ e_source_alarms_dup_last_notified (ESourceAlarms *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_ALARMS (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_alarms_get_last_notified (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -307,17 +307,17 @@ e_source_alarms_set_last_notified (ESourceAlarms *extension,
 		}
 	}
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->last_notified, last_notified) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->last_notified);
 	extension->priv->last_notified = g_strdup (last_notified);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "last-notified");
 }
diff --git a/libedataserver/e-source-authentication.c b/libedataserver/e-source-authentication.c
index bceb7ca..863ad21 100644
--- a/libedataserver/e-source-authentication.c
+++ b/libedataserver/e-source-authentication.c
@@ -44,7 +44,7 @@
 	((obj), E_TYPE_SOURCE_AUTHENTICATION, ESourceAuthenticationPrivate))
 
 struct _ESourceAuthenticationPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *host;
 	gchar *method;
 	guint16 port;
@@ -145,7 +145,7 @@ source_authentication_finalize (GObject *object)
 
 	priv = E_SOURCE_AUTHENTICATION_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->host);
 	g_free (priv->method);
@@ -228,7 +228,7 @@ static void
 e_source_authentication_init (ESourceAuthentication *extension)
 {
 	extension->priv = E_SOURCE_AUTHENTICATION_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -296,12 +296,12 @@ e_source_authentication_dup_host (ESourceAuthentication *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_authentication_get_host (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -325,17 +325,17 @@ e_source_authentication_set_host (ESourceAuthentication *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->host, host) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->host);
 	extension->priv->host = e_util_strdup_strip (host);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "host");
 }
@@ -382,12 +382,12 @@ e_source_authentication_dup_method (ESourceAuthentication *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_authentication_get_method (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -412,10 +412,10 @@ e_source_authentication_set_method (ESourceAuthentication *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->method, method) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -425,7 +425,7 @@ e_source_authentication_set_method (ESourceAuthentication *extension,
 	if (extension->priv->method == NULL)
 		extension->priv->method = g_strdup ("none");
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "method");
 }
@@ -510,12 +510,12 @@ e_source_authentication_dup_user (ESourceAuthentication *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_authentication_get_user (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -539,17 +539,17 @@ e_source_authentication_set_user (ESourceAuthentication *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->user, user) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->user);
 	extension->priv->user = e_util_strdup_strip (user);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "user");
 }
diff --git a/libedataserver/e-source-backend.c b/libedataserver/e-source-backend.c
index 1820724..ce568b9 100644
--- a/libedataserver/e-source-backend.c
+++ b/libedataserver/e-source-backend.c
@@ -35,7 +35,7 @@
 	((obj), E_TYPE_SOURCE_BACKEND, ESourceBackendPrivate))
 
 struct _ESourceBackendPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *backend_name;
 };
 
@@ -91,7 +91,7 @@ source_backend_finalize (GObject *object)
 
 	priv = E_SOURCE_BACKEND_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->backend_name);
 
@@ -132,7 +132,7 @@ static void
 e_source_backend_init (ESourceBackend *extension)
 {
 	extension->priv = E_SOURCE_BACKEND_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -174,12 +174,12 @@ e_source_backend_dup_backend_name (ESourceBackend *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_BACKEND (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_backend_get_backend_name (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -203,17 +203,17 @@ e_source_backend_set_backend_name (ESourceBackend *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_BACKEND (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->backend_name, backend_name) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->backend_name);
 	extension->priv->backend_name = e_util_strdup_strip (backend_name);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "backend-name");
 }
diff --git a/libedataserver/e-source-collection.c b/libedataserver/e-source-collection.c
index 5507ff9..8254080 100644
--- a/libedataserver/e-source-collection.c
+++ b/libedataserver/e-source-collection.c
@@ -50,7 +50,7 @@
 	((obj), E_TYPE_SOURCE_COLLECTION, ESourceCollectionPrivate))
 
 struct _ESourceCollectionPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *identity;
 	gboolean calendar_enabled;
 	gboolean contacts_enabled;
@@ -151,7 +151,7 @@ source_collection_finalize (GObject *object)
 
 	priv = E_SOURCE_COLLECTION_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->identity);
 
@@ -233,7 +233,7 @@ static void
 e_source_collection_init (ESourceCollection *extension)
 {
 	extension->priv = E_SOURCE_COLLECTION_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -276,12 +276,12 @@ e_source_collection_dup_identity (ESourceCollection *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_COLLECTION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_collection_get_identity (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -306,17 +306,17 @@ e_source_collection_set_identity (ESourceCollection *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_COLLECTION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->identity, identity) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->identity);
 	extension->priv->identity = e_util_strdup_strip (identity);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "identity");
 }
diff --git a/libedataserver/e-source-goa.c b/libedataserver/e-source-goa.c
index 8890621..5cff646 100644
--- a/libedataserver/e-source-goa.c
+++ b/libedataserver/e-source-goa.c
@@ -45,7 +45,7 @@
 	((obj), E_TYPE_SOURCE_GOA, ESourceGoaPrivate))
 
 struct _ESourceGoaPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *account_id;
 };
 
@@ -101,7 +101,7 @@ source_goa_finalize (GObject *object)
 
 	priv = E_SOURCE_GOA_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->account_id);
 
@@ -143,7 +143,7 @@ static void
 e_source_goa_init (ESourceGoa *extension)
 {
 	extension->priv = E_SOURCE_GOA_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -186,12 +186,12 @@ e_source_goa_dup_account_id (ESourceGoa *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_GOA (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_goa_get_account_id (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -216,17 +216,17 @@ e_source_goa_set_account_id (ESourceGoa *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_GOA (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->account_id, account_id) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->account_id);
 	extension->priv->account_id = e_util_strdup_strip (account_id);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "account-id");
 }
diff --git a/libedataserver/e-source-mail-account.c b/libedataserver/e-source-mail-account.c
index d551058..76404cd 100644
--- a/libedataserver/e-source-mail-account.c
+++ b/libedataserver/e-source-mail-account.c
@@ -46,7 +46,7 @@
 	((obj), E_TYPE_SOURCE_MAIL_ACCOUNT, ESourceMailAccountPrivate))
 
 struct _ESourceMailAccountPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *identity_uid;
 };
 
@@ -102,7 +102,7 @@ source_mail_account_finalize (GObject *object)
 
 	priv = E_SOURCE_MAIL_ACCOUNT_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->identity_uid);
 
@@ -144,7 +144,7 @@ static void
 e_source_mail_account_init (ESourceMailAccount *extension)
 {
 	extension->priv = E_SOURCE_MAIL_ACCOUNT_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -187,12 +187,12 @@ e_source_mail_account_dup_identity_uid (ESourceMailAccount *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_ACCOUNT (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_account_get_identity_uid (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -213,17 +213,17 @@ e_source_mail_account_set_identity_uid (ESourceMailAccount *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_ACCOUNT (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->identity_uid, identity_uid) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->identity_uid);
 	extension->priv->identity_uid = g_strdup (identity_uid);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "identity-uid");
 }
diff --git a/libedataserver/e-source-mail-composition.c b/libedataserver/e-source-mail-composition.c
index 6059d5b..88b7928 100644
--- a/libedataserver/e-source-mail-composition.c
+++ b/libedataserver/e-source-mail-composition.c
@@ -44,7 +44,7 @@
 	((obj), E_TYPE_SOURCE_MAIL_COMPOSITION, ESourceMailCompositionPrivate))
 
 struct _ESourceMailCompositionPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar **bcc;
 	gchar **cc;
 	gchar *drafts_folder;
@@ -160,7 +160,7 @@ source_mail_composition_finalize (GObject *object)
 
 	priv = E_SOURCE_MAIL_COMPOSITION_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_strfreev (priv->bcc);
 	g_strfreev (priv->cc);
@@ -259,7 +259,7 @@ static void
 e_source_mail_composition_init (ESourceMailComposition *extension)
 {
 	extension->priv = E_SOURCE_MAIL_COMPOSITION_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -307,12 +307,12 @@ e_source_mail_composition_dup_bcc (ESourceMailComposition *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_composition_get_bcc (extension);
 	duplicate = g_strdupv ((gchar **) protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -351,17 +351,17 @@ e_source_mail_composition_set_bcc (ESourceMailComposition *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (strv_equal ((const gchar * const *) extension->priv->bcc, bcc)) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_strfreev (extension->priv->bcc);
 	extension->priv->bcc = g_strdupv ((gchar **) bcc);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "bcc");
 }
@@ -411,12 +411,12 @@ e_source_mail_composition_dup_cc (ESourceMailComposition *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_composition_get_cc (extension);
 	duplicate = g_strdupv ((gchar **) protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -438,17 +438,17 @@ e_source_mail_composition_set_cc (ESourceMailComposition *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (strv_equal ((const gchar * const *) extension->priv->cc, cc)) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_strfreev (extension->priv->cc);
 	extension->priv->cc = g_strdupv ((gchar **) cc);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "cc");
 }
@@ -493,12 +493,12 @@ e_source_mail_composition_dup_drafts_folder (ESourceMailComposition *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_composition_get_drafts_folder (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -524,17 +524,17 @@ e_source_mail_composition_set_drafts_folder (ESourceMailComposition *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->drafts_folder, drafts_folder) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->drafts_folder);
 	extension->priv->drafts_folder = e_util_strdup_strip (drafts_folder);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "drafts-folder");
 }
@@ -624,12 +624,12 @@ e_source_mail_composition_dup_templates_folder (ESourceMailComposition *extensio
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_composition_get_templates_folder (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -655,17 +655,17 @@ e_source_mail_composition_set_templates_folder (ESourceMailComposition *extensio
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->templates_folder, templates_folder) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->templates_folder);
 	extension->priv->templates_folder = e_util_strdup_strip (templates_folder);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "templates-folder");
 }
diff --git a/libedataserver/e-source-mail-identity.c b/libedataserver/e-source-mail-identity.c
index f8729f6..9af90d8 100644
--- a/libedataserver/e-source-mail-identity.c
+++ b/libedataserver/e-source-mail-identity.c
@@ -45,7 +45,7 @@
 	((obj), E_TYPE_SOURCE_MAIL_IDENTITY, ESourceMailIdentityPrivate))
 
 struct _ESourceMailIdentityPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *address;
 	gchar *name;
 	gchar *organization;
@@ -161,7 +161,7 @@ source_mail_identity_finalize (GObject *object)
 
 	priv = E_SOURCE_MAIL_IDENTITY_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->address);
 	g_free (priv->name);
@@ -259,7 +259,7 @@ static void
 e_source_mail_identity_init (ESourceMailIdentity *extension)
 {
 	extension->priv = E_SOURCE_MAIL_IDENTITY_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -302,12 +302,12 @@ e_source_mail_identity_dup_address (ESourceMailIdentity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_identity_get_address (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -331,17 +331,17 @@ e_source_mail_identity_set_address (ESourceMailIdentity *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->address, address) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->address);
 	extension->priv->address = e_util_strdup_strip (address);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "address");
 }
@@ -385,12 +385,12 @@ e_source_mail_identity_dup_name (ESourceMailIdentity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_identity_get_name (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -414,11 +414,11 @@ e_source_mail_identity_set_name (ESourceMailIdentity *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (extension->priv->name != NULL &&
 	    g_strcmp0 (extension->priv->name, name) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -428,7 +428,7 @@ e_source_mail_identity_set_name (ESourceMailIdentity *extension,
 	if (extension->priv->name == NULL)
 		extension->priv->name = g_strdup (g_get_real_name ());
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "name");
 }
@@ -472,12 +472,12 @@ e_source_mail_identity_dup_organization (ESourceMailIdentity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_identity_get_organization (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -501,17 +501,17 @@ e_source_mail_identity_set_organization (ESourceMailIdentity *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->organization, organization) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->organization);
 	extension->priv->organization = e_util_strdup_strip (organization);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "organization");
 }
@@ -556,12 +556,12 @@ e_source_mail_identity_dup_reply_to (ESourceMailIdentity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_identity_get_reply_to (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -586,17 +586,17 @@ e_source_mail_identity_set_reply_to (ESourceMailIdentity *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->reply_to, reply_to) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->reply_to);
 	extension->priv->reply_to = e_util_strdup_strip (reply_to);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "reply-to");
 }
@@ -644,12 +644,12 @@ e_source_mail_identity_dup_signature_uid (ESourceMailIdentity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_identity_get_signature_uid (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -678,17 +678,17 @@ e_source_mail_identity_set_signature_uid (ESourceMailIdentity *extension,
 	if (signature_uid == NULL || *signature_uid == '\0')
 		signature_uid = "none";
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->signature_uid, signature_uid) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->signature_uid);
 	extension->priv->signature_uid = g_strdup (signature_uid);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "signature-uid");
 }
diff --git a/libedataserver/e-source-mail-signature.c b/libedataserver/e-source-mail-signature.c
index ca0a43a..e43f8c5 100644
--- a/libedataserver/e-source-mail-signature.c
+++ b/libedataserver/e-source-mail-signature.c
@@ -50,7 +50,7 @@
 typedef struct _AsyncContext AsyncContext;
 
 struct _ESourceMailSignaturePrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	GFile *file;
 	gchar *mime_type;
 };
@@ -147,7 +147,7 @@ source_mail_signature_finalize (GObject *object)
 
 	priv = E_SOURCE_MAIL_SIGNATURE_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->mime_type);
 
@@ -236,7 +236,7 @@ static void
 e_source_mail_signature_init (ESourceMailSignature *extension)
 {
 	extension->priv = E_SOURCE_MAIL_SIGNATURE_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -305,12 +305,12 @@ e_source_mail_signature_dup_mime_type (ESourceMailSignature *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_SIGNATURE (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_signature_get_mime_type (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -337,17 +337,17 @@ e_source_mail_signature_set_mime_type (ESourceMailSignature *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_SIGNATURE (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->mime_type, mime_type) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->mime_type);
 	extension->priv->mime_type = e_util_strdup_strip (mime_type);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "mime-type");
 }
diff --git a/libedataserver/e-source-mail-submission.c b/libedataserver/e-source-mail-submission.c
index cbacde4..951db19 100644
--- a/libedataserver/e-source-mail-submission.c
+++ b/libedataserver/e-source-mail-submission.c
@@ -44,7 +44,7 @@
 	((obj), E_TYPE_SOURCE_MAIL_SUBMISSION, ESourceMailSubmissionPrivate))
 
 struct _ESourceMailSubmissionPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *sent_folder;
 	gchar *transport_uid;
 	gboolean replies_to_origin_folder;
@@ -130,7 +130,7 @@ source_mail_submission_finalize (GObject *object)
 
 	priv = E_SOURCE_MAIL_SUBMISSION_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->sent_folder);
 	g_free (priv->transport_uid);
@@ -201,7 +201,7 @@ static void
 e_source_mail_submission_init (ESourceMailSubmission *extension)
 {
 	extension->priv = E_SOURCE_MAIL_SUBMISSION_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -244,12 +244,12 @@ e_source_mail_submission_dup_sent_folder (ESourceMailSubmission *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_submission_get_sent_folder (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -275,17 +275,17 @@ e_source_mail_submission_set_sent_folder (ESourceMailSubmission *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->sent_folder, sent_folder) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->sent_folder);
 	extension->priv->sent_folder = e_util_strdup_strip (sent_folder);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "sent-folder");
 }
@@ -330,12 +330,12 @@ e_source_mail_submission_dup_transport_uid (ESourceMailSubmission *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_mail_submission_get_transport_uid (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -356,17 +356,17 @@ e_source_mail_submission_set_transport_uid (ESourceMailSubmission *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->transport_uid, transport_uid) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->transport_uid);
 	extension->priv->transport_uid = g_strdup (transport_uid);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "transport-uid");
 }
diff --git a/libedataserver/e-source-openpgp.c b/libedataserver/e-source-openpgp.c
index ef1fd5a..483ce08 100644
--- a/libedataserver/e-source-openpgp.c
+++ b/libedataserver/e-source-openpgp.c
@@ -44,7 +44,7 @@
 	((obj), E_TYPE_SOURCE_OPENPGP, ESourceOpenPGPPrivate))
 
 struct _ESourceOpenPGPPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *key_id;
 	gchar *signing_algorithm;
 
@@ -161,7 +161,7 @@ source_openpgp_finalize (GObject *object)
 
 	priv = E_SOURCE_OPENPGP_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->key_id);
 	g_free (priv->signing_algorithm);
@@ -256,7 +256,7 @@ static void
 e_source_openpgp_init (ESourceOpenPGP *extension)
 {
 	extension->priv = E_SOURCE_OPENPGP_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -382,12 +382,12 @@ e_source_openpgp_dup_key_id (ESourceOpenPGP *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_OPENPGP (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_openpgp_get_key_id (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -411,17 +411,17 @@ e_source_openpgp_set_key_id (ESourceOpenPGP *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_OPENPGP (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->key_id, key_id) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->key_id);
 	extension->priv->key_id = e_util_strdup_strip (key_id);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "key-id");
 }
@@ -466,12 +466,12 @@ e_source_openpgp_dup_signing_algorithm (ESourceOpenPGP *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_OPENPGP (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_openpgp_get_signing_algorithm (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -496,10 +496,10 @@ e_source_openpgp_set_signing_algorithm (ESourceOpenPGP *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_OPENPGP (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->signing_algorithm, signing_algorithm) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -507,7 +507,7 @@ e_source_openpgp_set_signing_algorithm (ESourceOpenPGP *extension,
 	extension->priv->signing_algorithm =
 		e_util_strdup_strip (signing_algorithm);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "signing-algorithm");
 }
diff --git a/libedataserver/e-source-refresh.c b/libedataserver/e-source-refresh.c
index e4662ea..c8fcbd6 100644
--- a/libedataserver/e-source-refresh.c
+++ b/libedataserver/e-source-refresh.c
@@ -47,7 +47,7 @@ struct _ESourceRefreshPrivate {
 	gboolean enabled;
 	guint interval_minutes;
 
-	GMutex *timeout_lock;
+	GMutex timeout_lock;
 	GHashTable *timeout_table;
 	guint next_timeout_id;
 };
@@ -172,7 +172,7 @@ source_refresh_update_timeouts (ESourceRefresh *extension,
 {
 	GList *list, *link;
 
-	g_mutex_lock (extension->priv->timeout_lock);
+	g_mutex_lock (&extension->priv->timeout_lock);
 
 	list = g_hash_table_get_values (extension->priv->timeout_table);
 
@@ -190,7 +190,7 @@ source_refresh_update_timeouts (ESourceRefresh *extension,
 
 	g_list_free (list);
 
-	g_mutex_unlock (extension->priv->timeout_lock);
+	g_mutex_unlock (&extension->priv->timeout_lock);
 }
 
 static gboolean
@@ -294,7 +294,7 @@ source_refresh_finalize (GObject *object)
 
 	priv = E_SOURCE_REFRESH_GET_PRIVATE (object);
 
-	g_mutex_free (priv->timeout_lock);
+	g_mutex_clear (&priv->timeout_lock);
 	g_hash_table_destroy (priv->timeout_table);
 
 	/* Chain up to parent's finalize() method. */
@@ -380,7 +380,7 @@ e_source_refresh_init (ESourceRefresh *extension)
 		(GDestroyNotify) timeout_node_free);
 
 	extension->priv = E_SOURCE_REFRESH_GET_PRIVATE (extension);
-	extension->priv->timeout_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->timeout_lock);
 	extension->priv->timeout_table = timeout_table;
 	extension->priv->next_timeout_id = 1;
 }
@@ -525,7 +525,7 @@ e_source_refresh_add_timeout (ESource *source,
 	extension_name = E_SOURCE_EXTENSION_REFRESH;
 	extension = e_source_get_extension (source, extension_name);
 
-	g_mutex_lock (extension->priv->timeout_lock);
+	g_mutex_lock (&extension->priv->timeout_lock);
 
 	timeout_id = extension->priv->next_timeout_id++;
 
@@ -537,7 +537,7 @@ e_source_refresh_add_timeout (ESource *source,
 	if (e_source_refresh_get_enabled (extension))
 		timeout_node_attach (node);
 
-	g_mutex_unlock (extension->priv->timeout_lock);
+	g_mutex_unlock (&extension->priv->timeout_lock);
 
 	return timeout_id;
 }
@@ -596,12 +596,12 @@ e_source_refresh_remove_timeout (ESource *source,
 	extension_name = E_SOURCE_EXTENSION_REFRESH;
 	extension = e_source_get_extension (source, extension_name);
 
-	g_mutex_lock (extension->priv->timeout_lock);
+	g_mutex_lock (&extension->priv->timeout_lock);
 
 	key = GUINT_TO_POINTER (refresh_timeout_id);
 	removed = g_hash_table_remove (extension->priv->timeout_table, key);
 
-	g_mutex_unlock (extension->priv->timeout_lock);
+	g_mutex_unlock (&extension->priv->timeout_lock);
 
 	return removed;
 }
@@ -634,7 +634,7 @@ e_source_refresh_remove_timeouts_by_data (ESource *source,
 	extension_name = E_SOURCE_EXTENSION_REFRESH;
 	extension = e_source_get_extension (source, extension_name);
 
-	g_mutex_lock (extension->priv->timeout_lock);
+	g_mutex_lock (&extension->priv->timeout_lock);
 
 	g_hash_table_iter_init (&iter, extension->priv->timeout_table);
 
@@ -649,7 +649,7 @@ e_source_refresh_remove_timeouts_by_data (ESource *source,
 		if (g_hash_table_remove (extension->priv->timeout_table, key))
 			n_removed++;
 
-	g_mutex_unlock (extension->priv->timeout_lock);
+	g_mutex_unlock (&extension->priv->timeout_lock);
 
 	return n_removed;
 }
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index 7c0025f..3077f57 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -109,10 +109,10 @@ struct _ESourceRegistryPrivate {
 	EDBusSourceManager *dbus_source_manager;
 
 	GHashTable *object_path_table;
-	GMutex *object_path_table_lock;
+	GMutex object_path_table_lock;
 
 	GHashTable *sources;
-	GMutex *sources_lock;
+	GMutex sources_lock;
 
 	GSettings *settings;
 };
@@ -152,8 +152,8 @@ struct _ThreadClosure {
 	ESourceRegistry *registry;
 	GMainContext *main_context;
 	GMainLoop *main_loop;
-	GCond *main_loop_cond;
-	GMutex *main_loop_mutex;
+	GCond main_loop_cond;
+	GMutex main_loop_mutex;
 	GError *error;
 };
 
@@ -278,8 +278,8 @@ thread_closure_free (ThreadClosure *closure)
 
 	g_main_context_unref (closure->main_context);
 	g_main_loop_unref (closure->main_loop);
-	g_cond_free (closure->main_loop_cond);
-	g_mutex_free (closure->main_loop_mutex);
+	g_cond_clear (&closure->main_loop_cond);
+	g_mutex_clear (&closure->main_loop_mutex);
 
 	/* The GError should be NULL at this point,
 	 * regardless of whether an error occurred. */
@@ -296,14 +296,14 @@ source_registry_object_path_table_insert (ESourceRegistry *registry,
 	g_return_if_fail (object_path != NULL);
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	g_mutex_lock (registry->priv->object_path_table_lock);
+	g_mutex_lock (&registry->priv->object_path_table_lock);
 
 	g_hash_table_insert (
 		registry->priv->object_path_table,
 		g_strdup (object_path),
 		g_object_ref (source));
 
-	g_mutex_unlock (registry->priv->object_path_table_lock);
+	g_mutex_unlock (&registry->priv->object_path_table_lock);
 }
 
 static ESource *
@@ -314,14 +314,14 @@ source_registry_object_path_table_lookup (ESourceRegistry *registry,
 
 	g_return_val_if_fail (object_path != NULL, NULL);
 
-	g_mutex_lock (registry->priv->object_path_table_lock);
+	g_mutex_lock (&registry->priv->object_path_table_lock);
 
 	source = g_hash_table_lookup (
 		registry->priv->object_path_table, object_path);
 	if (source != NULL)
 		g_object_ref (source);
 
-	g_mutex_unlock (registry->priv->object_path_table_lock);
+	g_mutex_unlock (&registry->priv->object_path_table_lock);
 
 	return source;
 }
@@ -334,12 +334,12 @@ source_registry_object_path_table_remove (ESourceRegistry *registry,
 
 	g_return_val_if_fail (object_path != NULL, FALSE);
 
-	g_mutex_lock (registry->priv->object_path_table_lock);
+	g_mutex_lock (&registry->priv->object_path_table_lock);
 
 	removed = g_hash_table_remove (
 		registry->priv->object_path_table, object_path);
 
-	g_mutex_unlock (registry->priv->object_path_table_lock);
+	g_mutex_unlock (&registry->priv->object_path_table_lock);
 
 	return removed;
 }
@@ -353,13 +353,13 @@ source_registry_sources_insert (ESourceRegistry *registry,
 	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	g_hash_table_insert (
 		registry->priv->sources,
 		g_strdup (uid), g_object_ref (source));
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 }
 
 static gboolean
@@ -372,11 +372,11 @@ source_registry_sources_remove (ESourceRegistry *registry,
 	uid = e_source_get_uid (source);
 	g_return_val_if_fail (uid != NULL, FALSE);
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	removed = g_hash_table_remove (registry->priv->sources, uid);
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 
 	return removed;
 }
@@ -389,14 +389,14 @@ source_registry_sources_lookup (ESourceRegistry *registry,
 
 	g_return_val_if_fail (uid != NULL, NULL);
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	source = g_hash_table_lookup (registry->priv->sources, uid);
 
 	if (source != NULL)
 		g_object_ref (source);
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 
 	return source;
 }
@@ -406,13 +406,13 @@ source_registry_sources_get_values (ESourceRegistry *registry)
 {
 	GList *values;
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	values = g_hash_table_get_values (registry->priv->sources);
 
 	g_list_foreach (values, (GFunc) g_object_ref, NULL);
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 
 	return values;
 }
@@ -425,7 +425,7 @@ source_registry_sources_build_tree (ESourceRegistry *registry)
 	GHashTableIter iter;
 	gpointer key, value;
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	root = g_node_new (NULL);
 	index = g_hash_table_new (g_str_hash, g_str_equal);
@@ -463,7 +463,7 @@ source_registry_sources_build_tree (ESourceRegistry *registry)
 
 	g_hash_table_destroy (index);
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 
 	return root;
 }
@@ -614,11 +614,11 @@ source_registry_add_source (ESourceRegistry *registry,
 	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
-	g_mutex_lock (registry->priv->sources_lock);
+	g_mutex_lock (&registry->priv->sources_lock);
 
 	/* Check if we already have this source in the registry. */
 	if (g_hash_table_lookup (registry->priv->sources, uid) != NULL) {
-		g_mutex_unlock (registry->priv->sources_lock);
+		g_mutex_unlock (&registry->priv->sources_lock);
 		return;
 	}
 
@@ -632,7 +632,7 @@ source_registry_add_source (ESourceRegistry *registry,
 		G_CALLBACK (source_registry_source_notify_enabled_cb),
 		registry);
 
-	g_mutex_unlock (registry->priv->sources_lock);
+	g_mutex_unlock (&registry->priv->sources_lock);
 
 	source_registry_sources_insert (registry, source);
 }
@@ -741,9 +741,9 @@ source_registry_object_manager_running (gpointer data)
 {
 	ThreadClosure *closure = data;
 
-	g_mutex_lock (closure->main_loop_mutex);
-	g_cond_broadcast (closure->main_loop_cond);
-	g_mutex_unlock (closure->main_loop_mutex);
+	g_mutex_lock (&closure->main_loop_mutex);
+	g_cond_broadcast (&closure->main_loop_cond);
+	g_mutex_unlock (&closure->main_loop_mutex);
 
 	return FALSE;
 }
@@ -1007,10 +1007,10 @@ source_registry_finalize (GObject *object)
 	priv = E_SOURCE_REGISTRY_GET_PRIVATE (object);
 
 	g_hash_table_destroy (priv->object_path_table);
-	g_mutex_free (priv->object_path_table_lock);
+	g_mutex_clear (&priv->object_path_table_lock);
 
 	g_hash_table_destroy (priv->sources);
-	g_mutex_free (priv->sources_lock);
+	g_mutex_clear (&priv->sources_lock);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_source_registry_parent_class)->finalize (object);
@@ -1033,26 +1033,26 @@ source_registry_initable_init (GInitable *initable,
 	 * we wait for the main loop to start running as a way of
 	 * synchronizing with the manager thread. */
 	closure->main_loop = g_main_loop_new (closure->main_context, FALSE);
-	closure->main_loop_cond = g_cond_new ();
-	closure->main_loop_mutex = g_mutex_new ();
+	g_cond_init (&closure->main_loop_cond);
+	g_mutex_init (&closure->main_loop_mutex);
 
 	registry->priv->thread_closure = closure;
 
-	registry->priv->manager_thread = g_thread_create (
+	registry->priv->manager_thread = g_thread_new (NULL,
 		source_registry_object_manager_thread,
-		closure, TRUE /* joinable */, error);
+		closure);
 
 	if (registry->priv->manager_thread == NULL)
 		return FALSE;
 
 	/* Wait for notification that the manager
 	 * thread's main loop has been started. */
-	g_mutex_lock (closure->main_loop_mutex);
+	g_mutex_lock (&closure->main_loop_mutex);
 	while (!g_main_loop_is_running (closure->main_loop))
 		g_cond_wait (
-			closure->main_loop_cond,
-			closure->main_loop_mutex);
-	g_mutex_unlock (closure->main_loop_mutex);
+			&closure->main_loop_cond,
+			&closure->main_loop_mutex);
+	g_mutex_unlock (&closure->main_loop_mutex);
 
 	/* Check for error in the manager thread. */
 	if (closure->error != NULL) {
@@ -1311,7 +1311,7 @@ e_source_registry_init (ESourceRegistry *registry)
 			(GDestroyNotify) g_free,
 			(GDestroyNotify) g_object_unref);
 
-	registry->priv->object_path_table_lock = g_mutex_new ();
+	g_mutex_init (&registry->priv->object_path_table_lock);
 
 	/* UID string -> ESource */
 	registry->priv->sources = g_hash_table_new_full (
@@ -1320,7 +1320,7 @@ e_source_registry_init (ESourceRegistry *registry)
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) source_registry_unref_source);
 
-	registry->priv->sources_lock = g_mutex_new ();
+	g_mutex_init (&registry->priv->sources_lock);
 
 	registry->priv->settings = g_settings_new (GSETTINGS_SCHEMA);
 
diff --git a/libedataserver/e-source-resource.c b/libedataserver/e-source-resource.c
index 12bcd4c..35e1501 100644
--- a/libedataserver/e-source-resource.c
+++ b/libedataserver/e-source-resource.c
@@ -50,7 +50,7 @@
 	((obj), E_TYPE_SOURCE_RESOURCE, ESourceResourcePrivate))
 
 struct _ESourceResourcePrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *identity;
 };
 
@@ -106,7 +106,7 @@ source_resource_finalize (GObject *object)
 
 	priv = E_SOURCE_RESOURCE_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->identity);
 
@@ -148,7 +148,7 @@ static void
 e_source_resource_init (ESourceResource *extension)
 {
 	extension->priv = E_SOURCE_RESOURCE_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -191,12 +191,12 @@ e_source_resource_dup_identity (ESourceResource *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_RESOURCE (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_resource_get_identity (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -221,17 +221,17 @@ e_source_resource_set_identity (ESourceResource *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_RESOURCE (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->identity, identity) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->identity);
 	extension->priv->identity = e_util_strdup_strip (identity);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "identity");
 }
diff --git a/libedataserver/e-source-security.c b/libedataserver/e-source-security.c
index 81f7934..3360f07 100644
--- a/libedataserver/e-source-security.c
+++ b/libedataserver/e-source-security.c
@@ -46,7 +46,7 @@
 #define SECURE_METHOD "tls"
 
 struct _ESourceSecurityPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *method;
 };
 
@@ -116,7 +116,7 @@ source_security_finalize (GObject *object)
 
 	priv = E_SOURCE_SECURITY_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->method);
 
@@ -169,7 +169,7 @@ static void
 e_source_security_init (ESourceSecurity *extension)
 {
 	extension->priv = E_SOURCE_SECURITY_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -214,12 +214,12 @@ e_source_security_dup_method (ESourceSecurity *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_SECURITY (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_security_get_method (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -246,11 +246,11 @@ e_source_security_set_method (ESourceSecurity *extension,
 
 	g_return_if_fail (E_IS_SOURCE_SECURITY (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (extension->priv->method &&
 	    g_strcmp0 (extension->priv->method, method) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -260,7 +260,7 @@ e_source_security_set_method (ESourceSecurity *extension,
 	if (extension->priv->method == NULL)
 		extension->priv->method = g_strdup ("none");
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	object = G_OBJECT (extension);
 	g_object_freeze_notify (object);
diff --git a/libedataserver/e-source-selectable.c b/libedataserver/e-source-selectable.c
index 0d0f383..d501573 100644
--- a/libedataserver/e-source-selectable.c
+++ b/libedataserver/e-source-selectable.c
@@ -35,7 +35,7 @@
 	((obj), E_TYPE_SOURCE_SELECTABLE, ESourceSelectablePrivate))
 
 struct _ESourceSelectablePrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *color;
 	gboolean selected;
 };
@@ -106,7 +106,7 @@ source_selectable_finalize (GObject *object)
 
 	priv = E_SOURCE_SELECTABLE_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->color);
 
@@ -160,7 +160,7 @@ static void
 e_source_selectable_init (ESourceSelectable *extension)
 {
 	extension->priv = E_SOURCE_SELECTABLE_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -204,12 +204,12 @@ e_source_selectable_dup_color (ESourceSelectable *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_SELECTABLE (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_selectable_get_color (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -235,17 +235,17 @@ e_source_selectable_set_color (ESourceSelectable *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_SELECTABLE (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->color, color) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->color);
 	extension->priv->color = e_util_strdup_strip (color);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "color");
 }
diff --git a/libedataserver/e-source-smime.c b/libedataserver/e-source-smime.c
index 2ad1bec..d3cf323 100644
--- a/libedataserver/e-source-smime.c
+++ b/libedataserver/e-source-smime.c
@@ -44,7 +44,7 @@
 	((obj), E_TYPE_SOURCE_SMIME, ESourceSMIMEPrivate))
 
 struct _ESourceSMIMEPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *encryption_certificate;
 	gchar *signing_algorithm;
 	gchar *signing_certificate;
@@ -176,7 +176,7 @@ source_smime_finalize (GObject *object)
 
 	priv = E_SOURCE_SMIME_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->encryption_certificate);
 	g_free (priv->signing_algorithm);
@@ -285,7 +285,7 @@ static void
 e_source_smime_init (ESourceSMIME *extension)
 {
 	extension->priv = E_SOURCE_SMIME_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 }
 
 /**
@@ -327,12 +327,12 @@ e_source_smime_dup_encryption_certificate (ESourceSMIME *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_smime_get_encryption_certificate (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -357,12 +357,12 @@ e_source_smime_set_encryption_certificate (ESourceSMIME *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_SMIME (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (
 		extension->priv->encryption_certificate,
 		encryption_certificate) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -370,7 +370,7 @@ e_source_smime_set_encryption_certificate (ESourceSMIME *extension,
 	extension->priv->encryption_certificate =
 		e_util_strdup_strip (encryption_certificate);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "encryption-certificate");
 }
@@ -499,12 +499,12 @@ e_source_smime_dup_signing_algorithm (ESourceSMIME *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_smime_get_signing_algorithm (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -530,10 +530,10 @@ e_source_smime_set_signing_algorithm (ESourceSMIME *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_SMIME (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->signing_algorithm, signing_algorithm) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -541,7 +541,7 @@ e_source_smime_set_signing_algorithm (ESourceSMIME *extension,
 	extension->priv->signing_algorithm =
 		e_util_strdup_strip (signing_algorithm);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "signing-algorithm");
 }
@@ -585,12 +585,12 @@ e_source_smime_dup_signing_certificate (ESourceSMIME *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_smime_get_signing_certificate (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -615,10 +615,10 @@ e_source_smime_set_signing_certificate (ESourceSMIME *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_SMIME (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->signing_certificate, signing_certificate) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
@@ -626,7 +626,7 @@ e_source_smime_set_signing_certificate (ESourceSMIME *extension,
 	extension->priv->signing_certificate =
 		e_util_strdup_strip (signing_certificate);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "signing-certificate");
 }
diff --git a/libedataserver/e-source-webdav.c b/libedataserver/e-source-webdav.c
index 5fd9117..e0ae6ba 100644
--- a/libedataserver/e-source-webdav.c
+++ b/libedataserver/e-source-webdav.c
@@ -55,7 +55,7 @@
 	((obj), E_TYPE_SOURCE_WEBDAV, ESourceWebdavPrivate))
 
 struct _ESourceWebdavPrivate {
-	GMutex *property_lock;
+	GMutex property_lock;
 	gchar *display_name;
 	gchar *email_address;
 	gchar *resource_path;
@@ -118,9 +118,9 @@ source_webdav_update_properties_from_soup_uri (ESourceWebdav *webdav_extension)
 
 	/* Do not use e_source_webdav_dup_soup_uri() here.  That
 	 * builds the URI from properties we haven't yet updated. */
-	g_mutex_lock (webdav_extension->priv->property_lock);
+	g_mutex_lock (&webdav_extension->priv->property_lock);
 	soup_uri = soup_uri_copy (webdav_extension->priv->soup_uri);
-	g_mutex_unlock (webdav_extension->priv->property_lock);
+	g_mutex_unlock (&webdav_extension->priv->property_lock);
 
 	extension = E_SOURCE_EXTENSION (webdav_extension);
 	source = e_source_extension_ref_source (extension);
@@ -197,7 +197,7 @@ source_webdav_update_soup_uri_from_properties (ESourceWebdav *webdav_extension)
 
 	g_object_unref (source);
 
-	g_mutex_lock (webdav_extension->priv->property_lock);
+	g_mutex_lock (&webdav_extension->priv->property_lock);
 
 	soup_uri = webdav_extension->priv->soup_uri;
 
@@ -217,7 +217,7 @@ source_webdav_update_soup_uri_from_properties (ESourceWebdav *webdav_extension)
 
 	soup_uri_set_query (soup_uri, query);
 
-	g_mutex_unlock (webdav_extension->priv->property_lock);
+	g_mutex_unlock (&webdav_extension->priv->property_lock);
 
 	g_free (user);
 	g_free (host);
@@ -358,7 +358,7 @@ source_webdav_finalize (GObject *object)
 
 	priv = E_SOURCE_WEBDAV_GET_PRIVATE (object);
 
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->display_name);
 	g_free (priv->email_address);
@@ -549,7 +549,7 @@ static void
 e_source_webdav_init (ESourceWebdav *extension)
 {
 	extension->priv = E_SOURCE_WEBDAV_GET_PRIVATE (extension);
-	extension->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&extension->priv->property_lock);
 
 	/* Initialize this enough for SOUP_URI_IS_VALID() to pass. */
 	extension->priv->soup_uri = soup_uri_new (NULL);
@@ -699,12 +699,12 @@ e_source_webdav_dup_display_name (ESourceWebdav *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_webdav_get_display_name (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -731,17 +731,17 @@ e_source_webdav_set_display_name (ESourceWebdav *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->display_name, display_name) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->display_name);
 	extension->priv->display_name = e_util_strdup_strip (display_name);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "display-name");
 }
@@ -786,12 +786,12 @@ e_source_webdav_dup_email_address (ESourceWebdav *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_webdav_get_email_address (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -816,17 +816,17 @@ e_source_webdav_set_email_address (ESourceWebdav *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->email_address, email_address) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->email_address);
 	extension->priv->email_address = e_util_strdup_strip (email_address);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "email-address");
 }
@@ -917,12 +917,12 @@ e_source_webdav_dup_resource_path (ESourceWebdav *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_webdav_get_resource_path (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -947,17 +947,17 @@ e_source_webdav_set_resource_path (ESourceWebdav *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->resource_path, resource_path) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->resource_path);
 	extension->priv->resource_path = e_util_strdup_strip (resource_path);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "resource-path");
 }
@@ -1006,12 +1006,12 @@ e_source_webdav_dup_resource_query (ESourceWebdav *extension)
 
 	g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	protected = e_source_webdav_get_resource_query (extension);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -1041,17 +1041,17 @@ e_source_webdav_set_resource_query (ESourceWebdav *extension,
 {
 	g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	if (g_strcmp0 (extension->priv->resource_query, resource_query) == 0) {
-		g_mutex_unlock (extension->priv->property_lock);
+		g_mutex_unlock (&extension->priv->property_lock);
 		return;
 	}
 
 	g_free (extension->priv->resource_query);
 	extension->priv->resource_query = e_util_strdup_strip (resource_query);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_notify (G_OBJECT (extension), "resource-query");
 }
@@ -1079,11 +1079,11 @@ e_source_webdav_dup_soup_uri (ESourceWebdav *extension)
 	/* Keep this outside of the property lock. */
 	source_webdav_update_soup_uri_from_properties (extension);
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	duplicate = soup_uri_copy (extension->priv->soup_uri);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	return duplicate;
 }
@@ -1107,7 +1107,7 @@ e_source_webdav_set_soup_uri (ESourceWebdav *extension,
 	g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
 	g_return_if_fail (SOUP_URI_IS_VALID (soup_uri));
 
-	g_mutex_lock (extension->priv->property_lock);
+	g_mutex_lock (&extension->priv->property_lock);
 
 	/* Do not test for URI equality because our
 	 * internal SoupURI might not be up-to-date. */
@@ -1115,7 +1115,7 @@ e_source_webdav_set_soup_uri (ESourceWebdav *extension,
 	soup_uri_free (extension->priv->soup_uri);
 	extension->priv->soup_uri = soup_uri_copy (soup_uri);
 
-	g_mutex_unlock (extension->priv->property_lock);
+	g_mutex_unlock (&extension->priv->property_lock);
 
 	g_object_freeze_notify (G_OBJECT (extension));
 	source_webdav_update_properties_from_soup_uri (extension);
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 1ce85eb..75eb7f6 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -116,9 +116,9 @@ struct _ESourcePrivate {
 	GMainContext *main_context;
 
 	GSource *changed;
-	GMutex *changed_lock;
+	GMutex changed_lock;
 
-	GMutex *property_lock;
+	GMutex property_lock;
 
 	gchar *display_name;
 	gchar *collate_key;
@@ -128,7 +128,7 @@ struct _ESourcePrivate {
 	/* The lock guards the key file and hash table. */
 
 	GKeyFile *key_file;
-	GStaticRecMutex lock;
+	GRecMutex lock;
 	GHashTable *extensions;
 
 	gboolean enabled;
@@ -647,7 +647,7 @@ source_notify_dbus_data_cb (EDBusSource *dbus_source,
 {
 	GError *error = NULL;
 
-	g_static_rec_mutex_lock (&source->priv->lock);
+	g_rec_mutex_lock (&source->priv->lock);
 
 	/* Since the source data came from a GKeyFile structure on the
 	 * server-side, this should never fail.  But we'll print error
@@ -658,7 +658,7 @@ source_notify_dbus_data_cb (EDBusSource *dbus_source,
 		g_error_free (error);
 	}
 
-	g_static_rec_mutex_unlock (&source->priv->lock);
+	g_rec_mutex_unlock (&source->priv->lock);
 }
 
 static gboolean
@@ -673,12 +673,12 @@ source_idle_changed_cb (gpointer user_data)
 	if (!source->priv->initialized)
 		return TRUE;
 
-	g_mutex_lock (source->priv->changed_lock);
+	g_mutex_lock (&source->priv->changed_lock);
 	if (source->priv->changed != NULL) {
 		g_source_unref (source->priv->changed);
 		source->priv->changed = NULL;
 	}
-	g_mutex_unlock (source->priv->changed_lock);
+	g_mutex_unlock (&source->priv->changed_lock);
 
 	g_signal_emit (source, signals[CHANGED], 0);
 
@@ -873,13 +873,13 @@ source_dispose (GObject *object)
 	}
 
 	/* XXX Maybe not necessary to acquire the lock? */
-	g_mutex_lock (priv->changed_lock);
+	g_mutex_lock (&priv->changed_lock);
 	if (priv->changed != NULL) {
 		g_source_destroy (priv->changed);
 		g_source_unref (priv->changed);
 		priv->changed = NULL;
 	}
-	g_mutex_unlock (priv->changed_lock);
+	g_mutex_unlock (&priv->changed_lock);
 
 	g_hash_table_remove_all (priv->extensions);
 
@@ -894,8 +894,8 @@ source_finalize (GObject *object)
 
 	priv = E_SOURCE_GET_PRIVATE (object);
 
-	g_mutex_free (priv->changed_lock);
-	g_mutex_free (priv->property_lock);
+	g_mutex_clear (&priv->changed_lock);
+	g_mutex_clear (&priv->property_lock);
 
 	g_free (priv->display_name);
 	g_free (priv->collate_key);
@@ -903,7 +903,7 @@ source_finalize (GObject *object)
 	g_free (priv->uid);
 
 	g_key_file_free (priv->key_file);
-	g_static_rec_mutex_free (&priv->lock);
+	g_rec_mutex_clear (&priv->lock);
 	g_hash_table_destroy (priv->extensions);
 
 	/* Chain up to parent's finalize() method. */
@@ -1331,13 +1331,13 @@ source_initable_init (GInitable *initable,
 	}
 
 	/* Try to avoid a spurious "changed" emission. */
-	g_mutex_lock (source->priv->changed_lock);
+	g_mutex_lock (&source->priv->changed_lock);
 	if (source->priv->changed != NULL) {
 		g_source_destroy (source->priv->changed);
 		g_source_unref (source->priv->changed);
 		source->priv->changed = NULL;
 	}
-	g_mutex_unlock (source->priv->changed_lock);
+	g_mutex_unlock (&source->priv->changed_lock);
 
 	source->priv->initialized = TRUE;
 
@@ -1559,12 +1559,12 @@ e_source_init (ESource *source)
 		(GDestroyNotify) g_object_unref);
 
 	source->priv = E_SOURCE_GET_PRIVATE (source);
-	source->priv->changed_lock = g_mutex_new ();
-	source->priv->property_lock = g_mutex_new ();
+	g_mutex_init (&source->priv->changed_lock);
+	g_mutex_init (&source->priv->property_lock);
 	source->priv->key_file = g_key_file_new ();
 	source->priv->extensions = extensions;
 
-	g_static_rec_mutex_init (&source->priv->lock);
+	g_rec_mutex_init (&source->priv->lock);
 }
 
 /**
@@ -1704,7 +1704,7 @@ e_source_changed (ESource *source)
 {
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	g_mutex_lock (source->priv->changed_lock);
+	g_mutex_lock (&source->priv->changed_lock);
 	if (source->priv->changed == NULL) {
 		source->priv->changed = g_idle_source_new ();
 		g_source_set_callback (
@@ -1715,7 +1715,7 @@ e_source_changed (ESource *source)
 			source->priv->changed,
 			source->priv->main_context);
 	}
-	g_mutex_unlock (source->priv->changed_lock);
+	g_mutex_unlock (&source->priv->changed_lock);
 }
 
 /**
@@ -1760,12 +1760,12 @@ e_source_dup_uid (ESource *source)
 	/* Perhaps we don't need to lock the mutex since
 	 * this is a read-only property but it can't hurt. */
 
-	g_mutex_lock (source->priv->property_lock);
+	g_mutex_lock (&source->priv->property_lock);
 
 	protected = e_source_get_uid (source);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (source->priv->property_lock);
+	g_mutex_unlock (&source->priv->property_lock);
 
 	return duplicate;
 }
@@ -1809,12 +1809,12 @@ e_source_dup_parent (ESource *source)
 
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 
-	g_mutex_lock (source->priv->property_lock);
+	g_mutex_lock (&source->priv->property_lock);
 
 	protected = e_source_get_parent (source);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (source->priv->property_lock);
+	g_mutex_unlock (&source->priv->property_lock);
 
 	return duplicate;
 }
@@ -1839,17 +1839,17 @@ e_source_set_parent (ESource *source,
 {
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	g_mutex_lock (source->priv->property_lock);
+	g_mutex_lock (&source->priv->property_lock);
 
 	if (g_strcmp0 (source->priv->parent, parent) == 0) {
-		g_mutex_unlock (source->priv->property_lock);
+		g_mutex_unlock (&source->priv->property_lock);
 		return;
 	}
 
 	g_free (source->priv->parent);
 	source->priv->parent = e_util_strdup_strip (parent);
 
-	g_mutex_unlock (source->priv->property_lock);
+	g_mutex_unlock (&source->priv->property_lock);
 
 	g_object_notify (G_OBJECT (source), "parent");
 }
@@ -2055,7 +2055,7 @@ e_source_get_extension (ESource *source,
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 	g_return_val_if_fail (extension_name != NULL, NULL);
 
-	g_static_rec_mutex_lock (&source->priv->lock);
+	g_rec_mutex_lock (&source->priv->lock);
 
 	/* Check if we already have the extension. */
 	extension = g_hash_table_lookup (
@@ -2091,7 +2091,7 @@ e_source_get_extension (ESource *source,
 	g_hash_table_destroy (hash_table);
 
 exit:
-	g_static_rec_mutex_unlock (&source->priv->lock);
+	g_rec_mutex_unlock (&source->priv->lock);
 
 	return extension;
 }
@@ -2116,7 +2116,7 @@ e_source_has_extension (ESource *source,
 	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
 	g_return_val_if_fail (extension_name != NULL, FALSE);
 
-	g_static_rec_mutex_lock (&source->priv->lock);
+	g_rec_mutex_lock (&source->priv->lock);
 
 	/* Two cases to check for, either one is good enough:
 	 * 1) Our internal GKeyFile has a group named 'extension_name'.
@@ -2139,7 +2139,7 @@ e_source_has_extension (ESource *source,
 		extension = g_hash_table_lookup (hash_table, extension_name);
 	}
 
-	g_static_rec_mutex_unlock (&source->priv->lock);
+	g_rec_mutex_unlock (&source->priv->lock);
 
 	return (extension != NULL);
 }
@@ -2230,12 +2230,12 @@ e_source_dup_display_name (ESource *source)
 
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 
-	g_mutex_lock (source->priv->property_lock);
+	g_mutex_lock (&source->priv->property_lock);
 
 	protected = e_source_get_display_name (source);
 	duplicate = g_strdup (protected);
 
-	g_mutex_unlock (source->priv->property_lock);
+	g_mutex_unlock (&source->priv->property_lock);
 
 	return duplicate;
 }
@@ -2262,10 +2262,10 @@ e_source_set_display_name (ESource *source,
 	g_return_if_fail (display_name != NULL);
 	g_return_if_fail (g_utf8_validate (display_name, -1, NULL));
 
-	g_mutex_lock (source->priv->property_lock);
+	g_mutex_lock (&source->priv->property_lock);
 
 	if (g_strcmp0 (source->priv->display_name, display_name) == 0) {
-		g_mutex_unlock (source->priv->property_lock);
+		g_mutex_unlock (&source->priv->property_lock);
 		return;
 	}
 
@@ -2279,7 +2279,7 @@ e_source_set_display_name (ESource *source,
 	g_free (source->priv->collate_key);
 	source->priv->collate_key = g_utf8_collate_key (display_name, -1);
 
-	g_mutex_unlock (source->priv->property_lock);
+	g_mutex_unlock (&source->priv->property_lock);
 
 	g_object_notify (G_OBJECT (source), "display-name");
 }
@@ -2332,7 +2332,7 @@ e_source_to_string (ESource *source,
 
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 
-	g_static_rec_mutex_lock (&source->priv->lock);
+	g_rec_mutex_lock (&source->priv->lock);
 
 	key_file = source->priv->key_file;
 
@@ -2345,7 +2345,7 @@ e_source_to_string (ESource *source,
 
 	data = g_key_file_to_data (key_file, length, NULL);
 
-	g_static_rec_mutex_unlock (&source->priv->lock);
+	g_rec_mutex_unlock (&source->priv->lock);
 
 	return data;
 }
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index e66c018..26cce75 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -95,14 +95,10 @@ idle_cb (gpointer data)
 	g_return_val_if_fail (idle->func != NULL, FALSE);
 
 	if (idle->run_in_thread) {
-		GError *error = NULL;
+		GThread *thread;
 
-		g_thread_create (idle->func, idle->data, FALSE, &error);
-
-		if (error) {
-			report_error ("create thread", &error);
-			stop_main_loop (1);
-		}
+		thread = g_thread_new (NULL, idle->func, idle->data);
+		g_thread_unref (thread);
 	} else {
 		idle->func (idle->data);
 	}
diff --git a/tests/libecal/client/client-test-utils.c b/tests/libecal/client/client-test-utils.c
index 12a2aa2..ee69cff 100644
--- a/tests/libecal/client/client-test-utils.c
+++ b/tests/libecal/client/client-test-utils.c
@@ -84,14 +84,10 @@ idle_cb (gpointer data)
 	g_return_val_if_fail (idle->func != NULL, FALSE);
 
 	if (idle->run_in_thread) {
-		GError *error = NULL;
+		GThread *thread;
 
-		g_thread_create (idle->func, idle->data, FALSE, &error);
-
-		if (error) {
-			report_error ("create thread", &error);
-			stop_main_loop (1);
-		}
+		thread = g_thread_new (NULL, idle->func, idle->data);
+		g_thread_unref (thread);
 	} else {
 		idle->func (idle->data);
 	}



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