From fb68f6eb603f22c5496122f50d2563fb24474435 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Fri, 19 Aug 2016 19:16:06 +0100 Subject: [PATCH] Remove enable property from model --- .../AddProgramSource.xaml.cs | 1 - Plugins/Wox.Plugin.Program/Main.cs | 28 ++++++------------- .../Wox.Plugin.Program/ProgramSetting.xaml.cs | 1 - .../ProgramSources/ProgramSource.cs | 1 - 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs index 507626eb05..2fe3f302c2 100644 --- a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs +++ b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs @@ -57,7 +57,6 @@ namespace Wox.Plugin.Program Location = Directory.Text, MaxDepth = max, Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator), - Enabled = true }; _settings.ProgramSources.Add(source); } diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index 924f07520b..463f47016e 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -150,27 +150,17 @@ namespace Wox.Plugin.Program private static List ProgramSources() { - var sources = new List + var sources = new List(); + if (_settings.EnableStartMenuSource) { - new CommonStartMenuProgramSource - { - Enabled = _settings.EnableStartMenuSource, - }, - new UserStartMenuProgramSource - { - Enabled = _settings.EnableStartMenuSource, - }, - new AppPathsProgramSource - { - Enabled = _settings.EnableRegistrySource, - } - }; - - if (_settings.ProgramSources.Count(o => o.Enabled) > 0) - { - sources.AddRange(_settings.ProgramSources); + sources.Add(new CommonStartMenuProgramSource()); + sources.Add(new UserStartMenuProgramSource()); } - + if (_settings.EnableRegistrySource) + { + sources.Add(new AppPathsProgramSource()); + } + sources.AddRange(_settings.ProgramSources); return sources; } diff --git a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs index f54cc7b3e6..6f2f777969 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs @@ -123,7 +123,6 @@ namespace Wox.Plugin.Program _settings.ProgramSources.Add(new FileSystemProgramSource { Location = s, - Enabled = true }); ReIndexing(); diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs index 3245e3f03d..0141a321da 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs @@ -10,7 +10,6 @@ namespace Wox.Plugin.Program.ProgramSources { public const char SuffixSeperator = ';'; - public bool Enabled { get; set; } = true; // happlebao todo: temp hack for program suffixes public string[] Suffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"}; public int MaxDepth { get; set; } = -1;