root.node
[tfs.git] / tools / tf / DirectoryView.cs
blob49194b5530419f0cb7a5fee707491a2fece8be6a
1 using System;
2 using System.IO;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Net;
6 using System.Text;
7 using Gtk;
8 using Microsoft.TeamFoundation.Client;
9 using Microsoft.TeamFoundation.VersionControl.Common;
10 using Microsoft.TeamFoundation.VersionControl.Client;
12 public class DirectoryView : Gtk.ScrolledWindow, IExploreViewChild
14 private Gtk.TreeView directoryList;
15 private Gtk.ListStore directoryListStore;
16 private Driver driver;
18 public DirectoryView(Driver driver)
20 this.driver = driver;
21 directoryList = new Gtk.TreeView();
23 #if HAVE_ATLEAST_GTK_210
24 directoryList.EnableGridLines = TreeViewGridLines.Vertical;
25 #endif
26 directoryList.AppendColumn ("Name", new Gtk.CellRendererText (), "text", 0);
27 directoryList.AppendColumn ("Status", new Gtk.CellRendererText (), "text", 1);
28 directoryList.AppendColumn ("Owner", new Gtk.CellRendererText (), "text", 2);
29 directoryList.AppendColumn ("Latest", new Gtk.CellRendererText (), "text", 3);
31 directoryListStore = new Gtk.ListStore (typeof(string), typeof(string), typeof(string), typeof(string));
32 directoryList.Model = directoryListStore;
34 Add(directoryList);
36 int x, y, width, height, depth;
37 RootWindow.GetGeometry (out x, out y, out width, out height, out depth);
40 public void UpdatePath(string path)
42 if (String.IsNullOrEmpty(path)) return;
43 directoryListStore.Clear();
45 ExtendedItem[] items = driver.VersionControlServer.GetExtendedItems (path, DeletedState.Any, ItemType.Any);
47 foreach (ExtendedItem item in items)
49 string latest = item.IsLatest ? "Yes" : "No";
51 string status = item.LockStatus.ToString();
52 if (status == "None") status = String.Empty;
54 string shortPath = item.TargetServerItem.Substring(item.TargetServerItem.LastIndexOf('/') + 1);
55 if (item.ItemType == ItemType.Folder) shortPath += "/";
57 directoryListStore.AppendValues(shortPath, status, item.LockOwner, latest);
60 // this would be nice be seems to cause a segfault
61 //changesetList.ColumnsAutosize();