Skip to content

Commit 161154a

Browse files
authored
SearchView: only invalidate when search isn't empty (#327)
1 parent be7f38a commit 161154a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

data/settings.appdata.xml.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
<li>Updated translations</li>
4646
</ul>
4747
</description>
48+
<issues>
49+
<issue url="https://github.com/elementary/switchboard/issues/182">Search returns alphabetically sorted list after clicking on a search result</issue>
50+
</issues>
4851
</release>
4952

5053
<release version="8.0.0" date="2024-05-21" urgency="medium">

src/SearchView.vala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ public class Switchboard.SearchView : Gtk.Box {
4848

4949
search_entry.search_changed.connect (() => {
5050
alert_view.title = _("No Results for “%s").printf (search_entry.text);
51-
listbox.invalidate_filter ();
52-
listbox.invalidate_sort ();
53-
listbox.select_row (null);
51+
52+
if (search_entry.text.length > 0) {
53+
listbox.invalidate_filter ();
54+
listbox.invalidate_sort ();
55+
listbox.select_row (null);
56+
}
5457
});
5558

5659
listbox.row_activated.connect ((row) => {
5760
app.load_setting_path (
5861
((SearchRow) row).uri.replace ("settings://", ""),
5962
Switchboard.PlugsManager.get_default ()
6063
);
64+
6165
search_entry.text = "";
6266
});
6367
}

0 commit comments

Comments
 (0)