From 03c3dabf40851d2ebb0cd9f28c4c7b278b57c116 Mon Sep 17 00:00:00 2001 From: "Joel W. Reed" Date: Tue, 20 Nov 2007 14:38:20 -0500 Subject: [PATCH] folder.icon --- class/Gtk.TeamFoundation/RepositoryView.cs | 44 ++++++++++++++------- class/Gtk.TeamFoundation/icons/README | 6 +++ class/Gtk.TeamFoundation/icons/folder.png | Bin 0 -> 479 bytes .../Workspace.cs | 6 ++- 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 class/Gtk.TeamFoundation/icons/README create mode 100644 class/Gtk.TeamFoundation/icons/folder.png diff --git a/class/Gtk.TeamFoundation/RepositoryView.cs b/class/Gtk.TeamFoundation/RepositoryView.cs index b92641f..38d9640 100644 --- a/class/Gtk.TeamFoundation/RepositoryView.cs +++ b/class/Gtk.TeamFoundation/RepositoryView.cs @@ -46,16 +46,21 @@ namespace Gtk.TeamFoundation public static int Workspace = 4; } - private TreeStore store = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string)); + private TreeStore store = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(Workspace)); private ICredentialsProvider credentialsProvider; private RepositoryMenu menu = new RepositoryMenu(); private Gdk.Pixbuf repositoryPixbuf; + private Gdk.Pixbuf folderPixbuf; public RepositoryView(ICredentialsProvider credentialsProvider) { this.credentialsProvider = credentialsProvider; + + // load view images repositoryPixbuf = Gdk.Pixbuf.LoadFromResource("repository.png"); + folderPixbuf = Gdk.Pixbuf.LoadFromResource("folder.png"); + // setup main column with image/text data TreeViewColumn column = new TreeViewColumn (); CellRendererText crt = new CellRendererText(); CellRendererPixbuf crp = new CellRendererPixbuf(); @@ -70,14 +75,14 @@ namespace Gtk.TeamFoundation WorkspaceInfo[] infos = Workstation.Current.GetAllLocalWorkspaceInfo(); foreach (WorkspaceInfo info in infos) { - string label = String.Format("{0}@{1}", info.Name, info.ServerUri.Host.ToString()); - Gtk.TreeIter serverIter = store.AppendValues(repositoryPixbuf, label, info.ServerUri.ToString(), VersionControlPath.RootFolder, info.Name); - store.AppendValues(serverIter, null, "", "", "", ""); - ICredentials credentials = credentialsProvider.GetCredentials(info.ServerUri, null); TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(info.ServerUri.ToString(), credentials); VersionControlServer vcs = tfs.GetService(typeof(VersionControlServer)) as VersionControlServer; - Workspace w = vcs.GetWorkspace(info); + Workspace workspace = vcs.GetWorkspace(info.Name, info.OwnerName); + + string label = String.Format("{0}@{1}", info.Name, info.ServerUri.Host.ToString()); + Gtk.TreeIter serverIter = store.AppendValues(repositoryPixbuf, label, info.ServerUri.ToString(), VersionControlPath.RootFolder, workspace); + store.AppendValues(serverIter, null, "", "", "", null); } Model = store; @@ -91,15 +96,14 @@ namespace Gtk.TeamFoundation string path = store.GetValue(iter, ColumnIndex.Path).ToString(); string url = String.Empty; - TreeIter iterParent; + Workspace workspace = null; - TreeIter current = iter; + TreeIter iterParent; TreeIter current = iter; while (store.IterParent(out iterParent, current)) - { current = iterParent; - } url = store.GetValue(current, ColumnIndex.Url).ToString(); + workspace = store.GetValue(current, ColumnIndex.Workspace) as Workspace; ICredentials credentials = credentialsProvider.GetCredentials(new Uri(url), null); TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(url, credentials); @@ -110,16 +114,16 @@ namespace Gtk.TeamFoundation ItemSet itemSet = versionControlServer.GetItems(itemSpec, VersionSpec.Latest, DeletedState.NonDeleted, ItemType.Folder, false); if (itemSet.Items.Length == 0) - SetRowValue(store, iter, indx, null, " - item list not available - ", ""); + SetRowValue(store, iter, indx, null, " - item list not available - ", "", "", null); foreach (Microsoft.TeamFoundation.VersionControl.Client.Item item in itemSet.Items) { if (item.ServerItem == path) continue; string shortPath = item.ServerItem.Substring(item.ServerItem.LastIndexOf('/') + 1); - Gtk.TreeIter child = SetRowValue(store, iter, indx, null, shortPath, item.ServerItem, "", ""); + Gtk.TreeIter child = SetRowValue(store, iter, indx, folderPixbuf, shortPath, url, item.ServerItem, workspace); - store.AppendValues(child, null, "", "", "", ""); + store.AppendValues(child, null, "", "", "", null); indx++; } } @@ -144,8 +148,18 @@ namespace Gtk.TeamFoundation Gtk.TreeModel model, Gtk.TreeIter iter) { string path = model.GetValue(iter, ColumnIndex.Path).ToString(); - if (path != VersionControlPath.RootFolder) - (cell as Gtk.CellRendererText).Foreground = "grey"; + Workspace workspace = model.GetValue(iter, ColumnIndex.Workspace) as Workspace; + + Gtk.CellRendererText crt = cell as Gtk.CellRendererText; + crt.Foreground = "black"; + + if (path == VersionControlPath.RootFolder) return; + if (workspace == null) return; + + if (!workspace.IsServerPathMapped(path)) + { + (cell as Gtk.CellRendererText).Foreground = "grey"; + } } diff --git a/class/Gtk.TeamFoundation/icons/README b/class/Gtk.TeamFoundation/icons/README new file mode 100644 index 0000000..f3877bf --- /dev/null +++ b/class/Gtk.TeamFoundation/icons/README @@ -0,0 +1,6 @@ +As of now, I did: + +cp /usr/share/icons/gnome/16x16/places/stock_folder.png icons/ +cp /usr/local/src/mono/monodevelop-0.16/Extras/VersionControl/MonoDevelop.VersionControl/repository.png icons/ + +I'm not sure what the recommended approach is here a.t.m. \ No newline at end of file diff --git a/class/Gtk.TeamFoundation/icons/folder.png b/class/Gtk.TeamFoundation/icons/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..e45b65b6ec99a0403754c2ffeaf766266cb006b1 GIT binary patch literal 479 zcwPbD0U-W~P)WFU8GbZ8({Xk{QrNlj4iWF>9@00BcuL_t(I%dL{VN&`U@ zg}?nNUD!>cV3%57B4VM|QM6Lf!XSAW1@Q-C>m#@pkzkQBg@p)$F&YSDJ7JTZ-RzEq zxM9>_qMm9vbMJTOFjw0vmztjE<@uysE_ZiycrwoqGCj}Bm&;q|x{;bazt36aVvaFn z0)$~e^XUqR-L(Q)kB>2YPj1PB6w@AuwsB)qhrSuHLhLV<=3nx-^| zVT9}66w(*yhJgq|rKoyc$M*$s94o$I7-X|qHNur!r`zo+g*)3D*mefXnj%RO262p( z5}71ix>Y)z&Ja-A-TXGE@4wP&-GA{{mKSL>ZifIVCGGYDzmX0oUpS5igGdGR`#!&w z{t@9%0GJFQWugL-B%TNmMS;2pLI^A?Gh$kLNNV002ovPDHLkV1nMAzOw)T literal 0 HcwPel00001 diff --git a/class/Microsoft.TeamFoundation.VersionControl.Client/Workspace.cs b/class/Microsoft.TeamFoundation.VersionControl.Client/Workspace.cs index 542f1d4..10eadbc 100644 --- a/class/Microsoft.TeamFoundation.VersionControl.Client/Workspace.cs +++ b/class/Microsoft.TeamFoundation.VersionControl.Client/Workspace.cs @@ -319,7 +319,8 @@ namespace Microsoft.TeamFoundation.VersionControl.Client { foreach (WorkingFolder workingFolder in Folders) { - if (workingFolder.LocalItem == localPath) return true; + if (localPath.StartsWith(workingFolder.LocalItem)) + return true; } return false; @@ -329,7 +330,8 @@ namespace Microsoft.TeamFoundation.VersionControl.Client { foreach (WorkingFolder workingFolder in Folders) { - if (workingFolder.ServerItem == serverPath) return true; + if (serverPath.StartsWith(workingFolder.ServerItem)) + return true; } return false; -- 2.11.4.GIT