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() + "/*";
33 Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] items
= ItemsForPath(path
);
34 if (items
.Length
== 0)
35 SetRowValue(args
.Iter
, indx
, " - item list not available - ", "");
37 foreach (Microsoft
.TeamFoundation
.VersionControl
.Client
.Item item
in items
)
39 string shortPath
= item
.ServerItem
.Substring(item
.ServerItem
.LastIndexOf('/') + 1);
40 if (item
.ItemType
== ItemType
.Folder
)
43 Gtk
.TreeIter child
= SetRowValue(args
.Iter
, indx
, shortPath
, item
.ServerItem
);
45 if (item
.ItemType
== ItemType
.Folder
)
46 itemStore
.AppendValues(child
, "", "");
52 private Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] ItemsForPath(string path
)
54 ItemSpec itemSpec
= new ItemSpec (path
, RecursionType
.OneLevel
);
55 ItemSet itemSet
= driver
.VersionControlServer
.GetItems (itemSpec
, VersionSpec
.Latest
,
56 DeletedState
.NonDeleted
, ItemType
.Any
, false);
61 public RepositoryView(Driver driver
)
64 HeadersVisible
= false;
66 AppendColumn ("", new Gtk
.CellRendererText (), "text", 0);
67 TreeViewColumn fullPath
= AppendColumn ("", new Gtk
.CellRendererText (), "text", 0);
68 fullPath
.Visible
= false;
70 itemStore
= new Gtk
.TreeStore (typeof (string), typeof (string));
71 Gtk
.TreeIter root
= itemStore
.AppendValues(VersionControlPath
.RootFolder
, VersionControlPath
.RootFolder
);
73 Microsoft
.TeamFoundation
.VersionControl
.Client
.Item
[] items
= ItemsForPath(VersionControlPath
.RootFolder
);
74 foreach (Microsoft
.TeamFoundation
.VersionControl
.Client
.Item item
in items
)
76 if (item
.ServerItem
== VersionControlPath
.RootFolder
) continue;
78 string shortPath
= item
.ServerItem
.Substring(item
.ServerItem
.LastIndexOf('/') + 1) + "/";
79 Gtk
.TreeIter iter
= itemStore
.AppendValues (root
, shortPath
, item
.ServerItem
);
81 itemStore
.AppendValues(iter
, "");
86 ExpandRow(TreePath
.NewFirst(), false);
87 RowExpanded
+= MyRowExpandedHandler
;
88 KeyReleaseEvent
+= MyKeyReleaseEventHandler
;
91 public void MyKeyReleaseEventHandler (object o
, KeyReleaseEventArgs args
)
93 if ((Gdk
.Key
.c
== args
.Event
.Key
) && ((args
.Event
.State
& Gdk
.ModifierType
.ControlMask
) != 0))
97 if (!(Selection
.GetSelected (out model
, out iter
))) return;
99 string path
= model
.GetValue(iter
, 1).ToString();
100 Clipboard primary
= Clipboard
.Get(Gdk
.Atom
.Intern ("PRIMARY", false));