diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index e8672e249..7bc773d28 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -192,9 +192,9 @@ namespace Flow.Launcher.Plugin.Program if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)) { - _uwps.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) - .Enabled = false; - _settings.DisabledProgramSources.Add(new DisabledProgramSource(programToDelete)); + var program = _uwps.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier); + program.Enabled = false; + _settings.DisabledProgramSources.Add(new ProgramSource(program)); _ = Task.Run(() => { IndexUwpPrograms(); @@ -203,9 +203,9 @@ namespace Flow.Launcher.Plugin.Program } else if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)) { - _win32s.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier) - .Enabled = false; - _settings.DisabledProgramSources.Add(new DisabledProgramSource(programToDelete)); + var program = _win32s.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier); + program.Enabled = false; + _settings.DisabledProgramSources.Add(new ProgramSource(program)); _ = Task.Run(() => { IndexWin32Programs(); diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs index 3afb499f5..a9f88c6dc 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs @@ -9,7 +9,7 @@ namespace Flow.Launcher.Plugin.Program { public DateTime LastIndexTime { get; set; } public List ProgramSources { get; set; } = new List(); - public List DisabledProgramSources { get; set; } = new List(); // For disabled single programs + public List DisabledProgramSources { get; set; } = new List(); // For disabled single programs public string[] ProgramSuffixes { get; set; } = {"appref-ms", "exe", "lnk"}; public bool EnableStartMenuSource { get; set; } = true; diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs index efa7900b0..8a2a5adee 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Commands/ProgramSettingDisplay.cs @@ -14,7 +14,6 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands // Even though these are disabled, we still want to display them so users can enable later on return Main._settings .DisabledProgramSources - .Select(s => new ProgramSource(s)) .Union(Main._settings.ProgramSources) .ToList(); } @@ -62,8 +61,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands var tmp = ProgramSetting.ProgramSettingDisplayList .Where(t1 => !t1.Enabled && !Main._settings.DisabledProgramSources.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier) - && !Main._settings.ProgramSources.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier)) - .Select(x => new DisabledProgramSource(x)); + && !Main._settings.ProgramSources.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier)); Main._settings.DisabledProgramSources.AddRange(tmp); } @@ -76,7 +74,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands // .ForEach(t1 => t1.Enabled = true); Main._settings.DisabledProgramSources - .RemoveAll(t1 => ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier && x.Enabled)); + .RemoveAll(t1 => t1.Enabled); } internal static bool IsReindexRequired(this List selectedItems) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs index 8efa3ef6d..6d24d12d5 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs @@ -83,22 +83,4 @@ namespace Flow.Launcher.Plugin.Program.Views.Models UniqueIdentifier = value.ToLowerInvariant(); // Update } } - - public class DisabledProgramSource : ProgramSource - { - [JsonConstructor] - public DisabledProgramSource(string name, string location, bool enabled, string uniqueIdentifier) : base(name, location, enabled, uniqueIdentifier) { } - - public DisabledProgramSource(string location) : base(location, false) { } - - public DisabledProgramSource(ProgramSource source) : base(source) - { - Enabled = false; - } - - public DisabledProgramSource(IProgram program) : base(program) - { - Enabled = false; - } - } }