Skip to content

Commit

Permalink
Fix gitextensions#7077: Hide push checkbox cells when there's no loca…
Browse files Browse the repository at this point in the history
…l branches
  • Loading branch information
hieuxlu committed Oct 24, 2019
1 parent 4b1d520 commit d47bcb7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions GitUI/CommandsDialogs/FormPush.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions GitUI/CommandsDialogs/FormPush.cs
Expand Up @@ -977,6 +977,8 @@ void ProcessHeads(IReadOnlyList<IGitRef> remoteHeads)
var localHeads = GetLocalBranches().ToList();
var remoteBranches = remoteHeads.ToHashSet(h => h.LocalName);

_branchTable.BeginLoadData();

// Add all the local branches.
foreach (var head in localHeads)
{
Expand Down Expand Up @@ -1015,6 +1017,7 @@ void ProcessHeads(IReadOnlyList<IGitRef> remoteHeads)
}
}

_branchTable.EndLoadData();
BranchGrid.Enabled = true;
}
}
Expand Down Expand Up @@ -1085,6 +1088,32 @@ private void BranchGrid_CurrentCellDirtyStateChanged(object sender, EventArgs e)
}
}

private void BranchGrid_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
foreach (DataGridViewRow row in BranchGrid.Rows)
{
if (row.Cells[0].Value == DBNull.Value)
{
row.Cells[3].ReadOnly = true;
row.Cells[4].ReadOnly = true;
}
}
}

private void BranchGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0)
{
return;
}

if ((e.ColumnIndex == 3 || e.ColumnIndex == 4) && BranchGrid.Rows[e.RowIndex].Cells[0].Value == DBNull.Value)
{
e.PaintBackground(e.ClipBounds, true);
e.Handled = true;
}
}

#endregion

private void ShowOptions_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
Expand Down

0 comments on commit d47bcb7

Please sign in to comment.