From 966b11ad3090d9c1d528438dd3321554725e6fef Mon Sep 17 00:00:00 2001 From: "Joel W. Reed" Date: Tue, 20 Nov 2007 16:18:05 -0500 Subject: [PATCH] repo.dlg --- class/Gtk.TeamFoundation/RepositoryDialog.cs | 10 ++++++++-- class/Gtk.TeamFoundation/RepositoryMenu.cs | 18 +++++++++++++++++- class/Gtk.TeamFoundation/RepositoryView.cs | 18 +++++------------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/class/Gtk.TeamFoundation/RepositoryDialog.cs b/class/Gtk.TeamFoundation/RepositoryDialog.cs index 5fc21fc..87799ff 100644 --- a/class/Gtk.TeamFoundation/RepositoryDialog.cs +++ b/class/Gtk.TeamFoundation/RepositoryDialog.cs @@ -59,7 +59,7 @@ namespace Gtk.TeamFoundation return base.OnKeyPressEvent(evnt); } - public RepositoryDialog() : base("Add/Edit Repository") + public RepositoryDialog(Workspace workspace) : base((workspace == null)? "Add Repository" : "Edit Repository") { Table table = new Table(3, 2, false); table.RowSpacing = ((uint)(6)); @@ -69,14 +69,20 @@ namespace Gtk.TeamFoundation name = AddLabeledEntry(table, "_Name:", 1, 2); server = AddLabeledEntry(table, "_Server:", 2, 3); table.Attach(new Gtk.HSeparator(), 0, 2, 3, 4); + username = AddLabeledEntry(table, "_Username:", 4, 5); password = AddLabeledEntry(table, "_Password:", 5, 6); VBox.Add(table); okButton = AddButton ("OK", ResponseType.Ok) as Button; AddCloseButton("Cancel"); - DefaultResponse = ResponseType.Ok; + + if (workspace != null) + { + name.Text = workspace.Name; + server.Text = workspace.VersionControlServer.TeamFoundationServer.Uri.Host.ToString(); + } } } } \ No newline at end of file diff --git a/class/Gtk.TeamFoundation/RepositoryMenu.cs b/class/Gtk.TeamFoundation/RepositoryMenu.cs index 33e8bad..5a5813c 100644 --- a/class/Gtk.TeamFoundation/RepositoryMenu.cs +++ b/class/Gtk.TeamFoundation/RepositoryMenu.cs @@ -45,6 +45,7 @@ namespace Gtk.TeamFoundation MenuItem addRepoItem; MenuItem editRepoItem; MenuItem deleteRepoItem; + Workspace currentWorkspace; public RepositoryMenu() { @@ -54,13 +55,17 @@ namespace Gtk.TeamFoundation Append(new SeparatorMenuItem()); addRepoItem = AddImageMenuItem("Add Repository", Stock.Add); + addRepoItem.Activated += AddRepositoryHandler; + editRepoItem = AddImageMenuItem("Edit Repository", Stock.Edit); + editRepoItem.Activated += AddRepositoryHandler; + deleteRepoItem = AddImageMenuItem("Delete Repository", Stock.Delete); ShowAll(); } - public void Show(string path) + public void Show(Workspace workspace, string path) { bool root_folder = (path == VersionControlPath.RootFolder); @@ -69,7 +74,18 @@ namespace Gtk.TeamFoundation editRepoItem.Sensitive = root_folder; deleteRepoItem.Sensitive = root_folder; + + currentWorkspace = workspace; Popup(); } + + public void AddRepositoryHandler(object sender, EventArgs e) + { + RepositoryDialog dialog = new RepositoryDialog(currentWorkspace); + + dialog.ShowAll(); + dialog.Run(); + dialog.Destroy(); + } } } \ No newline at end of file diff --git a/class/Gtk.TeamFoundation/RepositoryView.cs b/class/Gtk.TeamFoundation/RepositoryView.cs index 27c0a19..a7e5f77 100644 --- a/class/Gtk.TeamFoundation/RepositoryView.cs +++ b/class/Gtk.TeamFoundation/RepositoryView.cs @@ -125,16 +125,18 @@ namespace Gtk.TeamFoundation protected override void ShowPopupMenu(TreePath path) { string tfpath = String.Empty; + Workspace workspace = null; if (path != null) { TreeIter iter; store.GetIter(out iter, path); - tfpath = store.GetValue(iter, ColumnIndex.Path).ToString();; - Console.WriteLine(tfpath); + + tfpath = store.GetValue(iter, ColumnIndex.Path).ToString(); + workspace = store.GetValue(iter, ColumnIndex.Workspace) as Workspace; } - menu.Show(tfpath); + menu.Show(workspace, tfpath); } private void RenderRepositoryName(Gtk.TreeViewColumn column, @@ -155,15 +157,5 @@ namespace Gtk.TeamFoundation (cell as Gtk.CellRendererText).Foreground = "grey"; } } - - - void OnAddRepository(object sender, EventArgs args) - { - RepositoryDialog dialog = new RepositoryDialog(); - - dialog.ShowAll(); - dialog.Run(); - dialog.Destroy(); - } } } \ No newline at end of file -- 2.11.4.GIT