Skip to content

Commit 9ba495b

Browse files
authored
Feature: Added git icons (#12572)
1 parent 5473b98 commit 9ba495b

File tree

4 files changed

+95
-10
lines changed

4 files changed

+95
-10
lines changed

src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public DirectoryPropertiesViewModel()
8585
public void UpdateGitInfo(bool isGitRepository, string? repositoryPath, BranchItem[] branches)
8686
{
8787
GitBranchDisplayName = isGitRepository && branches.Any()
88-
? string.Format("Branch".GetLocalizedResource(), branches[ACTIVE_BRANCH_INDEX].Name)
88+
? branches[ACTIVE_BRANCH_INDEX].Name
8989
: null;
9090

9191
_gitRepositoryPath = repositoryPath;

src/Files.App/ResourceDictionaries/PathIcons.xaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,82 @@
18721872
</Setter.Value>
18731873
</Setter>
18741874
</Style>
1875+
1876+
<Style x:Key="ColorIconGitBranches" TargetType="local:OpacityIcon">
1877+
<Setter Property="Template">
1878+
<Setter.Value>
1879+
<ControlTemplate>
1880+
<Viewbox
1881+
Width="12"
1882+
Height="12"
1883+
Stretch="Fill">
1884+
<Grid Width="16" Height="16">
1885+
<Path
1886+
x:Name="Path1"
1887+
Data="M1 2.5C1 1.67157 1.67157 1 2.5 1C3.32843 1 4 1.67157 4 2.5C4 3.32843 3.32843 4 2.5 4C1.67157 4 1 3.32843 1 2.5Z"
1888+
Fill="{ThemeResource IconAltBrush}" />
1889+
<Path
1890+
x:Name="Path2"
1891+
Data="M11 2.5C11 1.67157 11.6716 1 12.5 1C13.3284 1 14 1.67157 14 2.5C14 3.32843 13.3284 4 12.5 4C11.6716 4 11 3.32843 11 2.5Z"
1892+
Fill="{ThemeResource IconAltBrush}" />
1893+
<Path
1894+
x:Name="Path3"
1895+
Data="M5 2.5C5 3.70948 4.14112 4.71836 3 4.94999V7C3 7.55228 3.44772 8 4 8H11C11.5523 8 12 7.55228 12 7V4.94999C10.8589 4.71836 10 3.70948 10 2.5C10 1.11929 11.1193 0 12.5 0C13.8807 0 15 1.11929 15 2.5C15 3.70948 14.1411 4.71836 13 4.94999V7C13 8.10457 12.1046 9 11 9H8V11.05C9.14112 11.2816 10 12.2905 10 13.5C10 14.8807 8.88071 16 7.5 16C6.11929 16 5 14.8807 5 13.5C5 12.2905 5.85888 11.2816 7 11.05V9H4C2.89543 9 2 8.10457 2 7V4.94999C0.85888 4.71836 0 3.70948 0 2.5C0 1.11929 1.11929 0 2.5 0C3.88071 0 5 1.11929 5 2.5ZM2.5 1C1.67157 1 1 1.67157 1 2.5C1 3.32843 1.67157 4 2.5 4C3.32843 4 4 3.32843 4 2.5C4 1.67157 3.32843 1 2.5 1ZM7.5 12C6.67157 12 6 12.6716 6 13.5C6 14.3284 6.67157 15 7.5 15C8.32843 15 9 14.3284 9 13.5C9 12.6716 8.32843 12 7.5 12ZM14 2.5C14 3.32843 13.3284 4 12.5 4C11.6716 4 11 3.32843 11 2.5C11 1.67157 11.6716 1 12.5 1C13.3284 1 14 1.67157 14 2.5Z"
1896+
Fill="{ThemeResource IconBaseBrush}" />
1897+
</Grid>
1898+
1899+
<VisualStateManager.VisualStateGroups>
1900+
<VisualStateGroup>
1901+
<VisualState x:Name="Normal" />
1902+
<VisualState x:Name="Disabled" />
1903+
<VisualState x:Name="Selected" />
1904+
</VisualStateGroup>
1905+
</VisualStateManager.VisualStateGroups>
1906+
</Viewbox>
1907+
</ControlTemplate>
1908+
</Setter.Value>
1909+
</Setter>
1910+
</Style>
1911+
1912+
<Style x:Key="ColorIconGitPull" TargetType="local:OpacityIcon">
1913+
<Setter Property="Template">
1914+
<Setter.Value>
1915+
<ControlTemplate>
1916+
<Viewbox
1917+
Width="12"
1918+
Height="12"
1919+
Stretch="Fill">
1920+
<Grid Width="16" Height="16">
1921+
<Path
1922+
x:Name="Path1"
1923+
Data="M13.5 11C12.6716 11 12 11.6716 12 12.5C12 13.3284 12.6716 14 13.5 14C14.3284 14 15 13.3284 15 12.5C15 11.6716 14.3284 11 13.5 11Z"
1924+
Fill="{ThemeResource IconAltBrush}" />
1925+
<Path
1926+
x:Name="Path2"
1927+
Data="M6.5 2C5.67157 2 5 2.67157 5 3.5C5 4.32843 5.67157 5 6.5 5C7.32843 5 8 4.32843 8 3.5C8 2.67157 7.32843 2 6.5 2Z"
1928+
Fill="{ThemeResource AccentFillColorDefaultBrush}" />
1929+
<Path
1930+
x:Name="Path3"
1931+
Data="M15.1464 6.14645C15.3417 5.95118 15.6583 5.95118 15.8536 6.14645C16.0488 6.34171 16.0488 6.65829 15.8536 6.85355L13.8536 8.85355C13.6583 9.04882 13.3417 9.04882 13.1464 8.85355L11.1464 6.85355C10.9512 6.65829 10.9512 6.34171 11.1464 6.14645C11.3417 5.95118 11.6583 5.95118 11.8536 6.14645L13 7.29289V5C13 4.44772 12.5523 4 12 4L8.94999 4C8.71836 5.14112 7.70948 6 6.5 6C5.11929 6 4 4.88071 4 3.5C4 2.11929 5.11929 1 6.5 1C7.70948 1 8.71836 1.85888 8.94999 3L12 3C13.1046 3 14 3.89543 14 5V7.29289L15.1464 6.14645ZM8 3.5C8 4.32843 7.32843 5 6.5 5C5.67157 5 5 4.32843 5 3.5C5 2.67157 5.67157 2 6.5 2C7.32843 2 8 2.67157 8 3.5Z"
1932+
Fill="{ThemeResource IconBaseBrush}" />
1933+
<Path
1934+
x:Name="Path4"
1935+
Data="M16 12.5C16 13.8807 14.8807 15 13.5 15C12.2905 15 11.2816 14.1411 11.05 13H4.94999C4.71836 14.1411 3.70948 15 2.5 15C1.11929 15 -6.03528e-08 13.8807 0 12.5C6.03528e-08 11.1193 1.11929 10 2.5 10C3.70948 10 4.71836 10.8589 4.94999 12H11.05C11.2816 10.8589 12.2905 10 13.5 10C14.8807 10 16 11.1193 16 12.5ZM13.5 14C14.3284 14 15 13.3284 15 12.5C15 11.6716 14.3284 11 13.5 11C12.6716 11 12 11.6716 12 12.5C12 13.3284 12.6716 14 13.5 14ZM2.5 14C3.32843 14 4 13.3284 4 12.5C4 11.6716 3.32843 11 2.5 11C1.67157 11 1 11.6716 1 12.5C1 13.3284 1.67157 14 2.5 14Z"
1936+
Fill="{ThemeResource IconBaseBrush}" />
1937+
</Grid>
1938+
1939+
<VisualStateManager.VisualStateGroups>
1940+
<VisualStateGroup>
1941+
<VisualState x:Name="Normal" />
1942+
<VisualState x:Name="Disabled" />
1943+
<VisualState x:Name="Selected" />
1944+
</VisualStateGroup>
1945+
</VisualStateManager.VisualStateGroups>
1946+
</Viewbox>
1947+
</ControlTemplate>
1948+
</Setter.Value>
1949+
</Setter>
1950+
</Style>
18751951
</ResourceDictionary>
18761952
</ResourceDictionary.MergedDictionaries>
18771953
</ResourceDictionary>

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,9 +3151,6 @@
31513151
<data name="EditPath" xml:space="preserve">
31523152
<value>Edit path</value>
31533153
</data>
3154-
<data name="Branch" xml:space="preserve">
3155-
<value>Branch: {0}</value>
3156-
</data>
31573154
<data name="Redo" xml:space="preserve">
31583155
<value>Redo</value>
31593156
</data>

src/Files.App/UserControls/StatusBarControl.xaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
88
xmlns:helpers="using:Files.App.Helpers"
99
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
10+
xmlns:usercontrols="using:Files.App.UserControls"
1011
d:DesignHeight="32"
1112
d:DesignWidth="400"
1213
mc:Ignorable="d">
@@ -141,22 +142,22 @@
141142
Grid.Column="1"
142143
VerticalAlignment="Center"
143144
x:Load="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}"
144-
Orientation="Horizontal">
145+
Orientation="Horizontal"
146+
Spacing="4">
145147

146148
<!-- Pull Button -->
147149
<Button
148150
x:Name="GitPullButton"
151+
Height="24"
152+
Padding="8,0,8,0"
149153
VerticalAlignment="Center"
150154
Background="Transparent"
151155
BorderBrush="Transparent"
152156
Command="{x:Bind Commands.GitPull}"
153157
IsEnabled="{x:Bind Commands.GitPull.IsExecutable, Mode=OneWay}"
154158
ToolTipService.ToolTip="{x:Bind Commands.GitPull.LabelWithHotKey, Mode=OneWay}">
155159
<StackPanel Orientation="Horizontal" Spacing="8">
156-
<FontIcon
157-
HorizontalAlignment="Center"
158-
FontSize="12"
159-
Glyph="{x:Bind Commands.GitPull.Glyph.BaseGlyph}" />
160+
<usercontrols:OpacityIcon Style="{StaticResource ColorIconGitPull}" />
160161

161162
<!-- Remote commits -->
162163
<TextBlock Text="{x:Bind DirectoryPropertiesViewModel.PullInfo, Mode=OneWay}" />
@@ -165,10 +166,21 @@
165166

166167
<Button
167168
x:Name="GitBranch"
169+
Height="24"
170+
Padding="8,0,8,0"
168171
Background="Transparent"
169172
BorderBrush="Transparent"
170-
Content="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay}"
171173
ToolTipService.ToolTip="{helpers:ResourceString Name=ManageBranches}">
174+
175+
<Button.Content>
176+
<StackPanel Orientation="Horizontal" Spacing="8">
177+
<usercontrols:OpacityIcon Style="{StaticResource ColorIconGitBranches}" />
178+
179+
<!-- Branch Name -->
180+
<TextBlock Text="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay}" />
181+
</StackPanel>
182+
</Button.Content>
183+
172184
<Button.Flyout>
173185
<Flyout x:Name="BranchesFlyout" Opening="BranchesFlyout_Opening">
174186
<Grid

0 commit comments

Comments
 (0)