From 161154a6bfa06f5e4d7e54ee2ab1da9c0f6b743d Mon Sep 17 00:00:00 2001 From: Alain Date: Tue, 22 Oct 2024 20:38:46 +0000 Subject: [PATCH] SearchView: only invalidate when search isn't empty (#327) --- data/settings.appdata.xml.in | 3 +++ src/SearchView.vala | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/data/settings.appdata.xml.in b/data/settings.appdata.xml.in index 1321c37d..2505480d 100644 --- a/data/settings.appdata.xml.in +++ b/data/settings.appdata.xml.in @@ -45,6 +45,9 @@
  • Updated translations
  • + + Search returns alphabetically sorted list after clicking on a search result + diff --git a/src/SearchView.vala b/src/SearchView.vala index a2d2b9f3..10226df9 100644 --- a/src/SearchView.vala +++ b/src/SearchView.vala @@ -48,9 +48,12 @@ public class Switchboard.SearchView : Gtk.Box { search_entry.search_changed.connect (() => { alert_view.title = _("No Results for ā€œ%sā€").printf (search_entry.text); - listbox.invalidate_filter (); - listbox.invalidate_sort (); - listbox.select_row (null); + + if (search_entry.text.length > 0) { + listbox.invalidate_filter (); + listbox.invalidate_sort (); + listbox.select_row (null); + } }); listbox.row_activated.connect ((row) => { @@ -58,6 +61,7 @@ public class Switchboard.SearchView : Gtk.Box { ((SearchRow) row).uri.replace ("settings://", ""), Switchboard.PlugsManager.get_default () ); + search_entry.text = ""; }); }