Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 3bf04a5

Browse files
Hiding the publish section to favor the main package
1 parent fb7b443 commit 3bf04a5

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/GitHub.VisualStudio.16/Sync/PublishSection.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class PublishSection : TeamExplorerBaseSection
1818
public const int Priority = 4;
1919

2020
readonly Guid PushToRemoteSectionId = new Guid("99ADF41C-0022-4C03-B3C2-05047A3F6C2C");
21+
readonly Guid GitHubPublishSectionId = new Guid("92655B52-360D-4BF5-95C5-D9E9E596AC76");
2122

2223
/// <summary>
2324
/// Constructor.
@@ -55,6 +56,11 @@ public override void Initialize(object sender, SectionInitializeEventArgs e)
5556
{
5657
pushToRemoteSection.PropertyChanged += Section_PropertyChanged;
5758
}
59+
60+
if (page.GetSection(GitHubPublishSectionId) is ITeamExplorerSection gitHubPublishSection)
61+
{
62+
gitHubPublishSection.PropertyChanged += Section_PropertyChanged;
63+
}
5864
}
5965
}
6066

@@ -71,17 +77,21 @@ void Section_PropertyChanged(object sender, PropertyChangedEventArgs e)
7177

7278
void RefreshVisibility()
7379
{
80+
bool IsSectionVisible(ITeamExplorerPage teamExplorerPage, Guid sectionId)
81+
{
82+
if (teamExplorerPage.GetSection(sectionId) is ITeamExplorerSection pushToRemoteSection)
83+
{
84+
return pushToRemoteSection.SectionContent != null && pushToRemoteSection.IsVisible;
85+
}
86+
87+
return false;
88+
}
89+
7490
var visible = false;
7591

7692
if (ServiceProvider.GetService(typeof(ITeamExplorerPage)) is ITeamExplorerPage page)
7793
{
78-
if (page.GetSection(PushToRemoteSectionId) is ITeamExplorerSection pushToRemoteSection)
79-
{
80-
if (pushToRemoteSection.SectionContent != null && pushToRemoteSection.IsVisible)
81-
{
82-
visible = true;
83-
}
84-
}
94+
visible = IsSectionVisible(page, PushToRemoteSectionId) && !IsSectionVisible(page, GitHubPublishSectionId);
8595
}
8696

8797
if (IsVisible != visible)

0 commit comments

Comments
 (0)