[evolution/foocanvas] Camel is now GObject-based.



commit 63116ac31f3b0aaf81ac6dd077f57383d888638d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Apr 23 10:28:53 2010 -0400

    Camel is now GObject-based.

 calendar/gui/dialogs/comp-editor.c               |    2 +-
 calendar/gui/itip-utils.c                        |    4 +-
 capplet/settings/mail-capplet-shell.c            |    2 +-
 composer/e-composer-autosave.c                   |    4 +-
 composer/e-composer-header-table.c               |    2 +-
 composer/e-composer-private.c                    |    6 +-
 composer/e-msg-composer.c                        |  118 ++++++++--------
 e-util/e-signature-utils.c                       |   12 +-
 e-util/e-util.c                                  |    4 +-
 em-format/em-format-quote.c                      |   18 ++--
 em-format/em-format.c                            |   78 ++++++------
 em-format/em-stripsig-filter.c                   |  100 ++++++--------
 em-format/em-stripsig-filter.h                   |   41 ++++--
 mail/e-mail-backend.c                            |    2 +-
 mail/e-mail-local.c                              |    2 +-
 mail/e-mail-migrate.c                            |   36 ++----
 mail/e-mail-reader.c                             |    8 +-
 mail/e-mail-store.c                              |   16 +-
 mail/em-composer-utils.c                         |   78 ++++++------
 mail/em-config.c                                 |    4 +-
 mail/em-event.c                                  |    8 +-
 mail/em-folder-properties.c                      |    4 +-
 mail/em-folder-tree-model.c                      |   24 ++--
 mail/em-folder-tree.c                            |   24 ++--
 mail/em-folder-utils.c                           |   30 ++--
 mail/em-format-html-display.c                    |    4 +-
 mail/em-format-html.c                            |   58 ++++----
 mail/em-html-stream.c                            |   76 ++++-------
 mail/em-html-stream.h                            |   23 ++-
 mail/em-inline-filter.c                          |  157 ++++++++++------------
 mail/em-inline-filter.h                          |   40 ++++--
 mail/em-subscribe-editor.c                       |    4 +-
 mail/em-sync-stream.c                            |   91 ++++++-------
 mail/em-sync-stream.h                            |   22 ++-
 mail/em-utils.c                                  |   30 ++--
 mail/importers/mail-importer.c                   |    8 +-
 mail/mail-folder-cache.c                         |   22 ++--
 mail/mail-ops.c                                  |  140 ++++++++++----------
 mail/mail-send-recv.c                            |   18 ++--
 mail/mail-session.c                              |  125 +++++++++---------
 mail/mail-session.h                              |    2 +-
 mail/mail-tools.c                                |    6 +-
 mail/mail-vfolder.c                              |   22 ++--
 mail/message-list.c                              |   22 ++--
 modules/addressbook/eab-composer-util.c          |    2 +-
 modules/calendar/e-cal-attachment-handler.c      |    2 +-
 modules/mail/e-mail-attachment-handler.c         |   18 ++--
 modules/mail/e-mail-shell-settings.c             |    2 +-
 modules/mail/e-mail-shell-view-private.c         |    4 +-
 modules/mail/e-mail-shell-view.c                 |   14 +-
 plugins/audio-inline/audio-inline.c              |    6 +-
 plugins/bogo-junk-plugin/bf-junk-filter.c        |    8 +-
 plugins/groupwise-features/install-shared.c      |   12 +-
 plugins/groupwise-features/proxy.c               |    2 +-
 plugins/groupwise-features/share-folder-common.c |   12 +-
 plugins/image-inline/image-inline.c              |    6 +-
 plugins/itip-formatter/itip-formatter.c          |    2 +-
 plugins/mail-to-task/mail-to-task.c              |    2 +-
 plugins/pst-import/pst-importer.c                |   26 ++--
 plugins/sa-junk-plugin/em-junk-filter.c          |    4 +-
 plugins/templates/templates.c                    |   12 +-
 plugins/tnef-attachments/tnef-plugin.c           |   14 +-
 plugins/vcard-inline/vcard-inline.c              |    6 +-
 widgets/misc/e-account-combo-box.c               |    2 +-
 widgets/misc/e-attachment-view.c                 |    4 +-
 widgets/misc/e-attachment.c                      |   26 ++--
 widgets/misc/e-web-view.c                        |    4 +-
 67 files changed, 834 insertions(+), 853 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 6e3776d..261b0b3 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -2934,7 +2934,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
 
 		attach_list = g_slist_append (attach_list, cal_mime_attach);
 
-		camel_object_unref (stream);
+		g_object_unref (stream);
 
 	}
 
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index f686ac5..d40a7ac 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1193,7 +1193,7 @@ append_cal_attachments (EMsgComposer *composer,
 			camel_mime_part_set_disposition (
 				attachment, "attachment");
 		e_msg_composer_attach (composer, attachment);
-		camel_object_unref (attachment);
+		g_object_unref (attachment);
 
 		g_free (mime_attach->filename);
 		g_free (mime_attach->content_type);
@@ -1362,7 +1362,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
 			camel_mime_part_set_description (attachment, description);
 		camel_mime_part_set_disposition (attachment, "inline");
 		e_msg_composer_attach (composer, attachment);
-		camel_object_unref (attachment);
+		g_object_unref (attachment);
 
 		g_free (description);
 	}
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index 3c5803b..33b22f8 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -240,7 +240,7 @@ mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean
 	gtk_box_pack_end ((GtkBox *)priv->box, (GtkWidget *)shell->view, TRUE, TRUE, 2);
 
 	/* This also initializes Camel, so it needs to happen early. */
-	mail_session_init ();
+	mail_session_start ();
 	mail_config_init ();
 	mail_msg_init ();
 	custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c
index ca7492f..a850cf9 100644
--- a/composer/e-composer-autosave.c
+++ b/composer/e-composer-autosave.c
@@ -388,8 +388,8 @@ autosave_snapshot_cb (GFile *file,
 		CAMEL_STREAM_MEM (camel_stream), buffer);
 	camel_data_wrapper_decode_to_stream (
 		CAMEL_DATA_WRAPPER (message), camel_stream);
-	camel_object_unref (message);
-	camel_object_unref (camel_stream);
+	g_object_unref (message);
+	g_object_unref (camel_stream);
 
 	/* Load the buffer into a GMemoryInputStream.
 	 * But watch out for zero length MIME parts. */
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 92e2c72..26d9202 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -249,7 +249,7 @@ composer_header_table_update_destinations (EDestination **old_destinations,
 		}
 	}
 
-	camel_object_unref (inet_address);
+	g_object_unref (inet_address);
 
 skip_auto:
 
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 0ff1da7..a3d43dc 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -116,7 +116,7 @@ msg_composer_url_requested_cb (GtkHTML *html,
 
 	gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
 
-	camel_object_unref (camel_stream);
+	g_object_unref (camel_stream);
 
 	/* gtk_html_end() destroys the GtkHTMLStream, so we need to
 	 * stop the signal emission so nothing else tries to use it. */
@@ -176,7 +176,7 @@ e_composer_private_constructed (EMsgComposer *composer)
 	priv->inline_images_by_url = g_hash_table_new_full (
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
-		(GDestroyNotify) camel_object_unref);
+		(GDestroyNotify) g_object_unref);
 
 	priv->charset = e_composer_get_default_charset ();
 
@@ -440,7 +440,7 @@ e_composer_private_dispose (EMsgComposer *composer)
 	g_hash_table_remove_all (composer->priv->inline_images_by_url);
 
 	if (composer->priv->redirect != NULL) {
-		camel_object_unref (composer->priv->redirect);
+		g_object_unref (composer->priv->redirect);
 		composer->priv->redirect = NULL;
 	}
 }
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 1705d85..9d26e50 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -149,7 +149,7 @@ emcu_part_to_html (CamelMimePart *part, gssize *len, EMFormat *source)
 	g_object_unref(emfq);
 
 	camel_stream_write((CamelStream *) mem, "", 1);
-	camel_object_unref(mem);
+	g_object_unref (mem);
 
 	text = (gchar *)buf->data;
 	if (len)
@@ -461,9 +461,9 @@ set_recipients_from_destv (CamelMimeMessage *msg,
 		camel_mime_message_set_recipients (msg, header, bcc_addr);
 	}
 
-	camel_object_unref (to_addr);
-	camel_object_unref (cc_addr);
-	camel_object_unref (bcc_addr);
+	g_object_unref (to_addr);
+	g_object_unref (cc_addr);
+	g_object_unref (bcc_addr);
 }
 
 static void
@@ -506,7 +506,7 @@ build_message_headers (EMsgComposer *composer,
 		} else
 			camel_mime_message_set_from (msg, addr);
 
-		camel_object_unref (addr);
+		g_object_unref (addr);
 	}
 
 	/* Reply-To: */
@@ -519,7 +519,7 @@ build_message_headers (EMsgComposer *composer,
 		if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) > 0)
 			camel_mime_message_set_reply_to (msg, addr);
 
-		camel_object_unref (addr);
+		g_object_unref (addr);
 	}
 
 	/* To:, Cc:, Bcc: */
@@ -603,7 +603,7 @@ build_message (EMsgComposer *composer,
 	/* evil kludgy hack for Redirect */
 	if (p->redirect) {
 		build_message_headers (composer, p->redirect, TRUE);
-		camel_object_ref (p->redirect);
+		g_object_ref (p->redirect);
 		return p->redirect;
 	}
 
@@ -675,13 +675,13 @@ build_message (EMsgComposer *composer,
 		CamelMimeFilter *filter;
 
 		filter_stream = camel_stream_filter_new (stream);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 
 		stream = filter_stream;
 		filter = camel_mime_filter_charset_new ("UTF-8", iconv_charset);
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filter_stream), filter);
-		camel_object_unref (filter);
+		g_object_unref (filter);
 	}
 
 	if (plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
@@ -692,7 +692,7 @@ build_message (EMsgComposer *composer,
 
 		if (!CAMEL_IS_STREAM_FILTER (stream)) {
 			filter_stream = camel_stream_filter_new (stream);
-			camel_object_unref (stream);
+			g_object_unref (stream);
 
 			stream = filter_stream;
 		}
@@ -700,17 +700,17 @@ build_message (EMsgComposer *composer,
 		qp = camel_mime_filter_basic_new (
 			CAMEL_MIME_FILTER_BASIC_QP_ENC);
 		camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), qp);
-		camel_object_unref (qp);
+		g_object_unref (qp);
 
 		mf = camel_mime_filter_canon_new (CAMEL_MIME_FILTER_CANON_FROM);
 		camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), mf);
-		camel_object_unref (mf);
+		g_object_unref (mf);
 	}
 
 	/* construct the content object */
 	plain = camel_data_wrapper_new ();
 	camel_data_wrapper_construct_from_stream (plain, stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	if (plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
 		/* to not re-encode the data when pushing it to a part */
@@ -751,7 +751,7 @@ build_message (EMsgComposer *composer,
 
 			if (!CAMEL_IS_STREAM_FILTER (stream)) {
 				filter_stream = camel_stream_filter_new (stream);
-				camel_object_unref (stream);
+				g_object_unref (stream);
 
 				stream = filter_stream;
 			}
@@ -759,15 +759,15 @@ build_message (EMsgComposer *composer,
 			qp = camel_mime_filter_basic_new (
 				CAMEL_MIME_FILTER_BASIC_QP_ENC);
 			camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), qp);
-			camel_object_unref (qp);
+			g_object_unref (qp);
 
 			mf = camel_mime_filter_canon_new (CAMEL_MIME_FILTER_CANON_FROM);
 			camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), mf);
-			camel_object_unref (mf);
+			g_object_unref (mf);
 		}
 
 		camel_data_wrapper_construct_from_stream (html, stream);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 		camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8");
 
 		if (pre_encode) {
@@ -783,17 +783,17 @@ build_message (EMsgComposer *composer,
 
 		part = camel_mime_part_new ();
 		camel_medium_set_content (CAMEL_MEDIUM (part), plain);
-		camel_object_unref (plain);
+		g_object_unref (plain);
 		camel_mime_part_set_encoding (part, plain_encoding);
 		camel_multipart_add_part (body, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 
 		part = camel_mime_part_new ();
 		camel_medium_set_content (CAMEL_MEDIUM (part), html);
-		camel_object_unref (html);
+		g_object_unref (html);
 		camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE);
 		camel_multipart_add_part (body, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 
 		/* If there are inlined images, construct a
 		 * multipart/related containing the
@@ -810,9 +810,9 @@ build_message (EMsgComposer *composer,
 
 			part = camel_mime_part_new ();
 			camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (body));
-			camel_object_unref (body);
+			g_object_unref (body);
 			camel_multipart_add_part (html_with_images, part);
-			camel_object_unref (part);
+			g_object_unref (part);
 
 			add_inlined_images (composer, html_with_images);
 			clear_current_images (composer);
@@ -838,9 +838,9 @@ build_message (EMsgComposer *composer,
 		camel_medium_set_content (CAMEL_MEDIUM (part), current);
 		if (current == plain)
 			camel_mime_part_set_encoding (part, plain_encoding);
-		camel_object_unref (current);
+		g_object_unref (current);
 		camel_multipart_add_part (multipart, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 
 		e_attachment_store_add_to_multipart (
 			store, multipart, p->charset);
@@ -901,7 +901,7 @@ build_message (EMsgComposer *composer,
 		camel_medium_set_content (CAMEL_MEDIUM (part), current);
 		if (current == plain)
 			camel_mime_part_set_encoding (part, plain_encoding);
-		camel_object_unref (current);
+		g_object_unref (current);
 
 		account = e_composer_header_table_get_account (table);
 
@@ -923,14 +923,14 @@ build_message (EMsgComposer *composer,
 			camel_cipher_sign (
 				cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1,
 				part, npart, &ex);
-			camel_object_unref (cipher);
+			g_object_unref (cipher);
 
 			if (camel_exception_is_set (&ex)) {
-				camel_object_unref (npart);
+				g_object_unref (npart);
 				goto exception;
 			}
 
-			camel_object_unref (part);
+			g_object_unref (part);
 			part = npart;
 		}
 
@@ -949,26 +949,26 @@ build_message (EMsgComposer *composer,
 			camel_cipher_encrypt (
 				cipher, pgp_userid, recipients,
 				part, npart, &ex);
-			camel_object_unref (cipher);
+			g_object_unref (cipher);
 
 			if (account && account->pgp_encrypt_to_self && pgp_userid)
 				g_ptr_array_set_size (recipients, recipients->len - 1);
 
 			if (camel_exception_is_set (&ex)) {
-				camel_object_unref (npart);
+				g_object_unref (npart);
 				goto exception;
 			}
 
-			camel_object_unref (part);
+			g_object_unref (part);
 			part = npart;
 		}
 
 		if (from)
-			camel_object_unref (from);
+			g_object_unref (from);
 
 		current = camel_medium_get_content (CAMEL_MEDIUM (part));
-		camel_object_ref (current);
-		camel_object_unref (part);
+		g_object_ref (current);
+		g_object_unref (part);
 	}
 
 #if defined (HAVE_NSS)
@@ -980,7 +980,7 @@ build_message (EMsgComposer *composer,
 		camel_medium_set_content ((CamelMedium *)part, current);
 		if (current == plain)
 			camel_mime_part_set_encoding (part, plain_encoding);
-		camel_object_unref (current);
+		g_object_unref (current);
 
 		if (smime_sign
 		    && (account == NULL || account->smime_sign_key == NULL || account->smime_sign_key[0] == 0)) {
@@ -1010,14 +1010,14 @@ build_message (EMsgComposer *composer,
 			}
 
 			camel_cipher_sign (cipher, account->smime_sign_key, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
-			camel_object_unref (cipher);
+			g_object_unref (cipher);
 
 			if (camel_exception_is_set (&ex)) {
-				camel_object_unref (npart);
+				g_object_unref (npart);
 				goto exception;
 			}
 
-			camel_object_unref (part);
+			g_object_unref (part);
 			part = npart;
 		}
 
@@ -1031,7 +1031,7 @@ build_message (EMsgComposer *composer,
 			camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
 
 			camel_cipher_encrypt (cipher, NULL, recipients, part, (CamelMimePart *)new, &ex);
-			camel_object_unref (cipher);
+			g_object_unref (cipher);
 
 			if (camel_exception_is_set (&ex))
 				goto exception;
@@ -1041,16 +1041,16 @@ build_message (EMsgComposer *composer,
 		}
 
 		if (from)
-			camel_object_unref (from);
+			g_object_unref (from);
 
 		/* we replaced the message directly, we don't want to do reparenting foo */
 		if (smime_encrypt) {
-			camel_object_unref (part);
+			g_object_unref (part);
 			goto skip_content;
 		} else {
 			current = camel_medium_get_content ((CamelMedium *)part);
-			camel_object_ref (current);
-			camel_object_unref (part);
+			g_object_ref (current);
+			g_object_unref (part);
 		}
 	}
 #endif /* HAVE_NSS */
@@ -1058,7 +1058,7 @@ build_message (EMsgComposer *composer,
 	camel_medium_set_content (CAMEL_MEDIUM (new), current);
 	if (current == plain)
 		camel_mime_part_set_encoding (CAMEL_MIME_PART (new), plain_encoding);
-	camel_object_unref (current);
+	g_object_unref (current);
 
 #if defined (HAVE_NSS)
 skip_content:
@@ -1079,9 +1079,9 @@ skip_content:
  exception:
 
 	if (part != CAMEL_MIME_PART (new))
-		camel_object_unref (part);
+		g_object_unref (part);
 
-	camel_object_unref (new);
+	g_object_unref (new);
 
 	if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) {
 		e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail-composer:no-build-message",
@@ -1408,7 +1408,7 @@ autosave_load_draft (const gchar *filename)
 	msg = camel_mime_message_new ();
 	camel_data_wrapper_construct_from_stream (
 		CAMEL_DATA_WRAPPER (msg), stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	composer = e_msg_composer_new_with_message (msg);
 	if (composer) {
@@ -2444,7 +2444,7 @@ handle_multipart_encrypted (EMsgComposer *composer,
 	cipher = camel_gpg_context_new (session);
 	mime_part = camel_mime_part_new ();
 	valid = camel_cipher_decrypt (cipher, multipart, mime_part, &ex);
-	camel_object_unref (cipher);
+	g_object_unref (cipher);
 	camel_exception_clear (&ex);
 	if (valid == NULL)
 		return;
@@ -2485,7 +2485,7 @@ handle_multipart_encrypted (EMsgComposer *composer,
 		e_msg_composer_attach (composer, mime_part);
 	}
 
-	camel_object_unref (mime_part);
+	g_object_unref (mime_part);
 }
 
 static void
@@ -2727,7 +2727,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
 						g_hash_table_insert (auto_cc, g_strdup (addr), GINT_TO_POINTER (TRUE));
 					}
 				}
-				camel_object_unref (iaddr);
+				g_object_unref (iaddr);
 			}
 
 			if (account->always_bcc) {
@@ -2742,7 +2742,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
 						g_hash_table_insert (auto_bcc, g_strdup (addr), GINT_TO_POINTER (TRUE));
 					}
 				}
-				camel_object_unref (iaddr);
+				g_object_unref (iaddr);
 			}
 		}
 
@@ -2984,7 +2984,7 @@ e_msg_composer_new_redirect (CamelMimeMessage *message,
 	subject = camel_mime_message_get_subject (message);
 
 	composer->priv->redirect = message;
-	camel_object_ref (message);
+	g_object_ref (message);
 
 	e_composer_header_table_set_account_name (table, resent_from);
 	e_composer_header_table_set_subject (table, subject);
@@ -3477,7 +3477,7 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
 
 	wrapper = camel_data_wrapper_new ();
 	camel_data_wrapper_construct_from_stream (wrapper, stream);
-	camel_object_unref (CAMEL_OBJECT (stream));
+	g_object_unref (CAMEL_OBJECT (stream));
 
 	mime_type = e_util_guess_mime_type (dec_file_name, TRUE);
 	if (mime_type == NULL)
@@ -3487,7 +3487,7 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
 
 	part = camel_mime_part_new ();
 	camel_medium_set_content (CAMEL_MEDIUM (part), wrapper);
-	camel_object_unref (wrapper);
+	g_object_unref (wrapper);
 
 	cid = camel_header_msgid_generate ();
 	camel_mime_part_set_content_id (part, cid);
@@ -3532,7 +3532,7 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer  *composer,
 
 	url = g_strdup_printf ("cid:%s", cid);
 	g_hash_table_insert (p->inline_images, url, part);
-	camel_object_ref (part);
+	g_object_ref (part);
 
 	location = camel_mime_part_get_content_location (part);
 	if (location != NULL)
@@ -3633,7 +3633,7 @@ e_msg_composer_get_message_print (EMsgComposer *composer,
 		return NULL;
 
 	temp_composer = e_msg_composer_new_with_message (msg);
-	camel_object_unref (msg);
+	g_object_unref (msg);
 
 	/* Override composer flags. */
 	flags = msg_composer_get_message_print_helper (
@@ -3832,7 +3832,7 @@ e_msg_composer_get_reply_to (EMsgComposer *composer)
 
 	address = camel_internet_address_new ();
 	if (camel_address_unformat (CAMEL_ADDRESS (address), reply_to) == -1) {
-		camel_object_unref (CAMEL_OBJECT (address));
+		g_object_unref (CAMEL_OBJECT (address));
 		return NULL;
 	}
 
@@ -3902,7 +3902,7 @@ e_msg_composer_load_from_file (const gchar *filename)
 	msg = camel_mime_message_new ();
 	camel_data_wrapper_construct_from_stream (
 		CAMEL_DATA_WRAPPER (msg), stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	composer = e_msg_composer_new_with_message (msg);
 	if (composer != NULL)
diff --git a/e-util/e-signature-utils.c b/e-util/e-signature-utils.c
index 5680278..6a8258c 100644
--- a/e-util/e-signature-utils.c
+++ b/e-util/e-signature-utils.c
@@ -177,7 +177,7 @@ e_read_signature_file (ESignature *signature,
 
 		filtered_stream =
 			camel_stream_filter_new (input_stream);
-		camel_object_unref (input_stream);
+		g_object_unref (input_stream);
 
 		flags =
 			CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT |
@@ -187,7 +187,7 @@ e_read_signature_file (ESignature *signature,
 		filter = camel_mime_filter_tohtml_new (flags, 0);
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filtered_stream), filter);
-		camel_object_unref (filter);
+		g_object_unref (filter);
 
 		input_stream = filtered_stream;
 	}
@@ -197,8 +197,8 @@ e_read_signature_file (ESignature *signature,
 	camel_stream_mem_set_byte_array (
 		CAMEL_STREAM_MEM (output_stream), buffer);
 	camel_stream_write_to_stream (input_stream, output_stream);
-	camel_object_unref (output_stream);
-	camel_object_unref (input_stream);
+	g_object_unref (output_stream);
+	g_object_unref (input_stream);
 
 	/* Make sure the buffer is nul-terminated. */
 	length = (gsize) buffer->len;
@@ -291,9 +291,9 @@ e_run_signature_script (const gchar *filename)
 
 		input_stream = camel_stream_fs_new_with_fd (in_fds[0]);
 		camel_stream_write_to_stream (input_stream, output_stream);
-		camel_object_unref (input_stream);
+		g_object_unref (input_stream);
 
-		camel_object_unref (output_stream);
+		g_object_unref (output_stream);
 
 		/* Make sure the buffer is nul-terminated. */
 		length = (gsize) buffer->len;
diff --git a/e-util/e-util.c b/e-util/e-util.c
index dfc2754..737c062 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1488,7 +1488,7 @@ static gpointer
 e_camel_object_copy (gpointer camel_object)
 {
 	if (CAMEL_IS_OBJECT (camel_object))
-		camel_object_ref (camel_object);
+		g_object_ref (camel_object);
 
 	return camel_object;
 }
@@ -1497,7 +1497,7 @@ static void
 e_camel_object_free (gpointer camel_object)
 {
 	if (CAMEL_IS_OBJECT (camel_object))
-		camel_object_unref (camel_object);
+		g_object_unref (camel_object);
 }
 
 GType
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index 93cb5c3..6ba72f4 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -63,7 +63,7 @@ emfq_finalize (GObject *object)
 	EMFormatQuote *emfq =(EMFormatQuote *) object;
 
 	if (emfq->stream)
-		camel_object_unref(emfq->stream);
+		g_object_unref (emfq->stream);
 	g_free(emfq->credits);
 
 	/* Chain up to parent's finalize() method. */
@@ -132,7 +132,7 @@ em_format_quote_new (const gchar *credits,
 
 	emfq->credits = g_strdup (credits);
 	emfq->stream = stream;
-	camel_object_ref (stream);
+	g_object_ref (stream);
 	emfq->flags = flags;
 
 	return emfq;
@@ -443,10 +443,10 @@ emfq_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
 						    | CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT, 0);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), html_filter);
-	camel_object_unref(html_filter);
+	g_object_unref (html_filter);
 
 	em_format_format_text(emf, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 }
 
 static void
@@ -499,17 +499,17 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E
 		sig_strip = em_stripsig_filter_new ();
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filtered_stream), sig_strip);
-		camel_object_unref (sig_strip);
+		g_object_unref (sig_strip);
 	}
 
 	html_filter = camel_mime_filter_tohtml_new(flags, rgb);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), html_filter);
-	camel_object_unref(html_filter);
+	g_object_unref (html_filter);
 
 	em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
 	camel_stream_flush((CamelStream *)filtered_stream);
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 }
 
 static void
@@ -530,11 +530,11 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part
 	filtered_stream = camel_stream_filter_new (stream);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), enriched);
-	camel_object_unref(enriched);
+	g_object_unref (enriched);
 
 	camel_stream_write_string(stream, "<br><hr><br>");
 	em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 }
 
 static void
diff --git a/em-format/em-format.c b/em-format/em-format.c
index ca4a269..9c8e181 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -76,7 +76,7 @@ emf_free_cache(struct _EMFormatCache *efc)
 	if (efc->valid)
 		camel_cipher_validity_free(efc->valid);
 	if (efc->secured)
-		camel_object_unref(efc->secured);
+		g_object_unref (efc->secured);
 	g_free(efc);
 }
 
@@ -98,7 +98,7 @@ emf_finalize (GObject *object)
 	EMFormat *emf = EM_FORMAT (object);
 
 	if (emf->session)
-		camel_object_unref (emf->session);
+		g_object_unref (emf->session);
 
 	g_hash_table_destroy (emf->inline_table);
 
@@ -172,7 +172,7 @@ emf_init (EMFormat *emf)
 	emf->session = e_shell_settings_get_pointer (shell_settings, "mail-session");
 	g_return_if_fail (emf->session != NULL);
 
-	camel_object_ref (emf->session);
+	g_object_ref (emf->session);
 }
 
 GType
@@ -400,7 +400,7 @@ em_format_add_puri (EMFormat *emf,
 	puri->part_id = g_strdup(emf->part_id->str);
 
 	if (part) {
-		camel_object_ref(part);
+		g_object_ref (part);
 		puri->part = part;
 	}
 
@@ -568,7 +568,7 @@ emf_clear_puri_node (GNode *node)
 		g_free(pn->cid);
 		g_free(pn->part_id);
 		if (pn->part)
-			camel_object_unref(pn->part);
+			g_object_unref (pn->part);
 		g_free(pn);
 	}
 
@@ -696,7 +696,7 @@ emf_clone_inlines(gpointer key, gpointer val, gpointer data)
 	if (emfc->valid)
 		new->valid = camel_cipher_validity_clone(emfc->valid);
 	if (emfc->secured)
-		camel_object_ref((new->secured = emfc->secured));
+		g_object_ref ((new->secured = emfc->secured));
 }
 
 static void
@@ -731,9 +731,9 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMime
 	/* what a mess */
 	if (folder != emf->folder) {
 		if (emf->folder)
-			camel_object_unref(emf->folder);
+			g_object_unref (emf->folder);
 		if (folder)
-			camel_object_ref(folder);
+			g_object_ref (folder);
 		emf->folder = folder;
 	}
 
@@ -744,9 +744,9 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMime
 
 	if (msg != emf->message) {
 		if (emf->message)
-			camel_object_unref(emf->message);
+			g_object_unref (emf->message);
 		if (msg)
-			camel_object_ref(msg);
+			g_object_ref (msg);
 		emf->message = msg;
 	}
 
@@ -1226,7 +1226,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
 
 		null = camel_stream_null_new();
 		filter_stream = camel_stream_filter_new (null);
-		camel_object_unref(null);
+		g_object_unref (null);
 
 		windows = (CamelMimeFilterWindows *)camel_mime_filter_windows_new(charset);
 		camel_stream_filter_add (
@@ -1235,7 +1235,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
 
 		camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filter_stream);
 		camel_stream_flush((CamelStream *)filter_stream);
-		camel_object_unref(filter_stream);
+		g_object_unref (filter_stream);
 
 		charset = camel_mime_filter_windows_real_charset (windows);
 	} else if (charset == NULL) {
@@ -1249,7 +1249,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filter_stream),
 			CAMEL_MIME_FILTER (filter));
-		camel_object_unref(filter);
+		g_object_unref (filter);
 	}
 
 	max = -1;
@@ -1264,7 +1264,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
 
 	size = camel_data_wrapper_decode_to_stream(emf->mode == EM_FORMAT_SOURCE ? (CamelDataWrapper *)dw: camel_medium_get_content ((CamelMedium *)dw), (CamelStream *)filter_stream);
 	camel_stream_flush((CamelStream *)filter_stream);
-	camel_object_unref(filter_stream);
+	g_object_unref (filter_stream);
 	camel_stream_reset (mem_stream);
 
 	if (max == -1 || size == -1 || size < (max * 1024) || emf->composer) {
@@ -1275,7 +1275,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
 	}
 
 	if (windows)
-		camel_object_unref(windows);
+		g_object_unref (windows);
 }
 
 /**
@@ -1365,14 +1365,14 @@ emf_application_xpkcs7mime (EMFormat *emf,
 			emfc = emf_insert_cache(emf, emf->part_id->str);
 
 		emfc->valid = camel_cipher_validity_clone(valid);
-		camel_object_ref((emfc->secured = opart));
+		g_object_ref ((emfc->secured = opart));
 
 		add_validity_found (emf, valid);
 		em_format_format_secure(emf, stream, opart, valid);
 	}
 
-	camel_object_unref(opart);
-	camel_object_unref(context);
+	g_object_unref (opart);
+	g_object_unref (context);
 	camel_exception_free(ex);
 }
 #endif
@@ -1541,15 +1541,15 @@ emf_multipart_encrypted (EMFormat *emf,
 			emfc = emf_insert_cache(emf, emf->part_id->str);
 
 		emfc->valid = camel_cipher_validity_clone(valid);
-		camel_object_ref((emfc->secured = opart));
+		g_object_ref ((emfc->secured = opart));
 
 		add_validity_found (emf, valid);
 		em_format_format_secure(emf, stream, opart, valid);
 	}
 
 	/* TODO: Make sure when we finalize this part, it is zero'd out */
-	camel_object_unref(opart);
-	camel_object_unref(context);
+	g_object_unref (opart);
+	g_object_unref (context);
 	camel_exception_free(ex);
 }
 
@@ -1723,14 +1723,14 @@ emf_multipart_signed (EMFormat *emf,
 				emfc = emf_insert_cache(emf, emf->part_id->str);
 
 			emfc->valid = camel_cipher_validity_clone(valid);
-			camel_object_ref((emfc->secured = cpart));
+			g_object_ref ((emfc->secured = cpart));
 
 			add_validity_found (emf, valid);
 			em_format_format_secure(emf, stream, cpart, valid);
 		}
 
 		camel_exception_free(ex);
-		camel_object_unref(cipher);
+		g_object_unref (cipher);
 	}
 }
 
@@ -1773,7 +1773,7 @@ emf_application_mbox (EMFormat *emf,
 	camel_seekable_stream_seek (
 		CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET);
 	camel_mime_parser_init_with_stream (parser, mem_stream);
-	camel_object_unref (mem_stream);
+	g_object_unref (mem_stream);
 
 	/* Extract messages from the mbox. */
 	state = camel_mime_parser_step (parser, NULL, NULL);
@@ -1784,14 +1784,14 @@ emf_application_mbox (EMFormat *emf,
 		mime_part = CAMEL_MIME_PART (message);
 
 		if (camel_mime_part_construct_from_parser (mime_part, parser) == -1) {
-			camel_object_unref (message);
+			g_object_unref (message);
 			break;
 		}
 
 		/* Render the message. */
 		handle->handler (emf, stream, mime_part, handle, FALSE);
 
-		camel_object_unref (message);
+		g_object_unref (message);
 
 		/* Skip past CAMEL_MIME_PARSER_STATE_FROM_END. */
 		camel_mime_parser_step (parser, NULL, NULL);
@@ -1799,7 +1799,7 @@ emf_application_mbox (EMFormat *emf,
 		state = camel_mime_parser_step (parser, NULL, NULL);
 	}
 
-	camel_object_unref (parser);
+	g_object_unref (parser);
 }
 
 static void
@@ -1870,7 +1870,7 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
 		em_format_format_source(emf, stream, ipart);
 		/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
 		camel_exception_free(ex);
-		camel_object_unref(cipher);
+		g_object_unref (cipher);
 		return;
 	}
 
@@ -1883,13 +1883,13 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream),
 		CAMEL_MIME_FILTER (pgp_filter));
-	camel_object_unref(pgp_filter);
+	g_object_unref (pgp_filter);
 
 	/* Pass through the filters that have been setup */
 	dw = camel_medium_get_content ((CamelMedium *)ipart);
 	camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filtered_stream);
 	camel_stream_flush((CamelStream *)filtered_stream);
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 
 	/* Create a new text/plain MIME part containing the signed content preserving the original part's Content-Type params */
 	content_type = camel_mime_part_get_content_type (ipart);
@@ -1918,10 +1918,10 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
 	em_format_format_secure(emf, stream, opart, valid);
 
 	/* Clean Up */
-	camel_object_unref(dw);
-	camel_object_unref(opart);
-	camel_object_unref(ostream);
-	camel_object_unref(cipher);
+	g_object_unref (dw);
+	g_object_unref (opart);
+	g_object_unref (ostream);
+	g_object_unref (cipher);
 	camel_exception_free(ex);
 }
 
@@ -1949,8 +1949,8 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
 		em_format_format_source(emf, stream, ipart);
 		/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
 		camel_exception_free(ex);
-		camel_object_unref(cipher);
-		camel_object_unref(opart);
+		g_object_unref (cipher);
+		g_object_unref (opart);
 		return;
 	}
 
@@ -1972,8 +1972,8 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
 	em_format_format_secure(emf, stream, opart, valid);
 
 	/* Clean Up */
-	camel_object_unref(opart);
-	camel_object_unref (cipher);
+	g_object_unref (opart);
+	g_object_unref (cipher);
 	camel_exception_free (ex);
 }
 
@@ -2056,7 +2056,7 @@ em_format_snoop_type (CamelMimePart *part)
 			g_free (content_type);
 		}
 
-		camel_object_unref (stream);
+		g_object_unref (stream);
 	}
 
 	d(printf("snooped part, magic_type '%s' name_type '%s'\n", magic_type, name_type));
diff --git a/em-format/em-stripsig-filter.c b/em-format/em-stripsig-filter.c
index 42d8247..f2c08a8 100644
--- a/em-format/em-stripsig-filter.c
+++ b/em-format/em-stripsig-filter.c
@@ -30,57 +30,17 @@
 
 #include "em-stripsig-filter.h"
 
-static void em_stripsig_filter_class_init (EMStripSigFilterClass *klass);
-static void em_stripsig_filter_init (EMStripSigFilter *filter, EMStripSigFilterClass *klass);
-
-static void filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
-			   gchar **out, gsize *outlen, gsize *outprespace);
-static void filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
-			     gchar **out, gsize *outlen, gsize *outprespace);
-static void filter_reset (CamelMimeFilter *filter);
-
-static CamelMimeFilterClass *parent_class = NULL;
-
-CamelType
-em_stripsig_filter_get_type (void)
-{
-	static CamelType type = CAMEL_INVALID_TYPE;
-
-	if (type == CAMEL_INVALID_TYPE) {
-		type = camel_type_register (camel_mime_filter_get_type (),
-					    "EMStripSigFilter",
-					    sizeof (EMStripSigFilter),
-					    sizeof (EMStripSigFilterClass),
-					    (CamelObjectClassInitFunc) em_stripsig_filter_class_init,
-					    NULL,
-					    (CamelObjectInitFunc) em_stripsig_filter_init,
-					    NULL);
-	}
-
-	return type;
-}
-
-static void
-em_stripsig_filter_class_init (EMStripSigFilterClass *klass)
-{
-	CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
-	parent_class = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
-	filter_class->reset = filter_reset;
-	filter_class->filter = filter_filter;
-	filter_class->complete = filter_complete;
-}
+G_DEFINE_TYPE (EMStripSigFilter, em_stripsig_filter, CAMEL_TYPE_MIME_FILTER)
 
 static void
-em_stripsig_filter_init (EMStripSigFilter *filter, EMStripSigFilterClass *klass)
-{
-	filter->midline = FALSE;
-}
-
-static void
-strip_signature (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
-		 gchar **out, gsize *outlen, gsize *outprespace, gint flush)
+strip_signature (CamelMimeFilter *filter,
+                 const gchar *in,
+                 gsize len,
+                 gsize prespace,
+                 gchar **out,
+                 gsize *outlen,
+                 gsize *outprespace,
+                 gint flush)
 {
 	EMStripSigFilter *stripsig = (EMStripSigFilter *) filter;
 	register const gchar *inptr = in;
@@ -128,17 +88,29 @@ strip_signature (CamelMimeFilter *filter, const gchar *in, gsize len, gsize pres
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
-	       gchar **out, gsize *outlen, gsize *outprespace)
+filter_filter (CamelMimeFilter *filter,
+               const gchar *in,
+               gsize len,
+               gsize prespace,
+               gchar **out,
+               gsize *outlen,
+               gsize *outprespace)
 {
-	strip_signature (filter, in, len, prespace, out, outlen, outprespace, FALSE);
+	strip_signature (
+		filter, in, len, prespace, out, outlen, outprespace, FALSE);
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
-		 gchar **out, gsize *outlen, gsize *outprespace)
+filter_complete (CamelMimeFilter *filter,
+                 const gchar *in,
+                 gsize len,
+                 gsize prespace,
+                 gchar **out,
+                 gsize *outlen,
+                 gsize *outprespace)
 {
-	strip_signature (filter, in, len, prespace, out, outlen, outprespace, TRUE);
+	strip_signature (
+		filter, in, len, prespace, out, outlen, outprespace, TRUE);
 }
 
 /* should this 'flush' outstanding state/data bytes? */
@@ -150,6 +122,22 @@ filter_reset (CamelMimeFilter *filter)
 	stripsig->midline = FALSE;
 }
 
+static void
+em_stripsig_filter_class_init (EMStripSigFilterClass *class)
+{
+	CamelMimeFilterClass *mime_filter_class;
+
+	mime_filter_class = CAMEL_MIME_FILTER_CLASS (class);
+	mime_filter_class->filter = filter_filter;
+	mime_filter_class->complete = filter_complete;
+	mime_filter_class->reset = filter_reset;
+}
+
+static void
+em_stripsig_filter_init (EMStripSigFilter *filter)
+{
+}
+
 /**
  * em_stripsig_filter_new:
  *
@@ -160,5 +148,5 @@ filter_reset (CamelMimeFilter *filter)
 CamelMimeFilter *
 em_stripsig_filter_new (void)
 {
-	return (CamelMimeFilter *) camel_object_new (EM_TYPE_STRIPSIG_FILTER);
+	return g_object_new (EM_TYPE_STRIPSIG_FILTER, NULL);
 }
diff --git a/em-format/em-stripsig-filter.h b/em-format/em-stripsig-filter.h
index 25ea239..f841727 100644
--- a/em-format/em-stripsig-filter.h
+++ b/em-format/em-stripsig-filter.h
@@ -20,38 +20,49 @@
  *
  */
 
-#ifndef __EM_STRIPSIG_FILTER_H__
-#define __EM_STRIPSIG_FILTER_H__
+#ifndef EM_STRIPSIG_FILTER_H
+#define EM_STRIPSIG_FILTER_H
 
 #include <camel/camel.h>
 
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define EM_TYPE_STRIPSIG_FILTER \
+	(em_stripsig_filter_get_type ())
+#define EM_STRIPSIG_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilter))
+#define EM_STRIPSIG_FILTER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilterClass))
+#define EM_IS_STRIPSIG_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EM_TYPE_STRIPSIG_FILTER))
+#define EM_IS_STRIPSIG_FILTER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EM_TYPE_STRIPSIG_FILTER))
+#define EM_STRIPSIG_FILTER_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilterClass))
 
-#define EM_TYPE_STRIPSIG_FILTER            (em_stripsig_filter_get_type ())
-#define EM_STRIPSIG_FILTER(obj)            (CAMEL_CHECK_CAST ((obj), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilter))
-#define EM_STRIPSIG_FILTER_CLASS(klass)    (CAMEL_CHECK_CLASS_CAST ((klass), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilterClass))
-#define EM_IS_STRIPSIG_FILTER(obj)         (CAMEL_CHECK_TYPE ((obj), EM_TYPE_STRIPSIG_FILTER))
-#define EM_IS_STRIPSIG_FILTER_CLASS(klass) (CAMEL_CHECK_CLASS_TYPE ((klass), EM_TYPE_STRIPSIG_FILTER))
-#define EM_STRIPSIG_FILTER_GET_CLASS(obj)  (CAMEL_CHECK_GET_CLASS ((obj), EM_TYPE_STRIPSIG_FILTER, EMStripSigFilterClass))
+G_BEGIN_DECLS
 
 typedef struct _EMStripSigFilter EMStripSigFilter;
 typedef struct _EMStripSigFilterClass EMStripSigFilterClass;
 
 struct _EMStripSigFilter {
-	CamelMimeFilter parent_object;
+	CamelMimeFilter parent;
 
 	guint32 midline:1;
 };
 
 struct _EMStripSigFilterClass {
 	CamelMimeFilterClass parent_class;
-
 };
 
-CamelType em_stripsig_filter_get_type (void);
-
-CamelMimeFilter *em_stripsig_filter_new (void);
+GType		em_stripsig_filter_get_type	(void);
+CamelMimeFilter *
+		em_stripsig_filter_new		(void);
 
 G_END_DECLS
 
-#endif /* __EM_STRIPSIG_FILTER_H__ */
+#endif /* EM_STRIPSIG_FILTER_H */
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 17b8b4b..e2ca212 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -385,7 +385,7 @@ mail_backend_constructed (GObject *object)
 	shell = e_shell_backend_get_shell (shell_backend);
 
 	/* This also initializes Camel, so it needs to happen early. */
-	mail_session_init ();
+	mail_session_start ();
 
 	online = e_shell_get_online (shell);
 	camel_session_set_online (CAMEL_SESSION (session), online);
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c
index 0944c7d..002865c 100644
--- a/mail/e-mail-local.c
+++ b/mail/e-mail-local.c
@@ -93,7 +93,7 @@ e_mail_local_init (const gchar *data_dir)
 
 	camel_url_free (url);
 
-	camel_object_ref (service);
+	g_object_ref (service);
 	local_store = CAMEL_STORE (service);
 
 	return;
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index 5e4b18f..c5f3845 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -75,10 +75,8 @@ update_states_in_main_thread (const struct _migrate_state_info *info);
 
 /* 1.4 upgrade functions */
 
-#define EM_MIGRATE_SESSION_TYPE     (em_migrate_session_get_type ())
-#define EM_MIGRATE_SESSION(obj)     (CAMEL_CHECK_CAST((obj), EM_MIGRATE_SESSION_TYPE, EMMigrateSession))
-#define EM_MIGRATE_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_MIGRATE_SESSION_TYPE, EMMigrateSessionClass))
-#define EM_MIGRATE_IS_SESSION(o)    (CAMEL_CHECK_TYPE((o), EM_MIGRATE_SESSION_TYPE))
+#define EM_TYPE_MIGRATE_SESSION \
+	(em_migrate_session_get_type ())
 
 typedef struct _EMMigrateSession {
 	CamelSession parent_object;
@@ -92,33 +90,20 @@ typedef struct _EMMigrateSessionClass {
 
 } EMMigrateSessionClass;
 
-static CamelType em_migrate_session_get_type (void);
+GType em_migrate_session_get_type (void);
+
+G_DEFINE_TYPE (EMMigrateSession, em_migrate_session, CAMEL_TYPE_SESSION)
+
 static CamelSession *em_migrate_session_new (const gchar *path);
 
 static void
-class_init (EMMigrateSessionClass *klass)
+em_migrate_session_class_init (EMMigrateSessionClass *class)
 {
-	;
 }
 
-static CamelType
-em_migrate_session_get_type (void)
+static void
+em_migrate_session_init (EMMigrateSession *session)
 {
-	static CamelType type = CAMEL_INVALID_TYPE;
-
-	if (type == CAMEL_INVALID_TYPE) {
-		type = camel_type_register (
-			camel_session_get_type (),
-			"EMMigrateSession",
-			sizeof (EMMigrateSession),
-			sizeof (EMMigrateSessionClass),
-			(CamelObjectClassInitFunc) class_init,
-			NULL,
-			NULL,
-			NULL);
-	}
-
-	return type;
 }
 
 static CamelSession *
@@ -126,8 +111,7 @@ em_migrate_session_new (const gchar *path)
 {
 	CamelSession *session;
 
-	session = CAMEL_SESSION (camel_object_new (EM_MIGRATE_SESSION_TYPE));
-
+	session = g_object_new (EM_TYPE_MIGRATE_SESSION, NULL);
 	camel_session_construct (session, path);
 
 	return session;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 78970c7..9debef4 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -185,7 +185,7 @@ action_add_to_address_book_cb (GtkAction *action,
 
 	cia = camel_internet_address_new ();
 	if (camel_address_decode (CAMEL_ADDRESS (cia), curl->path) < 0) {
-		camel_object_unref (cia);
+		g_object_unref (cia);
 		goto exit;
 	}
 
@@ -197,7 +197,7 @@ action_add_to_address_book_cb (GtkAction *action,
 	e_shell_event (shell, "contact-quick-add-email", email);
 	emu_remove_from_mail_cache_1 (curl->path);
 
-	camel_object_unref (cia);
+	g_object_unref (cia);
 	g_free (email);
 
 exit:
@@ -1092,7 +1092,7 @@ action_search_folder_recipient_cb (GtkAction *action,
 		inet_addr = camel_internet_address_new ();
 		camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
 		vfolder_gui_add_from_address (inet_addr, AUTO_TO, folder_uri);
-		camel_object_unref (inet_addr);
+		g_object_unref (inet_addr);
 	}
 
 	camel_url_free (curl);
@@ -1130,7 +1130,7 @@ action_search_folder_sender_cb (GtkAction *action,
 		inet_addr = camel_internet_address_new ();
 		camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
 		vfolder_gui_add_from_address (inet_addr, AUTO_FROM, folder_uri);
-		camel_object_unref (inet_addr);
+		g_object_unref (inet_addr);
 	}
 
 	camel_url_free (curl);
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 1024ec6..3418404 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -74,7 +74,7 @@ store_info_new (CamelStore *store,
 	store_info = g_slice_new0 (StoreInfo);
 	store_info->ref_count = 1;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 	store_info->store = store;
 
 	if (display_name == NULL)
@@ -113,14 +113,14 @@ store_info_unref (StoreInfo *store_info)
 	if (g_atomic_int_exchange_and_add (&store_info->ref_count, -1) > 1)
 		return;
 
-	camel_object_unref (store_info->store);
+	g_object_unref (store_info->store);
 	g_free (store_info->display_name);
 
 	if (store_info->vtrash != NULL)
-		camel_object_unref (store_info->vtrash);
+		g_object_unref (store_info->vtrash);
 
 	if (store_info->vjunk != NULL)
-		camel_object_unref (store_info->vjunk);
+		g_object_unref (store_info->vjunk);
 
 	g_slice_free (StoreInfo, store_info);
 }
@@ -327,7 +327,7 @@ e_mail_store_add_by_uri (const gchar *uri,
 
 	e_mail_store_add (CAMEL_STORE (service), display_name);
 
-	camel_object_unref (service);
+	g_object_unref (service);
 
 	return CAMEL_STORE (service);
 
@@ -346,7 +346,7 @@ static void
 mail_store_remove_cb (CamelStore *store)
 {
 	camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
-	camel_object_unref (store);
+	g_object_unref (store);
 }
 
 void
@@ -366,7 +366,7 @@ e_mail_store_remove (CamelStore *store)
 	if (g_hash_table_lookup (store_table, store) == NULL)
 		return;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 
 	g_hash_table_remove (store_table, store);
 	mail_folder_cache_note_store_remove (mail_folder_cache_get_default (), store);
@@ -402,7 +402,7 @@ e_mail_store_remove_by_uri (const gchar *uri)
 
 	e_mail_store_remove (CAMEL_STORE (service));
 
-	camel_object_unref (service);
+	g_object_unref (service);
 }
 
 void
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 7e8d2b1..59e4a45 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -105,10 +105,10 @@ emcs_set_drafts_info (struct emcs_t *emcs,
 	g_return_if_fail (drafts_uid != NULL);
 
 	if (emcs->drafts_folder != NULL)
-		camel_object_unref (emcs->drafts_folder);
+		g_object_unref (emcs->drafts_folder);
 	g_free (emcs->drafts_uid);
 
-	camel_object_ref (drafts_folder);
+	g_object_ref (drafts_folder);
 	emcs->drafts_folder = drafts_folder;
 	emcs->drafts_uid = g_strdup (drafts_uid);
 }
@@ -125,10 +125,10 @@ emcs_set_folder_info (struct emcs_t *emcs,
 	g_return_if_fail (uid != NULL);
 
 	if (emcs->folder != NULL)
-		camel_object_unref (emcs->folder);
+		g_object_unref (emcs->folder);
 	g_free (emcs->uid);
 
-	camel_object_ref (folder);
+	g_object_ref (folder);
 	emcs->folder = folder;
 	emcs->uid = g_strdup (uid);
 	emcs->flags = flags;
@@ -139,11 +139,11 @@ static void
 free_emcs (struct emcs_t *emcs)
 {
 	if (emcs->drafts_folder != NULL)
-		camel_object_unref (emcs->drafts_folder);
+		g_object_unref (emcs->drafts_folder);
 	g_free (emcs->drafts_uid);
 
 	if (emcs->folder != NULL)
-		camel_object_unref (emcs->folder);
+		g_object_unref (emcs->folder);
 	g_free (emcs->uid);
 
 	g_free (emcs);
@@ -233,7 +233,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag
 			camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid,
 							CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
 							CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
-			camel_object_unref (emcs->drafts_folder);
+			g_object_unref (emcs->drafts_folder);
 			emcs->drafts_folder = NULL;
 			g_free (emcs->drafts_uid);
 			emcs->drafts_uid = NULL;
@@ -243,7 +243,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag
 			/* set any replied flags etc */
 			camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set);
 			camel_folder_set_message_user_flag (emcs->folder, emcs->uid, "receipt-handled", TRUE);
-			camel_object_unref (emcs->folder);
+			g_object_unref (emcs->folder);
 			emcs->folder = NULL;
 			g_free (emcs->uid);
 			emcs->uid = NULL;
@@ -386,7 +386,7 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data)
 		e_destination_freev (recipients_bcc);
 	}
 
-	camel_object_unref (cia);
+	g_object_unref (cia);
 
 	post_to_header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_POST_TO);
 	if (e_composer_header_get_visible (post_to_header)) {
@@ -521,7 +521,7 @@ em_utils_composer_send_cb (EMsgComposer *composer)
 		return;
 
 	folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
-	camel_object_ref (folder);
+	g_object_ref (folder);
 
 	/* mail the message */
 	e_msg_composer_set_mail_sent (composer, TRUE);
@@ -541,8 +541,8 @@ em_utils_composer_send_cb (EMsgComposer *composer)
 	mail_append_mail (
 		folder, message, info, composer_send_queued_cb, send);
 
-	camel_object_unref (folder);
-	camel_object_unref (message);
+	g_object_unref (folder);
+	g_object_unref (message);
 }
 
 struct _save_draft_info {
@@ -587,7 +587,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
 		camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid,
 						CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
 						CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
-		camel_object_unref (emcs->drafts_folder);
+		g_object_unref (emcs->drafts_folder);
 		emcs->drafts_folder = NULL;
 		g_free (emcs->drafts_uid);
 		emcs->drafts_uid = NULL;
@@ -596,14 +596,14 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
 	if (emcs->folder) {
 		/* set the replied flags etc */
 		camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set);
-		camel_object_unref (emcs->folder);
+		g_object_unref (emcs->folder);
 		emcs->folder = NULL;
 		g_free (emcs->uid);
 		emcs->uid = NULL;
 	}
 
 	if (appended_uid) {
-		camel_object_ref (folder);
+		g_object_ref (folder);
 		emcs->drafts_folder = folder;
 		emcs->drafts_uid = g_strdup (appended_uid);
 	}
@@ -626,7 +626,7 @@ save_draft_folder (gchar *uri, CamelFolder *folder, gpointer data)
 
 	if (folder) {
 		*save = folder;
-		camel_object_ref (folder);
+		g_object_ref (folder);
 	}
 }
 
@@ -672,7 +672,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer)
 		if (!folder || !account->enabled) {
 			if (e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) {
 				g_object_unref(composer);
-				camel_object_unref(msg);
+				g_object_unref (msg);
 				if (sdi->emcs)
 					emcs_unref(sdi->emcs);
 				g_free(sdi);
@@ -680,19 +680,19 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer)
 			}
 
 			folder = local_drafts_folder;
-			camel_object_ref (local_drafts_folder);
+			g_object_ref (local_drafts_folder);
 		}
 	} else {
 		folder = local_drafts_folder;
-		camel_object_ref (folder);
+		g_object_ref (folder);
 	}
 
 	info = camel_message_info_new(NULL);
 	camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0);
 
 	mail_append_mail (folder, msg, info, save_draft_done, sdi);
-	camel_object_unref (folder);
-	camel_object_unref (msg);
+	g_object_unref (folder);
+	g_object_unref (msg);
 }
 
 static void
@@ -941,13 +941,13 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
 		camel_data_wrapper_decode_to_stream (content, stream);
 
 		str = g_strndup ((gchar *) byte_array->data, byte_array->len);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 
 		if (replace_variables (clues, message, &str)) {
 			stream = camel_stream_mem_new_with_buffer (str, strlen (str));
 			camel_stream_reset (stream);
 			camel_data_wrapper_construct_from_stream (content, stream);
-			camel_object_unref (stream);
+			g_object_unref (stream);
 		}
 
 		g_free (str);
@@ -1107,7 +1107,7 @@ composer_destroy_fad_cb (gpointer user_data, GObject *deadbeef)
 	struct forward_attached_data *fad = (struct forward_attached_data*) user_data;
 
 	if (fad) {
-		camel_object_unref (fad->folder);
+		g_object_unref (fad->folder);
 		em_utils_uids_free (fad->uids);
 		g_free (fad);
 	}
@@ -1121,7 +1121,7 @@ setup_forward_attached_callbacks (EMsgComposer *composer, CamelFolder *folder, G
 	if (!composer || !folder || !uids || !uids->len)
 		return;
 
-	camel_object_ref (folder);
+	g_object_ref (folder);
 
 	fad = g_new0 (struct forward_attached_data, 1);
 	fad->folder = folder;
@@ -1329,7 +1329,7 @@ em_utils_forward_message (CamelMimeMessage *message, const gchar *fromuri)
 		subject = mail_tool_generate_forward_subject (message);
 
 		composer = forward_attached (NULL, NULL, messages, part, subject, fromuri);
-		camel_object_unref (part);
+		g_object_unref (part);
 		g_free (subject);
 		break;
 	case MAIL_CONFIG_FORWARD_INLINE:
@@ -1570,14 +1570,14 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 			     _("Your message to %s about \"%s\" on %s has been read."),
 			     self_address, message_subject, message_date);
 	camel_data_wrapper_construct_from_stream (receipt_text, stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	part = camel_mime_part_new ();
 	camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text);
 	camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE);
-	camel_object_unref (receipt_text);
+	g_object_unref (receipt_text);
 	camel_multipart_add_part (body, part);
-	camel_object_unref (part);
+	g_object_unref (part);
 
 	/* Create the machine-readable receipt */
 	receipt_data = camel_data_wrapper_new ();
@@ -1598,7 +1598,7 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 			     "Disposition: manual-action/MDN-sent-manually; displayed\n",
 			     ua, recipient, message_id);
 	camel_data_wrapper_construct_from_stream (receipt_data, stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	g_free (ua);
 	g_free (recipient);
@@ -1606,13 +1606,13 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 
 	camel_medium_set_content (CAMEL_MEDIUM (part), receipt_data);
 	camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_7BIT);
-	camel_object_unref (receipt_data);
+	g_object_unref (receipt_data);
 	camel_multipart_add_part (body, part);
-	camel_object_unref (part);
+	g_object_unref (part);
 
 	/* Finish creating the message */
 	camel_medium_set_content (CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body));
-	camel_object_unref (body);
+	g_object_unref (body);
 
 	/* Translators: %s is the subject of the email message */
 	receipt_subject = g_strdup_printf (_("Delivery Notification for: \"%s\""), message_subject);
@@ -1622,12 +1622,12 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 	addr = camel_internet_address_new ();
 	camel_address_decode (CAMEL_ADDRESS (addr), self_address);
 	camel_mime_message_set_from (receipt, addr);
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	addr = camel_internet_address_new ();
 	camel_address_decode (CAMEL_ADDRESS (addr), receipt_address);
 	camel_mime_message_set_recipients (receipt, CAMEL_RECIPIENT_TYPE_TO, addr);
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	camel_medium_set_header (CAMEL_MEDIUM (receipt), "Return-Path", "<>");
 	camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Account", account->uid);
@@ -2127,7 +2127,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
 		/* attach the original message as an attachment */
 		part = mail_tool_make_message_attachment (message);
 		e_msg_composer_attach (composer, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 		break;
 	case MAIL_CONFIG_REPLY_OUTLOOK:
 		text = em_utils_message_to_html (message, _("-----Original Message-----"), EM_FORMAT_QUOTE_HEADERS, &len, source, start_bottom ? "<BR>" : NULL, &validity_found);
@@ -2269,9 +2269,9 @@ em_utils_reply_to_message(CamelFolder *folder, const gchar *uid, CamelMimeMessag
 	e_msg_composer_add_message_attachments (composer, message, TRUE);
 
 	if (postto)
-		camel_object_unref(postto);
-	camel_object_unref(to);
-	camel_object_unref(cc);
+		g_object_unref (postto);
+	g_object_unref (to);
+	g_object_unref (cc);
 
 	composer_set_body (composer, message, source);
 
diff --git a/mail/em-config.c b/mail/em-config.c
index 67cfddf..4e9d52c 100644
--- a/mail/em-config.c
+++ b/mail/em-config.c
@@ -93,7 +93,7 @@ emp_target_free(EConfig *ep, EConfigTarget *t)
 		EMConfigTargetFolder *s = (EMConfigTargetFolder *)t;
 
 		g_free(s->uri);
-		camel_object_unref(s->folder);
+		g_object_unref (s->folder);
 		break; }
 	case EM_CONFIG_TARGET_PREFS: {
 		EMConfigTargetPrefs *s = (EMConfigTargetPrefs *)t;
@@ -184,7 +184,7 @@ em_config_target_new_folder(EMConfig *emp, CamelFolder *folder, const gchar *uri
 
 	t->uri = g_strdup(uri);
 	t->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 
 	return t;
 }
diff --git a/mail/em-event.c b/mail/em-event.c
index 6a77deb..a84eb92 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -63,9 +63,9 @@ eme_target_free(EEvent *ep, EEventTarget *t)
 		EMEventTargetMessage *s = (EMEventTargetMessage *)t;
 
 		if (s->folder)
-			camel_object_unref(s->folder);
+			g_object_unref (s->folder);
 		if (s->message)
-			camel_object_unref(s->message);
+			g_object_unref (s->message);
 		g_free(s->uid);
 		if (s->composer)
 			g_object_unref (s->composer);
@@ -162,10 +162,10 @@ em_event_target_new_message(EMEvent *eme, CamelFolder *folder, CamelMimeMessage
 	t->uid = g_strdup (uid);
 	t->folder = folder;
 	if (folder)
-		camel_object_ref(folder);
+		g_object_ref (folder);
 	t->message = message;
 	if (message)
-		camel_object_ref(message);
+		g_object_ref (message);
 	t->target.mask = ~flags;
 	if (composer)
 		t->composer = g_object_ref(G_OBJECT(composer));
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index bc35cd0..266ce9f 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -113,7 +113,7 @@ emfp_free(EConfig *ec, GSList *items, gpointer data)
 	camel_object_free (prop_data->object, CAMEL_FOLDER_PROPERTIES, prop_data->properties);
 	camel_object_free (prop_data->object, CAMEL_FOLDER_NAME, prop_data->name);
 
-	camel_object_unref (prop_data->object);
+	g_object_unref (prop_data->object);
 	g_free (prop_data->argv);
 
 	camel_folder_quota_info_free (prop_data->quota);
@@ -315,7 +315,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
 
 	prop_data = g_malloc0 (sizeof (*prop_data));
 	prop_data->object = folder;
-	camel_object_ref (folder);
+	g_object_ref (folder);
 	prop_data->quota = camel_folder_quota_info_clone (quota);
 
 	/*
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index e34f911..0f6ba84 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -104,7 +104,7 @@ store_info_free (EMFolderTreeModelStoreInfo *si)
 	camel_object_remove_event (si->store, si->unsubscribed_id);
 
 	g_free (si->display_name);
-	camel_object_unref (si->store);
+	g_object_unref (si->store);
 	gtk_tree_row_reference_free (si->row);
 	g_hash_table_destroy (si->full_hash);
 	g_free (si);
@@ -234,7 +234,7 @@ account_changed_cb (EAccountList *accounts,
 	}
 
 	em_folder_tree_model_add_store (model, store, account->name);
-	camel_object_unref (store);
+	g_object_unref (store);
 }
 
 static void
@@ -656,7 +656,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
 			unread = total > 0 ? total : 0;
 		}
 
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 
 	/* TODO Maybe this should be handled by mail_get_folderinfo
@@ -838,7 +838,7 @@ folder_subscribed (CamelStore *store,
 	g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->full_name, fi->uri);
 
 done:
-	camel_object_unref (store);
+	g_object_unref (store);
 	camel_folder_info_free (fi);
 }
 
@@ -849,7 +849,7 @@ folder_subscribed_cb (CamelStore *store,
 {
 	CamelFolderInfo *fi;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 	fi = camel_folder_info_clone (event_data);
 
 	mail_async_event_emit (
@@ -882,7 +882,7 @@ folder_unsubscribed (CamelStore *store,
 	em_folder_tree_model_remove_folders (model, si, &iter);
 
 done:
-	camel_object_unref (store);
+	g_object_unref (store);
 	camel_folder_info_free (fi);
 }
 
@@ -893,7 +893,7 @@ folder_unsubscribed_cb (CamelStore *store,
 {
 	CamelFolderInfo *fi;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 	fi = camel_folder_info_clone (event_data);
 
 	mail_async_event_emit (
@@ -913,7 +913,7 @@ folder_created_cb (CamelStore *store,
 	if (camel_store_supports_subscriptions (store))
 		return;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 	fi = camel_folder_info_clone (event_data);
 
 	mail_async_event_emit (
@@ -933,7 +933,7 @@ folder_deleted_cb (CamelStore *store,
 	if (camel_store_supports_subscriptions (store))
 		return;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 	fi = camel_folder_info_clone (event_data);
 
 	mail_async_event_emit (
@@ -989,7 +989,7 @@ folder_renamed (CamelStore *store,
 	em_folder_tree_model_set_folder_info (model, &iter, si, info->new, TRUE);
 
 done:
-	camel_object_unref (store);
+	g_object_unref (store);
 
 	g_free (info->old_base);
 	camel_folder_info_free (info->new);
@@ -1003,7 +1003,7 @@ folder_renamed_cb (CamelStore *store,
 {
 	CamelRenameInfo *rinfo, *info = event_data;
 
-	camel_object_ref (store);
+	g_object_ref (store);
 
 	rinfo = g_new0 (CamelRenameInfo, 1);
 	rinfo->old_base = g_strdup (info->old_base);
@@ -1058,7 +1058,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model,
 
 	si = g_new (EMFolderTreeModelStoreInfo, 1);
 	si->display_name = g_strdup (display_name);
-	camel_object_ref (store);
+	g_object_ref (store);
 	si->store = store;
 	si->account = account;
 	si->row = gtk_tree_row_reference_copy (reference);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index a74bfa2..40e692c 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -317,7 +317,7 @@ folder_tree_get_folder_info__free (struct _EMFolderTreeGetFolderInfo *m)
 
 	gtk_tree_row_reference_free (m->root);
 	g_object_unref(m->folder_tree);
-	camel_object_unref (m->store);
+	g_object_unref (m->store);
 	g_free (m->top);
 }
 
@@ -341,7 +341,7 @@ folder_tree_free_select_uri (struct _selected_uri *u)
 {
 	g_free (u->uri);
 	if (u->store)
-		camel_object_unref (u->store);
+		g_object_unref (u->store);
 	g_free (u->key);
 	g_free (u->path);
 	g_free (u);
@@ -451,12 +451,12 @@ folder_tree_expand_node (const gchar *key,
 		if (!(store = vfolder_store))
 			return;
 
-		camel_object_ref (store);
+		g_object_ref (store);
 	} else if (!strcmp (uid, "local")) {
 		if (!(store = e_mail_local_get_store ()))
 			return;
 
-		camel_object_ref (store);
+		g_object_ref (store);
 	} else {
 		return;
 	}
@@ -464,11 +464,11 @@ folder_tree_expand_node (const gchar *key,
 	si = em_folder_tree_model_lookup_store_info (
 		EM_FOLDER_TREE_MODEL (model), store);
 	if (si == NULL) {
-		camel_object_unref (store);
+		g_object_unref (store);
 		return;
 	}
 
-	camel_object_unref (store);
+	g_object_unref (store);
 
 	if (p != NULL) {
 		if (!(row = g_hash_table_lookup (si->full_hash, p + 1)))
@@ -923,7 +923,7 @@ folder_tree_row_expanded (GtkTreeView *tree_view,
 
 	msg = mail_msg_new (&get_folder_info_info);
 	msg->root = gtk_tree_row_reference_new (model, path);
-	camel_object_ref (store);
+	g_object_ref (store);
 	msg->store = store;
 	msg->folder_tree = g_object_ref (tree_view);
 	msg->top = full_name;
@@ -1506,7 +1506,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
 
 			em_utils_selection_set_urilist(selection, folder, uids);
 			camel_folder_free_uids(folder, uids);
-			camel_object_unref(folder);
+			g_object_unref (folder);
 		}
 		break;
 	default:
@@ -1556,7 +1556,7 @@ folder_tree_drop_folder(struct _DragDataReceivedAsync *m)
 		return;
 
 	em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move);
-	camel_object_unref(src);
+	g_object_unref (src);
 }
 
 static gchar *
@@ -1617,7 +1617,7 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m)
 		default:
 			abort();
 		}
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 }
 
@@ -1625,7 +1625,7 @@ static void
 folder_tree_drop_async__free (struct _DragDataReceivedAsync *m)
 {
 	g_object_unref(m->context);
-	camel_object_unref(m->store);
+	g_object_unref (m->store);
 	g_free(m->full_name);
 	gtk_selection_data_free (m->selection);
 }
@@ -1696,7 +1696,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
 	m->context = context;
 	g_object_ref(context);
 	m->store = store;
-	camel_object_ref(store);
+	g_object_ref (store);
 	m->full_name = full_name;
 	m->action = context->action;
 	m->info = info;
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 3381275..ea26d9e 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -158,7 +158,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 						goto exception;
 
 					if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) {
-						camel_object_unref (fromfolder);
+						g_object_unref (fromfolder);
 						goto exception;
 					}
 
@@ -169,8 +169,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 					if (m->delete && !camel_exception_is_set (&m->base.ex))
 						camel_folder_sync(fromfolder, TRUE, NULL);
 
-					camel_object_unref (fromfolder);
-					camel_object_unref (tofolder);
+					g_object_unref (fromfolder);
+					g_object_unref (tofolder);
 				}
 			}
 
@@ -217,8 +217,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 static void
 emft_copy_folders__free (struct _EMCopyFolders *m)
 {
-	camel_object_unref (m->fromstore);
-	camel_object_unref (m->tostore);
+	g_object_unref (m->fromstore);
+	g_object_unref (m->tostore);
 
 	g_free (m->frombase);
 	g_free (m->tobase);
@@ -239,9 +239,9 @@ em_folder_utils_copy_folders(CamelStore *fromstore, const gchar *frombase, Camel
 	gint seq;
 
 	m = mail_msg_new (&copy_folders_info);
-	camel_object_ref (fromstore);
+	g_object_ref (fromstore);
 	m->fromstore = fromstore;
-	camel_object_ref (tostore);
+	g_object_ref (tostore);
 	m->tostore = tostore;
 	m->frombase = g_strdup (frombase);
 	m->tobase = g_strdup (tobase);
@@ -312,9 +312,9 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
 	camel_url_free (url);
 fail:
 	if (fromstore)
-		camel_object_unref(fromstore);
+		g_object_unref (fromstore);
 	if (tostore)
-		camel_object_unref(tostore);
+		g_object_unref (tostore);
 	camel_exception_clear (&ex);
 	g_free (cfd);
 }
@@ -451,7 +451,7 @@ em_folder_utils_delete_folder (CamelFolder *folder)
 		return;
 	}
 
-	camel_object_ref (folder);
+	g_object_ref (folder);
 
 	if (mail_folder_cache_get_folder_info_flags (mail_folder_cache_get_default (), folder, &flags) && (flags & CAMEL_FOLDER_CHILDREN)) {
 		dialog = e_alert_dialog_new_for_args (parent,
@@ -464,7 +464,7 @@ em_folder_utils_delete_folder (CamelFolder *folder)
 			     folder->full_name, NULL);
 	}
 
-	g_object_set_data_full ((GObject *) dialog, "folder", folder, camel_object_unref);
+	g_object_set_data_full ((GObject *) dialog, "folder", folder, g_object_unref);
 	g_signal_connect (dialog, "response", G_CALLBACK (emfu_delete_response), NULL);
 	gtk_widget_show (dialog);
 }
@@ -522,7 +522,7 @@ static void
 emfu_create_folder__free (struct _EMCreateFolder *m)
 {
 	camel_store_free_folder_info (m->store, m->fi);
-	camel_object_unref (m->store);
+	g_object_unref (m->store);
 	g_free (m->full_name);
 	g_free (m->parent);
 	g_free (m->name);
@@ -554,7 +554,7 @@ emfu_create_folder_real (CamelStore *store, const gchar *full_name, void (* done
 	}
 
 	m = mail_msg_new (&create_folder_info);
-	camel_object_ref (store);
+	g_object_ref (store);
 	m->store = store;
 	m->full_name = g_strdup (full_name);
 	m->parent = g_strdup (parent);
@@ -618,7 +618,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
 	si = em_folder_tree_model_lookup_store_info (
 		EM_FOLDER_TREE_MODEL (model), store);
 	if (si == NULL) {
-		camel_object_unref (store);
+		g_object_unref (store);
 		g_return_if_reached();
 	}
 
@@ -644,7 +644,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
 		emfu_create_folder_real (si->store, path, new_folder_created_cb, emcftd);
 	}
 
-	camel_object_unref (store);
+	g_object_unref (store);
 	camel_exception_clear (&ex);
 }
 
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index a0a6c6e..422d5d2 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -714,7 +714,7 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF
 			camel_stream_printf(stream, "<td align=\"left\"><img src=\"%s\"></td>", classid);
 			(void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efhd_write_image);
 			g_free(classid);
-			camel_object_unref(iconpart);
+			g_object_unref (iconpart);
 		}
 	}
 
@@ -1032,7 +1032,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
 	byte_array = camel_stream_mem_get_byte_array (info->mstream);
 	gtk_text_buffer_set_text (
 		buffer, (gchar *) byte_array->data, byte_array->len);
-	camel_object_unref(info->mstream);
+	g_object_unref (info->mstream);
 	info->mstream = NULL;
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
 					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index b521264..f2e2b5a 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -227,7 +227,7 @@ efh_format_exec (struct _format_msg *m)
 			format->base = base;
 
 			/* clean up the job */
-			camel_object_unref(job->stream);
+			g_object_unref (job->stream);
 			if (job->base)
 				camel_url_free(job->base);
 			g_free(job);
@@ -242,7 +242,7 @@ efh_format_exec (struct _format_msg *m)
 			d(printf("out of jobs, closing root stream\n"));
 			camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
 			camel_stream_close((CamelStream *)m->estream);
-			camel_object_unref(m->estream);
+			g_object_unref (m->estream);
 			m->estream = NULL;
 		}
 
@@ -271,13 +271,13 @@ efh_format_free (struct _format_msg *m)
 	g_object_unref(m->format);
 	if (m->estream) {
 		camel_stream_close((CamelStream *)m->estream);
-		camel_object_unref(m->estream);
+		g_object_unref (m->estream);
 	}
 	if (m->folder)
-		camel_object_unref(m->folder);
+		g_object_unref (m->folder);
 	g_free(m->uid);
 	if (m->message)
-		camel_object_unref(m->message);
+		g_object_unref (m->message);
 	if (m->format_source)
 		g_object_unref(m->format_source);
 }
@@ -367,7 +367,7 @@ static void
 efh_free_cache(struct _EMFormatHTMLCache *efhc)
 {
 	if (efhc->textmp)
-		camel_object_unref(efhc->textmp);
+		g_object_unref (efhc->textmp);
 	g_free(efhc);
 }
 
@@ -622,10 +622,10 @@ efh_format_clone (EMFormat *emf,
 		g_object_ref (emfsource);
 
 	if (folder != NULL)
-		camel_object_ref (folder);
+		g_object_ref (folder);
 
 	if (msg != NULL)
-		camel_object_ref (msg);
+		g_object_ref (msg);
 
 	m = mail_msg_new (&efh_format_info);
 	m->format = g_object_ref (emf);
@@ -679,11 +679,11 @@ efh_format_source (EMFormat *emf,
 		CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), filter);
-	camel_object_unref (filter);
+	g_object_unref (filter);
 
 	camel_stream_write_string (stream, "<table><tr><td><tt>");
 	em_format_format_text (emf, (CamelStream *) filtered_stream, dw);
-	camel_object_unref (filtered_stream);
+	g_object_unref (filtered_stream);
 
 	camel_stream_write_string(stream, "</tt></td></tr></table>");
 }
@@ -1187,12 +1187,12 @@ em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar
 
 	dw = camel_data_wrapper_new();
 	camel_data_wrapper_construct_from_stream(dw, stream);
-	camel_object_unref(stream);
+	g_object_unref (stream);
 	if (mime_type)
 		camel_data_wrapper_set_mime_type(dw, mime_type);
 	part = camel_mime_part_new();
 	camel_medium_set_content ((CamelMedium *)part, dw);
-	camel_object_unref(dw);
+	g_object_unref (dw);
 	basename = g_path_get_basename (filename);
 	camel_mime_part_set_filename(part, basename);
 	g_free (basename);
@@ -1428,10 +1428,10 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled)
 		/* do not store broken files in a cache */
 		if (n != 0)
 			camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
-		camel_object_unref(costream);
+		g_object_unref (costream);
 	}
 
-	camel_object_unref(instream);
+	g_object_unref (instream);
 done:
 	camel_operation_end(NULL);
 badurl:
@@ -1586,7 +1586,7 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel
 		iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath);
 		if (iconpart) {
 			(void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image);
-			camel_object_unref(iconpart);
+			g_object_unref (iconpart);
 		}
 		g_free (iconpath);
 		g_free(classid);
@@ -1670,21 +1670,21 @@ efh_text_plain (EMFormatHTML *efh,
 
 		null = camel_stream_null_new();
 		filtered_stream = camel_stream_filter_new (null);
-		camel_object_unref(null);
+		g_object_unref (null);
 		inline_filter = em_inline_filter_new(camel_mime_part_get_encoding(part), ct);
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filtered_stream),
 			CAMEL_MIME_FILTER (inline_filter));
 		camel_data_wrapper_write_to_stream(dw, (CamelStream *)filtered_stream);
 		camel_stream_close((CamelStream *)filtered_stream);
-		camel_object_unref(filtered_stream);
+		g_object_unref (filtered_stream);
 
 		mp = em_inline_filter_get_multipart(inline_filter);
 		if (efhc == NULL)
 			efhc = efh_insert_cache(efh, ((EMFormat *)efh)->part_id->str);
 		efhc->textmp = mp;
 
-		camel_object_unref(inline_filter);
+		g_object_unref (inline_filter);
 		camel_content_type_unref(ct);
 	}
 
@@ -1694,7 +1694,7 @@ efh_text_plain (EMFormatHTML *efh,
 	html_filter = camel_mime_filter_tohtml_new(flags, rgb);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), html_filter);
-	camel_object_unref(html_filter);
+	g_object_unref (html_filter);
 
 	/* We handle our made-up multipart here, so we don't recursively call ourselves */
 
@@ -1731,7 +1731,7 @@ efh_text_plain (EMFormatHTML *efh,
 		}
 	}
 
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 }
 
 static void
@@ -1752,7 +1752,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E
 	filtered_stream = camel_stream_filter_new (stream);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), enriched);
-	camel_object_unref(enriched);
+	g_object_unref (enriched);
 
 	camel_stream_printf (
 		stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n" EFH_MESSAGE_START,
@@ -1768,7 +1768,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E
 
 	em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
 
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 	camel_stream_write_string(stream, "</div>");
 }
 
@@ -1786,7 +1786,7 @@ efh_write_text_html(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
 	dw = camel_medium_get_content (puri->part);
 	if (dw)
 		camel_data_wrapper_write_to_stream(dw, out);
-	camel_object_unref(out);
+	g_object_unref (out);
 #endif
 	em_format_format_text(emf, stream, (CamelDataWrapper *)puri->part);
 }
@@ -1961,7 +1961,7 @@ efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart
 	html_filter = camel_mime_filter_tohtml_new(efh->text_html_flags, rgb);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), html_filter);
-	camel_object_unref(html_filter);
+	g_object_unref (html_filter);
 
 	camel_stream_write_string(stream, "<tt>\n" EFH_MESSAGE_START);
 	em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
@@ -2091,7 +2091,7 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
 	/* queue a job to check for un-referenced parts to add as attachments */
 	job = em_format_html_job_new((EMFormatHTML *)emf, emfh_multipart_related_check, NULL);
 	job->stream = stream;
-	camel_object_ref(stream);
+	g_object_ref (stream);
 	em_format_html_job_queue((EMFormatHTML *)emf, job);
 
 	em_format_pull_level(emf);
@@ -2709,11 +2709,11 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
 					classid);
 				em_format_add_puri(emf, sizeof(EMFormatPURI), classid,
 					photopart, efh_write_image);
-				camel_object_unref(photopart);
+				g_object_unref (photopart);
 
 				g_free(classid);
 			}
-			camel_object_unref(cia);
+			g_object_unref (cia);
 		}
 
 		if (!contact_has_photo && face_decoded) {
@@ -2725,7 +2725,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
 			classid = g_strdup_printf("icon:///em-format-html/face/photo/header");
 			camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=48 src=\"%s\"></td>", classid);
 			em_format_add_puri(emf, sizeof(EMFormatPURI), classid, part, efh_write_image);
-			camel_object_unref(part);
+			g_object_unref (part);
 		}
 
 		if (have_icon && efh->show_icon) {
@@ -2748,7 +2748,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
 
 			if (iconpart) {
 				em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image);
-				camel_object_unref(iconpart);
+				g_object_unref (iconpart);
 			}
 			g_free(classid);
 		}
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index cc3c795..d86e2a3 100644
--- a/mail/em-html-stream.c
+++ b/mail/em-html-stream.c
@@ -32,10 +32,10 @@
 
 #define d(x)
 
-static EMSyncStreamClass *parent_class = NULL;
+G_DEFINE_TYPE (EMHTMLStream, em_html_stream, EM_TYPE_SYNC_STREAM)
 
 static void
-emhs_cleanup (EMHTMLStream *emhs)
+html_stream_cleanup (EMHTMLStream *emhs)
 {
 	if (emhs->sync.cancel && emhs->html_stream)
 		gtk_html_stream_close (
@@ -49,17 +49,28 @@ emhs_cleanup (EMHTMLStream *emhs)
 }
 
 static void
-emhs_gtkhtml_destroy (GtkHTML *html,
-                      EMHTMLStream *emhs)
+html_stream_gtkhtml_destroy (GtkHTML *html,
+                             EMHTMLStream *emhs)
 {
 	emhs->sync.cancel = TRUE;
-	emhs_cleanup (emhs);
+	html_stream_cleanup (emhs);
+}
+
+static void
+html_stream_dispose (GObject *object)
+{
+	EMHTMLStream *emhs = EM_HTML_STREAM (object);
+
+	if (emhs->html_stream) {
+		/* set 'in finalise' flag */
+		camel_stream_close (CAMEL_STREAM (emhs));
+	}
 }
 
 static gssize
-emhs_sync_write (CamelStream *stream,
-                 const gchar *buffer,
-                 gsize n)
+html_stream_sync_write (CamelStream *stream,
+                        const gchar *buffer,
+                        gsize n)
 {
 	EMHTMLStream *emhs = EM_HTML_STREAM (stream);
 
@@ -76,7 +87,7 @@ emhs_sync_write (CamelStream *stream,
 }
 
 static gint
-emhs_sync_flush(CamelStream *stream)
+html_stream_sync_flush (CamelStream *stream)
 {
 	EMHTMLStream *emhs = (EMHTMLStream *)stream;
 
@@ -89,7 +100,7 @@ emhs_sync_flush(CamelStream *stream)
 }
 
 static gint
-emhs_sync_close (CamelStream *stream)
+html_stream_sync_close (CamelStream *stream)
 {
 	EMHTMLStream *emhs = (EMHTMLStream *)stream;
 
@@ -97,7 +108,7 @@ emhs_sync_close (CamelStream *stream)
 		return -1;
 
 	gtk_html_stream_close (emhs->html_stream, GTK_HTML_STREAM_OK);
-	emhs_cleanup (emhs);
+	html_stream_cleanup (emhs);
 
 	return 0;
 }
@@ -105,14 +116,16 @@ emhs_sync_close (CamelStream *stream)
 static void
 em_html_stream_class_init (EMHTMLStreamClass *class)
 {
+	GObjectClass *object_class;
 	EMSyncStreamClass *sync_stream_class;
 
-	parent_class = (EMSyncStreamClass *)em_sync_stream_get_type();
+	object_class = G_OBJECT_CLASS (class);
+	object_class->dispose = html_stream_dispose;
 
 	sync_stream_class = EM_SYNC_STREAM_CLASS (class);
-	sync_stream_class->sync_write = emhs_sync_write;
-	sync_stream_class->sync_flush = emhs_sync_flush;
-	sync_stream_class->sync_close = emhs_sync_close;
+	sync_stream_class->sync_write = html_stream_sync_write;
+	sync_stream_class->sync_flush = html_stream_sync_flush;
+	sync_stream_class->sync_close = html_stream_sync_close;
 }
 
 static void
@@ -120,35 +133,6 @@ em_html_stream_init (EMHTMLStream *emhs)
 {
 }
 
-static void
-em_html_stream_finalize (EMHTMLStream *emhs)
-{
-	if (emhs->html_stream) {
-		/* set 'in finalise' flag */
-		camel_stream_close (CAMEL_STREAM (emhs));
-	}
-}
-
-CamelType
-em_html_stream_get_type (void)
-{
-	static CamelType type = CAMEL_INVALID_TYPE;
-
-	if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) {
-		type = camel_type_register (
-			em_sync_stream_get_type(),
-			"EMHTMLStream",
-			sizeof (EMHTMLStream),
-			sizeof (EMHTMLStreamClass),
-			(CamelObjectClassInitFunc) em_html_stream_class_init,
-			NULL,
-			(CamelObjectInitFunc) em_html_stream_init,
-			(CamelObjectFinalizeFunc) em_html_stream_finalize);
-	}
-
-	return type;
-}
-
 /* TODO: Could pass NULL for html_stream, and do a gtk_html_begin
    on first data -> less flashing */
 CamelStream *
@@ -159,13 +143,13 @@ em_html_stream_new (GtkHTML *html,
 
 	g_return_val_if_fail (GTK_IS_HTML (html), NULL);
 
-	new = EM_HTML_STREAM (camel_object_new (EM_HTML_STREAM_TYPE));
+	new = g_object_new (EM_TYPE_HTML_STREAM, NULL);
 	new->html_stream = html_stream;
 	new->html = g_object_ref (html);
 	new->flags = 0;
 	new->destroy_id = g_signal_connect (
 		html, "destroy",
-		G_CALLBACK (emhs_gtkhtml_destroy), new);
+		G_CALLBACK (html_stream_gtkhtml_destroy), new);
 
 	em_sync_stream_set_buffer_size (&new->sync, 8192);
 
diff --git a/mail/em-html-stream.h b/mail/em-html-stream.h
index 7bf7947..24d32f7 100644
--- a/mail/em-html-stream.h
+++ b/mail/em-html-stream.h
@@ -28,17 +28,24 @@
 #include <gtkhtml/gtkhtml-stream.h>
 #include <mail/em-sync-stream.h>
 
-#define EM_HTML_STREAM_TYPE \
+/* Standard GObject macros */
+#define EM_TYPE_HTML_STREAM \
 	(em_html_stream_get_type ())
 #define EM_HTML_STREAM(obj) \
-	(CAMEL_CHECK_CAST \
-	((obj), EM_HTML_STREAM_TYPE, EMHTMLStream))
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EM_TYPE_HTML_STREAM, EMHTMLStream))
 #define EM_HTML_STREAM_CLASS(cls) \
-	(CAMEL_CHECK_CLASS_CAST \
-	((cls), EM_HTML_STREAM_TYPE, EMHTMLStreamClass))
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EM_TYPE_HTML_STREAM, EMHTMLStreamClass))
 #define EM_IS_HTML_STREAM(obj) \
-	(CAMEL_CHECK_TYPE \
-	((obj), EM_HTML_STREAM_TYPE))
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EM_TYPE_HTML_STREAM))
+#define EM_IS_HTML_STREAM_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EM_TYPE_HTML_STREAM))
+#define EM_HTML_STREAM_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), EM_TYPE_HTML_STREAM, EMHTMLStreamClass))
 
 G_BEGIN_DECLS
 
@@ -59,7 +66,7 @@ struct _EMHTMLStreamClass {
 
 };
 
-CamelType	em_html_stream_get_type		(void);
+GType		em_html_stream_get_type		(void);
 CamelStream *	em_html_stream_new		(GtkHTML *html,
 						 GtkHTMLStream *html_stream);
 void		em_html_stream_set_flags	(EMHTMLStream *emhs,
diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c
index 55a43ca..1ac2166 100644
--- a/mail/em-inline-filter.c
+++ b/mail/em-inline-filter.c
@@ -33,65 +33,7 @@
 
 #define d(x)
 
-static void em_inline_filter_class_init (EMInlineFilterClass *klass);
-static void em_inline_filter_init (CamelObject *object);
-static void em_inline_filter_finalize (CamelObject *object);
-
-static void emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace);
-static void emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace);
-static void emif_reset(CamelMimeFilter *f);
-
-static CamelMimeFilterClass *parent_class = NULL;
-
-CamelType
-em_inline_filter_get_type (void)
-{
-	static CamelType type = CAMEL_INVALID_TYPE;
-
-	if (type == CAMEL_INVALID_TYPE) {
-		parent_class = (CamelMimeFilterClass *)camel_mime_filter_get_type();
-
-		type = camel_type_register(camel_mime_filter_get_type(),
-					   "EMInlineFilter",
-					   sizeof (EMInlineFilter),
-					   sizeof (EMInlineFilterClass),
-					   (CamelObjectClassInitFunc) em_inline_filter_class_init,
-					   NULL,
-					   (CamelObjectInitFunc) em_inline_filter_init,
-					   (CamelObjectFinalizeFunc) em_inline_filter_finalize);
-	}
-
-	return type;
-}
-
-static void
-em_inline_filter_class_init (EMInlineFilterClass *klass)
-{
-	((CamelMimeFilterClass *)klass)->filter = emif_filter;
-	((CamelMimeFilterClass *)klass)->complete = emif_complete;
-	((CamelMimeFilterClass *)klass)->reset = emif_reset;
-}
-
-static void
-em_inline_filter_init (CamelObject *object)
-{
-	EMInlineFilter *emif = (EMInlineFilter *)object;
-
-	emif->data = g_byte_array_new();
-}
-
-static void
-em_inline_filter_finalize (CamelObject *object)
-{
-	EMInlineFilter *emif = (EMInlineFilter *)object;
-
-	if (emif->base_type)
-		camel_content_type_unref(emif->base_type);
-
-	emif_reset((CamelMimeFilter *)emif);
-	g_byte_array_free(emif->data, TRUE);
-	g_free(emif->filename);
-}
+G_DEFINE_TYPE (EMInlineFilter, em_inline_filter, CAMEL_TYPE_MIME_FILTER)
 
 enum {
 	EMIF_PLAIN,
@@ -117,7 +59,7 @@ static const struct {
 };
 
 static void
-emif_add_part(EMInlineFilter *emif, const gchar *data, gint len)
+inline_filter_add_part(EMInlineFilter *emif, const gchar *data, gint len)
 {
 	CamelTransferEncoding encoding;
 	CamelContentType *content_type;
@@ -142,7 +84,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len)
 
 	dw = camel_data_wrapper_new();
 	camel_data_wrapper_construct_from_stream(dw, mem);
-	camel_object_unref(mem);
+	g_object_unref (mem);
 
 	if (emif_types[emif->state].plain && emif->base_type) {
 		camel_content_type_ref (emif->base_type);
@@ -166,7 +108,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len)
 	part = camel_mime_part_new();
 	camel_medium_set_content ((CamelMedium *)part, dw);
 	camel_mime_part_set_encoding(part, encoding);
-	camel_object_unref(dw);
+	g_object_unref (dw);
 
 	if (emif->filename)
 		camel_mime_part_set_filename(part, emif->filename);
@@ -188,7 +130,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len)
 }
 
 static gint
-emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
+inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 {
 	EMInlineFilter *emif = (EMInlineFilter *)f;
 	gchar *inptr = in, *inend = in+len;
@@ -227,7 +169,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 				if (start[i++] != ' ')
 					break;
 
-				emif_add_part(emif, data_start, start-data_start);
+				inline_filter_add_part(emif, data_start, start-data_start);
 
 				name = g_strndup(start+i, inptr-start-i-1);
 				emif->filename = camel_header_decode_string(name, emif->base_type?camel_content_type_param(emif->base_type, "charset"):NULL);
@@ -236,22 +178,22 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 				emif->state = EMIF_UUENC;
 			} else if (strncmp(start, "(This file must be converted with BinHex 4.0)", 45) == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, start-data_start);
+				inline_filter_add_part(emif, data_start, start-data_start);
 				data_start = start;
 				emif->state = EMIF_BINHEX;
 			} else if (strncmp(start, "%!PS-Adobe-", 11) == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, start-data_start);
+				inline_filter_add_part(emif, data_start, start-data_start);
 				data_start = start;
 				emif->state = EMIF_POSTSCRIPT;
 			} else if (strncmp(start, "-----BEGIN PGP SIGNED MESSAGE-----", 34) == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, start-data_start);
+				inline_filter_add_part(emif, data_start, start-data_start);
 				data_start = start;
 				emif->state = EMIF_PGPSIGNED;
 			} else if (strncmp(start, "-----BEGIN PGP MESSAGE-----", 27) == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, start-data_start);
+				inline_filter_add_part(emif, data_start, start-data_start);
 				data_start = start;
 				emif->state = EMIF_PGPENCRYPTED;
 			}
@@ -260,7 +202,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		case EMIF_UUENC:
 			if (strcmp(start, "end") == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, inptr-data_start);
+				inline_filter_add_part(emif, data_start, inptr-data_start);
 				data_start = inptr;
 				emif->state = EMIF_PLAIN;
 			} else {
@@ -276,7 +218,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 				linelen *= 3;
 				if (!(len == linelen || len == linelen-1 || len == linelen-2)) {
 					inptr[-1] = '\n';
-					emif_add_part(emif, data_start, start-data_start);
+					inline_filter_add_part(emif, data_start, start-data_start);
 					data_start = start;
 					inptr = start;
 					emif->state = EMIF_PLAIN;
@@ -287,7 +229,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		case EMIF_BINHEX:
 			if (inptr > (start+1) && inptr[-2] == ':') {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, inptr-data_start);
+				inline_filter_add_part(emif, data_start, inptr-data_start);
 				data_start = inptr;
 				emif->state = EMIF_PLAIN;
 			}
@@ -295,7 +237,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		case EMIF_POSTSCRIPT:
 			if (strcmp(start, "%%EOF") == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, inptr-data_start);
+				inline_filter_add_part(emif, data_start, inptr-data_start);
 				data_start = inptr;
 				emif->state = EMIF_PLAIN;
 			}
@@ -303,7 +245,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		case EMIF_PGPSIGNED:
 			if (strcmp(start, "-----END PGP SIGNATURE-----") == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, inptr-data_start);
+				inline_filter_add_part(emif, data_start, inptr-data_start);
 				data_start = inptr;
 				emif->state = EMIF_PLAIN;
 			}
@@ -311,7 +253,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		case EMIF_PGPENCRYPTED:
 			if (strcmp(start, "-----END PGP MESSAGE-----") == 0) {
 				inptr[-1] = '\n';
-				emif_add_part(emif, data_start, inptr-data_start);
+				inline_filter_add_part(emif, data_start, inptr-data_start);
 				data_start = inptr;
 				emif->state = EMIF_PLAIN;
 			}
@@ -325,7 +267,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 		/* always stop as plain, especially when not read those tags fully */
 		emif->state = EMIF_PLAIN;
 
-		emif_add_part(emif, data_start, inend-data_start);
+		inline_filter_add_part(emif, data_start, inend-data_start);
 	} else {
 		g_byte_array_append(emif->data, (guchar *)data_start, inend-data_start);
 	}
@@ -334,9 +276,31 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final)
 }
 
 static void
-emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
+inline_filter_finalize (GObject *object)
+{
+	EMInlineFilter *emif = EM_INLINE_FILTER (object);
+
+	if (emif->base_type)
+		camel_content_type_unref(emif->base_type);
+
+	camel_mime_filter_reset (CAMEL_MIME_FILTER (object));
+	g_byte_array_free(emif->data, TRUE);
+	g_free(emif->filename);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (em_inline_filter_parent_class)->finalize (object);
+}
+
+static void
+inline_filter_filter (CamelMimeFilter *filter,
+                      const gchar *in,
+                      gsize len,
+                      gsize prespace,
+                      gchar **out,
+                      gsize *outlen,
+                      gsize *outprespace)
 {
-	emif_scan(f, (gchar *)in, len, FALSE);
+	inline_filter_scan (filter, (gchar *)in, len, FALSE);
 
 	*out = (gchar *)in;
 	*outlen = len;
@@ -344,9 +308,15 @@ emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gcha
 }
 
 static void
-emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
+inline_filter_complete (CamelMimeFilter *filter,
+                        const gchar *in,
+                        gsize len,
+                        gsize prespace,
+                        gchar **out,
+                        gsize *outlen,
+                        gsize *outprespace)
 {
-	emif_scan(f, (gchar *)in, len, TRUE);
+	inline_filter_scan (filter, (gchar *)in, len, TRUE);
 
 	*out = (gchar *)in;
 	*outlen = len;
@@ -354,16 +324,16 @@ emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gc
 }
 
 static void
-emif_reset(CamelMimeFilter *f)
+inline_filter_reset (CamelMimeFilter *filter)
 {
-	EMInlineFilter *emif = (EMInlineFilter *)f;
+	EMInlineFilter *emif = EM_INLINE_FILTER (filter);
 	GSList *l;
 
 	l = emif->parts;
 	while (l) {
 		GSList *n = l->next;
 
-		camel_object_unref(l->data);
+		g_object_unref (l->data);
 		g_slist_free_1(l);
 
 		l = n;
@@ -372,6 +342,27 @@ emif_reset(CamelMimeFilter *f)
 	g_byte_array_set_size(emif->data, 0);
 }
 
+static void
+em_inline_filter_class_init (EMInlineFilterClass *class)
+{
+	GObjectClass *object_class;
+	CamelMimeFilterClass *mime_filter_class;
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = inline_filter_finalize;
+
+	mime_filter_class = CAMEL_MIME_FILTER_CLASS (class);
+	mime_filter_class->filter = inline_filter_filter;
+	mime_filter_class->complete = inline_filter_complete;
+	mime_filter_class->reset = inline_filter_reset;
+}
+
+static void
+em_inline_filter_init (EMInlineFilter *emif)
+{
+	emif->data = g_byte_array_new();
+}
+
 /**
  * em_inline_filter_new:
  * @base_encoding: The base transfer-encoding of the
@@ -390,7 +381,7 @@ em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *base
 {
 	EMInlineFilter *emif;
 
-	emif = (EMInlineFilter *)camel_object_new(em_inline_filter_get_type());
+	emif = g_object_new (EM_TYPE_INLINE_FILTER, NULL);
 	emif->base_encoding = base_encoding;
 	if (base_type) {
 		emif->base_type = base_type;
diff --git a/mail/em-inline-filter.h b/mail/em-inline-filter.h
index 11aaa7f..8ee90a6 100644
--- a/mail/em-inline-filter.h
+++ b/mail/em-inline-filter.h
@@ -26,14 +26,31 @@
 
 #include <camel/camel.h>
 
-#define EM_INLINE_FILTER_TYPE     (em_inline_filter_get_type ())
-#define EM_INLINE_FILTER(obj)     (CAMEL_CHECK_CAST((obj), EM_INLINE_FILTER_TYPE, EMInlineFilter))
-#define EM_INLINE_FILTER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_INLINE_FILTER_TYPE, EMInlineFilterClass))
-#define EM_IS_INLINE_FILTER(o)    (CAMEL_CHECK_TYPE((o), EM_INLINE_FILTER_TYPE))
+/* Standard GObject macros */
+#define EM_TYPE_INLINE_FILTER \
+	(em_inline_filter_get_type ())
+#define EM_INLINE_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EM_TYPE_INLINE_FILTER, EMInlineFilter))
+#define EM_INLINE_FILTER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EM_TYPE_INLINE_FILTER, EMInlineFilterClass))
+#define EM_IS_INLINE_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EM_TYPE_INLINE_FILTER))
+#define EM_IS_INLINE_FILTER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EM_TYPE_INLINE_FILTER))
+#define EM_INLINE_FILTER_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), EM_TYPE_INLINE_FILTER, EMInlineFilterClass))
 
 G_BEGIN_DECLS
 
-typedef struct _EMInlineFilter {
+typedef struct _EMInlineFilter EMInlineFilter;
+typedef struct _EMInlineFilterClass EMInlineFilterClass;
+
+struct _EMInlineFilter {
 	CamelMimeFilter filter;
 
 	gint state;
@@ -44,15 +61,16 @@ typedef struct _EMInlineFilter {
 	GByteArray *data;
 	gchar *filename;
 	GSList *parts;
-} EMInlineFilter;
+};
 
-typedef struct _EMInlineFilterClass {
+struct _EMInlineFilterClass {
 	CamelMimeFilterClass filter_class;
-} EMInlineFilterClass;
+};
 
-CamelType    em_inline_filter_get_type(void);
-EMInlineFilter *em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *type);
-CamelMultipart *em_inline_filter_get_multipart(EMInlineFilter *emif);
+GType		em_inline_filter_get_type	(void);
+EMInlineFilter *em_inline_filter_new		(CamelTransferEncoding base_encoding,
+						 CamelContentType *type);
+CamelMultipart *em_inline_filter_get_multipart	(EMInlineFilter *emif);
 
 G_END_DECLS
 
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 068d74c..e1e0e1d 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -144,7 +144,7 @@ sub_unref(EMSubscribe *sub)
 			l = n;
 		}
 		if (sub->store)
-			camel_object_unref(sub->store);
+			g_object_unref (sub->store);
 		g_free(sub->store_uri);
 		g_free(sub);
 	}
@@ -594,7 +594,7 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store)
 		GtkTreeStore *model;
 
 		sub->store = store;
-		camel_object_ref(store);
+		g_object_ref (store);
 		sub->folders = g_hash_table_new_full (
 			g_str_hash, g_str_equal,
 			(GDestroyNotify) NULL,
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index 780ae9d..d0dd6e7 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -33,8 +33,6 @@
 
 #include "mail-mt.h"
 
-#define EMSS_CLASS(x) ((EMSyncStreamClass *)(((CamelObject *)(x))->klass))
-
 enum _write_msg_t {
 	EMSS_WRITE,
 	EMSS_FLUSH,
@@ -51,10 +49,10 @@ struct _write_msg {
 	gsize len;
 };
 
-static CamelStreamClass *parent_class = NULL;
+G_DEFINE_TYPE (EMSyncStream, em_sync_stream, CAMEL_TYPE_STREAM)
 
 static gboolean
-emss_process_message (struct _write_msg *msg)
+sync_stream_process_message (struct _write_msg *msg)
 {
 	struct _EMSyncStream *emss = msg->emss;
 
@@ -67,7 +65,7 @@ emss_process_message (struct _write_msg *msg)
 
 	/* Force out any pending data before doing anything else. */
 	if (emss->buffer != NULL && emss->buffer->len > 0) {
-		EMSS_CLASS (emss)->sync_write (
+		EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (
 			CAMEL_STREAM (emss), emss->buffer->str,
 			emss->buffer->len);
 		g_string_set_size (emss->buffer, 0);
@@ -75,15 +73,15 @@ emss_process_message (struct _write_msg *msg)
 
 	switch (msg->op) {
 		case EMSS_WRITE:
-			EMSS_CLASS (emss)->sync_write (
+			EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (
 				CAMEL_STREAM (emss), msg->string, msg->len);
 			break;
 		case EMSS_FLUSH:
-			EMSS_CLASS (emss)->sync_flush (
+			EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (
 				CAMEL_STREAM (emss));
 			break;
 		case EMSS_CLOSE:
-			EMSS_CLASS (emss)->sync_close (
+			EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (
 				CAMEL_STREAM (emss));
 			break;
 	}
@@ -95,7 +93,7 @@ emss_process_message (struct _write_msg *msg)
 }
 
 static void
-emss_sync_op (EMSyncStream *emss, enum _write_msg_t op,
+sync_stream_sync_op (EMSyncStream *emss, enum _write_msg_t op,
 	      const gchar *string, gsize len)
 {
 	struct _write_msg msg;
@@ -106,20 +104,31 @@ emss_sync_op (EMSyncStream *emss, enum _write_msg_t op,
 	msg.string = string;
 	msg.len = len;
 
-	camel_object_ref (emss);
+	g_object_ref (emss);
 
 	if (emss->idle_id)
 		g_source_remove (emss->idle_id);
-	emss->idle_id = g_idle_add ((GSourceFunc) emss_process_message, &msg);
+	emss->idle_id = g_idle_add ((GSourceFunc) sync_stream_process_message, &msg);
 
 	e_flag_wait (msg.done);
 	e_flag_free (msg.done);
 
-	camel_object_unref (emss);
+	g_object_unref (emss);
+}
+
+static void
+sync_stream_finalize (GObject *object)
+{
+	EMSyncStream *emss = EM_SYNC_STREAM (object);
+
+	if (emss->buffer != NULL)
+		g_string_free (emss->buffer, TRUE);
+	if (emss->idle_id)
+		g_source_remove (emss->idle_id);
 }
 
 static gssize
-emss_stream_write (CamelStream *stream, const gchar *string, gsize len)
+sync_stream_write (CamelStream *stream, const gchar *string, gsize len)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
 
@@ -127,21 +136,21 @@ emss_stream_write (CamelStream *stream, const gchar *string, gsize len)
 		return -1;
 
 	if (mail_in_main_thread ()) {
-		EMSS_CLASS (emss)->sync_write (stream, string, len);
+		EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (stream, string, len);
 	} else if (emss->buffer != NULL) {
 		if (len < (emss->buffer->allocated_len - emss->buffer->len))
 			g_string_append_len (emss->buffer, string, len);
 		else
-			emss_sync_op (emss, EMSS_WRITE, string, len);
+			sync_stream_sync_op (emss, EMSS_WRITE, string, len);
 	} else {
-		emss_sync_op(emss, EMSS_WRITE, string, len);
+		sync_stream_sync_op(emss, EMSS_WRITE, string, len);
 	}
 
 	return (gssize) len;
 }
 
 static gint
-emss_stream_flush (CamelStream *stream)
+sync_stream_flush (CamelStream *stream)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
 
@@ -149,15 +158,15 @@ emss_stream_flush (CamelStream *stream)
 		return -1;
 
 	if (mail_in_main_thread ())
-		return EMSS_CLASS (emss)->sync_flush (stream);
+		return EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (stream);
 	else
-		emss_sync_op (emss, EMSS_FLUSH, NULL, 0);
+		sync_stream_sync_op (emss, EMSS_FLUSH, NULL, 0);
 
 	return 0;
 }
 
 static gint
-emss_stream_close (CamelStream *stream)
+sync_stream_close (CamelStream *stream)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
 
@@ -167,9 +176,9 @@ emss_stream_close (CamelStream *stream)
 	emss->idle_id = 0;
 
 	if (mail_in_main_thread ())
-		return EMSS_CLASS (emss)->sync_close (stream);
+		return EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (stream);
 	else
-		emss_sync_op (emss, EMSS_CLOSE, NULL, 0);
+		sync_stream_sync_op (emss, EMSS_CLOSE, NULL, 0);
 
 	return 0;
 }
@@ -177,41 +186,21 @@ emss_stream_close (CamelStream *stream)
 static void
 em_sync_stream_class_init (EMSyncStreamClass *class)
 {
-	CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (class);
+	GObjectClass *object_class;
+	CamelStreamClass *stream_class;
 
-	parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE;
+	object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = sync_stream_finalize;
 
-	stream_class->write = emss_stream_write;
-	stream_class->flush = emss_stream_flush;
-	stream_class->close = emss_stream_close;
+	stream_class = CAMEL_STREAM_CLASS (class);
+	stream_class->write = sync_stream_write;
+	stream_class->flush = sync_stream_flush;
+	stream_class->close = sync_stream_close;
 }
 
 static void
-em_sync_stream_finalize (EMSyncStream *emss)
-{
-	if (emss->buffer != NULL)
-		g_string_free (emss->buffer, TRUE);
-	if (emss->idle_id)
-		g_source_remove (emss->idle_id);
-}
-
-CamelType
-em_sync_stream_get_type (void)
+em_sync_stream_init (EMSyncStream *emss)
 {
-	static CamelType type = CAMEL_INVALID_TYPE;
-
-	if (G_UNLIKELY (type == CAMEL_INVALID_TYPE))
-		type = camel_type_register (
-			CAMEL_STREAM_TYPE,
-			"EMSyncStream",
-			sizeof (EMSyncStream),
-			sizeof (EMSyncStreamClass),
-			(CamelObjectClassInitFunc) em_sync_stream_class_init,
-			NULL,
-			(CamelObjectInitFunc) NULL,
-			(CamelObjectFinalizeFunc) em_sync_stream_finalize);
-
-	return type;
 }
 
 void
diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h
index b8684ac..5930790 100644
--- a/mail/em-sync-stream.h
+++ b/mail/em-sync-stream.h
@@ -33,16 +33,24 @@ requests are always handled in the main gui thread in the correct order.
 #include <glib.h>
 #include <camel/camel.h>
 
-#define EM_SYNC_STREAM_TYPE \
+/* Standard GObject macros */
+#define EM_TYPE_SYNC_STREAM \
 	(em_sync_stream_get_type ())
 #define EM_SYNC_STREAM(obj) \
-	(CAMEL_CHECK_CAST \
-	((obj), EM_SYNC_STREAM_TYPE, EMSyncStream))
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EM_TYPE_SYNC_STREAM, EMSyncStream))
 #define EM_SYNC_STREAM_CLASS(cls) \
-	(CAMEL_CHECK_CLASS_CAST \
-	((cls), EM_SYNC_STREAM_TYPE, EMSyncStreamClass))
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EM_TYPE_SYNC_STREAM, EMSyncStreamClass))
 #define EM_IS_SYNC_STREAM(obj) \
-	(CAMEL_CHECK_TYPE ((obj), EM_SYNC_STREAM_TYPE))
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EM_TYPE_SYNC_STREAM))
+#define EM_IS_SYNC_STREAM_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EM_TYPE_SYNC_STREAM))
+#define EM_SYNC_STREAM_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), EM_TYPE_SYNC_STREAM, EMSyncStreamClass))
 
 G_BEGIN_DECLS
 
@@ -66,7 +74,7 @@ struct _EMSyncStreamClass {
 	gint		(*sync_flush)		(CamelStream *stream);
 };
 
-CamelType	em_sync_stream_get_type		(void);
+GType		em_sync_stream_get_type		(void);
 void		em_sync_stream_set_buffer_size	(EMSyncStream *stream,
 						 gsize size);
 
diff --git a/mail/em-utils.c b/mail/em-utils.c
index a1dd9ea..e0e4433 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -552,7 +552,7 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr
 	filtered_stream = camel_stream_filter_new (stream);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), from_filter);
-	camel_object_unref(from_filter);
+	g_object_unref (from_filter);
 
 	for (i=0; i<uids->len; i++) {
 		CamelMimeMessage *message;
@@ -574,13 +574,13 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr
 			res = -1;
 
 		g_free(from);
-		camel_object_unref(message);
+		g_object_unref (message);
 
 		if (res == -1)
 			break;
 	}
 
-	camel_object_unref(filtered_stream);
+	g_object_unref (filtered_stream);
 
 	return res;
 }
@@ -603,12 +603,12 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream)
 		/* NB: de-from filter, once written */
 		msg = camel_mime_message_new();
 		if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
-			camel_object_unref(msg);
+			g_object_unref (msg);
 			break;
 		}
 
 		camel_folder_append_message(folder, msg, NULL, NULL, ex);
-		camel_object_unref(msg);
+		g_object_unref (msg);
 
 		if (camel_exception_is_set (ex))
 			break;
@@ -616,7 +616,7 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream)
 		camel_mime_parser_step(mp, NULL, NULL);
 	}
 
-	camel_object_unref(mp);
+	g_object_unref (mp);
 	if (!camel_exception_is_set(ex))
 		res = 0;
 	camel_exception_free(ex);
@@ -653,7 +653,7 @@ em_utils_selection_set_mailbox (GtkSelectionData *data,
 			data, target, 8,
 			byte_array->data, byte_array->len);
 
-	camel_object_unref (stream);
+	g_object_unref (stream);
 }
 
 /**
@@ -685,7 +685,7 @@ em_utils_selection_get_mailbox (GtkSelectionData *selection_data,
 	stream = (CamelStream *)
 		camel_stream_mem_new_with_buffer ((gchar *) data, length);
 	em_utils_read_messages_from_stream(folder, stream);
-	camel_object_unref(stream);
+	g_object_unref (stream);
 }
 
 /**
@@ -717,8 +717,8 @@ em_utils_selection_get_message (GtkSelectionData *selection_data,
 	msg = camel_mime_message_new();
 	if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) == 0)
 		camel_folder_append_message(folder, msg, NULL, NULL, ex);
-	camel_object_unref(msg);
-	camel_object_unref(stream);
+	g_object_unref (msg);
+	g_object_unref (stream);
 	camel_exception_free(ex);
 }
 
@@ -808,7 +808,7 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data,
 	folder = mail_tool_uri_to_folder((gchar *) data, 0, ex);
 	if (folder) {
 		camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, ex);
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 
 	em_utils_uids_free(uids);
@@ -878,7 +878,7 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
 			g_free(uri_crlf);
 		}
 
-		camel_object_unref(fstream);
+		g_object_unref (fstream);
 	} else
 		close(fd);
 
@@ -928,7 +928,7 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data,
 			stream = camel_stream_fs_new_with_fd(fd);
 			if (stream) {
 				res = em_utils_read_messages_from_stream(folder, stream);
-				camel_object_unref(stream);
+				g_object_unref (stream);
 			} else
 				close(fd);
 		}
@@ -1278,7 +1278,7 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint
 		camel_stream_write ((CamelStream*)mem, append, strlen (append));
 
 	camel_stream_write((CamelStream *)mem, "", 1);
-	camel_object_unref(mem);
+	g_object_unref (mem);
 
 	text = (gchar *)buf->data;
 	if (len)
@@ -1983,7 +1983,7 @@ emu_remove_from_mail_cache (const GSList *addresses)
 		}
 	}
 
-	camel_object_unref (cia);
+	g_object_unref (cia);
 }
 
 void
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 3889277..2c98918 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -160,7 +160,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
 			msg = camel_mime_message_new();
 			if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
 				/* set exception? */
-				camel_object_unref(msg);
+				g_object_unref (msg);
 				break;
 			}
 
@@ -179,7 +179,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
 			camel_message_info_set_flags(info, flags, ~0);
 			camel_folder_append_message(folder, msg, info, NULL, &m->base.ex);
 			camel_message_info_free(info);
-			camel_object_unref(msg);
+			g_object_unref (msg);
 
 			if (camel_exception_is_set(&m->base.ex))
 				break;
@@ -193,11 +193,11 @@ import_mbox_exec (struct _import_mbox_msg *m)
 		if (m->cancel)
 			camel_operation_register(oldcancel);
 	fail2:
-		camel_object_unref(mp);
+		g_object_unref (mp);
 	}
 fail1:
 	camel_folder_sync(folder, FALSE, NULL);
-	camel_object_unref(folder);
+	g_object_unref (folder);
 }
 
 static void
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 822afa3..0504bc7 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -153,7 +153,7 @@ free_update(struct _folder_update *up)
 	g_free (up->full_name);
 	g_free (up->uri);
 	if (up->store)
-		camel_object_unref(up->store);
+		g_object_unref (up->store);
 	g_free (up->oldfull);
 	g_free (up->olduri);
 	g_free (up->msg_uid);
@@ -205,7 +205,7 @@ real_flush_updates (gpointer o, gpointer event_data, gpointer data)
 
 			if (folder) {
 				mail_folder_cache_note_folder (self, folder);
-				camel_object_unref (folder);
+				g_object_unref (folder);
 			}
 		}
 
@@ -250,7 +250,7 @@ unset_folder_info(MailFolderCache *self, struct _folder_info *mfi, gint delete,
 		up->unsub = unsub;
 		up->store = mfi->store_info->store;
 		up->full_name = g_strdup (mfi->full_name);
-		camel_object_ref(up->store);
+		g_object_ref (up->store);
 		up->uri = g_strdup(mfi->uri);
 
 		g_queue_push_head (&self->priv->updates, up);
@@ -342,7 +342,7 @@ update_1folder(MailFolderCache *self, struct _folder_info *mfi, gint new, const
 	up->msg_uid = g_strdup (msg_uid);
 	up->msg_sender = g_strdup (msg_sender);
 	up->msg_subject = g_strdup (msg_subject);
-	camel_object_ref(up->store);
+	g_object_ref (up->store);
 	g_queue_push_head (&self->priv->updates, up);
 	flush_updates(self);
 }
@@ -372,7 +372,7 @@ setup_folder(MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si)
 		up->uri = g_strdup(fi->uri);
 		up->unread = fi->unread;
 		up->store = si->store;
-		camel_object_ref(up->store);
+		g_object_ref (up->store);
 
 		if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0)
 			up->add = TRUE;
@@ -683,7 +683,7 @@ rename_folders(MailFolderCache *self, struct _store_info *si, const gchar *oldba
 	up->uri = g_strdup(mfi->uri);
 	up->unread = fi->unread==-1?0:fi->unread;
 	up->store = si->store;
-	camel_object_ref(up->store);
+	g_object_ref (up->store);
 
 	if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0)
 		up->add = TRUE;
@@ -838,7 +838,7 @@ mail_folder_cache_note_store_remove(MailFolderCache *self, CamelStore *store)
 			link = g_list_next (link);
 		}
 
-		camel_object_unref(si->store);
+		g_object_unref (si->store);
 		g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL);
 		g_hash_table_destroy(si->folders);
 		g_hash_table_destroy(si->folders_uri);
@@ -914,7 +914,7 @@ ping_store_exec (struct _ping_store_msg *m)
 static void
 ping_store_free (struct _ping_store_msg *m)
 {
-	camel_object_unref (m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo ping_store_info = {
@@ -936,7 +936,7 @@ ping_store (gpointer key, gpointer val, gpointer user_data)
 
 	m = mail_msg_new (&ping_store_info);
 	m->store = store;
-	camel_object_ref (store);
+	g_object_ref (store);
 
 	mail_msg_slow_ordered_push (m);
 }
@@ -1002,7 +1002,7 @@ mail_folder_cache_note_store(MailFolderCache *self, CamelStore *store, CamelOper
 		si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name,
 						   CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name);
 		si->store = store;
-		camel_object_ref((CamelObject *)store);
+		g_object_ref ((CamelObject *)store);
 		g_hash_table_insert(self->priv->stores, store, si);
 		g_queue_init (&si->folderinfo_updates);
 		hook = TRUE;
@@ -1094,7 +1094,7 @@ mail_folder_cache_get_folder_from_uri(MailFolderCache *self, const gchar *uri, C
 	if (folderp) {
 		if (fi.fi && fi.fi->folder) {
 			*folderp = fi.fi->folder;
-			camel_object_ref(*folderp);
+			g_object_ref (*folderp);
 		} else {
 			*folderp = NULL;
 		}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 3aa310b..22edd9a 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -131,7 +131,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
 
 	/* this may thaw/unref source folders, do it here so we dont do it in the main thread
 	   see also fetch_mail_fetch() below */
-	camel_object_unref(m->driver);
+	g_object_unref (m->driver);
 	m->driver = NULL;
 
 	if (m->cancel)
@@ -147,7 +147,7 @@ static void
 em_filter_folder_element_free (struct _filter_mail_msg *m)
 {
 	if (m->source_folder)
-		camel_object_unref (m->source_folder);
+		g_object_unref (m->source_folder);
 
 	if (m->source_uids)
 		em_utils_uids_free (m->source_uids);
@@ -156,10 +156,10 @@ em_filter_folder_element_free (struct _filter_mail_msg *m)
 		camel_operation_unref (m->cancel);
 
 	if (m->destination)
-		camel_object_unref (m->destination);
+		g_object_unref (m->destination);
 
 	if (m->driver)
-		camel_object_unref (m->driver);
+		g_object_unref (m->driver);
 
 	mail_session_flush_filter_log ();
 }
@@ -181,7 +181,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
 
 	m = mail_msg_new (&em_filter_folder_element_info);
 	m->source_folder = source_folder;
-	camel_object_ref (source_folder);
+	g_object_ref (source_folder);
 	m->source_uids = uids;
 	m->cache = NULL;
 	m->delete = FALSE;
@@ -255,7 +255,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 	fm->destination = e_mail_local_get_folder (E_MAIL_FOLDER_LOCAL_INBOX);
 	if (fm->destination == NULL)
 		goto fail;
-	camel_object_ref (fm->destination);
+	g_object_ref (fm->destination);
 
 	/* FIXME: this should support keep_on_server too, which would then perform a spool
 	   access thingy, right?  problem is matching raw messages to uid's etc. */
@@ -331,7 +331,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 			/* we unref the source folder here since we
 			   may now block in finalize (we try to
 			   disconnect cleanly) */
-			camel_object_unref (fm->source_folder);
+			g_object_unref (fm->source_folder);
 			fm->source_folder = NULL;
 		}
 	}
@@ -343,7 +343,7 @@ fail:
 	   folders and whatnot) before we are really done */
 	/* should this be cancellable too? (i.e. above unregister above) */
 	if (fm->driver) {
-		camel_object_unref (fm->driver);
+		g_object_unref (fm->driver);
 		fm->driver = NULL;
 	}
 }
@@ -553,7 +553,7 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
 		folder = mail_tool_uri_to_folder(uri, 0, NULL);
 		if (folder) {
 			camel_folder_append_message(folder, message, info, NULL, NULL);
-			camel_object_unref(folder);
+			g_object_unref (folder);
 			folder = NULL;
 		}
 		g_free(uri);
@@ -592,7 +592,7 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
 
 		if (!folder) {
 			folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
-			camel_object_ref(folder);
+			g_object_ref (folder);
 		}
 
 		camel_folder_append_message (folder, message, info, NULL, ex);
@@ -613,8 +613,8 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
 				g_string_append_printf (err, _("Failed to append to %s: %s\n"
 							"Appending to local 'Sent' folder instead."),
 						name, camel_exception_get_description (ex));
-				camel_object_ref (sent_folder);
-				camel_object_unref (folder);
+				g_object_ref (sent_folder);
+				g_object_unref (folder);
 				folder = sent_folder;
 
 				camel_exception_clear (ex);
@@ -646,19 +646,19 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
 exit:
 	if (folder) {
 		camel_folder_sync(folder, FALSE, NULL);
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 	if (info)
 		camel_message_info_free(info);
-	camel_object_unref(recipients);
-	camel_object_unref(from);
+	g_object_unref (recipients);
+	g_object_unref (from);
 	if (xport)
-		camel_object_unref(xport);
+		g_object_unref (xport);
 	g_free(sent_folder_uri);
 	g_free(transport_url);
 	camel_header_raw_clear(&xev);
 	g_string_free(err, TRUE);
-	camel_object_unref(message);
+	g_object_unref (message);
 
 	return;
 }
@@ -782,7 +782,7 @@ send_queue_exec (struct _send_queue_msg *m)
 		report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete."));
 
 	if (m->driver) {
-		camel_object_unref (m->driver);
+		g_object_unref (m->driver);
 		m->driver = NULL;
 	}
 
@@ -826,8 +826,8 @@ static void
 send_queue_free (struct _send_queue_msg *m)
 {
 	if (m->driver)
-		camel_object_unref(m->driver);
-	camel_object_unref(m->queue);
+		g_object_unref (m->driver);
+	g_object_unref (m->queue);
 	g_free(m->destination);
 	if (m->cancel)
 		camel_operation_unref(m->cancel);
@@ -853,7 +853,7 @@ mail_send_queue(CamelFolder *queue, const gchar *destination,
 
 	m = mail_msg_new(&send_queue_info);
 	m->queue = queue;
-	camel_object_ref(queue);
+	g_object_ref (queue);
 	m->destination = g_strdup(destination);
 	if (cancel) {
 		m->cancel = cancel;
@@ -911,8 +911,8 @@ append_mail_done (struct _append_msg *m)
 static void
 append_mail_free (struct _append_msg *m)
 {
-	camel_object_unref(m->message);
-	camel_object_unref(m->folder);
+	g_object_unref (m->message);
+	g_object_unref (m->folder);
 	g_free (m->appended_uid);
 }
 
@@ -939,9 +939,9 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn
 
 	m = mail_msg_new (&append_mail_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->message = message;
-	camel_object_ref(message);
+	g_object_ref (message);
 	m->info = info;
 
 	m->done = done;
@@ -983,7 +983,7 @@ transfer_messages_exec (struct _transfer_msg *m)
 		return;
 
 	if (dest == m->source) {
-		camel_object_unref(dest);
+		g_object_unref (dest);
 		/* no-op */
 		return;
 	}
@@ -1006,7 +1006,7 @@ transfer_messages_exec (struct _transfer_msg *m)
 	camel_folder_thaw (m->source);
 	camel_folder_thaw (dest);
 	camel_folder_sync (dest, FALSE, NULL);
-	camel_object_unref (dest);
+	g_object_unref (dest);
 }
 
 static void
@@ -1019,7 +1019,7 @@ transfer_messages_done (struct _transfer_msg *m)
 static void
 transfer_messages_free (struct _transfer_msg *m)
 {
-	camel_object_unref (m->source);
+	g_object_unref (m->source);
 	g_free (m->dest_uri);
 	em_utils_uids_free (m->uids);
 }
@@ -1048,7 +1048,7 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids,
 
 	m = mail_msg_new(&transfer_messages_info);
 	m->source = source;
-	camel_object_ref (source);
+	g_object_ref (source);
 	m->uids = uids;
 	m->delete = delete_from_source;
 	m->dest_uri = g_strdup (dest_uri);
@@ -1113,7 +1113,7 @@ get_folderinfo_free (struct _get_folderinfo_msg *m)
 {
 	if (m->info && m->can_clear)
 		camel_store_free_folder_info(m->store, m->info);
-	camel_object_unref(m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo get_folderinfo_info = {
@@ -1137,7 +1137,7 @@ mail_get_folderinfo (CamelStore *store, CamelOperation *op, gboolean (*done)(Cam
 		camel_operation_ref(op);
 	}
 	m->store = store;
-	camel_object_ref(store);
+	g_object_ref (store);
 	m->done = done;
 	m->data = data;
 	id = m->base.seq;
@@ -1179,11 +1179,11 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
 		for (i=0;i<messages->len;i++) {
 			part = mail_tool_make_message_attachment(messages->pdata[i]);
 			camel_multipart_add_part(multipart, part);
-			camel_object_unref(part);
+			g_object_unref (part);
 		}
 		part = camel_mime_part_new();
 		camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart));
-		camel_object_unref(multipart);
+		g_object_unref (multipart);
 
 		camel_mime_part_set_description(part, _("Forwarded messages"));
 	}
@@ -1191,7 +1191,7 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
 	subject = mail_tool_generate_forward_subject(messages->pdata[0]);
 	d->done(folder, messages, part, subject, d->data);
 	g_free(subject);
-	camel_object_unref(part);
+	g_object_unref (part);
 
 	g_free(d);
 }
@@ -1247,7 +1247,7 @@ get_folder_free (struct _get_folder_msg *m)
 {
 	g_free (m->uri);
 	if (m->folder)
-		camel_object_unref (m->folder);
+		g_object_unref (m->folder);
 }
 
 static MailMsgInfo get_folder_info = {
@@ -1312,7 +1312,7 @@ static void
 get_quota_free (struct _get_quota_msg *m)
 {
 	if (m->folder)
-		camel_object_unref (m->folder);
+		g_object_unref (m->folder);
 	if (m->quota)
 		camel_folder_quota_info_free (m->quota);
 	g_free (m->folder_uri);
@@ -1343,7 +1343,7 @@ mail_get_folder_quota (CamelFolder *folder,
 	m->data = data;
 	m->done = done;
 
-	camel_object_ref (m->folder);
+	g_object_ref (m->folder);
 
 	id = m->base.seq;
 	dispatch (m);
@@ -1389,7 +1389,7 @@ get_store_free (struct _get_store_msg *m)
 {
 	g_free (m->uri);
 	if (m->store)
-		camel_object_unref (m->store);
+		g_object_unref (m->store);
 }
 
 static MailMsgInfo get_store_info = {
@@ -1513,7 +1513,7 @@ remove_folder_done (struct _remove_folder_msg *m)
 static void
 remove_folder_free (struct _remove_folder_msg *m)
 {
-	camel_object_unref (m->folder);
+	g_object_unref (m->folder);
 }
 
 static MailMsgInfo remove_folder_info = {
@@ -1533,7 +1533,7 @@ mail_remove_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gboo
 
 	m = mail_msg_new (&remove_folder_info);
 	m->folder = folder;
-	camel_object_ref (folder);
+	g_object_ref (folder);
 	m->data = data;
 	m->done = done;
 
@@ -1573,7 +1573,7 @@ sync_folder_done (struct _sync_folder_msg *m)
 static void
 sync_folder_free (struct _sync_folder_msg *m)
 {
-	camel_object_unref((CamelObject *)m->folder);
+	g_object_unref ((CamelObject *)m->folder);
 }
 
 static MailMsgInfo sync_folder_info = {
@@ -1591,7 +1591,7 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpointe
 
 	m = mail_msg_new(&sync_folder_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->data = data;
 	m->done = done;
 
@@ -1640,7 +1640,7 @@ sync_store_done (struct _sync_store_msg *m)
 static void
 sync_store_free (struct _sync_store_msg *m)
 {
-	camel_object_unref(m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo sync_store_info = {
@@ -1659,7 +1659,7 @@ mail_sync_store(CamelStore *store, gint expunge, void (*done) (CamelStore *store
 	m = mail_msg_new(&sync_store_info);
 	m->store = store;
 	m->expunge = expunge;
-	camel_object_ref(store);
+	g_object_ref (store);
 	m->data = data;
 	m->done = done;
 
@@ -1699,7 +1699,7 @@ mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpoi
 
 	m = mail_msg_new(&refresh_folder_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->data = data;
 	m->done = done;
 
@@ -1736,7 +1736,7 @@ mail_expunge_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpoi
 
 	m = mail_msg_new(&expunge_folder_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->data = data;
 	m->done = done;
 
@@ -1778,7 +1778,7 @@ empty_trash_exec (struct _empty_trash_msg *m)
 
 	if (trash) {
 		camel_folder_expunge (trash, &m->base.ex);
-		camel_object_unref (trash);
+		g_object_unref (trash);
 	}
 }
 
@@ -1858,11 +1858,11 @@ static void
 get_message_free (struct _get_message_msg *m)
 {
 	g_free (m->uid);
-	camel_object_unref (m->folder);
+	g_object_unref (m->folder);
 	camel_operation_unref (m->cancel);
 
 	if (m->message)
-		camel_object_unref (m->message);
+		g_object_unref (m->message);
 }
 
 static MailMsgInfo get_message_info = {
@@ -1883,7 +1883,7 @@ mail_get_message(CamelFolder *folder, const gchar *uid, void (*done) (CamelFolde
 
 	m = mail_msg_new(&get_message_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->uid = g_strdup(uid);
 	m->data = data;
 	m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done;
@@ -1925,7 +1925,7 @@ mail_get_messagex(CamelFolder *folder, const gchar *uid, void (*done) (CamelFold
 
 	m = mail_msg_new(&get_messagex_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->uid = g_strdup(uid);
 	m->data = data;
 	m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done;
@@ -1991,10 +1991,10 @@ get_messages_free (struct _get_messages_msg *m)
 	em_utils_uids_free (m->uids);
 	for (i=0;i<m->messages->len;i++) {
 		if (m->messages->pdata[i])
-			camel_object_unref(m->messages->pdata[i]);
+			g_object_unref (m->messages->pdata[i]);
 	}
 	g_ptr_array_free(m->messages, TRUE);
-	camel_object_unref(m->folder);
+	g_object_unref (m->folder);
 }
 
 static MailMsgInfo get_messages_info = {
@@ -2015,7 +2015,7 @@ mail_get_messages(CamelFolder *folder, GPtrArray *uids,
 
 	m = mail_msg_new(&get_messages_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->uids = uids;
 	m->messages = g_ptr_array_new();
 	m->data = data;
@@ -2098,7 +2098,7 @@ save_messages_exec (struct _save_messages_msg *m)
 	filtered_stream = camel_stream_filter_new (stream);
 	camel_stream_filter_add (
 		CAMEL_STREAM_FILTER (filtered_stream), from_filter);
-	camel_object_unref(from_filter);
+	g_object_unref (from_filter);
 
 	if (path != m->path)
 		g_free (path);
@@ -2125,15 +2125,15 @@ save_messages_exec (struct _save_messages_msg *m)
 			camel_exception_setv(&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
 					     _("Error saving messages to: %s:\n %s"), m->path, g_strerror(errno));
 			g_free(from);
-			camel_object_unref((CamelObject *)message);
+			g_object_unref ((CamelObject *)message);
 			break;
 		}
 		g_free(from);
-		camel_object_unref(message);
+		g_object_unref (message);
 	}
 
-	camel_object_unref(filtered_stream);
-	camel_object_unref(stream);
+	g_object_unref (filtered_stream);
+	g_object_unref (stream);
 }
 
 static void
@@ -2147,7 +2147,7 @@ static void
 save_messages_free (struct _save_messages_msg *m)
 {
 	em_utils_uids_free (m->uids);
-	camel_object_unref(m->folder);
+	g_object_unref (m->folder);
 	g_free(m->path);
 }
 
@@ -2168,7 +2168,7 @@ mail_save_messages(CamelFolder *folder, GPtrArray *uids, const gchar *path,
 
 	m = mail_msg_new(&save_messages_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->uids = uids;
 	m->path = g_strdup(path);
 	m->data = data;
@@ -2239,7 +2239,7 @@ save_part_exec (struct _save_part_msg *m)
 				      _("Could not write data: %s"),
 				      g_strerror (errno));
 
-	camel_object_unref (stream);
+	g_object_unref (stream);
 }
 
 static void
@@ -2252,7 +2252,7 @@ save_part_done (struct _save_part_msg *m)
 static void
 save_part_free (struct _save_part_msg *m)
 {
-	camel_object_unref (m->part);
+	g_object_unref (m->part);
 	g_free (m->path);
 }
 
@@ -2272,7 +2272,7 @@ mail_save_part (CamelMimePart *part, const gchar *path,
 	gint id;
 	m = mail_msg_new (&save_part_info);
 	m->part = part;
-	camel_object_ref (part);
+	g_object_ref (part);
 	m->path = g_strdup (path);
 	m->data = data;
 	m->done = done;
@@ -2315,7 +2315,7 @@ prep_offline_exec (struct _prep_offline_msg *m)
 		/* prepare_for_offline should do this? */
 		/* of course it should all be atomic, but ... */
 		camel_folder_sync(folder, FALSE, NULL);
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 
 	if (m->cancel)
@@ -2431,7 +2431,7 @@ set_offline_done (struct _set_offline_msg *m)
 static void
 set_offline_free (struct _set_offline_msg *m)
 {
-	camel_object_unref(m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo set_offline_info = {
@@ -2458,7 +2458,7 @@ mail_store_set_offline (CamelStore *store, gboolean offline,
 
 	m = mail_msg_new(&set_offline_info);
 	m->store = store;
-	camel_object_ref(store);
+	g_object_ref (store);
 	m->offline = offline;
 	m->data = data;
 	m->done = done;
@@ -2505,7 +2505,7 @@ prepare_offline_done (struct _set_offline_msg *m)
 static void
 prepare_offline_free (struct _set_offline_msg *m)
 {
-	camel_object_unref (m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo prepare_offline_info = {
@@ -2528,7 +2528,7 @@ mail_store_prepare_offline (CamelStore *store)
 
 	m = mail_msg_new(&prepare_offline_info);
 	m->store = store;
-	camel_object_ref(store);
+	g_object_ref (store);
 	m->data = NULL;
 	m->done = NULL;
 
@@ -2578,7 +2578,7 @@ check_service_exec (struct _check_msg *m)
 	}
 
 	m->authtypes = camel_service_query_auth_types(service, &m->base.ex);
-	camel_object_unref(service);
+	g_object_unref (service);
 }
 
 static void
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index ffce091..1cfe345 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -132,7 +132,7 @@ free_folder_info(struct _folder_info *info)
 {
 	/*camel_folder_thaw (info->folder);	*/
 	mail_sync_folder(info->folder, NULL, NULL);
-	camel_object_unref(info->folder);
+	g_object_unref (info->folder);
 	g_free(info->uri);
 	g_free(info);
 }
@@ -164,7 +164,7 @@ setup_send_data(void)
 			(GDestroyNotify) free_folder_info);
 		data->inbox = e_mail_local_get_folder (
 			E_MAIL_FOLDER_LOCAL_INBOX);
-		camel_object_ref(data->inbox);
+		g_object_ref (data->inbox);
 		data->active = g_hash_table_new_full (
 			g_str_hash, g_str_equal,
 			(GDestroyNotify) NULL,
@@ -198,7 +198,7 @@ free_send_data(void)
 	if (data->inbox) {
 		mail_sync_folder(data->inbox, NULL, NULL);
 		/*camel_folder_thaw (data->inbox);		*/
-		camel_object_unref(data->inbox);
+		g_object_unref (data->inbox);
 	}
 
 	g_list_free(data->infos);
@@ -803,7 +803,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
 	oldinfo = g_hash_table_lookup(info->data->folders, uri);
 	g_mutex_unlock(info->data->lock);
 	if (oldinfo) {
-		camel_object_ref(oldinfo->folder);
+		g_object_ref (oldinfo->folder);
 		return oldinfo->folder;
 	}
 	folder = mail_tool_uri_to_folder (uri, 0, ex);
@@ -816,7 +816,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
 
 	if (g_hash_table_lookup_extended (info->data->folders, uri, &oldkey, &oldinfoptr)) {
 		oldinfo = (struct _folder_info *) oldinfoptr;
-		camel_object_unref(oldinfo->folder);
+		g_object_unref (oldinfo->folder);
 		oldinfo->folder = folder;
 	} else {
 		/*camel_folder_freeze (folder);		*/
@@ -826,7 +826,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
 		g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo);
 	}
 
-	camel_object_ref (folder);
+	g_object_ref (folder);
 
 	g_mutex_unlock(info->data->lock);
 
@@ -890,7 +890,7 @@ refresh_folders_exec (struct _refresh_folders_msg *m)
 			camel_exception_clear(&ex);
 			camel_folder_refresh_info(folder, &ex);
 			camel_exception_clear(&ex);
-			camel_object_unref(folder);
+			g_object_unref (folder);
 		} else if (camel_exception_is_set(&ex)) {
 			g_warning ("Failed to refresh folders: %s", camel_exception_get_description (&ex));
 			camel_exception_clear (&ex);
@@ -917,7 +917,7 @@ refresh_folders_free (struct _refresh_folders_msg *m)
 	g_ptr_array_free(m->folders, TRUE);
 
 	camel_store_free_folder_info (m->store, m->finfo);
-	camel_object_unref(m->store);
+	g_object_unref (m->store);
 }
 
 static MailMsgInfo refresh_folders_info = {
@@ -938,7 +938,7 @@ receive_update_got_folderinfo(CamelStore *store, CamelFolderInfo *info, gpointer
 
 		m = mail_msg_new(&refresh_folders_info);
 		m->store = store;
-		camel_object_ref(store);
+		g_object_ref (store);
 		m->folders = folders;
 		m->info = sinfo;
 		m->finfo = info;
diff --git a/mail/mail-session.c b/mail/mail-session.c
index ac96a65..f551032 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -64,12 +64,13 @@
 CamelSession *session;
 static gint session_check_junk_notify_id = -1;
 
-#define MAIL_SESSION_TYPE     (mail_session_get_type ())
-#define MAIL_SESSION(obj)     (CAMEL_CHECK_CAST((obj), MAIL_SESSION_TYPE, MailSession))
-#define MAIL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_SESSION_TYPE, MailSessionClass))
-#define MAIL_IS_SESSION(o)    (CAMEL_CHECK_TYPE((o), MAIL_SESSION_TYPE))
+#define MAIL_TYPE_SESSION \
+	(mail_session_get_type ())
 
-typedef struct _MailSession {
+typedef struct _MailSession MailSession;
+typedef struct _MailSessionClass MailSessionClass;
+
+struct _MailSession {
 	CamelSession parent_object;
 
 	gboolean interactive;
@@ -77,14 +78,12 @@ typedef struct _MailSession {
 	GList *junk_plugins;
 
 	MailAsyncEvent *async;
-} MailSession;
+};
 
-typedef struct _MailSessionClass {
+struct _MailSessionClass {
 	CamelSessionClass parent_class;
+};
 
-} MailSessionClass;
-
-static CamelSessionClass *ms_parent_class;
 static gchar *mail_data_dir;
 static gchar *mail_config_dir;
 
@@ -99,16 +98,15 @@ static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *
 static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m);
 static void ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex);
 
-static void
-init (MailSession *session)
-{
-	session->async = mail_async_event_new();
-	session->junk_plugins = NULL;
-}
+GType mail_session_get_type (void);
+
+G_DEFINE_TYPE (MailSession, mail_session, CAMEL_TYPE_SESSION)
 
 static void
-finalise (MailSession *session)
+mail_session_finalize (GObject *object)
 {
+	MailSession *session = (MailSession *) object;
+
 	if (session_check_junk_notify_id != -1)
 		gconf_client_notify_remove (mail_config_get_gconf_client (), session_check_junk_notify_id);
 
@@ -116,44 +114,37 @@ finalise (MailSession *session)
 
 	g_free (mail_data_dir);
 	g_free (mail_config_dir);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (mail_session_parent_class)->finalize (object);
 }
 
 static void
-class_init (MailSessionClass *mail_session_class)
-{
-	CamelSessionClass *camel_session_class = CAMEL_SESSION_CLASS (mail_session_class);
-
-	/* virtual method override */
-	camel_session_class->get_password = get_password;
-	camel_session_class->forget_password = forget_password;
-	camel_session_class->alert_user = alert_user;
-	camel_session_class->get_filter_driver = get_filter_driver;
-	camel_session_class->lookup_addressbook = lookup_addressbook;
-	camel_session_class->thread_msg_new = ms_thread_msg_new;
-	camel_session_class->thread_msg_free = ms_thread_msg_free;
-	camel_session_class->thread_status = ms_thread_status;
-	camel_session_class->forward_to = ms_forward_to;
-}
-
-static CamelType
-mail_session_get_type (void)
-{
-	static CamelType mail_session_type = CAMEL_INVALID_TYPE;
-
-	if (mail_session_type == CAMEL_INVALID_TYPE) {
-		ms_parent_class = (CamelSessionClass *)camel_session_get_type();
-		mail_session_type = camel_type_register (
-			camel_session_get_type (),
-			"MailSession",
-			sizeof (MailSession),
-			sizeof (MailSessionClass),
-			(CamelObjectClassInitFunc) class_init,
-			NULL,
-			(CamelObjectInitFunc) init,
-			(CamelObjectFinalizeFunc) finalise);
-	}
+mail_session_class_init (MailSessionClass *class)
+{
+	GObjectClass *object_class;
+	CamelSessionClass *session_class;
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = mail_session_finalize;
 
-	return mail_session_type;
+	session_class = CAMEL_SESSION_CLASS (class);
+	session_class->get_password = get_password;
+	session_class->forget_password = forget_password;
+	session_class->alert_user = alert_user;
+	session_class->get_filter_driver = get_filter_driver;
+	session_class->lookup_addressbook = lookup_addressbook;
+	session_class->thread_msg_new = ms_thread_msg_new;
+	session_class->thread_msg_free = ms_thread_msg_free;
+	session_class->thread_status = ms_thread_status;
+	session_class->forward_to = ms_forward_to;
+}
+
+static void
+mail_session_init (MailSession *session)
+{
+	session->async = mail_async_event_new();
+	session->junk_plugins = NULL;
 }
 
 static gchar *
@@ -424,7 +415,7 @@ lookup_addressbook(CamelSession *session, const gchar *name)
 	addr = camel_internet_address_new ();
 	camel_address_decode ((CamelAddress *)addr, name);
 	ret = em_utils_in_addressbook (addr, mail_config_get_lookup_book_local_only ());
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	return ret;
 }
@@ -481,7 +472,7 @@ main_play_sound (CamelFilterDriver *driver, gchar *filename, gpointer user_data)
 		gdk_beep ();
 
 	g_free (filename);
-	camel_object_unref (session);
+	g_object_unref (session);
 }
 
 static void
@@ -489,7 +480,7 @@ session_play_sound (CamelFilterDriver *driver, const gchar *filename, gpointer u
 {
 	MailSession *ms = (MailSession *) session;
 
-	camel_object_ref (session);
+	g_object_ref (session);
 
 	mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_play_sound,
 			       driver, g_strdup (filename), user_data);
@@ -499,7 +490,7 @@ static void
 main_system_beep (CamelFilterDriver *driver, gpointer user_data)
 {
 	gdk_beep ();
-	camel_object_unref (session);
+	g_object_unref (session);
 }
 
 static void
@@ -507,7 +498,7 @@ session_system_beep (CamelFilterDriver *driver, gpointer user_data)
 {
 	MailSession *ms = (MailSession *) session;
 
-	camel_object_ref (session);
+	g_object_ref (session);
 
 	mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_system_beep,
 			       driver, user_data, NULL);
@@ -609,7 +600,11 @@ static MailMsgInfo ms_thread_info_dummy = { sizeof (MailMsg) };
 
 static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, guint size)
 {
-	CamelSessionThreadMsg *msg = ms_parent_class->thread_msg_new(session, ops, size);
+	CamelSessionThreadMsg *msg;
+	CamelSessionClass *session_class;
+
+	session_class = CAMEL_SESSION_CLASS (mail_session_parent_class);
+	msg = session_class->thread_msg_new (session, ops, size);
 
 	/* We create a dummy mail_msg, and then copy its cancellation port over to ours, so
 	   we get cancellation and progress in common with hte existing mail code, for free */
@@ -625,13 +620,19 @@ static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *
 	return msg;
 }
 
-static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m)
+static void
+ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m)
 {
+	CamelSessionClass *session_class;
+
+	session_class = CAMEL_SESSION_CLASS (mail_session_parent_class);
+
 	mail_msg_unref(m->data);
-	ms_parent_class->thread_msg_free(session, m);
+	session_class->thread_msg_free(session, m);
 }
 
-static void ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc)
+static void
+ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc)
 {
 	/* This should never be called since we bypass it in alloc! */
 	printf("Thread status '%s' %d%%\n", text, pc);
@@ -680,7 +681,7 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes
 	camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, mem);
 	camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (mem), 0, CAMEL_STREAM_SET);
 	camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)forward, mem);
-	camel_object_unref (mem);
+	g_object_unref (mem);
 
 	/* clear previous recipients */
 	camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, NULL);
@@ -705,13 +706,13 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes
 	addr = camel_internet_address_new ();
 	camel_internet_address_add (addr, account->id->name, account->id->address);
 	camel_mime_message_set_from (forward, addr);
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	/* to */
 	addr = camel_internet_address_new ();
 	camel_address_decode (CAMEL_ADDRESS (addr), address);
 	camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, addr);
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	/* subject */
 	subject = mail_tool_generate_forward_subject (message);
@@ -797,7 +798,7 @@ mail_session_check_junk_notify (GConfClient *gconf, guint id, GConfEntry *entry,
 }
 
 void
-mail_session_init (void)
+mail_session_start (void)
 {
 	GConfClient *gconf;
 
@@ -806,7 +807,7 @@ mail_session_init (void)
 
 	camel_provider_init();
 
-	session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE));
+	session = g_object_new (MAIL_TYPE_SESSION, NULL);
 	e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */
 
 	camel_session_construct (session, mail_session_get_data_dir ());
diff --git a/mail/mail-session.h b/mail/mail-session.h
index 22dc792..4984a58 100644
--- a/mail/mail-session.h
+++ b/mail/mail-session.h
@@ -28,7 +28,7 @@
 
 G_BEGIN_DECLS
 
-void mail_session_init (void);
+void mail_session_start (void);
 void mail_session_shutdown (void);
 gchar *mail_session_request_dialog (const gchar *prompt, gboolean secret,
 				   const gchar *key, gboolean async);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 92677a4..d7cb5c6 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -54,7 +54,7 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex)
 		return NULL;
 
 	folder = camel_store_get_inbox (store, ex);
-	camel_object_unref (store);
+	g_object_unref (store);
 
 	return folder;
 }
@@ -92,7 +92,7 @@ mail_tool_get_trash (const gchar *url, gint connect, CamelException *ex)
 	else
 		trash = NULL;
 
-	camel_object_unref (store);
+	g_object_unref (store);
 
 	return trash;
 }
@@ -328,7 +328,7 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex)
 				folder = camel_store_get_junk (store, ex);
 		} else
 			folder = camel_store_get_folder (store, name, flags, ex);
-		camel_object_unref (store);
+		g_object_unref (store);
 	}
 
 	if (folder)
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 5f0f0c8..3ff43cd 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -111,7 +111,7 @@ vfolder_setup_exec (struct _setup_msg *m)
 	l = m->sources_folder;
 	while (l && !vfolder_shutdown) {
 		d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name));
-		camel_object_ref(l->data);
+		g_object_ref (l->data);
 		list = g_list_append(list, l->data);
 		l = l->next;
 	}
@@ -121,7 +121,7 @@ vfolder_setup_exec (struct _setup_msg *m)
 
 	l = list;
 	while (l) {
-		camel_object_unref(l->data);
+		g_object_unref (l->data);
 		l = l->next;
 	}
 	g_list_free(list);
@@ -137,7 +137,7 @@ vfolder_setup_free (struct _setup_msg *m)
 {
 	GList *l;
 
-	camel_object_unref(m->folder);
+	g_object_unref (m->folder);
 	g_free(m->query);
 
 	l = m->sources_uri;
@@ -149,7 +149,7 @@ vfolder_setup_free (struct _setup_msg *m)
 
 	l = m->sources_folder;
 	while (l) {
-		camel_object_unref(l->data);
+		g_object_unref (l->data);
 		l = l->next;
 	}
 	g_list_free(m->sources_folder);
@@ -172,7 +172,7 @@ vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList
 
 	m = mail_msg_new(&vfolder_setup_info);
 	m->folder = folder;
-	camel_object_ref(folder);
+	g_object_ref (folder);
 	m->query = g_strdup(query);
 	m->sources_uri = sources_uri;
 	m->sources_folder = sources_folder;
@@ -270,7 +270,7 @@ vfolder_adduri_exec (struct _adduri_msg *m)
 				camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder);
 			l = l->next;
 		}
-		camel_object_unref(folder);
+		g_object_unref (folder);
 	}
 }
 
@@ -282,7 +282,7 @@ vfolder_adduri_done(struct _adduri_msg *m)
 static void
 vfolder_adduri_free (struct _adduri_msg *m)
 {
-	g_list_foreach(m->folders, (GFunc)camel_object_unref, NULL);
+	g_list_foreach(m->folders, (GFunc)g_object_unref, NULL);
 	g_list_free(m->folders);
 	g_free(m->uri);
 }
@@ -523,7 +523,7 @@ mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove)
 				g_warning ("vf is NULL for %s\n", rule->name);
 				continue;
 			}
-			camel_object_ref(vf);
+			g_object_ref (vf);
 			folders = g_list_prepend(folders, vf);
 		}
 	}
@@ -890,7 +890,7 @@ static void context_rule_removed(ERuleContext *ctx, EFilterRule *rule)
 	camel_store_delete_folder(vfolder_store, rule->name, NULL);
 	/* this must be unref'd after its deleted */
 	if (folder)
-		camel_object_unref ((CamelFolder *) folder);
+		g_object_unref ((CamelFolder *) folder);
 }
 
 static void
@@ -1350,7 +1350,7 @@ vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data)
 	CamelFolder *folder = CAMEL_FOLDER (data);
 
 	if (folder)
-		camel_object_unref(folder);
+		g_object_unref (folder);
 
 	g_free (key);
 }
@@ -1367,7 +1367,7 @@ mail_vfolder_shutdown (void)
 	}
 
 	if (vfolder_store) {
-		camel_object_unref (vfolder_store);
+		g_object_unref (vfolder_store);
 		vfolder_store = NULL;
 	}
 
diff --git a/mail/message-list.c b/mail/message-list.c
index 012b862..f31af18 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -264,7 +264,7 @@ e_mail_address_new (const gchar *address)
 
 	cia = camel_internet_address_new ();
 	if (camel_address_unformat (CAMEL_ADDRESS (cia), address) == -1) {
-		camel_object_unref (cia);
+		g_object_unref (cia);
 		return NULL;
 	}
 	camel_internet_address_get (cia, 0, &name, &addr);
@@ -277,7 +277,7 @@ e_mail_address_new (const gchar *address)
 		new->wname = NULL;
 	}
 
-	camel_object_unref (cia);
+	g_object_unref (cia);
 
 	return new;
 }
@@ -500,7 +500,7 @@ clear_selection(MessageList *ml, struct _MLSelection *selection)
 		selection->uids = NULL;
 	}
 	if (selection->folder) {
-		camel_object_unref(selection->folder);
+		g_object_unref (selection->folder);
 		selection->folder = NULL;
 	}
 	g_free(selection->folder_uri);
@@ -884,7 +884,7 @@ message_list_copy(MessageList *ml, gboolean cut)
 
 		p->clipboard.uids = uids;
 		p->clipboard.folder = ml->folder;
-		camel_object_ref(p->clipboard.folder);
+		g_object_ref (p->clipboard.folder);
 		p->clipboard.folder_uri = g_strdup(ml->folder_uri);
 		gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
 	} else {
@@ -2137,7 +2137,7 @@ static void
 ml_drop_async_free (struct _drop_msg *m)
 {
 	g_object_unref (m->context);
-	camel_object_unref (m->folder);
+	g_object_unref (m->folder);
 	gtk_selection_data_free (m->selection);
 }
 
@@ -2184,7 +2184,7 @@ ml_tree_drag_data_received (ETree *tree,
 	m->context = context;
 	g_object_ref(context);
 	m->folder = ml->folder;
-	camel_object_ref(m->folder);
+	g_object_ref (m->folder);
 	m->action = context->action;
 	m->info = info;
 
@@ -2369,7 +2369,7 @@ message_list_destroy(GtkObject *object)
 		}
 
 		camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list);
-		camel_object_unref (message_list->folder);
+		g_object_unref (message_list->folder);
 		message_list->folder = NULL;
 	}
 
@@ -3595,7 +3595,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
 	if (message_list->folder) {
 		camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed",
 					  folder_changed, message_list);
-		camel_object_unref (message_list->folder);
+		g_object_unref (message_list->folder);
 		message_list->folder = NULL;
 	}
 
@@ -3619,7 +3619,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
 		gint strikeout_col = -1;
 		ECell *cell;
 
-		camel_object_ref (folder);
+		g_object_ref (folder);
 		message_list->folder = folder;
 		message_list->just_set_folder = TRUE;
 
@@ -4461,7 +4461,7 @@ regen_list_free (struct _regen_list_msg *m)
 	g_free (m->search);
 	g_free (m->hideexpr);
 
-	camel_object_unref (m->folder);
+	g_object_unref (m->folder);
 
 	if (m->changes)
 		camel_folder_change_info_free (m->changes);
@@ -4577,7 +4577,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
 	m->thread_subject = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_subject", NULL);
 	g_object_ref(ml);
 	m->folder = ml->folder;
-	camel_object_ref(m->folder);
+	g_object_ref (m->folder);
 	m->last_row = -1;
 	m->expand_state = NULL;
 
diff --git a/modules/addressbook/eab-composer-util.c b/modules/addressbook/eab-composer-util.c
index a54f5fb..968a6b3 100644
--- a/modules/addressbook/eab-composer-util.c
+++ b/modules/addressbook/eab-composer-util.c
@@ -150,7 +150,7 @@ eab_send_as_attachment (GList *destinations)
 	camel_mime_part_set_disposition (attachment, "attachment");
 
 	e_msg_composer_attach (composer, attachment);
-	camel_object_unref (attachment);
+	g_object_unref (attachment);
 
 	if (destinations->next != NULL)
 		e_composer_header_table_set_subject (
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index c368f73..ce88a18 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -81,7 +81,7 @@ attachment_handler_get_component (EAttachment *attachment)
 	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
 	wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
 	camel_data_wrapper_decode_to_stream (wrapper, stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	component = e_cal_util_parse_ics_string ((gchar *) buffer->data);
 
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index ee49490..790f433 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -205,8 +205,8 @@ mail_attachment_handler_message_rfc822 (EAttachmentView *view,
 	success = TRUE;
 
 exit:
-	camel_object_unref (message);
-	camel_object_unref (stream);
+	g_object_unref (message);
+	g_object_unref (stream);
 
 	gtk_drag_finish (drag_context, success, FALSE, time);
 }
@@ -294,7 +294,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 			e_attachment_load_handle_error, parent);
 		g_object_unref (attachment);
 
-		camel_object_unref (message);
+		g_object_unref (message);
 		goto exit;
 	}
 
@@ -309,7 +309,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 		message = camel_folder_get_message (
 			folder, uids->pdata[ii], &ex);
 		if (message == NULL) {
-			camel_object_unref (multipart);
+			g_object_unref (multipart);
 			goto exit;
 		}
 
@@ -320,9 +320,9 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 			CAMEL_MEDIUM (mime_part), wrapper);
 		camel_mime_part_set_content_type (mime_part, "message/rfc822");
 		camel_multipart_add_part (multipart, mime_part);
-		camel_object_unref (mime_part);
+		g_object_unref (mime_part);
 
-		camel_object_unref (message);
+		g_object_unref (message);
 	}
 
 	mime_part = camel_mime_part_new ();
@@ -342,8 +342,8 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 		e_attachment_load_handle_error, parent);
 	g_object_unref (attachment);
 
-	camel_object_unref (mime_part);
-	camel_object_unref (multipart);
+	g_object_unref (mime_part);
+	g_object_unref (multipart);
 
 exit:
 	if (camel_exception_is_set (&ex)) {
@@ -371,7 +371,7 @@ exit:
 	}
 
 	if (folder != NULL)
-		camel_object_unref (folder);
+		g_object_unref (folder);
 
 	g_ptr_array_free (uids, TRUE);
 
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 1434951..d6e8fd6 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -58,7 +58,7 @@ e_mail_shell_settings_init (EShell *shell)
 			NULL,
 			G_PARAM_READWRITE));
 
-	camel_object_ref (session);
+	g_object_ref (session);
 	e_shell_settings_set_pointer (
 		shell_settings, "mail-session", session);
 
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 8a5ecea..5c60071 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -625,12 +625,12 @@ e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view)
 		DISPOSE (priv->search_rules[ii]);
 
 	if (priv->search_account_all != NULL) {
-		camel_object_unref (priv->search_account_all);
+		g_object_unref (priv->search_account_all);
 		priv->search_account_all = NULL;
 	}
 
 	if (priv->search_account_current != NULL) {
-		camel_object_unref (priv->search_account_current);
+		g_object_unref (priv->search_account_current);
 		priv->search_account_current = NULL;
 	}
 
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index c342985..acfcbdf 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -62,12 +62,12 @@ search_results_exec (SearchResultsMsg *msg)
 	camel_operation_register (msg->cancel);
 
 	copied_list = g_list_copy (msg->folder_list);
-	g_list_foreach (copied_list, (GFunc) camel_object_ref, NULL);
+	g_list_foreach (copied_list, (GFunc) g_object_ref, NULL);
 
 	camel_vee_folder_set_folders (
 		CAMEL_VEE_FOLDER (msg->folder), copied_list);
 
-	g_list_foreach (copied_list, (GFunc) camel_object_unref, NULL);
+	g_list_foreach (copied_list, (GFunc) g_object_unref, NULL);
 	g_list_free (copied_list);
 }
 
@@ -79,9 +79,9 @@ search_results_done (SearchResultsMsg *msg)
 static void
 search_results_free (SearchResultsMsg *msg)
 {
-	camel_object_unref (msg->folder);
+	g_object_unref (msg->folder);
 
-	g_list_foreach (msg->folder_list, (GFunc) camel_object_unref, NULL);
+	g_list_foreach (msg->folder_list, (GFunc) g_object_unref, NULL);
 	g_list_free (msg->folder_list);
 }
 
@@ -101,7 +101,7 @@ mail_shell_view_setup_search_results_folder (CamelFolder *folder,
 	SearchResultsMsg *msg;
 	gint id;
 
-	camel_object_ref (folder);
+	g_object_ref (folder);
 
 	msg = mail_msg_new (&search_results_setup_info);
 	msg->folder = folder;
@@ -487,7 +487,7 @@ all_accounts:
 	text = e_shell_searchbar_get_search_text (searchbar);
 	if (text == NULL || *text == '\0') {
 		if (priv->search_account_all != NULL) {
-			camel_object_unref (priv->search_account_all);
+			g_object_unref (priv->search_account_all);
 			priv->search_account_all = NULL;
 		}
 
@@ -614,7 +614,7 @@ current_account:
 	text = e_shell_searchbar_get_search_text (searchbar);
 	if (text == NULL || *text == '\0') {
 		if (priv->search_account_current != NULL) {
-			camel_object_unref (priv->search_account_current);
+			g_object_unref (priv->search_account_current);
 			priv->search_account_current = NULL;
 		}
 
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index 9c4ca2c..68a1a24 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -74,7 +74,7 @@ org_gnome_audio_inline_pobject_free (EMFormatHTMLPObject *o)
 	}
 
 	if (po->part) {
-		camel_object_unref (po->part);
+		g_object_unref (po->part);
 		po->part = NULL;
 	}
 	if (po->filename) {
@@ -204,7 +204,7 @@ org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pob
 		data = camel_medium_get_content (CAMEL_MEDIUM (po->part));
 		camel_data_wrapper_decode_to_stream (data, stream);
 		camel_stream_flush (stream);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 
 		d(printf ("audio inline formatter: init gst playbin\n"));
 
@@ -293,7 +293,7 @@ org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t)
 
 	pobj = (struct _org_gnome_audio_inline_pobject *) em_format_html_add_pobject ((EMFormatHTML *) t->format, sizeof(*pobj), classid,
 										      t->part, org_gnome_audio_inline_button_panel);
-	camel_object_ref (t->part);
+	g_object_ref (t->part);
 	pobj->part = t->part;
 	pobj->filename = NULL;
 	pobj->playbin = NULL;
diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c
index a3e72c9..04a01cb 100644
--- a/plugins/bogo-junk-plugin/bf-junk-filter.c
+++ b/plugins/bogo-junk-plugin/bf-junk-filter.c
@@ -94,10 +94,10 @@ init_db (void)
 
 	camel_mime_parser_init_with_stream (parser, stream);
 	camel_mime_parser_scan_from (parser, FALSE);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser);
-	camel_object_unref (parser);
+	g_object_unref (parser);
 
 	d(fprintf (stderr, "Initing the bogofilter DB with Welcome message\n"));
 
@@ -106,7 +106,7 @@ init_db (void)
 	}
 
 	pipe_to_bogofilter (msg, argv, NULL);
-	camel_object_unref (msg);
+	g_object_unref (msg);
 
 }
 
@@ -166,7 +166,7 @@ retry:
 	camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
 	camel_stream_flush (stream);
 	camel_stream_close (stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 #ifndef G_OS_WIN32
 	waitres = waitpid (child_pid, &status, 0);
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index c3be103..d2addbf 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -130,7 +130,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
 				}
 
 				em_folder_tree_model_add_store (model, store, account->name);
-				camel_object_unref (store);
+				g_object_unref (store);
 			}
 		}
 
@@ -145,7 +145,7 @@ accept_free(gpointer data)
 {
 	struct AcceptData *accept_data = data;
 
-	camel_object_unref(accept_data->msg);
+	g_object_unref (accept_data->msg);
 	g_free(accept_data);
 }
 
@@ -169,7 +169,7 @@ apply_clicked (GtkAssistant *assistant, CamelMimeMessage *msg)
 	em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri);
 	g_free(uri);
 	accept_data->msg = msg;
-	camel_object_ref(msg);
+	g_object_ref (msg);
 	accept_data->model = EM_FOLDER_TREE_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree)));
 	g_object_set_data_full((GObject *)dialog, "accept-data", accept_data, accept_free);
 	g_signal_connect (dialog, "response", G_CALLBACK (install_folder_response), accept_data);
@@ -235,8 +235,8 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target)
 			gtk_window_set_title (GTK_WINDOW (assistant), _("Shared Folder Installation"));
 			gtk_window_set_position (GTK_WINDOW (assistant) , GTK_WIN_POS_CENTER_ALWAYS);
 
-			camel_object_ref (msg);
-			g_object_set_data_full((GObject *)page, "msg", msg, camel_object_unref);
+			g_object_ref (msg);
+			g_object_set_data_full((GObject *)page, "msg", msg, g_object_unref);
 
 			g_signal_connect (assistant, "apply", G_CALLBACK (apply_clicked), msg);
 
@@ -246,7 +246,7 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target)
 		} else
 			g_warning ("Could not get the sender name");
 
-		camel_object_unref (stream);
+		g_object_unref (stream);
 	}
 }
 
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index 2d97684..1507e08 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -716,7 +716,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
 		}
 	}
 
-	camel_object_unref (store);
+	g_object_unref (store);
 	camel_exception_clear (&ex);
 	return NULL;
 }
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index e7775b2..10e9b34 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -86,7 +86,7 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
 	if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
 		return;
 	em_folder_tree_model_add_store (model, store, account->name);
-	/* camel_object_unref (store); */
+	/* g_object_unref (store); */
 }
 
 void
@@ -171,7 +171,7 @@ static void
 create_folder_free (struct _EMCreateFolder *m)
 {
 	camel_store_free_folder_info (m->store, m->fi);
-	camel_object_unref (m->store);
+	g_object_unref (m->store);
 	g_free (m->full_name);
 	g_free (m->parent);
 	g_free (m->name);
@@ -217,7 +217,7 @@ create_folder (CamelStore *store, const gchar *full_name, void (* done) (struct
 	}
 
 	m = mail_msg_new (&create_folder_info);
-	camel_object_ref (store);
+	g_object_ref (store);
 	m->store = store;
 	m->full_name = g_strdup (full_name);
 	m->parent = g_strdup (parent);
@@ -259,7 +259,7 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
 
 	if (!(si = em_folder_tree_model_lookup_store_info (ssi->model, store))) {
 		g_assert_not_reached ();
-		camel_object_unref (store);
+		g_object_unref (store);
 		return;
 	}
 
@@ -279,7 +279,7 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
 		create_folder (si->store, path, new_folder_created_cb, ssi);
 
 	}
-	camel_object_unref (store);
+	g_object_unref (store);
 }
 
 static void
@@ -325,7 +325,7 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
 	gtk_widget_show(users_dialog);
 	g_signal_connect (users_dialog, "response", G_CALLBACK (users_dialog_response), ssi);
 
-	camel_object_unref (store);
+	g_object_unref (store);
 	return;
 
 }
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index 861aaac..21688db 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -309,7 +309,7 @@ org_gnome_image_inline_pobject_free (EMFormatHTMLPObject *object)
 	image_object = (ImageInlinePObject *) object;
 
 	if (image_object->mime_part != NULL) {
-		camel_object_unref (image_object->mime_part);
+		g_object_unref (image_object->mime_part);
 		image_object->mime_part = NULL;
 	}
 
@@ -389,7 +389,7 @@ org_gnome_image_inline_decode (ImageInlinePObject *image_object)
 	}
 
 exit:
-	camel_object_unref (stream);
+	g_object_unref (stream);
 	g_object_unref (loader);
 }
 
@@ -458,7 +458,7 @@ org_gnome_image_inline_format (gpointer ep, EMFormatHookTarget *target)
 			classid, target->part,
 			org_gnome_image_inline_embed);
 
-	camel_object_ref (target->part);
+	g_object_ref (target->part);
 	image_object->mime_part = target->part;
 
 	image_object->object.free = org_gnome_image_inline_pobject_free;
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 6a85f94..4c93d29 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2562,7 +2562,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target)
 		puri->vcalendar = g_strndup (
 			(gchar *) byte_array->data, byte_array->len);
 
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	camel_stream_printf (target->stream, "<table border=0 width=\"100%%\" cellpadding=3><tr>");
 	camel_stream_printf (target->stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid);
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index cebf779..f2e3f98 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -205,7 +205,7 @@ set_description (ECalComponent *comp, CamelMimeMessage *message)
 	stream = camel_stream_mem_new_with_byte_array (byte_array);
 	camel_data_wrapper_decode_to_stream (content, stream);
 	str = g_strndup ((gchar *) byte_array->data, byte_array->len);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	/* convert to UTF-8 string */
 	if (str && content->mime_type->params && content->mime_type->params->value) {
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 0af8fc4..84706b7 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -668,7 +668,7 @@ pst_process_folder (PstImporter *m, pst_item *item)
 	m->folder_uri = uri;
 
 	if (m->folder) {
-		camel_object_unref (m->folder);
+		g_object_unref (m->folder);
 		m->folder = NULL;
 	}
 
@@ -705,7 +705,7 @@ pst_create_folder (PstImporter *m)
 			*pos = '\0';
 
 			folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
-			camel_object_unref(folder);
+			g_object_unref (folder);
 			*pos = '/';
 		}
 	}
@@ -713,7 +713,7 @@ pst_create_folder (PstImporter *m)
 	g_free (dest);
 
 	if (m->folder) {
-		camel_object_unref (m->folder);
+		g_object_unref (m->folder);
 	}
 
 	m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
@@ -805,7 +805,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 	}
 
 	camel_mime_message_set_from (msg, addr);
-	camel_object_unref (addr);
+	g_object_unref (addr);
 
 	if (item->email->sent_date != NULL) {
 		camel_mime_message_set_date (msg, pst_fileTimeToUnixTime (item->email->sent_date), 0);
@@ -833,7 +833,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 			if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0)
 				camel_mime_message_set_recipients (msg, "To", addr);
 
-			camel_object_unref (addr);
+			g_object_unref (addr);
 		}
 
 		if (item->email->cc_address.str != NULL) {
@@ -842,7 +842,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 			if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0)
 				camel_mime_message_set_recipients (msg, "CC", addr);
 
-			camel_object_unref (addr);
+			g_object_unref (addr);
 		}
 	}
 
@@ -873,7 +873,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 		part = camel_mime_part_new ();
 		camel_mime_part_set_content (part, item->body.str, strlen (item->body.str), "text/plain");
 		camel_multipart_add_part (mp, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 	}
 
 	if (item->email->htmlbody.str != NULL) {
@@ -881,14 +881,14 @@ pst_process_email (PstImporter *m, pst_item *item)
 		part = camel_mime_part_new ();
 		camel_mime_part_set_content (part, item->email->htmlbody.str, strlen (item->email->htmlbody.str), "text/html");
 		camel_multipart_add_part (mp, part);
-		camel_object_unref (part);
+		g_object_unref (part);
 	}
 
 	for (attach = item->attach; attach; attach = attach->next) {
 		if (attach->data.data || attach->i_id) {
 			part = attachment_to_part(m, attach);
 			camel_multipart_add_part (mp, part);
-			camel_object_unref (part);
+			g_object_unref (part);
 		}
 	}
 
@@ -918,7 +918,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 
 	camel_folder_append_message (m->folder, msg, info, NULL, &m->ex);
 	camel_message_info_free (info);
-	camel_object_unref (msg);
+	g_object_unref (msg);
 
 	camel_folder_sync (m->folder, FALSE, NULL);
 	camel_folder_thaw (m->folder);
@@ -1244,18 +1244,18 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
 			|| camel_stream_flush (stream) == -1)
 		{
 			g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno));
-			camel_object_unref (stream);
+			g_object_unref (stream);
 			attach = attach->next;
 			continue;
 		}
 
-		camel_object_unref (stream);
+		g_object_unref (stream);
 
 		uri = g_filename_to_uri (path, NULL, NULL);
 		list = g_slist_append (list, g_strdup (uri));
 		g_free (uri);
 
-		camel_object_unref (part);
+		g_object_unref (part);
 		g_free (path);
 
 		attach = attach->next;
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index 7db6b68..dbcd501 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -188,7 +188,7 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
 		camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
 		camel_stream_flush (stream);
 		camel_stream_close (stream);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 	} else if (in) {
 		camel_write (fds[1], in, strlen (in));
 		close (fds[1]);
@@ -203,7 +203,7 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
 		camel_stream_mem_set_byte_array (memstream, output_buffer);
 
 		camel_stream_write_to_stream (stream, (CamelStream *) memstream);
-		camel_object_unref (stream);
+		g_object_unref (stream);
 		g_byte_array_append (output_buffer, (guchar *)"", 1);
 
 		d(printf ("child process output: %s len: %d\n", output_buffer->data, output_buffer->len));
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 7971ea3..9728124 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -486,7 +486,7 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
 	camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (template), mem);
 	camel_stream_reset (mem);
 	camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem);
-	camel_object_unref (mem);
+	g_object_unref (mem);
 
 	/* Add the headers from the message we are replying to, so CC and that
 	 * stuff is preserved. */
@@ -514,7 +514,7 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
 	/* Create the composer */
 	em_utils_edit_message (new, folder);
 
-	camel_object_unref(new);
+	g_object_unref (new);
 }
 
 static void
@@ -605,7 +605,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 				continue;
 
 			template = camel_folder_get_message (folder, uid, NULL);
-			camel_object_ref (template);
+			g_object_ref (template);
 
 			action_label =
 				camel_mime_message_get_subject (template);
@@ -620,7 +620,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 				action_name, action_label, NULL, NULL);
 
 			muid = camel_pstring_strdup (message_uid);
-			camel_object_ref (message_folder);
+			g_object_ref (message_folder);
 
 			g_object_set_data_full (
 				G_OBJECT (action), "message_uid", (gpointer) muid,
@@ -628,11 +628,11 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 
 			g_object_set_data_full (
 				G_OBJECT (action), "message_folder", message_folder,
-				(GDestroyNotify) camel_object_unref);
+				(GDestroyNotify) g_object_unref);
 
 			g_object_set_data_full (
 				G_OBJECT (action), "template", template,
-				(GDestroyNotify) camel_object_unref);
+				(GDestroyNotify) g_object_unref);
 
 			g_signal_connect (
 				action, "activate",
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index f75fcf0..8bb5341 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -94,10 +94,10 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 		goto fail;
 	if (camel_data_wrapper_decode_to_stream(content, out) == -1
 	    || camel_stream_close(out) == -1) {
-		camel_object_unref(out);
+		g_object_unref (out);
 		goto fail;
 	}
-	camel_object_unref(out);
+	g_object_unref (out);
 
 	/* Extracting the winmail.dat */
         TNEFInitialize(&tnef);
@@ -139,13 +139,13 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 		stream = camel_stream_fs_new_with_name(path, O_RDONLY, 0);
 		content = camel_data_wrapper_new();
 		camel_data_wrapper_construct_from_stream(content, stream);
-		camel_object_unref(stream);
+		g_object_unref (stream);
 
 		part = camel_mime_part_new();
 		camel_mime_part_set_encoding(part, CAMEL_TRANSFER_ENCODING_BINARY);
 
 		camel_medium_set_content ((CamelMedium *)part, content);
-		camel_object_unref(content);
+		g_object_unref (content);
 
 		type = em_format_snoop_type(part);
 		if (type)
@@ -156,7 +156,7 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 		g_free(path);
 
 		camel_multipart_add_part(mp, part);
-		camel_object_unref(part);
+		g_object_unref (part);
 	}
 
 	closedir(dir);
@@ -171,8 +171,8 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 
 	g_string_truncate(t->format->part_id, len);
 
-	camel_object_unref(mp);
-	camel_object_unref(mainpart);
+	g_object_unref (mp);
+	g_object_unref (mainpart);
 
 	goto ok;
  fail:
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 3cd3f93..228d64b 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -101,8 +101,8 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
 	contact_list = eab_contact_list_from_string (string);
 	vcard_object->contact_list = contact_list;
 
-	camel_object_unref (mime_part);
-	camel_object_unref (stream);
+	g_object_unref (mime_part);
+	g_object_unref (stream);
 }
 
 static void
@@ -277,7 +277,7 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target)
 			classid, target->part,
 			org_gnome_vcard_inline_embed);
 
-	camel_object_ref (target->part);
+	g_object_ref (target->part);
 
 	vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
 	org_gnome_vcard_inline_decode (vcard_object, target->part);
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index e850efb..43c7fb8 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -129,7 +129,7 @@ account_combo_box_test_account (EAccount *account)
 		camel_session, url, CAMEL_PROVIDER_STORE, &ex));
 	if (store != NULL) {
 		writable = (store->mode & CAMEL_STORE_WRITE);
-		camel_object_unref (store);
+		g_object_unref (store);
 	}
 	camel_exception_clear (&ex);
 
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index a52b931..d9c45fb 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -460,7 +460,7 @@ attachment_view_text_calendar (EAttachmentView *view,
 		e_attachment_load_handle_error, parent);
 	g_object_unref (attachment);
 
-	camel_object_unref (mime_part);
+	g_object_unref (mime_part);
 
 	gtk_drag_finish (drag_context, TRUE, FALSE, time);
 }
@@ -514,7 +514,7 @@ attachment_view_text_x_vcard (EAttachmentView *view,
 		e_attachment_load_handle_error, parent);
 	g_object_unref (attachment);
 
-	camel_object_unref (mime_part);
+	g_object_unref (mime_part);
 
 	gtk_drag_finish (drag_context, TRUE, FALSE, time);
 }
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index cbfab83..ba2c705 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -670,7 +670,7 @@ attachment_dispose (GObject *object)
 	}
 
 	if (priv->mime_part != NULL) {
-		camel_object_unref (priv->mime_part);
+		g_object_unref (priv->mime_part);
 		priv->mime_part = NULL;
 	}
 
@@ -1003,7 +1003,7 @@ e_attachment_new_for_message (CamelMimeMessage *message)
 
 	attachment = e_attachment_new ();
 	e_attachment_set_mime_part (attachment, mime_part);
-	camel_object_unref (mime_part);
+	g_object_unref (mime_part);
 
 	return attachment;
 }
@@ -1054,15 +1054,15 @@ e_attachment_add_to_multipart (EAttachment *attachment,
 			CAMEL_MIME_FILTER (filter));
 		camel_data_wrapper_decode_to_stream (
 			wrapper, filtered_stream);
-		camel_object_unref (filtered_stream);
-		camel_object_unref (stream);
+		g_object_unref (filtered_stream);
+		g_object_unref (stream);
 
 		/* Retrieve the best encoding from the filter. */
 		encoding = camel_mime_filter_bestenc_get_best_encoding (
 			CAMEL_MIME_FILTER_BESTENC (filter),
 			CAMEL_BESTENC_8BIT);
 		camel_mime_part_set_encoding (mime_part, encoding);
-		camel_object_unref (filter);
+		g_object_unref (filter);
 
 		if (encoding == CAMEL_TRANSFER_ENCODING_7BIT) {
 			/* The text fits within us-ascii, so this is safe.
@@ -1202,11 +1202,11 @@ e_attachment_set_mime_part (EAttachment *attachment,
 
 	if (mime_part != NULL) {
 		g_return_if_fail (CAMEL_IS_MIME_PART (mime_part));
-		camel_object_ref (mime_part);
+		g_object_ref (mime_part);
 	}
 
 	if (attachment->priv->mime_part != NULL)
-		camel_object_unref (attachment->priv->mime_part);
+		g_object_unref (attachment->priv->mime_part);
 
 	attachment->priv->mime_part = mime_part;
 
@@ -1531,12 +1531,12 @@ attachment_load_finish (LoadContext *load_context)
 	camel_data_wrapper_construct_from_stream (wrapper, stream);
 	camel_data_wrapper_set_mime_type (wrapper, mime_type);
 	camel_stream_close (stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	mime_part = camel_mime_part_new ();
 	camel_medium_set_content (CAMEL_MEDIUM (mime_part), wrapper);
 
-	camel_object_unref (wrapper);
+	g_object_unref (wrapper);
 	g_free (mime_type);
 
 	display_name = g_file_info_get_display_name (file_info);
@@ -1559,7 +1559,7 @@ attachment_load_finish (LoadContext *load_context)
 	}
 
 	g_simple_async_result_set_op_res_gpointer (
-		simple, mime_part, (GDestroyNotify) camel_object_unref);
+		simple, mime_part, (GDestroyNotify) g_object_unref);
 
 	g_simple_async_result_complete (simple);
 
@@ -1784,12 +1784,12 @@ attachment_load_from_mime_part (LoadContext *load_context)
 
 	e_attachment_set_file_info (attachment, file_info);
 
-	camel_object_ref (mime_part);
+	g_object_ref (mime_part);
 
 	simple = load_context->simple;
 	g_simple_async_result_set_op_res_gpointer (
 		simple, mime_part,
-		(GDestroyNotify) camel_object_unref);
+		(GDestroyNotify) g_object_unref);
 	g_simple_async_result_complete (simple);
 
 	attachment_load_context_free (load_context);
@@ -2464,7 +2464,7 @@ attachment_save_got_output_stream (SaveContext *save_context)
 	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
 	wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
 	camel_data_wrapper_decode_to_stream (wrapper, stream);
-	camel_object_unref (stream);
+	g_object_unref (stream);
 
 	/* Load the buffer into a GMemoryInputStream.
 	 * But watch out for zero length MIME parts. */
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 4ff266f..71eb1ac 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -304,7 +304,7 @@ action_mailto_copy_cb (GtkAction *action,
 	if (text == NULL || *text == '\0')
 		text = g_strdup (uri + strlen ("mailto:";));
 
-	camel_object_unref (inet_addr);
+	g_object_unref (inet_addr);
 	camel_url_free (curl);
 
 	clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
@@ -856,7 +856,7 @@ web_view_hovering_over_link (EWebView *web_view,
 	address = camel_internet_address_new ();
 	camel_address_decode (CAMEL_ADDRESS (address), curl->path);
 	who = camel_address_format (CAMEL_ADDRESS (address));
-	camel_object_unref (address);
+	g_object_unref (address);
 	camel_url_free (curl);
 
 	if (who == NULL)



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