[gtk] placesview: Make "Other Locations" search case-insensitive
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] placesview: Make "Other Locations" search case-insensitive
- Date: Sun, 21 Jul 2019 10:45:57 +0000 (UTC)
commit 7eae9d115cb0fde397c767a9d5912b853eae1759
Author: Timm Bäder <mail baedert org>
Date: Sun Jul 21 09:51:54 2019 +0200
placesview: Make "Other Locations" search case-insensitive
It's just weird to search for "c" and not find the list item labelled
"Computer".
gtk/gtkplacesview.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 75c4af2372..f91c7e2d8c 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1999,10 +1999,22 @@ listbox_filter_func (GtkListBoxRow *row,
NULL);
if (name)
- retval |= strstr (name, priv->search_query) != NULL;
+ {
+ char *lowercase_name = g_utf8_strdown (name, -1);
+
+ retval |= strstr (lowercase_name, priv->search_query) != NULL;
+
+ g_free (lowercase_name);
+ }
if (path)
- retval |= strstr (path, priv->search_query) != NULL;
+ {
+ char *lowercase_path = g_utf8_strdown (path, -1);
+
+ retval |= strstr (lowercase_path, priv->search_query) != NULL;
+
+ g_free (lowercase_path);
+ }
g_free (name);
g_free (path);
@@ -2459,7 +2471,7 @@ gtk_places_view_set_search_query (GtkPlacesView *view,
if (g_strcmp0 (priv->search_query, query_text) != 0)
{
g_clear_pointer (&priv->search_query, g_free);
- priv->search_query = g_strdup (query_text);
+ priv->search_query = g_utf8_strdown (query_text, -1);
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->listbox));
gtk_list_box_invalidate_headers (GTK_LIST_BOX (priv->listbox));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]