[gitg/wip/commit: 20/28] Allow specifying status options in enumerator



commit 92e4d71dbe1c1fadbe26512f8a706140f4caa290
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Jul 3 16:40:30 2013 +0200

    Allow specifying status options in enumerator

 libgitg/gitg-stage-status-enumerator.vala |    7 +++++--
 libgitg/gitg-stage.vala                   |    7 +++----
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libgitg/gitg-stage-status-enumerator.vala b/libgitg/gitg-stage-status-enumerator.vala
index c3a7bdb..b6251d9 100644
--- a/libgitg/gitg-stage-status-enumerator.vala
+++ b/libgitg/gitg-stage-status-enumerator.vala
@@ -51,10 +51,13 @@ public class StageStatusEnumerator : Object
        private int d_callback_num;
        private Cancellable d_cancellable;
        private SourceFunc d_callback;
+       private Ggit.StatusOptions? d_options;
 
-       internal StageStatusEnumerator(Repository repository)
+       internal StageStatusEnumerator(Repository repository,
+                                      Ggit.StatusOptions? options = null)
        {
                d_repository = repository;
+               d_options = options;
 
                d_files = new StageStatusFile[100];
                d_files.length = 0;
@@ -83,7 +86,7 @@ public class StageStatusEnumerator : Object
        {
                try
                {
-                       d_repository.file_status_foreach(null, (path, flags) => {
+                       d_repository.file_status_foreach(d_options, (path, flags) => {
                                lock (d_files)
                                {
                                        d_files += new StageStatusFile(path, flags);
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index b0f6786..0385d4d 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -33,8 +33,6 @@ public class Stage : Object
 
        public async void refresh() throws Error
        {
-               d_enumerator = null;
-
                yield thread_index((index) => {
                        index.read();
                });
@@ -44,10 +42,11 @@ public class Stage : Object
        {
                if (d_enumerator == null)
                {
-                       d_enumerator = new StageStatusEnumerator(d_repository);
                }
 
-               return d_enumerator;
+       public StageStatusEnumerator file_status(Ggit.StatusOptions? options = null)
+       {
+               return new StageStatusEnumerator(d_repository, options);
        }
 
        private delegate void WithIndexFunc(Ggit.Index index) throws Error;


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