4 using Microsoft
.TeamFoundation
.Client
;
5 using Microsoft
.TeamFoundation
.VersionControl
.Common
;
6 using Microsoft
.TeamFoundation
.VersionControl
.Client
;
8 public class RepositoryView
: Gtk
.TreeView
10 private Gtk
.TreeStore itemStore
;
11 private Driver driver
;
13 private Gtk
.TreeIter
SetRowValue(Gtk
.TreeIter parent
, int childIndx
,
14 string cell1
, string cell2
)
17 if (itemStore
.IterNthChild(out child
, parent
, childIndx
))
19 itemStore
.SetValue(child
, 0, cell1
);
20 itemStore
.SetValue(child
, 1, cell2
);
23 child
= itemStore
.AppendValues (parent
, cell1
, cell2
);
28 private void MyRowExpandedHandler (object o
, RowExpandedArgs args
)
30 string path
= itemStore
.GetValue(args
.Iter
, 1).ToString() + "/*";
31 //Console.WriteLine(path);
34 Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] items
= ItemsForPath(path
);
35 if (items
.Length
== 0)
36 SetRowValue(args
.Iter
, indx
, " - item list not available - ", "");
38 foreach (Microsoft
.TeamFoundation
.VersionControl
.Client
.Item item
in items
)
40 string shortPath
= item
.ServerItem
.Substring(item
.ServerItem
.LastIndexOf('/') + 1);
41 if (item
.ItemType
== ItemType
.Folder
)
44 Gtk
.TreeIter child
= SetRowValue(args
.Iter
, indx
, shortPath
, item
.ServerItem
);
46 if (item
.ItemType
== ItemType
.Folder
)
47 itemStore
.AppendValues(child
, "", "");
53 private Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] ItemsForPath(string path
)
55 ItemSpec itemSpec
= new ItemSpec (path
, RecursionType
.OneLevel
);
56 ItemSet itemSet
= driver
.VersionControlServer
.GetItems (itemSpec
, VersionSpec
.Latest
,
57 DeletedState
.NonDeleted
, ItemType
.Any
, false);
62 public RepositoryView(Driver driver
)
65 HeadersVisible
= false;
67 AppendColumn ("", new Gtk
.CellRendererText (), "text", 0);
68 TreeViewColumn fullPath
= AppendColumn ("", new Gtk
.CellRendererText (), "text", 0);
69 fullPath
.Visible
= false;
71 itemStore
= new Gtk
.TreeStore (typeof (string), typeof (string));
72 Gtk
.TreeIter root
= itemStore
.AppendValues(VersionControlPath
.RootFolder
, VersionControlPath
.RootFolder
);
74 Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] items
= ItemsForPath("$/");
75 foreach (Microsoft
.TeamFoundation
.VersionControl
.Client
.Item item
in items
)
77 if (item
.ServerItem
== VersionControlPath
.RootFolder
) continue;
79 string shortPath
= item
.ServerItem
.Substring(item
.ServerItem
.LastIndexOf('/') + 1) + "/";
80 Gtk
.TreeIter iter
= itemStore
.AppendValues (root
, shortPath
, item
.ServerItem
);
82 itemStore
.AppendValues(iter
, "");
87 ExpandRow(TreePath
.NewFirst(), false);
88 RowExpanded
+= MyRowExpandedHandler
;
89 KeyReleaseEvent
+= MyKeyReleaseEventHandler
;
92 public void MyKeyReleaseEventHandler (object o
, KeyReleaseEventArgs args
)
94 if ((Gdk
.Key
.c
== args
.Event
.Key
) && ((args
.Event
.State
& Gdk
.ModifierType
.ControlMask
) != 0))
98 if (!(Selection
.GetSelected (out model
, out iter
))) return;
100 string path
= model
.GetValue(iter
, 1).ToString();
101 Clipboard primary
= Clipboard
.Get(Gdk
.Atom
.Intern ("PRIMARY", false));