mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Remove ProgramSource()
This commit is contained in:
parent
bc54b07fdc
commit
7832ab6898
4 changed files with 9 additions and 55 deletions
|
|
@ -59,11 +59,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
{
|
||||
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == Directory.Text))
|
||||
{
|
||||
var source = new ProgramSource
|
||||
{
|
||||
Location = Directory.Text,
|
||||
UniqueIdentifier = Directory.Text
|
||||
};
|
||||
var source = new ProgramSource(Directory.Text);
|
||||
|
||||
_settings.ProgramSources.Insert(0, source);
|
||||
ProgramSetting.ProgramSettingDisplayList.Add(source);
|
||||
|
|
|
|||
|
|
@ -13,16 +13,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands
|
|||
{
|
||||
var list = new List<ProgramSource>();
|
||||
|
||||
programSources.ForEach(x => list
|
||||
.Add(
|
||||
new ProgramSource
|
||||
{
|
||||
Enabled = x.Enabled,
|
||||
Location = x.Location,
|
||||
Name = x.Name,
|
||||
UniqueIdentifier = x.UniqueIdentifier
|
||||
}
|
||||
));
|
||||
programSources.ForEach(x => list.Add(new ProgramSource(x)));
|
||||
|
||||
// Even though these are disabled, we still want to display them so users can enable later on
|
||||
Main._settings
|
||||
|
|
@ -32,16 +23,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands
|
|||
.Any(x => t1.UniqueIdentifier == x.UniqueIdentifier))
|
||||
.Select(x => x)
|
||||
.ToList()
|
||||
.ForEach(x => list
|
||||
.Add(
|
||||
new ProgramSource
|
||||
{
|
||||
Enabled = x.Enabled,
|
||||
Location = x.Location,
|
||||
Name = x.Name,
|
||||
UniqueIdentifier = x.UniqueIdentifier
|
||||
}
|
||||
));
|
||||
.ForEach(x => list.Add(new ProgramSource(x)));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
@ -51,30 +33,12 @@ namespace Flow.Launcher.Plugin.Program.Views.Commands
|
|||
Main._win32s
|
||||
.Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier))
|
||||
.ToList()
|
||||
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList
|
||||
.Add(
|
||||
new ProgramSource
|
||||
{
|
||||
Name = t1.Name,
|
||||
Location = t1.ParentDirectory,
|
||||
UniqueIdentifier = t1.UniqueIdentifier,
|
||||
Enabled = t1.Enabled
|
||||
}
|
||||
));
|
||||
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList.Add(new ProgramSource(t1)));
|
||||
|
||||
Main._uwps
|
||||
.Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier))
|
||||
.ToList()
|
||||
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList
|
||||
.Add(
|
||||
new ProgramSource
|
||||
{
|
||||
Name = t1.DisplayName,
|
||||
Location = t1.Package.Location,
|
||||
UniqueIdentifier = t1.UniqueIdentifier,
|
||||
Enabled = t1.Enabled
|
||||
}
|
||||
));
|
||||
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList.Add(new ProgramSource(t1)));
|
||||
}
|
||||
|
||||
internal static void SetProgramSourcesStatus(this List<ProgramSource> list, List<ProgramSource> selectedProgramSourcesToDisable, bool status)
|
||||
|
|
|
|||
|
|
@ -26,16 +26,14 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
|
|||
/// </summary>
|
||||
public string UniqueIdentifier { get => uid; set => uid = value.ToLowerInvariant(); }
|
||||
|
||||
public ProgramSource()
|
||||
{
|
||||
} // TODO Remove
|
||||
//public ProgramSource() {}
|
||||
|
||||
/// <summary>
|
||||
/// Custom user added source.
|
||||
/// </summary>
|
||||
/// <param name="location"></param>
|
||||
/// <param name="enabled"></param>
|
||||
public ProgramSource(string location, bool enabled)
|
||||
public ProgramSource(string location, bool enabled=true)
|
||||
{
|
||||
Location = location;
|
||||
Enabled = enabled;
|
||||
|
|
|
|||
|
|
@ -199,13 +199,9 @@ namespace Flow.Launcher.Plugin.Program.Views
|
|||
{
|
||||
foreach (string directory in directories)
|
||||
{
|
||||
if (Directory.Exists(directory) && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == directory))
|
||||
if (Directory.Exists(directory) && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == directory.ToLowerInvariant()))
|
||||
{
|
||||
var source = new ProgramSource
|
||||
{
|
||||
Location = directory,
|
||||
UniqueIdentifier = directory
|
||||
};
|
||||
var source = new ProgramSource(directory);
|
||||
|
||||
directoriesToAdd.Add(source);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue