Skip to content

Commit 91564e0

Browse files
committed
remove null state from action keyword Enabled status
1 parent 267fb65 commit 91564e0

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}"
3232
Width="auto"
3333
VerticalAlignment="Center" IsChecked="{Binding Enabled}"
34-
Visibility="{Binding Visible}"/>
34+
Visibility="{Binding EnabledVisibility}"/>
3535
<Button Name="DownButton"
3636
Click="OnDoneButtonClick" Grid.Row="1" Grid.Column="2"
3737
Margin="10 0 10 0" Width="80" Height="35"

Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ public string ActionKeyword
2323
set
2424
{
2525
// Set Enable to be true if user change ActionKeyword
26-
if (Enabled is not null)
27-
Enabled = true;
26+
Enabled = true;
2827
_actionKeyword = value;
2928
}
3029
}
3130

32-
public bool? Enabled { get; set; }
31+
public bool Enabled { get; set; }
3332

3433
private string _actionKeyword;
3534

36-
public Visibility Visible =>
37-
CurrentActionKeyword.Enabled is not null ? Visibility.Visible : Visibility.Collapsed;
35+
public Visibility EnabledVisibility
36+
=> CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword
37+
? Visibility.Collapsed : Visibility.Visible;
3838

3939
public ActionKeywordSetting(SettingsViewModel settingsViewModel,
4040
ActionKeywordView selectedActionKeyword)

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ internal ActionKeywordView(Settings.ActionKeyword actionKeyword, string descript
325325
}
326326

327327
public string Description { get; private init; }
328-
public string Color => Enabled ?? true ? "Black" : "Gray";
328+
public string Color => Enabled ? "Black" : "Gray";
329329

330330
internal Settings.ActionKeyword KeywordProperty { get; }
331331

@@ -335,11 +335,10 @@ public string Keyword
335335
set => _settings.SetActionKeyword(KeywordProperty, value);
336336
}
337337

338-
public bool? Enabled
338+
public bool Enabled
339339
{
340340
get => _settings.GetActionKeywordEnabled(KeywordProperty);
341-
set => _settings.SetActionKeywordEnabled(KeywordProperty,
342-
value ?? throw new ArgumentException("Unexpected null value"));
341+
set => _settings.SetActionKeywordEnabled(KeywordProperty, value);
343342
}
344343
}
345344
}

0 commit comments

Comments
 (0)