[gitg/vala] Added sort mode for commit model



commit c4b196d5586544a0496b8218f5f9b57721680d2b
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Thu Jul 19 10:27:38 2012 +0200

    Added sort mode for commit model

 libgitg/gitg-commit-model.vala |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/libgitg/gitg-commit-model.vala b/libgitg/gitg-commit-model.vala
index 56f679e..b14e9ce 100644
--- a/libgitg/gitg-commit-model.vala
+++ b/libgitg/gitg-commit-model.vala
@@ -30,9 +30,23 @@ public class CommitModel : Object
 	private uint d_advertized_size;
 	private uint d_idleid;
 	private Lanes d_lanes;
+	private Ggit.SortMode d_sortmode;
 
 	public uint limit { get; set; }
 
+	public Ggit.SortMode sort_mode
+	{
+		get { return d_sortmode; }
+		set
+		{
+			if (d_sortmode != value)
+			{
+				d_sortmode = value;
+				reload();
+			}
+		}
+	}
+
 	private Ggit.OId[] d_include;
 	private Ggit.OId[] d_exclude;
 
@@ -62,6 +76,8 @@ public class CommitModel : Object
 		d_lanes = new Lanes();
 		d_cancellable = new Cancellable();
 		d_cancellable.cancel();
+
+		d_sortmode = Ggit.SortMode.TIME | Ggit.SortMode.TOPOLOGICAL;
 	}
 
 	~CommitModel()
@@ -122,6 +138,11 @@ public class CommitModel : Object
 	{
 		cancel();
 
+		if (d_include.length == 0)
+		{
+			return;
+		}
+
 		walk.begin((obj, res) => {
 			walk.end(res);
 
@@ -218,7 +239,7 @@ public class CommitModel : Object
 			}
 
 			d_walker.reset();
-			d_walker.set_sort_mode(Ggit.SortMode.TOPOLOGICAL | Ggit.SortMode.TIME);
+			d_walker.set_sort_mode(d_sortmode);
 
 			foreach (Ggit.OId oid in included)
 			{



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