[Xfce4-commits] [xfce/thunar] 01/01: Make path entry matching case-insensitive (Bug #12747)

noreply at xfce.org noreply at xfce.org
Fri Mar 13 22:00:21 CET 2020


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit c58510b4851f62cf8dac6233df140e3f6c19d4ca
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Fri Mar 13 14:30:06 2020 +0100

    Make path entry matching case-insensitive (Bug #12747)
---
 thunar/thunar-path-entry.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index 76b5b64..3f05d0f 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -818,6 +818,30 @@ thunar_path_entry_common_prefix_append (ThunarPathEntry *path_entry,
 
 
 
+static gboolean
+thunar_path_entry_has_prefix_casefolded (const gchar *string,
+                                         const gchar *prefix)
+{
+  gchar *string_casefolded;
+  gchar *prefix_casefolded;
+  gboolean has_prefix;
+
+  if (string == NULL || prefix == NULL)
+    return FALSE;
+
+  string_casefolded = g_utf8_casefold (string, -1);
+  prefix_casefolded = g_utf8_casefold (prefix, -1);
+
+  has_prefix = g_str_has_prefix (string_casefolded , prefix_casefolded);
+
+  g_free (string_casefolded);
+  g_free (prefix_casefolded);
+
+  return has_prefix;
+}
+
+
+
 static void
 thunar_path_entry_common_prefix_lookup (ThunarPathEntry *path_entry,
                                         gchar          **prefix_return,
@@ -851,7 +875,7 @@ thunar_path_entry_common_prefix_lookup (ThunarPathEntry *path_entry,
           gtk_tree_model_get (model, &iter, THUNAR_COLUMN_FILE_NAME, &name, -1);
 
           /* check if we have a valid prefix here */
-          if (g_str_has_prefix (name, text))
+          if (thunar_path_entry_has_prefix_casefolded (name, text))
             {
               /* check if we're the first to match */
               if (*prefix_return == NULL)
@@ -945,7 +969,7 @@ thunar_path_entry_match_func (GtkEntryCompletion *completion,
 
       /* check if we have a match here */
       if (name_normalized != NULL)
-        matched = g_str_has_prefix (name_normalized, last_slash);
+        matched = thunar_path_entry_has_prefix_casefolded (name_normalized, last_slash);
       else
         matched = FALSE;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list