[blam] ItemList: sort correctly
- From: Carlos MartÃn Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] ItemList: sort correctly
- Date: Sun, 4 Dec 2011 12:32:14 +0000 (UTC)
commit de8a71588ce817fb0524f71de1b098b7ab6b620e
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date: Sun Dec 4 13:30:09 2011 +0100
ItemList: sort correctly
Compare both the publish and the update time, otherwise some feeds
won't sort properly.
src/ItemList.cs | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/ItemList.cs b/src/ItemList.cs
index 079453f..d54d3af 100644
--- a/src/ItemList.cs
+++ b/src/ItemList.cs
@@ -243,13 +243,16 @@ namespace Imendio.Blam {
return false;
}
- private int CompareFunc(TreeModel model, TreeIter a, TreeIter b)
- {
- Item ia = Model.GetValue(a, 0) as Item;
- Item ib = Model.GetValue(b, 0) as Item;
+ private int CompareFunc(TreeModel model, TreeIter a, TreeIter b)
+ {
+ Item ia = Model.GetValue(a, 0) as Item;
+ Item ib = Model.GetValue(b, 0) as Item;
- return ia.PublishDate.CompareTo(ib.PublishDate);
- }
+ DateTimeOffset maxa = ia.PublishDate.CompareTo(ia.LastUpdatedTime) > 0 ? ia.PublishDate : ia.LastUpdatedTime;
+ DateTimeOffset maxb = ib.PublishDate.CompareTo(ib.LastUpdatedTime) > 0 ? ib.PublishDate : ib.LastUpdatedTime;
+
+ return maxa.CompareTo(maxb);
+ }
protected override bool OnKeyPressEvent (EventKey kEvent)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]