4 using Microsoft
.TeamFoundation
.Client
;
5 using Microsoft
.TeamFoundation
.VersionControl
.Common
;
6 using Microsoft
.TeamFoundation
.VersionControl
.Client
;
8 namespace Gtk
.TeamFoundation
10 public interface IExploreViewChild
12 void UpdatePath(VersionControlServer vcs
, string path
);
15 public class ExploreView
: Gtk
.VBox
17 private RepositoryView repositoryView
;
18 private ChangesetView changesetView
;
19 private DirectoryView directoryView
;
20 private FileView fileView
;
21 private Notebook viewChildren
;
22 private string currentSelectedPath
;
23 private VersionControlServer currentVcs
;
24 private IVersionControlServerFactory vcsFactory
;
26 public ExploreView(IVersionControlServerFactory vcsFactory
,
27 int stopAfter
) : base (false, 1)
29 this.vcsFactory
= vcsFactory
;
31 HPaned hPaned
= new HPaned();
34 ScrolledWindow scrolledWindow
= new ScrolledWindow();
35 hPaned
.Add1(scrolledWindow
);
37 repositoryView
= new RepositoryView(vcsFactory
);
38 scrolledWindow
.Add(repositoryView
);
40 viewChildren
= new Notebook();
42 changesetView
= new ChangesetView(stopAfter
);
43 viewChildren
.AppendPage(changesetView
, new Label ("Changeset View"));
45 directoryView
= new DirectoryView();
46 viewChildren
.AppendPage(directoryView
, new Label ("Directory View"));
48 fileView
= new FileView();
49 viewChildren
.AppendPage(fileView
, new Label ("File View"));
51 int x
, y
, width
, height
, depth
;
52 RootWindow
.GetGeometry (out x
, out y
, out width
, out height
, out depth
);
54 hPaned
.Add2(viewChildren
);
55 hPaned
.Position
= (width
- 50) / 3;
58 Statusbar sb
= new Statusbar ();
59 sb
.HasResizeGrip
= false;
60 PackEnd(sb
, false, false, 1);
64 repositoryView
.Selection
.Changed
+= OnPathSelectionChanged
;
65 viewChildren
.SwitchPage
+= OnSwitchPage
;
68 void OnPathSelectionChanged (object o
, EventArgs args
)
73 if (!((TreeSelection
)o
).GetSelected (out model
, out iter
)) return;
76 if (model
.IterParent(out iterParent
, iter
))
78 string url
= (string) model
.GetValue (iterParent
, 0);
79 currentVcs
= vcsFactory
.GetVersionControlServer(url
);
81 currentSelectedPath
= (string) model
.GetValue (iter
, 1);
82 IExploreViewChild child
= viewChildren
.CurrentPageWidget
as IExploreViewChild
;
83 UpdateChildPath(child
);
87 public void OnSwitchPage (object o
, SwitchPageArgs args
)
89 IExploreViewChild child
= viewChildren
.GetNthPage((int)args
.PageNum
) as IExploreViewChild
;
90 UpdateChildPath(child
);
93 protected void UpdateChildPath(IExploreViewChild child
)
95 GdkWindow
.Cursor
= new Gdk
.Cursor(Gdk
.CursorType
.Watch
);
96 child
.UpdatePath(currentVcs
, currentSelectedPath
);
97 GdkWindow
.Cursor
= null;