private TreeIter AddASingleDirectory(TreeIter iter, IDirectoryWithHistory dir)
 {
     return treeStore.AppendValues (iter,
         dir.GetStockForType (),
         dir.Status.GetStockFromFileStatus (),
         dir.PathInRepository,
         dir.Path
         );
 }
        public void LoadDirectory(string path)
        {
            ExceptionHandling.RunActionSavely (() =>
            {
                if (string.IsNullOrEmpty (path)) {
                    throw new ArgumentNullException ("path");
                }

                if (!HistoryProvider.IsARepository (path)) {
                    bool shouldCreate = AskUserIfHeWantsARepositoryToBeCreated (path);
                    if (shouldCreate) {
                        RootDirectory = HistoryProvider.CreateRepository (path);
                    } else {
                        return;
                    }
                }
                LoadExistingRepository (path);
            });
        }
 private void LoadExistingRepository(string path)
 {
     RootDirectory = HistoryProvider.LoadDirectory (path);
     if (OnDirectoryLoaded != null) {
         OnDirectoryLoaded (this, new DirectoryStatusWasUpdatedEventArgs (RootDirectory));
     }
 }
 public DirectoryStatusWasUpdatedEventArgs(IDirectoryWithHistory directoryWithHistory)
 {
     DirectoryThatChanged = directoryWithHistory;
 }
        private void DisplayAsRootFolder(IDirectoryWithHistory root)
        {
            if (root == null)
                throw new ArgumentNullException ("root");

            InitializeTreeStore ();

            AppendColumns ();

            RegisterCallbacks ();

            treeview.FreezeChildNotify ();

            TreeIter treeIter;

            treeStore.GetIter (out treeIter, new TreePath ("0"));

            var subIter = AddRootDir (root);

            foreach (var dir in root.ChildDirectories) {
                AddDirectory (subIter, dir);
            }
            AddChildFiles (subIter, root.ChildFiles);

            treeview.ThawChildNotify ();
        }
 private TreeIter AddRootDir(IDirectoryWithHistory dir)
 {
     return treeStore.AppendValues (
         dir.GetStockForType (),
         dir.Status.GetStockFromFileStatus (),
         dir.Path);
 }
 private TreeIter AddDirectory(TreeIter iter, IDirectoryWithHistory dir)
 {
     var childiter = AddASingleDirectory (iter, dir);
     foreach (var subdir in dir.ChildDirectories) {
         AddDirectory (childiter, subdir);
     }
     AddChildFiles (childiter, dir.ChildFiles);
     return childiter;
 }
 private static IEnumerable<IFileWithHistory> GetAllContainedFiles(IDirectoryWithHistory dir)
 {
     foreach (var subdir in dir.ChildDirectories) {
         foreach (var item in GetAllContainedFiles (subdir)) {
             yield return item;
         }
     }
     foreach (var item in dir.ChildFiles) {
         yield return item;
     }
 }