Skip to content

Commit 12d7fa6

Browse files
committed
Merge branch 'release/v8.13'
2 parents 283c681 + 6e12768 commit 12d7fa6

22 files changed

+217
-139
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ This software creates a folder `$"{System.Environment.SpecialFolder.ApplicationD
3939
| OS | PATH |
4040
| --- | --- |
4141
| Windows | `C:\Users\USER_NAME\AppData\Roaming\SourceGit` |
42-
| Linux | `/home/USER_NAME/.config/SourceGit` |
43-
| macOS | `/Users/USER_NAME/.config/SourceGit` |
42+
| Linux | `${HOME}/.config/SourceGit` |
43+
| macOS | `${HOME}/Library/Application Support/SourceGit` |
4444

4545
For **Windows** users:
4646

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.12
1+
8.13

build/build.osx.command

100644100755
File mode changed.

build/resources/rpm/SPECS/build.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ chmod 755 -R $RPM_BUILD_ROOT
2424

2525
%files
2626
/opt
27-
/usr/bin
27+
%attr(555,root,root)/usr/bin
2828
/usr/share
2929

3030
%changelog

screenshots/theme_dark.png

39.4 KB
Loading

screenshots/theme_light.png

42.5 KB
Loading

src/App.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
<NativeMenu.Menu>
2727
<NativeMenu>
2828
<NativeMenuItem Header="{DynamicResource Text.About.Menu}" Command="{x:Static s:App.OpenAboutCommand}"/>
29-
<NativeMenuItem Header="{DynamicResource Text.Hotkeys.Menu}" Command="{x:Static s:App.OpenHotkeysCommand}"/>
29+
<NativeMenuItem Header="{DynamicResource Text.Hotkeys}" Command="{x:Static s:App.OpenHotkeysCommand}"/>
3030
<NativeMenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}"/>
3131
<NativeMenuItemSeparator/>
3232
<NativeMenuItem Header="{DynamicResource Text.Preference}" Command="{x:Static s:App.OpenPreferenceCommand}" Gesture="⌘+,"/>
3333
<NativeMenuItemSeparator/>
34-
<NativeMenuItem Header="{DynamicResource Text.Quit}" Command="{x:Static s:App.QuitCommand}"/>
34+
<NativeMenuItem Header="{DynamicResource Text.Quit}" Command="{x:Static s:App.QuitCommand}" Gesture="⌘+Q"/>
3535
</NativeMenu>
3636
</NativeMenu.Menu>
3737
</Application>

src/App.axaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ public override void OnFrameworkInitializationCompleted()
266266
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
267267
{
268268
BindingPlugins.DataValidators.RemoveAt(0);
269+
Native.OS.SetupEnternalTools();
269270

270271
var launcher = new Views.Launcher();
271272
_notificationReceiver = launcher;

src/Models/ExternalTool.cs

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,23 @@ namespace SourceGit.Models
1212
{
1313
public class ExternalTool
1414
{
15-
public string Name { get; set; } = string.Empty;
16-
public string Icon { get; set; } = string.Empty;
17-
public string Executable { get; set; } = string.Empty;
18-
public string OpenCmdArgs { get; set; } = string.Empty;
15+
public string Name { get; private set; } = string.Empty;
16+
public string Executable { get; private set; } = string.Empty;
17+
public string OpenCmdArgs { get; private set; } = string.Empty;
18+
public Bitmap IconImage { get; private set; } = null;
1919

20-
public Bitmap IconImage
20+
public ExternalTool(string name, string icon, string executable, string openCmdArgs)
2121
{
22-
get
23-
{
24-
if (_isFirstTimeGetIcon)
25-
{
26-
_isFirstTimeGetIcon = false;
27-
28-
if (!string.IsNullOrWhiteSpace(Icon))
29-
{
30-
try
31-
{
32-
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{Icon}.png", UriKind.RelativeOrAbsolute));
33-
_iconImage = new Bitmap(icon);
34-
}
35-
catch
36-
{
37-
}
38-
}
39-
}
22+
Name = name;
23+
Executable = executable;
24+
OpenCmdArgs = openCmdArgs;
4025

41-
return _iconImage;
26+
try
27+
{
28+
var asset = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{icon}.png", UriKind.RelativeOrAbsolute));
29+
IconImage = new Bitmap(asset);
4230
}
31+
catch { }
4332
}
4433

4534
public void Open(string repo)
@@ -52,9 +41,6 @@ public void Open(string repo)
5241
UseShellExecute = false,
5342
});
5443
}
55-
56-
private bool _isFirstTimeGetIcon = true;
57-
private Bitmap _iconImage = null;
5844
}
5945

6046
public class JetBrainsState
@@ -107,13 +93,7 @@ public void TryAdd(string name, string icon, string args, string env, Func<strin
10793
return;
10894
}
10995

110-
Founded.Add(new ExternalTool
111-
{
112-
Name = name,
113-
Icon = icon,
114-
OpenCmdArgs = args,
115-
Executable = path
116-
});
96+
Founded.Add(new ExternalTool(name, icon, path, args));
11797
}
11898

11999
public void VSCode(Func<string> platformFinder)
@@ -154,13 +134,11 @@ public void FindJetBrainsFromToolbox(Func<string> platformFinder)
154134
if (exclude.Contains(tool.ToolId.ToLowerInvariant()))
155135
continue;
156136

157-
Founded.Add(new ExternalTool
158-
{
159-
Name = $"{tool.DisplayName} {tool.DisplayVersion}",
160-
Icon = supported_icons.Contains(tool.ProductCode) ? $"JetBrains/{tool.ProductCode}" : $"JetBrains/JB",
161-
OpenCmdArgs = "\"{0}\"",
162-
Executable = Path.Combine(tool.InstallLocation, tool.LaunchCommand),
163-
});
137+
Founded.Add(new ExternalTool(
138+
$"{tool.DisplayName} {tool.DisplayVersion}",
139+
supported_icons.Contains(tool.ProductCode) ? $"JetBrains/{tool.ProductCode}" : "JetBrains/JB",
140+
Path.Combine(tool.InstallLocation, tool.LaunchCommand),
141+
"\"{0}\""));
164142
}
165143
}
166144
}

src/Models/User.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,14 @@ public override int GetHashCode()
2525

2626
public static User FindOrAdd(string data)
2727
{
28-
if (_caches.TryGetValue(data, out var value))
28+
return _caches.GetOrAdd(data, key =>
2929
{
30-
return value;
31-
}
32-
else
33-
{
34-
var nameEndIdx = data.IndexOf('<', System.StringComparison.Ordinal);
35-
var name = nameEndIdx >= 2 ? data.Substring(0, nameEndIdx - 1) : string.Empty;
36-
var email = data.Substring(nameEndIdx + 1);
37-
38-
User user = new User() { Name = name, Email = email };
39-
_caches.TryAdd(data, user);
40-
return user;
41-
}
30+
var nameEndIdx = key.IndexOf('<', System.StringComparison.Ordinal);
31+
var name = nameEndIdx >= 2 ? key.Substring(0, nameEndIdx - 1) : string.Empty;
32+
var email = key.Substring(nameEndIdx + 1);
33+
34+
return new User() { Name = name, Email = email };
35+
});
4236
}
4337

4438
private static ConcurrentDictionary<string, User> _caches = new ConcurrentDictionary<string, User>();

0 commit comments

Comments
 (0)