Skip to content

Commit d9b70e6

Browse files
Refactor save settings logic
SettingWindowViewModel.Save() only saves Flow settings
1 parent 07c1a0b commit d9b70e6

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ private static void DeletePythonBinding()
4848
}
4949
}
5050

51+
/// <summary>
52+
/// Save json and ISavable
53+
/// </summary>
5154
public static void Save()
5255
{
5356
foreach (var plugin in AllPlugins)

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void RestartApp()
7777

7878
public void SaveAppAllSettings()
7979
{
80-
SavePluginSettings();
80+
PluginManager.Save();
8181
_mainVM.Save();
8282
_settingsVM.Save();
8383
ImageLoader.Save();
@@ -158,6 +158,9 @@ public void LogException(string className, string message, Exception e,
158158

159159
private readonly ConcurrentDictionary<Type, object> _pluginJsonStorages = new();
160160

161+
/// <summary>
162+
/// Save plugin settings.
163+
/// </summary>
161164
public void SavePluginSettings()
162165
{
163166
foreach (var value in _pluginJsonStorages.Values)

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ private void OnClosed(object sender, EventArgs e)
226226
settings.SettingWindowTop = Top;
227227
settings.SettingWindowLeft = Left;
228228
viewModel.Save();
229+
API.SavePluginSettings();
229230
}
230231

231232
private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public bool PortableMode
133133
}
134134
}
135135

136+
/// <summary>
137+
/// Save Flow settings. Plugins settings are not included.
138+
/// </summary>
136139
public void Save()
137140
{
138141
foreach (var vm in PluginViewModels)
@@ -143,7 +146,6 @@ public void Save()
143146
Settings.PluginSettings.Plugins[id].Priority = vm.Priority;
144147
}
145148

146-
PluginManager.Save();
147149
_storage.Save();
148150
}
149151

0 commit comments

Comments
 (0)