Skip to content

Commit 736b3a6

Browse files
committed
InstallationStatusUpdater: Add option to configure whether notifications should be shown after automatic scans
1 parent 29d343f commit 736b3a6

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

source/Generic/InstallationStatusUpdater/Application/GamesInstallationStatusScanner.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ public StatusUpdateResults DetectInstallationStatus(bool showResultsDialog, Canc
6565

6666
public StatusUpdateResults DetectInstallationStatusInternal(CancellationToken cancelToken)
6767
{
68-
int markedInstalled = 0;
69-
int markedUninstalled = 0;
7068
var updateResults = new StatusUpdateResults();
71-
7269
using (_playniteApi.Database.BufferedUpdate())
7370
{
7471
foreach (var game in _playniteApi.Database.Games)
@@ -85,14 +82,12 @@ public StatusUpdateResults DetectInstallationStatusInternal(CancellationToken ca
8582
{
8683
game.IsInstalled = false;
8784
_playniteApi.Database.Games.Update(game);
88-
markedUninstalled++;
8985
updateResults.AddUninstalled(game);
9086
}
9187
else if (!game.IsInstalled && detectedStatus == InstallationDetectionResult.Installed)
9288
{
9389
game.IsInstalled = true;
9490
_playniteApi.Database.Games.Update(game);
95-
markedInstalled++;
9691
updateResults.AddInstalled(game);
9792
}
9893
}
@@ -112,7 +107,8 @@ private void OpenWindowOrAddResultsNotification(bool showResultsDialog, StatusUp
112107
{
113108
OpenResultsWindow(statusUpdateResults);
114109
}
115-
else if (statusUpdateResults.Installed.Count > 0 || statusUpdateResults.Uninstalled.Count > 0)
110+
else if (_settings.Settings.ShowNotificationOnAutomaticScans &&
111+
(statusUpdateResults.Installed.Count > 0 || statusUpdateResults.Uninstalled.Count > 0))
116112
{
117113
var notificationMessage = new NotificationMessage(
118114
Guid.NewGuid().ToString(),

source/Generic/InstallationStatusUpdater/InstallationStatusUpdaterSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class InstallationStatusUpdaterSettings : ObservableObject
2222
public bool UpdateStatusOnUsbChanges { get; set; } = true;
2323
public bool UpdateStatusOnDirChanges { get; set; } = false;
2424
public bool DetectFilesFromLaunchArguments { get; set; } = true;
25+
public bool ShowNotificationOnAutomaticScans { get; set; } = true;
2526

2627
private List<WatchedDirectory> _detectionDirectories = new List<WatchedDirectory>();
2728
public List<WatchedDirectory> DetectionDirectories

source/Generic/InstallationStatusUpdater/Localization/en_US.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Previously uninstalled games were set as installed: {1}</sys:String>
1919
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingScanLibraryGamesWithAction">Scan games from library plugins using their installation directory</sys:String>
2020
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingOnlyUsePlayActionGameActions">Only use Actions marked as "Play Action" for detection</sys:String>
2121
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateOnStartup">Update installation status on startup</sys:String>
22+
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingShowAutoScanNotifications">Show a notification containing results after automatic installation scans</sys:String>
2223
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateOnLibraryUpdate">Update installation status on library update</sys:String>
2324
<sys:String x:Key="LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateLocTagsOnLibUpdate">Update tag with drive the game is installed on library update</sys:String>
2425

source/Generic/InstallationStatusUpdater/Presentation/InstallationStatusUpdaterSettingsView.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
<CheckBox Margin="0,10,0,0" IsChecked="{Binding Settings.UseOnlyFirstRomDetection}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingUseOnlyFirstRomDetection}" />
2727

2828
<TextBlock Text="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSectionAutoScanTriggers}" FontWeight="SemiBold" Margin="0,30,0,0" />
29-
<CheckBox Margin="0,10,0,0" IsChecked="{Binding Settings.UpdateOnStartup}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateOnStartup}" />
29+
<CheckBox Margin="0,10,0,0" IsChecked="{Binding Settings.ShowNotificationOnAutomaticScans}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingShowAutoScanNotifications}" />
30+
<CheckBox Margin="0,20,0,0" IsChecked="{Binding Settings.UpdateOnStartup}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateOnStartup}" />
3031
<CheckBox Margin="0,10,0,0" IsChecked="{Binding Settings.UpdateOnLibraryUpdate}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateOnLibraryUpdate}" />
3132
<CheckBox Margin="0,10,0,0" IsChecked="{Binding Settings.UpdateStatusOnUsbChanges}" Content="{DynamicResource LOCInstallation_Status_Updater_StatusUpdaterSettingUpdateStatusOnUsbChanges}" />
3233

0 commit comments

Comments
 (0)