[gitg] Separate untracked files



commit 522d587fad15f512e7127560a39d7236cee25102
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Jul 5 20:28:46 2013 +0200

    Separate untracked files

 gitg/commit/gitg-commit.vala |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 5025665..0b89c6d 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -305,11 +305,12 @@ namespace GitgCommit
                                         Ggit.StatusFlags.INDEX_RENAMED |
                                         Ggit.StatusFlags.INDEX_TYPECHANGE;
 
-                       var workflags = Ggit.StatusFlags.WORKING_TREE_NEW |
-                                       Ggit.StatusFlags.WORKING_TREE_MODIFIED |
+                       var workflags = Ggit.StatusFlags.WORKING_TREE_MODIFIED |
                                        Ggit.StatusFlags.WORKING_TREE_DELETED |
                                        Ggit.StatusFlags.WORKING_TREE_TYPECHANGE;
 
+                       var untrackedflags = Ggit.StatusFlags.WORKING_TREE_NEW;
+
                        enumerator.next_files.begin(-1, (obj, res) => {
                                var files = enumerator.next_files.end(res);
 
@@ -319,6 +320,9 @@ namespace GitgCommit
                                var unstaged = new Gitg.StageStatusFile[files.length];
                                unstaged.length = 0;
 
+                               var untracked = new Gitg.StageStatusFile[files.length];
+                               untracked.length = 0;
+
                                foreach (var f in files)
                                {
                                        if ((f.flags & indexflags) != 0)
@@ -330,6 +334,11 @@ namespace GitgCommit
                                        {
                                                unstaged += f;
                                        }
+
+                                       if ((f.flags & untrackedflags) != 0)
+                                       {
+                                               untracked += f;
+                                       }
                                }
 
                                model.clear();
@@ -361,6 +370,19 @@ namespace GitgCommit
 
                                model.end_header();
 
+                               model.begin_header(_("Untracked"));
+
+                               if (untracked.length == 0)
+                               {
+                                       model.append_dummy(_("No untracked files"));
+                               }
+                               else
+                               {
+                                       append_files(model, untracked, on_unstaged_activated);
+                               }
+
+                               model.end_header();
+
                                d_main.sidebar.expand_all();
 
                                if (staged.length == 0)


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