The work on the iterators



Attached you find the current patch Dirk has sent me. I created a wiki
page for this work:

http://tinymail.org/trac/tinymail/wiki/HelpRedesignIterators

Dirk (or other people): Feel free to put on that wiki page information
about the work.


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be
Index: libtinymail-test/tny-list-iface-test.c
===================================================================
--- libtinymail-test/tny-list-iface-test.c	(revision 722)
+++ libtinymail-test/tny-list-iface-test.c	(working copy)
@@ -125,33 +125,39 @@
 	gunit_fail_unless (tny_iterator_iface_get_list (iterator) == iface, str);
 	g_free (str);
 
-	item = (TnyTestObject*)tny_iterator_iface_nth (iterator, 2);
-
+	tny_iterator_iface_nth (iterator, 2);
+	item = (TnyTestObject*)tny_iterator_iface_current (iterator);
+	
 	str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "3"), str);
 	g_free (str);
-
-	item = (TnyTestObject*)tny_iterator_iface_next (iterator);
-
+	g_object_unref (G_OBJECT(item));
+	
+	tny_iterator_iface_next (iterator);
+	item = (TnyTestObject*)tny_iterator_iface_current (iterator);	
 	str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "4"), str);
 	g_free (str);
+	g_object_unref (G_OBJECT(item));
+	
+	tny_iterator_iface_prev (iterator);
+	item = (TnyTestObject*)tny_iterator_iface_current (iterator);	
 
-	item = (TnyTestObject*)tny_iterator_iface_prev (iterator);
-
 	str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "3"), str);
 	g_free (str);
-
-	item = (TnyTestObject*)tny_iterator_iface_next (iterator);
-
+	g_object_unref (G_OBJECT(item));
+	
+	tny_iterator_iface_next (iterator);
+	tny_iterator_iface_current (iterator);	
+	
 	str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "4"), str);
 	g_free (str);
+	g_object_unref (G_OBJECT(item));
 
-
 	item = (TnyTestObject*)tny_iterator_iface_current (iterator);
-
+	
 	str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "4"), str);
 	g_free (str);
@@ -164,11 +170,13 @@
 	gunit_fail_unless (tny_list_iface_length (iface) == 3, str);
 	g_free (str);
 
-
+	g_object_unref (G_OBJECT(item)); /* need to unref ? */
+	
 	iterator = tny_list_iface_create_iterator (iface);
 
-	item = (TnyTestObject*)tny_iterator_iface_first (iterator);
-
+	tny_iterator_iface_first (iterator);
+	item = (TnyTestObject*)tny_iterator_iface_current (iterator);
+	
 	str = g_strdup_printf ("Item should be \"1\" but is %s\n", item->str);
 	gunit_fail_unless (!strcmp (item->str, "1"), str);
 	g_free (str);
@@ -187,7 +195,7 @@
 	g_free (str);
 	
 	g_object_unref (G_OBJECT (iterator));
-
+	g_object_unref (G_OBJECT(item)); /* need to unref ? */	
 }
 
 
Index: libtinymail-camel/tny-mime-part.c
===================================================================
--- libtinymail-camel/tny-mime-part.c	(revision 722)
+++ libtinymail-camel/tny-mime-part.c	(working copy)
@@ -25,6 +25,7 @@
 #include <tny-mime-part-iface.h>
 #include <tny-mime-part.h>
 #include <tny-camel-stream.h>
+#include <tny-stream-camel.h>
 #include <camel/camel-stream-mem.h>
 #include <camel/camel-data-wrapper.h>
 #include <tny-camel-shared.h>
@@ -622,7 +623,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyMimePart),
 		  0,      /* n_preallocs */
-		  tny_mime_part_instance_init    /* instance_init */
+		  tny_mime_part_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_mime_part_iface_info = 
Index: libtinymail-camel/tny-camel-common.c
===================================================================
--- libtinymail-camel/tny-camel-common.c	(revision 722)
+++ libtinymail-camel/tny-camel-common.c	(working copy)
@@ -76,7 +76,6 @@
 void
 _foreach_email_add_to_inet_addr (const gchar *emails, CamelInternetAddress *target)
 {
-	int length = strlen (emails), i = 0;
 	char *dup = g_strdup (emails);
 	char *tok, *save;
 
Index: libtinymail-camel/tny-folder.c
===================================================================
--- libtinymail-camel/tny-folder.c	(revision 722)
+++ libtinymail-camel/tny-folder.c	(working copy)
@@ -106,7 +106,6 @@
 {
 	if (!priv->folder && !priv->loaded)
 	{
-		CamelFolderInfo *folder_info;
 		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 		CamelStore *store = (CamelStore*) _tny_account_get_service 
 			(TNY_ACCOUNT (priv->account));
Index: libtinymail-camel/tny-folder-list-iterator.c
===================================================================
--- libtinymail-camel/tny-folder-list-iterator.c	(revision 722)
+++ libtinymail-camel/tny-folder-list-iterator.c	(working copy)
@@ -24,7 +24,6 @@
 
 static GObjectClass *parent_class = NULL;
 
-
 void 
 _tny_folder_list_iterator_set_model (TnyFolderListIterator *self, TnyFolderList *model)
 {
@@ -70,21 +69,18 @@
 static void
 tny_folder_list_iterator_finalize (GObject *object)
 {
-	TnyFolderListIterator *self = (TnyFolderListIterator *)object;
-
 	(*parent_class->finalize) (object);
 
 	return;
 }
 
-
-static GObject* 
+static void
 tny_folder_list_iterator_next (TnyIteratorIface *self)
 {
 	TnyFolderListIterator *me = (TnyFolderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the next node */
 
@@ -92,7 +88,7 @@
 	me->current = g_list_next (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
 
@@ -112,13 +108,13 @@
 
 
 
-static GObject* 
+static void
 tny_folder_list_iterator_prev (TnyIteratorIface *self)
 {
 	TnyFolderListIterator *me = (TnyFolderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the previous node */
 
@@ -126,16 +122,16 @@
 	me->current = g_list_previous (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
-static GObject* 
+static void
 tny_folder_list_iterator_first (TnyIteratorIface *self)
 {
 	TnyFolderListIterator *me = (TnyFolderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the first node. We know that model always 
 	   keeps a reference to the first node, there's nothing wrong with 
@@ -145,17 +141,17 @@
 	me->current = me->model->first;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
-static GObject* 
+static void
 tny_folder_list_iterator_nth (TnyIteratorIface *self, guint nth)
 {
 	TnyFolderListIterator *me = (TnyFolderListIterator*) self;
-
+	
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the nth node. We'll count from zero,
 	   so we start with the first node of which we know the model
@@ -165,7 +161,7 @@
 	me->current = g_list_nth (me->model->first, nth);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
@@ -173,7 +169,7 @@
 tny_folder_list_iterator_current (TnyIteratorIface *self)
 {
 	TnyFolderListIterator *me = (TnyFolderListIterator*) self;
-	gpointer retval;
+	GObject *obj;
 
 	if (G_UNLIKELY (!me || !me->model))
 		return NULL;
@@ -181,10 +177,13 @@
 	/* Give the data of the current node */
 
 	g_mutex_lock (me->model->iterator_lock);
-	retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
+	obj = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return retval;
+	if (obj)
+		g_object_ref (obj);
+	
+	return obj;
 }
 
 static gboolean 
@@ -217,7 +216,7 @@
 	/* Return whether or not there's a next node */
 
 	g_mutex_lock (me->model->iterator_lock);
-	retval = G_LIKELY (me->current);
+	retval = G_LIKELY (me->current != NULL);
 	g_mutex_unlock (me->model->iterator_lock);
 
 	return retval;
@@ -239,7 +238,6 @@
 static void
 tny_iterator_iface_init (TnyIteratorIfaceClass *klass)
 {
-
 	klass->next_func = tny_folder_list_iterator_next;
 	klass->prev_func = tny_folder_list_iterator_prev;
 	klass->first_func = tny_folder_list_iterator_first;
Index: libtinymail-camel/tny-msg.c
===================================================================
--- libtinymail-camel/tny-msg.c	(revision 722)
+++ libtinymail-camel/tny-msg.c	(working copy)
@@ -97,8 +97,8 @@
 	TnyMimePartIface *tpart;
 
 	if (!part)
-		return;
-
+		return FALSE;
+	
 	/* http://bugzilla.gnome.org/show_bug.cgi?id=343683 
 	   and tny-mime-part.c:515 ! */
 
@@ -204,7 +204,6 @@
 	TnyMimePartPriv *ppriv = TNY_MIME_PART_GET_PRIVATE (self);
 	CamelMedium *medium;
 	CamelDataWrapper *containee;
-	TnyMimePartIface *tpart;
 	gint curl = 0;
 
 	g_mutex_lock (priv->message_lock);
@@ -252,7 +251,6 @@
 	TnyMsgPriv *priv = TNY_MSG_GET_PRIVATE (TNY_MSG (self));
 	TnyMimePartPriv *ppriv = TNY_MIME_PART_GET_PRIVATE (self);
 	gpointer remove;
-	TnyIteratorIface *iterator;
 	CamelDataWrapper *containee;
 
 	g_mutex_lock (priv->message_lock);
@@ -434,7 +432,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyMsg),
 		  0,      /* n_preallocs */
-		  tny_msg_instance_init    /* instance_init */
+		  tny_msg_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_msg_iface_info = 
Index: libtinymail-camel/tny-store-account.c
===================================================================
--- libtinymail-camel/tny-store-account.c	(revision 722)
+++ libtinymail-camel/tny-store-account.c	(working copy)
@@ -101,6 +101,8 @@
 
 		if (next)
 			tny_iterator_iface_next (iterator);
+
+		g_object_unref (G_OBJECT(folder));
 	}
 
 	g_object_unref (G_OBJECT (iterator));
@@ -332,7 +334,7 @@
 		tny_iterator_iface_nth (iterator, 0);
 		folder = (TnyFolderIface*)tny_iterator_iface_current (iterator);
 		g_signal_emit (folder, tny_folder_iface_signals [TNY_FOLDER_IFACE_FOLDERS_RELOADED], 0);
-
+		g_object_unref (G_OBJECT (folder));
 		g_object_unref (G_OBJECT (iterator));
 	}
 }
Index: libtinymail-camel/tny-header.c
===================================================================
--- libtinymail-camel/tny-header.c	(revision 722)
+++ libtinymail-camel/tny-header.c	(working copy)
@@ -566,7 +566,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyHeader),
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_header_iface_info = 
Index: libtinymail-camel/tny-session-camel.c
===================================================================
--- libtinymail-camel/tny-session-camel.c	(revision 722)
+++ libtinymail-camel/tny-session-camel.c	(working copy)
@@ -475,6 +475,8 @@
 			next = tny_iterator_iface_has_next (iterator);
 			if (next)
 				tny_iterator_iface_next (iterator);
+	
+			g_object_unref (G_OBJECT(account));
 		}
 
 		g_object_unref (G_OBJECT (iterator));
Index: libtinymailui-gtk/tny-account-tree-model.c
===================================================================
--- libtinymailui-gtk/tny-account-tree-model.c	(revision 722)
+++ libtinymailui-gtk/tny-account-tree-model.c	(working copy)
@@ -29,6 +29,7 @@
 #include <tny-folder-iface.h>
 
 #include "tny-account-tree-model-priv.h"
+#include "tny-account-tree-model-iterator-priv.h"
 
 static GObjectClass *parent_class = NULL;
 
@@ -79,6 +80,8 @@
 
 		if (next)
 			tny_iterator_iface_next (iterator);
+
+		g_object_unref (G_OBJECT(folder));
 	}
 
 	g_object_unref (G_OBJECT (iterator));
Index: libtinymailui-gtk/tny-header-list-iterator.c
===================================================================
--- libtinymailui-gtk/tny-header-list-iterator.c	(revision 722)
+++ libtinymailui-gtk/tny-header-list-iterator.c	(working copy)
@@ -79,28 +79,27 @@
 static void
 tny_header_list_iterator_finalize (GObject *object)
 {
-	TnyHeaderListIterator *self = (TnyHeaderListIterator *)object;
-
 	(*parent_class->finalize) (object);
 
 	return;
 }
 
 
-gpointer 
+void 
 _tny_header_list_iterator_next_nl (TnyHeaderListIterator *me)
 {
 	me->current = me->current?g_list_next (me->current):NULL;
-	return me->current?me->current->data:NULL;
+
+	return;
 }
 
-static GObject* 
+static void 
 tny_header_list_iterator_next (TnyIteratorIface *self)
 {
 	TnyHeaderListIterator *me = (TnyHeaderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the next node */
 
@@ -108,23 +107,24 @@
 	me->current = g_list_next (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
-gpointer 
+void
 _tny_header_list_iterator_prev_nl (TnyHeaderListIterator *me)
 {
 	me->current = me->current?g_list_previous (me->current):NULL;
-	return me->current?me->current->data:NULL;
+
+	return;
 }
 
-static GObject* 
+static void
 tny_header_list_iterator_prev (TnyIteratorIface *self)
 {
 	TnyHeaderListIterator *me = (TnyHeaderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the previous node */
 
@@ -132,7 +132,7 @@
 	me->current = g_list_previous (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
 
@@ -148,20 +148,21 @@
 }
 
 
-gpointer 
+void
 _tny_header_list_iterator_first_nl (TnyHeaderListIterator *me)
 {
 	me->current = me->model?me->model->first:NULL;
-	return me->current?me->current->data:NULL;
+
+	return;
 }
 
-static GObject* 
+static void
 tny_header_list_iterator_first (TnyIteratorIface *self)
 {
 	TnyHeaderListIterator *me = (TnyHeaderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the first node. We know that model always 
 	   keeps a reference to the first node, there's nothing wrong with 
@@ -171,24 +172,25 @@
 	me->current = me->model->first;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
-gpointer 
+void
 _tny_header_list_iterator_nth_nl (TnyHeaderListIterator *me, guint nth)
 {
 	me->current = me->model?g_list_nth (me->model->first, nth):NULL;
-	return me->current?me->current->data:NULL;
+
+	return;
 }
 
-static GObject* 
+static void 
 tny_header_list_iterator_nth (TnyIteratorIface *self, guint nth)
 {
 	TnyHeaderListIterator *me = (TnyHeaderListIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the nth node. We'll count from zero,
 	   so we start with the first node of which we know the model
@@ -198,10 +200,10 @@
 	me->current = g_list_nth (me->model->first, nth);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
-
+/* exception: don't ref */
 gpointer 
 _tny_header_list_iterator_current_nl (TnyHeaderListIterator *me)
 {
@@ -223,7 +225,9 @@
 	retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return retval;
+	if (retval)
+		g_object_ref (G_OBJECT(retval));	
+	return (GObject*)retval;
 }
 
 gboolean 
@@ -264,7 +268,7 @@
 	/* Return whether or not there's a next node */
 
 	g_mutex_lock (me->model->iterator_lock);
-	retval = G_UNLIKELY (me->current);
+	retval = G_UNLIKELY (me->current == NULL);
 	g_mutex_unlock (me->model->iterator_lock);
 
 	return retval;
@@ -331,7 +335,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyHeaderListIterator),
 		  0,      /* n_preallocs */
-		  tny_header_list_iterator_instance_init    /* instance_init */
+		  tny_header_list_iterator_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_iterator_iface_info = 
Index: libtinymailui-gtk/tny-msg-window.c
===================================================================
--- libtinymailui-gtk/tny-msg-window.c	(revision 722)
+++ libtinymailui-gtk/tny-msg-window.c	(working copy)
@@ -98,7 +98,6 @@
 tny_msg_window_instance_init (GTypeInstance *instance, gpointer g_class)
 {
 	TnyMsgWindow *self = (TnyMsgWindow *)instance;
-	TnyMsgWindowPriv *priv = TNY_MSG_WINDOW_GET_PRIVATE (self);
 
 	gtk_window_set_default_size (GTK_WINDOW (self), 640, 480);
 
@@ -166,7 +165,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyMsgWindow),
 		  0,      /* n_preallocs */
-		  tny_msg_window_instance_init    /* instance_init */
+		  tny_msg_window_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_msg_window_iface_info = 
Index: libtinymailui-gtk/tny-save-strategy.c
===================================================================
--- libtinymailui-gtk/tny-save-strategy.c	(revision 722)
+++ libtinymailui-gtk/tny-save-strategy.c	(working copy)
@@ -223,7 +223,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnySaveStrategy),
 		  0,      /* n_preallocs */
-		  tny_save_strategy_instance_init    /* instance_init */
+		  tny_save_strategy_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_save_strategy_iface_info = 
Index: libtinymailui-gtk/tny-msg-view.c
===================================================================
--- libtinymailui-gtk/tny-msg-view.c	(revision 722)
+++ libtinymailui-gtk/tny-msg-view.c	(working copy)
@@ -71,12 +71,10 @@
 reload_msg (TnyMsgViewIface *self)
 {
 	TnyMsgViewPriv *priv = TNY_MSG_VIEW_GET_PRIVATE (self);
-	GtkTextIter hiter;
 	GtkTextBuffer *buffer;
 	TnyStreamIface *dest;
 	TnyHeaderIface *header;
 	TnyIteratorIface *iterator;
-	const gchar *str = NULL;
 	gboolean first_attach = TRUE, next = FALSE;
 	TnyAttachListModel *model = tny_attach_list_model_new ();;
 
@@ -120,6 +118,8 @@
 
 		if (next)
 			tny_iterator_iface_next (iterator);
+		
+		g_object_unref (G_OBJECT(part));
 
 	}
 
@@ -293,7 +293,6 @@
 	GtkWidget *vbox = gtk_vbox_new (FALSE, 1);
 	GtkMenu *menu = GTK_MENU (gtk_menu_new ());
 	GtkWidget *mitem = gtk_menu_item_new_with_mnemonic ("Save _As");
-	GtkTextBuffer *headerbuffer;
 
 	priv->save_strategy = NULL;
 
@@ -421,7 +420,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyMsgView),
 		  0,      /* n_preallocs */
-		  tny_msg_view_instance_init    /* instance_init */
+		  tny_msg_view_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_msg_view_iface_info = 
Index: libtinymailui-gtk/tny-header-list-model.c
===================================================================
--- libtinymailui-gtk/tny-header-list-model.c	(revision 722)
+++ libtinymailui-gtk/tny-header-list-model.c	(working copy)
@@ -27,6 +27,8 @@
 #include <glib/gi18n-lib.h>
 
 #include <tny-header-list-model.h>
+#include <tny-header-list-iterator-priv.h>
+
 #include <tny-header-iface.h>
 #include <tny-folder-iface.h>
 
@@ -45,11 +47,6 @@
 stack allocations)? It's probably a na� manual optimization.*/
 
 
-#ifndef DEBUG
-#ifdef G_CAN_INLINE
-G_INLINE_FUNC
-#endif
-#endif
 void /* When sorting, this method is called a gazillion times */
 _tny_header_list_iterator_travel_to_nth_nl (TnyHeaderListIterator *self, guint cur, guint nth)
 {
@@ -205,7 +202,7 @@
 		list_model->last_nth, i);
 
 	/* We will store this as user_data of the GtkTreeIter */
-	
+	/* don't unref */	
 	ptr = _tny_header_list_iterator_current_nl ((TnyHeaderListIterator*)list_model->iterator);
 	list_model->last_nth = i;
 	iter->stamp = list_model->stamp;
@@ -223,7 +220,6 @@
 static GtkTreePath *
 tny_header_list_model_get_path (GtkTreeModel *self, GtkTreeIter *iter)
 {
-	GList *list, *headers;
 	GtkTreePath *tree_path;
 	gint i = 0;
 	TnyHeaderListModel *list_model = TNY_HEADER_LIST_MODEL (self);
@@ -238,7 +234,10 @@
 
 	while (_tny_header_list_iterator_has_next_nl ((TnyHeaderListIterator*)list_model->iterator))
 	{
-		if (_tny_header_list_iterator_next_nl ((TnyHeaderListIterator*)list_model->iterator) == iter->user_data)
+		_tny_header_list_iterator_next_nl ((TnyHeaderListIterator*)list_model->iterator);
+
+		/* header list iterator does not need to be unref'd... FIXME */
+		if (_tny_header_list_iterator_current_nl ((TnyHeaderListIterator*)list_model->iterator) == iter->user_data)
 			break;
 		i++;
 	}
@@ -257,11 +256,7 @@
 	return tree_path;
 }
 
-#ifndef DEBUG
-#ifdef G_CAN_INLINE
-G_INLINE_FUNC
-#endif
-#endif
+
 gchar *
 _get_readable_date (time_t file_time_raw)
 {
@@ -332,7 +327,6 @@
 tny_header_list_model_get_value (GtkTreeModel *self, GtkTreeIter *iter, gint column, GValue *value)
 {
 	TnyHeaderIface *header = NULL;
-	gchar *readable;
 	TnyHeaderListModel *list_model = TNY_HEADER_LIST_MODEL (self);
 
 	g_return_if_fail (iter->stamp == TNY_HEADER_LIST_MODEL (self)->stamp);
@@ -409,7 +403,7 @@
 {
 	gboolean retval;
 	TnyHeaderListModel *list_model = TNY_HEADER_LIST_MODEL (self);
-	GList *headers; gpointer ptr;
+	gpointer ptr;
 
 	/* Move the GtkTreeIter to the next item */
 
@@ -420,7 +414,9 @@
 	g_mutex_lock (list_model->iterator_lock);
 
 	/* We simply move the iterator and get the value */
-	ptr = _tny_header_list_iterator_next_nl ((TnyHeaderListIterator*)list_model->iterator);
+	_tny_header_list_iterator_next_nl ((TnyHeaderListIterator*)list_model->iterator);
+	/* the ptr needs not to be unref'd... */
+	ptr = _tny_header_list_iterator_current_nl ((TnyHeaderListIterator*)list_model->iterator);
 	list_model->last_nth++;
 	iter->user_data = ptr;
 	retval = (iter->user_data != NULL);
@@ -462,7 +458,7 @@
 static gboolean
 tny_header_list_model_iter_nth_child (GtkTreeModel *self, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
 {
-	GList *child, *headers;
+	GList *child;
 	TnyHeaderListModel *list_model = TNY_HEADER_LIST_MODEL (self);
 	GList *restore;
 
@@ -474,8 +470,10 @@
 
 	restore = ((TnyHeaderListIterator*)list_model->iterator)->current;
 	/* Move the GtkTreeIter to the nth child */
-	child = _tny_header_list_iterator_nth_nl ((TnyHeaderListIterator*)list_model->iterator, n);
-
+	_tny_header_list_iterator_nth_nl ((TnyHeaderListIterator*)list_model->iterator, n);
+	/* child needs not to be unref'd */
+	child = _tny_header_list_iterator_current_nl ((TnyHeaderListIterator*)list_model->iterator);
+	 
 	if (G_LIKELY (child))
 	{
 		list_model->last_nth = n;
@@ -562,7 +560,7 @@
 	return;
 }
 
-
+#if 0
 static void
 unref_header (gpointer data, gpointer user_data)
 {
@@ -576,6 +574,7 @@
 	g_object_ref (G_OBJECT (data));
 	return;
 }
+#endif /* 0 */
 
 
 static void
@@ -813,15 +812,20 @@
 	return TRUE;
 }
 
+
+#if 0
+
 static void 
 proxy_uncache_func (gpointer data, gpointer user_data)
 {
 	if (data)
-		tny_header_iface_uncache (TNY_HEADER_IFACE (data));
+		g_printerr ("tinymail: uncache %p\n", user_data);
+		//tny_header_iface_uncache (TNY_HEADER_IFACE (data));
 	return;
 }
 
 
+
 static void 
 tny_header_list_model_hdr_cache_uncacher_copy (TnyHeaderListModel *self)
 {
@@ -839,16 +843,6 @@
 	return;
 }
 
-static void
-proxy_destroy_func (gpointer data, gpointer user_data)
-{
-	if (data)
-		g_object_unref (G_OBJECT (data));
-	data = NULL;
-
-	return;
-}
-
 static void 
 tny_header_list_model_hdr_cache_remover (TnyHeaderListModel *self)
 {
@@ -866,7 +860,21 @@
 	return;
 } 
 
+#endif /* 0 */
 
+
+static void
+proxy_destroy_func (gpointer data, gpointer user_data)
+{
+	if (data)
+		g_object_unref (G_OBJECT (data));
+	data = NULL;
+
+	return;
+}
+
+
+
 static void 
 tny_header_list_model_hdr_cache_remover_copy (TnyHeaderListModel *self)
 {
@@ -1072,7 +1080,8 @@
 			NULL,		/* class_data */
 			sizeof (TnyHeaderListModel),
 			0,              /* n_preallocs */
-			(GInstanceInitFunc) tny_header_list_model_init
+			(GInstanceInitFunc) tny_header_list_model_init,
+			NULL
 		};
 
 		static const GInterfaceInfo tree_model_info = {
Index: libtinymailui-gtk/tny-attach-list-model-iterator.c
===================================================================
--- libtinymailui-gtk/tny-attach-list-model-iterator.c	(revision 722)
+++ libtinymailui-gtk/tny-attach-list-model-iterator.c	(working copy)
@@ -64,21 +64,19 @@
 static void
 tny_attach_list_model_iterator_finalize (GObject *object)
 {
-	TnyAttachListModelIterator *self = (TnyAttachListModelIterator *)object;
-
 	(*parent_class->finalize) (object);
 
 	return;
 }
 
 
-static GObject* 
+static void 
 tny_attach_list_model_iterator_next (TnyIteratorIface *self)
 {
 	TnyAttachListModelIterator *me = (TnyAttachListModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the next node */
 
@@ -86,16 +84,16 @@
 	me->current = g_list_next (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
-static GObject* 
+static void
 tny_attach_list_model_iterator_prev (TnyIteratorIface *self)
 {
 	TnyAttachListModelIterator *me = (TnyAttachListModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the previous node */
 
@@ -103,7 +101,7 @@
 	me->current = g_list_previous (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
 
@@ -120,13 +118,13 @@
 
 
 
-static GObject* 
+static void
 tny_attach_list_model_iterator_first (TnyIteratorIface *self)
 {
 	TnyAttachListModelIterator *me = (TnyAttachListModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the first node. We know that model always 
 	   keeps a reference to the first node, there's nothing wrong with 
@@ -136,17 +134,17 @@
 	me->current = me->model->first;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
-static GObject* 
+static void
 tny_attach_list_model_iterator_nth (TnyIteratorIface *self, guint nth)
 {
 	TnyAttachListModelIterator *me = (TnyAttachListModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the nth node. We'll count from zero,
 	   so we start with the first node of which we know the model
@@ -156,7 +154,7 @@
 	me->current = g_list_nth (me->model->first, nth);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
@@ -175,7 +173,10 @@
 	retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return retval;
+	if (retval)
+		g_object_ref (G_OBJECT(retval));
+	
+	return (GObject*)retval;
 }
 
 static gboolean 
@@ -208,9 +209,8 @@
 		return FALSE;
 
 	/* Return whether or not there's a next node */
-
 	g_mutex_lock (me->model->iterator_lock);
-	retval = G_UNLIKELY (me->current);
+	retval = G_UNLIKELY (me->current == NULL);
 	g_mutex_unlock (me->model->iterator_lock);
 
 	return retval;
Index: libtinymailui-gtk/tny-attach-list-model.c
===================================================================
--- libtinymailui-gtk/tny-attach-list-model.c	(revision 722)
+++ libtinymailui-gtk/tny-attach-list-model.c	(working copy)
@@ -33,7 +33,9 @@
 #include <tny-folder-iface.h>
 
 #include "tny-attach-list-model-priv.h"
+#include "tny-attach-list-model-iterator-priv.h"
 
+
 static GObjectClass *parent_class = NULL;
 
 
@@ -343,7 +345,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyAttachListModel),
 		  0,      /* n_preallocs */
-		  tny_attach_list_model_instance_init    /* instance_init */
+		  tny_attach_list_model_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		type = g_type_register_static (GTK_TYPE_LIST_STORE, "TnyAttachListModel",
Index: libtinymailui-gtk/tny-header-list-iterator-priv.h
===================================================================
--- libtinymailui-gtk/tny-header-list-iterator-priv.h	(revision 722)
+++ libtinymailui-gtk/tny-header-list-iterator-priv.h	(working copy)
@@ -56,10 +56,10 @@
 
 gboolean _tny_header_list_iterator_has_next_nl (TnyHeaderListIterator *self);
 gpointer _tny_header_list_iterator_current_nl (TnyHeaderListIterator *me);
-gpointer _tny_header_list_iterator_nth_nl (TnyHeaderListIterator *me, guint nth);
-gpointer _tny_header_list_iterator_first_nl (TnyHeaderListIterator *me);
-gpointer _tny_header_list_iterator_prev_nl (TnyHeaderListIterator *me);
-gpointer _tny_header_list_iterator_next_nl (TnyHeaderListIterator *me);
+void _tny_header_list_iterator_nth_nl (TnyHeaderListIterator *me, guint nth);
+void _tny_header_list_iterator_first_nl (TnyHeaderListIterator *me);
+void _tny_header_list_iterator_prev_nl (TnyHeaderListIterator *me);
+void _tny_header_list_iterator_next_nl (TnyHeaderListIterator *me);
 
 
 G_END_DECLS
Index: libtinymailui-gtk/tny-account-tree-model-iterator.c
===================================================================
--- libtinymailui-gtk/tny-account-tree-model-iterator.c	(revision 722)
+++ libtinymailui-gtk/tny-account-tree-model-iterator.c	(working copy)
@@ -64,21 +64,19 @@
 static void
 tny_account_tree_model_iterator_finalize (GObject *object)
 {
-	TnyAccountTreeModelIterator *self = (TnyAccountTreeModelIterator *)object;
-
 	(*parent_class->finalize) (object);
 
 	return;
 }
 
 
-static GObject* 
+static void
 tny_account_tree_model_iterator_next (TnyIteratorIface *self)
 {
 	TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the next node */
 
@@ -86,16 +84,16 @@
 	me->current = g_list_next (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
-static GObject* 
+static void 
 tny_account_tree_model_iterator_prev (TnyIteratorIface *self)
 {
 	TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the previous node */
 
@@ -103,7 +101,7 @@
 	me->current = g_list_previous (me->current);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
 
@@ -120,13 +118,13 @@
 
 
 
-static GObject* 
+static void 
 tny_account_tree_model_iterator_first (TnyIteratorIface *self)
 {
 	TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the first node. We know that model always 
 	   keeps a reference to the first node, there's nothing wrong with 
@@ -136,17 +134,17 @@
 	me->current = me->model->first;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
-static GObject* 
+static void 
 tny_account_tree_model_iterator_nth (TnyIteratorIface *self, guint nth)
 {
 	TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	/* Move the iterator to the nth node. We'll count from zero,
 	   so we start with the first node of which we know the model
@@ -156,7 +154,7 @@
 	me->current = g_list_nth (me->model->first, nth);
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
@@ -164,7 +162,7 @@
 tny_account_tree_model_iterator_current (TnyIteratorIface *self)
 {
 	TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self;
-	gpointer retval;
+	gpointer ptr;
 
 	if (G_UNLIKELY (!me || !me->model))
 		return NULL;
@@ -172,10 +170,13 @@
 	/* Give the data of the current node */
 
 	g_mutex_lock (me->model->iterator_lock);
-	retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
+	ptr = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
 	g_mutex_unlock (me->model->iterator_lock);
 
-	return retval;
+	if (ptr)
+		g_object_ref (G_OBJECT(ptr));
+	
+	return G_OBJECT(ptr);
 }
 
 static gboolean 
@@ -210,7 +211,7 @@
 	/* Return whether or not there's a next node */
 
 	g_mutex_lock (me->model->iterator_lock);
-	retval = G_UNLIKELY (me->current);
+	retval = G_UNLIKELY (me->current == NULL);
 	g_mutex_unlock (me->model->iterator_lock);
 
 	return retval;
@@ -233,7 +234,6 @@
 static void
 tny_iterator_iface_init (TnyIteratorIfaceClass *klass)
 {
-
 	klass->next_func = tny_account_tree_model_iterator_next;
 	klass->prev_func = tny_account_tree_model_iterator_prev;
 	klass->first_func = tny_account_tree_model_iterator_first;
@@ -277,7 +277,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyAccountTreeModelIterator),
 		  0,      /* n_preallocs */
-		  tny_account_tree_model_iterator_instance_init    /* instance_init */
+		  tny_account_tree_model_iterator_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_iterator_iface_info = 
Index: libtinymailui-gtk/tny-text-buffer-stream.c
===================================================================
--- libtinymailui-gtk/tny-text-buffer-stream.c	(revision 722)
+++ libtinymailui-gtk/tny-text-buffer-stream.c	(working copy)
@@ -55,6 +55,11 @@
 		if (G_UNLIKELY (nb_read < 0))
 			return -1;
 		else if (G_LIKELY (nb_read > 0)) {
+			const gchar *end;
+			if (!g_utf8_validate (tmp_buf, nb_read, &end)) 
+				g_warning ("utf8 invalid: %d of %d", (gint)nb_read,
+					   (gint)(end - tmp_buf));
+				
 			nb_written = 0;
 	
 			while (G_LIKELY (nb_written < nb_read))
Index: libtinymailui-mozembed/tny-moz-embed-stream.c
===================================================================
--- libtinymailui-mozembed/tny-moz-embed-stream.c	(revision 722)
+++ libtinymailui-mozembed/tny-moz-embed-stream.c	(working copy)
@@ -21,6 +21,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <glib.h>
+#include <glib/gstdio.h> /* for g_unlink */
 #include <stdlib.h>
 #include <gtk/gtk.h>
 
@@ -187,8 +188,6 @@
 static gint
 tny_moz_embed_stream_close (TnyStreamIface *self)
 {
-	TnyMozEmbedStreamPriv *priv = TNY_MOZ_EMBED_STREAM_GET_PRIVATE (self);
-
 	tny_moz_embed_stream_reset (self);
 
 	return 0;
Index: libtinymailui-mozembed/tny-moz-embed-msg-view.c
===================================================================
--- libtinymailui-mozembed/tny-moz-embed-msg-view.c	(revision 722)
+++ libtinymailui-mozembed/tny-moz-embed-msg-view.c	(working copy)
@@ -37,6 +37,7 @@
 #include <tny-attach-list-model.h>
 #include <tny-header-view-iface.h>
 #include <tny-header-view.h>
+#include <tny-text-buffer-stream.h>
 
 #ifdef GNOME
 #include <tny-vfs-stream.h>
@@ -86,12 +87,10 @@
 reload_msg (TnyMsgViewIface *self)
 {
 	TnyMozEmbedMsgViewPriv *priv = TNY_MOZ_EMBED_MSG_VIEW_GET_PRIVATE (self);
-	GtkTextIter hiter;
 	GtkTextBuffer *buffer;
 	TnyStreamIface *dest;
 	TnyHeaderIface *header;
 	TnyIteratorIface *iterator;
-	const gchar *str = NULL;
 	gboolean first_attach = TRUE;
 	TnyAttachListModel *model = tny_attach_list_model_new ();;
 	gboolean have_html = FALSE, next = FALSE;
@@ -163,6 +162,8 @@
 
 		if (next)
 			tny_iterator_iface_next (iterator);
+
+		g_object_unref (G_OBJECT(part));
 	}
 
 	g_object_unref (G_OBJECT (iterator));
@@ -338,7 +339,6 @@
 	GtkWidget *vbox = gtk_vbox_new (FALSE, 1);
 	GtkMenu *menu = GTK_MENU (gtk_menu_new ());
 	GtkWidget *mitem = gtk_menu_item_new_with_mnemonic ("Save _As");
-	GtkTextBuffer *headerbuffer;
 
 	priv->save_strategy = NULL;
 
Index: libtinymail-gnome-desktop/tny-account-store.c
===================================================================
--- libtinymail-gnome-desktop/tny-account-store.c	(revision 722)
+++ libtinymail-gnome-desktop/tny-account-store.c	(working copy)
@@ -73,8 +73,7 @@
 per_account_get_pass_func (TnyAccountIface *account, const gchar *prompt, gboolean *cancel)
 {
 	gchar *retval = NULL;
-	const gchar *accountid = tny_account_iface_get_id (account);
-	GList *list;
+GList *list;
 	GnomeKeyringResult keyringret;
 	gchar *keyring;
 
@@ -154,10 +153,6 @@
 static void
 per_account_forget_pass_func (TnyAccountIface *account)
 {
-	const TnyAccountStoreIface *self = tny_account_iface_get_account_store (account);
-	TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);
-	TnyGetPassFunc func;
-
 	GList *list=NULL;
 	GnomeKeyringResult keyringret;
 	gchar *keyring;
@@ -297,9 +292,7 @@
 			GConfEntry *entry, gpointer user_data)
 {
 	TnyAccountStoreIface *self = user_data;
-	TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);
 
-
 	gchar *key = g_strdup (entry->key);
 	gchar *ptr = strrchr (key, '/'); ptr++;
 
@@ -570,8 +563,6 @@
 static void
 tny_account_store_add_store_account (TnyAccountStoreIface *self, TnyStoreAccountIface *account)
 {
-	TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);
-
 	tny_account_store_notify_remove (self);
 	tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "store");
 	tny_account_store_notify_add (self);
@@ -584,8 +575,6 @@
 static void
 tny_account_store_add_transport_account (TnyAccountStoreIface *self, TnyTransportAccountIface *account)
 {
-	TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);
-
 	tny_account_store_notify_remove (self);
 	tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "transport");
 	tny_account_store_notify_add (self);
Index: libtinymail-gnome-desktop/tny-platform-factory.c
===================================================================
--- libtinymail-gnome-desktop/tny-platform-factory.c	(revision 722)
+++ libtinymail-gnome-desktop/tny-platform-factory.c	(working copy)
@@ -89,8 +89,6 @@
 static void
 tny_platform_factory_finalize (GObject *object)
 {
-	TnyPlatformFactory *self = (TnyPlatformFactory *)object;	
-
 	(*parent_class->finalize) (object);
 
 	return;
Index: libtinymail-gnome-desktop/tny-password-dialog.c
===================================================================
--- libtinymail-gnome-desktop/tny-password-dialog.c	(revision 722)
+++ libtinymail-gnome-desktop/tny-password-dialog.c	(working copy)
@@ -115,8 +115,6 @@
 static void
 tny_password_dialog_finalize (GObject *object)
 {
-	TnyPasswordDialog *self = (TnyPasswordDialog *)object;	
-	
 	(*parent_class->finalize) (object);
 
 	return;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 722)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+08-08-2006  Dirk-Jan C. Binnema <djcb djcbsoftware nl>
+
+	* make iterator ops next/prev/first/last/nth all void
+	* g_object_ref iterator _current retval, except with headers...
+	* misc small fixes (-Wall -Wextra helps...)
+
 08-01-2006  Philip Van Hoof  <pvanhoof gnome org>
 
 	* Implemented a few new unit tests
Index: libtinymail-gnomevfs/tny-vfs-stream.c
===================================================================
--- libtinymail-gnomevfs/tny-vfs-stream.c	(revision 722)
+++ libtinymail-gnomevfs/tny-vfs-stream.c	(working copy)
@@ -473,7 +473,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyVfsStream),
 		  0,      /* n_preallocs */
-		  tny_vfs_stream_instance_init    /* instance_init */
+		  tny_vfs_stream_instance_init,/* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_stream_iface_info = 
Index: libtinymail/tny-store-account-iface.c
===================================================================
--- libtinymail/tny-store-account-iface.c	(revision 722)
+++ libtinymail/tny-store-account-iface.c	(working copy)
@@ -111,7 +111,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyStoreAccountIface", &info, 0);
Index: libtinymail/tny-msg-iface.c
===================================================================
--- libtinymail/tny-msg-iface.c	(revision 722)
+++ libtinymail/tny-msg-iface.c	(working copy)
@@ -172,7 +172,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyMsgIface", &info, 0);
Index: libtinymail/tny-account-store-iface.c
===================================================================
--- libtinymail/tny-account-store-iface.c	(revision 722)
+++ libtinymail/tny-account-store-iface.c	(working copy)
@@ -263,7 +263,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyAccountStoreIface", &info, 0);
Index: libtinymail/tny-transport-account-iface.c
===================================================================
--- libtinymail/tny-transport-account-iface.c	(revision 722)
+++ libtinymail/tny-transport-account-iface.c	(working copy)
@@ -71,7 +71,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyTransportAccountIface", &info, 0);
Index: libtinymail/tny-header-iface.c
===================================================================
--- libtinymail/tny-header-iface.c	(revision 722)
+++ libtinymail/tny-header-iface.c	(working copy)
@@ -464,7 +464,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 
 		type = g_type_register_static (G_TYPE_INTERFACE,
Index: libtinymail/tny-iterator-iface.c
===================================================================
--- libtinymail/tny-iterator-iface.c	(revision 722)
+++ libtinymail/tny-iterator-iface.c	(working copy)
@@ -26,19 +26,16 @@
  * @self: A #TnyIteratorIface instance
  *
  * Moves the iterator to the next node 
- * 
- * Return value: the next value of the underlying #TnyListIface instance
  *
  **/
-GObject* 
+void 
 tny_iterator_iface_next (TnyIteratorIface *self)
 {
 #ifdef DEBUG
 	if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func)
 		g_critical ("You must implement tny_iterator_iface_next\n");
 #endif
-
-	return TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self);
+	TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self);
 }
 
 /**
@@ -47,18 +44,15 @@
  *
  * Moves the iterator to the previous node
  *
- * Return value: the previous value of the underlying #TnyListIface instance
- *
  **/
-GObject* 
+void
 tny_iterator_iface_prev (TnyIteratorIface *self)
 {
 #ifdef DEBUG
 	if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func)
 		g_critical ("You must implement tny_iterator_iface_prev\n");
 #endif
-
-	return TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self);
+	TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self);
 }
 
 
@@ -68,10 +62,8 @@
  *
  * Moves the iterator to the first node
  *
- * Return value: the first value of the underlying #TnyListIface instance
- *
  **/
-GObject* 
+void 
 tny_iterator_iface_first (TnyIteratorIface *self)
 {
 #ifdef DEBUG
@@ -79,7 +71,7 @@
 		g_critical ("You must implement tny_iterator_iface_first\n");
 #endif
 
-	return TNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self);
+	TNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self);
 }
 
 /**
@@ -92,15 +84,14 @@
  * Return value: the value of the underlying #TnyListIface instance at the nth position
  *
  **/
-GObject*
+void
 tny_iterator_iface_nth (TnyIteratorIface *self, guint nth)
 {
 #ifdef DEBUG
 	if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->nth_func)
 		g_critical ("You must implement tny_iterator_iface_nth\n");
 #endif
-
-	return TNY_ITERATOR_IFACE_GET_CLASS (self)->nth_func (self, nth);
+	TNY_ITERATOR_IFACE_GET_CLASS (self)->nth_func (self, nth);
 }
 
 
@@ -120,7 +111,6 @@
 	if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->current_func)
 		g_critical ("You must implement tny_iterator_iface_current\n");
 #endif
-
 	return TNY_ITERATOR_IFACE_GET_CLASS (self)->current_func (self);
 }
 
@@ -239,7 +229,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyIteratorIface", &info, 0);
Index: libtinymail/tny-account-iface.c
===================================================================
--- libtinymail/tny-account-iface.c	(revision 722)
+++ libtinymail/tny-account-iface.c	(working copy)
@@ -473,7 +473,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyAccountIface", &info, 0);
Index: libtinymail/tny-iterator-iface.h
===================================================================
--- libtinymail/tny-iterator-iface.h	(revision 722)
+++ libtinymail/tny-iterator-iface.h	(working copy)
@@ -38,10 +38,10 @@
 {
 	GTypeInterface parent;
 
-	GObject* (*next_func) (TnyIteratorIface *self);
-	GObject* (*prev_func) (TnyIteratorIface *self);
-	GObject* (*first_func) (TnyIteratorIface *self);
-	GObject* (*nth_func) (TnyIteratorIface *self, guint nth);
+	void (*next_func) (TnyIteratorIface *self);
+	void (*prev_func) (TnyIteratorIface *self);
+	void (*first_func) (TnyIteratorIface *self);
+	void (*nth_func) (TnyIteratorIface *self, guint nth);
 	GObject* (*current_func) (TnyIteratorIface *self);
 	gboolean (*has_first_func) (TnyIteratorIface *self);
 	gboolean (*has_next_func) (TnyIteratorIface *self);
@@ -51,14 +51,14 @@
 
 GType tny_iterator_iface_get_type (void);
 
-GObject* tny_iterator_iface_next (TnyIteratorIface *self);
-GObject* tny_iterator_iface_prev (TnyIteratorIface *self);
-GObject* tny_iterator_iface_first (TnyIteratorIface *self);
-GObject* tny_iterator_iface_nth (TnyIteratorIface *self, guint nth);
-GObject* tny_iterator_iface_current (TnyIteratorIface *self);
-gboolean tny_iterator_iface_has_first (TnyIteratorIface *self);
-gboolean tny_iterator_iface_has_next (TnyIteratorIface *self);
-gboolean tny_iterator_iface_is_done (TnyIteratorIface *self);
+void tny_iterator_iface_next              (TnyIteratorIface *self);
+void tny_iterator_iface_prev              (TnyIteratorIface *self);
+void tny_iterator_iface_first             (TnyIteratorIface *self);
+void tny_iterator_iface_nth               (TnyIteratorIface *self, guint nth);
+GObject* tny_iterator_iface_current       (TnyIteratorIface *self);
+gboolean tny_iterator_iface_has_first     (TnyIteratorIface *self);
+gboolean tny_iterator_iface_has_next      (TnyIteratorIface *self);
+gboolean tny_iterator_iface_is_done       (TnyIteratorIface *self);
 TnyListIface* tny_iterator_iface_get_list (TnyIteratorIface *self);
 
 G_END_DECLS
Index: libtinymail/tny-list.c
===================================================================
--- libtinymail/tny-list.c	(revision 722)
+++ libtinymail/tny-list.c	(working copy)
@@ -97,7 +97,6 @@
 static TnyListIface*
 tny_list_copy_the_list (TnyListIface *self)
 {
-	TnyList *me = (TnyList*)self;
 	TnyList *copy = g_object_new (TNY_TYPE_LIST, NULL);
 
 	TnyListPriv *priv = TNY_LIST_GET_PRIVATE (self);
@@ -225,7 +224,8 @@
 			NULL,		/* class_data */
 			sizeof (TnyList),
 			0,              /* n_preallocs */
-			(GInstanceInitFunc) tny_list_init
+			(GInstanceInitFunc) tny_list_init,
+			NULL
 		};
 
 		static const GInterfaceInfo tny_list_iface_info = {
Index: libtinymail/tny-list-iterator-priv.h
===================================================================
--- libtinymail/tny-list-iterator-priv.h	(revision 722)
+++ libtinymail/tny-list-iterator-priv.h	(working copy)
@@ -55,6 +55,7 @@
 GType _tny_list_iterator_get_type (void);
 void _tny_list_iterator_set_model (TnyListIterator *self, TnyList *model);
 TnyListIterator* _tny_header_list_iterator_new (TnyList *model);
+TnyListIterator* _tny_list_iterator_new (TnyList *model);
 
 G_END_DECLS
 
Index: libtinymail/tny-stream-iface.c
===================================================================
--- libtinymail/tny-stream-iface.c	(revision 722)
+++ libtinymail/tny-stream-iface.c	(working copy)
@@ -196,7 +196,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyStreamIface", &info, 0);
Index: libtinymail/tny-mime-part-iface.c
===================================================================
--- libtinymail/tny-mime-part-iface.c	(revision 722)
+++ libtinymail/tny-mime-part-iface.c	(working copy)
@@ -368,7 +368,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 
 		type = g_type_register_static (G_TYPE_INTERFACE,
Index: libtinymail/tny-fs-stream.c
===================================================================
--- libtinymail/tny-fs-stream.c	(revision 722)
+++ libtinymail/tny-fs-stream.c	(working copy)
@@ -277,7 +277,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyFsStream),
 		  0,      /* n_preallocs */
-		  tny_fs_stream_instance_init    /* instance_init */
+		  tny_fs_stream_instance_init,   /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_stream_iface_info = 
Index: libtinymail/tny-list-iterator.c
===================================================================
--- libtinymail/tny-list-iterator.c	(revision 722)
+++ libtinymail/tny-list-iterator.c	(working copy)
@@ -71,22 +71,20 @@
 static void
 tny_list_iterator_finalize (GObject *object)
 {
-	TnyListIterator *self = (TnyListIterator *)object;
-
 	(*parent_class->finalize) (object);
 
 	return;
 }
 
 
-static GObject* 
+static void 
 tny_list_iterator_next (TnyIteratorIface *self)
 {
 	TnyListIterator *me = (TnyListIterator*) self;
 	TnyListPriv *lpriv;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	lpriv = TNY_LIST_GET_PRIVATE (me->model);
 
@@ -94,17 +92,17 @@
 	me->current = g_list_next (me->current);
 	g_mutex_unlock (lpriv->iterator_lock);
 
-	return me->current ? me->current->data : NULL;
+	return;
 }
 
-static GObject* 
+static void 
 tny_list_iterator_prev (TnyIteratorIface *self)
 {
 	TnyListIterator *me = (TnyListIterator*) self;
 	TnyListPriv *lpriv;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	lpriv = TNY_LIST_GET_PRIVATE (me->model);
 
@@ -112,17 +110,17 @@
 	me->current = g_list_previous (me->current);
 	g_mutex_unlock (lpriv->iterator_lock);
 
-	 return me->current ? me->current->data : NULL;
+	return;
 }
 
-static GObject* 
+static void 
 tny_list_iterator_first (TnyIteratorIface *self)
 {
 	TnyListIterator *me = (TnyListIterator*) self;
 	TnyListPriv *lpriv;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	lpriv = TNY_LIST_GET_PRIVATE (me->model);
 
@@ -130,7 +128,7 @@
 	me->current = lpriv->first;
 	g_mutex_unlock (lpriv->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
@@ -144,14 +142,14 @@
 
 
 
-static GObject* 
+static void
 tny_list_iterator_nth (TnyIteratorIface *self, guint nth)
 {
 	TnyListIterator *me = (TnyListIterator*) self;
 	TnyListPriv *lpriv;
 
 	if (G_UNLIKELY (!me || !me->current || !me->model))
-		return NULL;
+		return;
 
 	lpriv = TNY_LIST_GET_PRIVATE (me->model);
 
@@ -163,7 +161,7 @@
 	me->current = g_list_nth (lpriv->first, nth);
 	g_mutex_unlock (lpriv->iterator_lock);
 
-	return me->current->data;
+	return;
 }
 
 
@@ -183,7 +181,10 @@
 	retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL;
 	g_mutex_unlock (lpriv->iterator_lock);
 
-	return retval;
+	if (retval) 
+		g_object_ref (G_OBJECT(retval));
+
+	return (GObject*)retval;
 }
 
 
@@ -200,7 +201,7 @@
 	lpriv = TNY_LIST_GET_PRIVATE (me->model);
 
 	g_mutex_lock (lpriv->iterator_lock);
-	retval = G_UNLIKELY (me->current);
+	retval = G_UNLIKELY (me->current == NULL);
 	g_mutex_unlock (lpriv->iterator_lock);
 
 	return retval;
@@ -285,7 +286,8 @@
 		  NULL,   /* class_data */
 		  sizeof (TnyListIterator),
 		  0,      /* n_preallocs */
-		  tny_list_iterator_instance_init    /* instance_init */
+		  tny_list_iterator_instance_init,    /* instance_init */
+		  NULL
 		};
 
 		static const GInterfaceInfo tny_iterator_iface_info = 
Index: libtinymail/tny-device-iface.c
===================================================================
--- libtinymail/tny-device-iface.c	(revision 722)
+++ libtinymail/tny-device-iface.c	(working copy)
@@ -151,7 +151,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,   /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyDeviceIface", &info, 0);
Index: libtinymail/tny-list-iface.c
===================================================================
--- libtinymail/tny-list-iface.c	(revision 722)
+++ libtinymail/tny-list-iface.c	(working copy)
@@ -34,9 +34,7 @@
 	if (!TNY_LIST_IFACE_GET_CLASS (self)->length_func)
 		g_critical ("You must implement tny_list_iface_length\n");
 #endif
-
-	TNY_LIST_IFACE_GET_CLASS (self)->length_func (self);
-	return;
+	return TNY_LIST_IFACE_GET_CLASS (self)->length_func (self);
 }
 
 /**
@@ -184,7 +182,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyListIface", &info, 0);
Index: libtinymail/tny-folder-iface.c
===================================================================
--- libtinymail/tny-folder-iface.c	(revision 722)
+++ libtinymail/tny-folder-iface.c	(working copy)
@@ -403,8 +403,9 @@
 tny_folder_iface_has_cache (TnyFolderIface *self)
 {
 	if (TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func != NULL)
-		TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func (self);
-	return;
+		return TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func (self);
+	else
+		return FALSE;
 }
 
 static void
@@ -471,7 +472,8 @@
 		  NULL,   /* class_data */
 		  0,
 		  0,      /* n_preallocs */
-		  NULL    /* instance_init */
+		  NULL,    /* instance_init */
+		  NULL
 		};
 		type = g_type_register_static (G_TYPE_INTERFACE, 
 			"TnyFolderIface", &info, 0);


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