Skip to content

Commit 7b08c96

Browse files
authored
Merge pull request #3889 from zoltanvi/bugfix/web_search
Fix property binding in WebSearch plugin
2 parents defe62b + 5a74b84 commit 7b08c96

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,19 @@ public Settings()
191191
[JsonIgnore]
192192
public SearchSource SelectedSearchSource { get; set; }
193193

194-
public bool EnableSuggestion { get; set; }
194+
private bool enableSuggestion;
195+
public bool EnableSuggestion
196+
{
197+
get => enableSuggestion;
198+
set
199+
{
200+
if (enableSuggestion != value)
201+
{
202+
enableSuggestion = value;
203+
OnPropertyChanged(nameof(EnableSuggestion));
204+
}
205+
}
206+
}
195207

196208
[JsonIgnore]
197209
public SuggestionSource[] Suggestions { get; set; } = {
@@ -221,9 +233,5 @@ public string Suggestion
221233
}
222234
}
223235
}
224-
225-
public string BrowserPath { get; set; }
226-
227-
public bool OpenInNewBrowser { get; set; } = true;
228236
}
229237
}

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
mc:Ignorable="d">
1212

1313
<UserControl.Resources>
14-
<Style x:Key="BrowserPathBoxStyle" TargetType="TextBox">
15-
<Setter Property="Height" Value="28" />
16-
<Setter Property="VerticalContentAlignment" Value="Center" />
17-
</Style>
1814
<DataTemplate x:Key="HeaderTemplateArrowUp">
1915
<DockPanel>
2016
<TextBlock HorizontalAlignment="Center" Text="{Binding}" />
@@ -138,7 +134,7 @@
138134
Margin="{StaticResource SettingPanelItemLeftMargin}"
139135
VerticalAlignment="Center"
140136
FontSize="11"
141-
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}"
137+
IsEnabled="{Binding Settings.EnableSuggestion}"
142138
ItemsSource="{Binding Settings.Suggestions}"
143139
SelectedItem="{Binding Settings.SelectedSuggestion}" />
144140
<CheckBox
@@ -149,7 +145,6 @@
149145
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
150146
IsChecked="{Binding Settings.EnableSuggestion}" />
151147
</StackPanel>
152-
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
153148
</DockPanel>
154149
</Grid>
155150
</UserControl>

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ private void SortByColumn(object sender, RoutedEventArgs e)
9494
var columnBinding = headerClicked.Column.DisplayMemberBinding as Binding;
9595
var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string;
9696

97-
if(sortBy != null) {
97+
if (sortBy != null)
98+
{
9899
Sort(sortBy, direction);
99100

100101
if (direction == ListSortDirection.Ascending)

Plugins/Flow.Launcher.Plugin.WebSearch/setting.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@
141141
"Enabled": true
142142
}
143143
],
144-
"EnableWebSearchSuggestion": false,
145-
"WebSearchSuggestionSource": "Google"
144+
"EnableSuggestion": false,
145+
"Suggestion": "Google"
146146
}

0 commit comments

Comments
 (0)