Skip to content

Commit a3a3a0e

Browse files
committed
enhance: add a button to clear git.http.proxy configuration
1 parent 20b45a1 commit a3a3a0e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/ViewModels/RepositoryConfigure.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public string GPGUserSigningKey
3737

3838
public string HttpProxy
3939
{
40-
get;
41-
set;
40+
get => _httpProxy;
41+
set => SetProperty(ref _httpProxy, value);
4242
}
4343

4444
public RepositoryConfigure(Repository repo)
@@ -60,6 +60,11 @@ public RepositoryConfigure(Repository repo)
6060
HttpProxy = proxy;
6161
}
6262

63+
public void ClearHttpProxy()
64+
{
65+
HttpProxy = string.Empty;
66+
}
67+
6368
public void Save()
6469
{
6570
SetIfChanged("user.name", UserName);
@@ -90,5 +95,6 @@ private void SetIfChanged(string key, string value)
9095

9196
private readonly Repository _repo = null;
9297
private readonly Dictionary<string, string> _cached = null;
98+
private string _httpProxy;
9399
}
94100
}

src/Views/RepositoryConfigure.axaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@
7777
Height="28"
7878
CornerRadius="3"
7979
Watermark="{DynamicResource Text.Configure.Proxy.Placeholder}"
80-
Text="{Binding HttpProxy, Mode=TwoWay}"/>
80+
Text="{Binding HttpProxy, Mode=TwoWay}">
81+
<TextBox.InnerRightContent>
82+
<Button Classes="icon_button" IsVisible="{Binding HttpProxy, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Command="{Binding ClearHttpProxy}">
83+
<Path Width="16" Height="16" Margin="0,0,0,0" Data="{StaticResource Icons.Clear}" Fill="{DynamicResource Brush.FG1}"/>
84+
</Button>
85+
</TextBox.InnerRightContent>
86+
</TextBox>
8187

8288
<TextBlock Grid.Row="3" Grid.Column="0"
8389
HorizontalAlignment="Right" VerticalAlignment="Center"

0 commit comments

Comments
 (0)