[PATCH] On obtaining the headers in a folder, return them in reverse order



* libtinymail-camel/tny-camel-folder.c
  (tny_camel_folder_get_headers_default): get headers now
  returns the headers in the reverse order (first we return
  latest messages). This makes tinymail behave better in the
  usual context (reading the newest messages).
---
 ChangeLog                            |    6 ++++++
 libtinymail-camel/tny-camel-folder.c |   14 +++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3532ea2..087904d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-06-22  Jose Dapena Paz  <jdapena igalia com>
 
+	* libtinymail-camel/tny-camel-folder.c
+	(tny_camel_folder_get_headers_default): get headers now
+	returns the headers in the reverse order (first we return
+	latest messages). This makes tinymail behave better in the
+	usual context (reading the newest messages).
+
 	* libtinymailui-gtk/tny-gtk-folder-list-store.c: stop delayed
 	refresh once timeout is gone (avoiding continuous retrieval
 	issue with delayed refresh).
diff --git a/libtinymail-camel/tny-camel-folder.c b/libtinymail-camel/tny-camel-folder.c
index 4b1e507..428f129 100644
--- a/libtinymail-camel/tny-camel-folder.c
+++ b/libtinymail-camel/tny-camel-folder.c
@@ -2436,9 +2436,17 @@ tny_camel_folder_get_headers_default (TnyFolder *self, TnyList *headers, gboolea
 
 	}
 
-	if (priv->folder && CAMEL_IS_FOLDER (priv->folder))
-		g_ptr_array_foreach (priv->folder->summary->messages, 
-			add_message_with_uid, ptr);
+	if (priv->folder && CAMEL_IS_FOLDER (priv->folder)) {
+		GPtrArray *array;;
+
+		array = priv->folder->summary->messages;
+		if (array->len > 0) {
+			guint i;
+			for (i = array->len - 1; i < array->len ; i--) {
+				add_message_with_uid (array->pdata[i], ptr);
+			}
+		}
+	}
 
 	g_slice_free (FldAndPriv, ptr);
 
-- 
1.6.0.4


--=-WkFrdfQUl9ktKBQq1V3a--



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