public EditBranchDialog(MercurialRepository repo, Branch branch, bool isNew) { this.Build(); this.repo = repo; comboStore = new ListStore(typeof(string), typeof(Gdk.Pixbuf), typeof(string)); comboSources.Model = comboStore; CellRendererPixbuf crp = new CellRendererPixbuf(); comboSources.PackStart(crp, false); comboSources.AddAttribute(crp, "pixbuf", 1); CellRendererText crt = new CellRendererText(); comboSources.PackStart(crt, true); comboSources.AddAttribute(crt, "text", 2); if (branch != null) { if (!isNew) { oldName = branch.Name; } currentTracking = branch.Tracking; entryName.Text = branch.Name; if (currentTracking != null) { checkTrack.Active = true; } } foreach (var b in repo.GetBranches()) { AddValues(b.Name, ImageService.GetPixbuf("vc-git-branch", IconSize.Menu)); } foreach (var t in repo.GetTags()) { AddValues(t.Name, ImageService.GetPixbuf("vc-git-tag", IconSize.Menu)); } foreach (var r in repo.GetRemotes()) { foreach (string b in repo.GetRemoteBranches(r.Name)) { AddValues(r.Name + "/" + b, ImageService.GetPixbuf("md-web-search-icon", IconSize.Menu)); } } UpdateStatus(); }
void UpdateStatus() { comboSources.Sensitive = checkTrack.Active; buttonOk.Sensitive = entryName.Text.Length > 0; if (oldName != entryName.Text && repo.GetBranches().Any(b => b.Name == entryName.Text)) { labelError.Markup = "<span color='red'>" + GettextCatalog.GetString("A branch with this name already exists") + "</span>"; labelError.Show(); buttonOk.Sensitive = false; } else { labelError.Hide(); } }
void FillBranches() { TreeViewState state = new TreeViewState(listBranches, 3); state.Save(); storeBranches.Clear(); string currentBranch = repo.GetCurrentBranch(); foreach (var branch in repo.GetBranches()) { string text = branch.Name == currentBranch ? "<b>" + branch.Name + "</b>" : branch.Name; storeBranches.AppendValues(branch, text, true /*branch.Tracking*/, branch.Name); } state.Load(); }
protected override void Update(CommandArrayInfo info) { MercurialRepository repo = Repository; if (repo != null) { string currentBranch = repo.GetCurrentBranch(); foreach (var branch in repo.GetBranches()) { CommandInfo ci = info.Add(branch.Name, branch.Name); if (branch.Name == currentBranch) { ci.Checked = true; } } } }
public EditBranchDialog(MercurialRepository repo, Branch branch, bool isNew) { this.Build (); this.repo = repo; comboStore = new ListStore (typeof(string), typeof(Gdk.Pixbuf), typeof (string)); comboSources.Model = comboStore; CellRendererPixbuf crp = new CellRendererPixbuf (); comboSources.PackStart (crp, false); comboSources.AddAttribute (crp, "pixbuf", 1); CellRendererText crt = new CellRendererText (); comboSources.PackStart (crt, true); comboSources.AddAttribute (crt, "text", 2); if (branch != null) { if (!isNew) oldName = branch.Name; currentTracking = branch.Tracking; entryName.Text = branch.Name; if (currentTracking != null) checkTrack.Active = true; } foreach (var b in repo.GetBranches ()) { AddValues (b.Name, ImageService.GetPixbuf ("vc-git-branch", IconSize.Menu)); } foreach (var t in repo.GetTags ()) AddValues (t.Name, ImageService.GetPixbuf ("vc-git-tag", IconSize.Menu)); foreach (var r in repo.GetRemotes ()) { foreach (string b in repo.GetRemoteBranches (r.Name)) AddValues (r.Name + "/" + b, ImageService.GetPixbuf ("md-web-search-icon", IconSize.Menu)); } UpdateStatus (); }
void Fill() { store.Clear(); foreach (var b in repo.GetBranches()) { store.AppendValues(b.Name, ImageService.GetPixbuf("vc-git-branch", IconSize.Menu), b.Name, "branch"); } foreach (var t in repo.GetTags()) { store.AppendValues(t.Name, ImageService.GetPixbuf("vc-git-tag", IconSize.Menu), t, "tag"); } foreach (var r in repo.GetRemotes()) { TreeIter it = store.AppendValues(null, ImageService.GetPixbuf("md-web-search-icon", IconSize.Menu), r.Name, null); foreach (string b in repo.GetRemoteBranches(r.Name)) { store.AppendValues(it, r.Name + "/" + b, ImageService.GetPixbuf("vc-git-branch", IconSize.Menu), b, "remote"); } } UpdateStatus(); }