Skip to content

Commit c350c5d

Browse files
committed
The rest of the settings window cleanup
1 parent baeb01f commit c350c5d

File tree

5 files changed

+191
-1342
lines changed

5 files changed

+191
-1342
lines changed

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
Margin="0 0 22 0"
5555
VerticalAlignment="Center"
5656
Command="{Binding EditPluginPriorityCommand}"
57-
Content="{Binding Priority, UpdateSourceTrigger=PropertyChanged}"
57+
Content="{Binding Priority}"
5858
Cursor="Hand"
5959
ToolTip="{DynamicResource priorityToolTip}">
6060
<!--#region Priority Button Style-->
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using CommunityToolkit.Mvvm.Input;
43
using Flow.Launcher.Core.Plugin;
54
using Flow.Launcher.Infrastructure;
65
using Flow.Launcher.Infrastructure.UserSettings;
@@ -11,7 +10,7 @@
1110

1211
namespace Flow.Launcher.SettingPages.ViewModels;
1312

14-
public partial class SettingsPanePluginsViewModel : BaseModel
13+
public class SettingsPanePluginsViewModel : BaseModel
1514
{
1615
private readonly Settings _settings;
1716

@@ -23,26 +22,23 @@ public SettingsPanePluginsViewModel(Settings settings)
2322
public string FilterText { get; set; } = string.Empty;
2423

2524
public PluginViewModel? SelectedPlugin { get; set; }
25+
2626
private IEnumerable<PluginViewModel>? _pluginViewModels;
2727
private IEnumerable<PluginViewModel> PluginViewModels => _pluginViewModels ??= PluginManager.AllPlugins
28-
.OrderBy(x => x.Metadata.Disabled)
29-
.ThenBy(y => y.Metadata.Name)
30-
.Select(p => new PluginViewModel { PluginPair = p })
28+
.OrderBy(plugin => plugin.Metadata.Disabled)
29+
.ThenBy(plugin => plugin.Metadata.Name)
30+
.Select(plugin => new PluginViewModel
31+
{
32+
PluginPair = plugin,
33+
PluginSettingsObject = _settings.PluginSettings.Plugins[plugin.Metadata.ID]
34+
})
3135
.ToList();
36+
3237
public List<PluginViewModel> FilteredPluginViewModels => PluginViewModels
3338
.Where(v =>
3439
string.IsNullOrEmpty(FilterText) ||
3540
StringMatcher.FuzzySearch(FilterText, v.PluginPair.Metadata.Name).IsSearchPrecisionScoreMet() ||
3641
StringMatcher.FuzzySearch(FilterText, v.PluginPair.Metadata.Description).IsSearchPrecisionScoreMet()
3742
)
3843
.ToList();
39-
40-
[RelayCommand]
41-
private void TogglePlugin()
42-
{
43-
if (SelectedPlugin is null) return;
44-
var id = SelectedPlugin.PluginPair.Metadata.ID;
45-
// used to sync the current status from the plugin manager into the setting to keep consistency after save
46-
_settings.PluginSettings.Plugins[id].Disabled = SelectedPlugin.PluginPair.Metadata.Disabled;
47-
}
4844
}

0 commit comments

Comments
 (0)