changeset 2007:99d652a3bf67 trunk

[svn] jump to file improvement: - case insensitive search - AND search with keywords
author yaz
date Sat, 25 Nov 2006 09:25:21 -0800
parents beaeb1990cb4
children efe4e38ffa32
files ChangeLog audacious/mainwin.c
diffstat 2 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 25 00:31:33 2006 -0800
+++ b/ChangeLog	Sat Nov 25 09:25:21 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-25 08:31:33 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [3005]
+  - now filepopup can find newly added images immediately.
+  
+  trunk/audacious/ui_fileinfo.c |   39 +++++++++++++++++----------------------
+  1 file changed, 17 insertions(+), 22 deletions(-)
+
+
 2006-11-24 17:49:06 +0000  Jonathan Schleifer <js@h3c.de>
   revision [3003]
   Fixed wrong help, it has to be --with-rc-path.
--- a/audacious/mainwin.c	Sat Nov 25 00:31:33 2006 -0800
+++ b/audacious/mainwin.c	Sat Nov 25 09:25:21 2006 -0800
@@ -1843,12 +1843,22 @@
 mainwin_jump_to_file_match(const gchar * song, gchar ** keys)
 {
     gint i = 0;
-
-    for (i = 0; keys[i] != NULL; i++)
-        if (strstr(song, keys[i]))
-            return TRUE;
-
-    return FALSE;
+    gboolean rv = TRUE;
+
+    while (keys[i]) {
+        gint len = strlen(keys[i]);
+        gint j = 0;        
+        while (*(song + j)) {
+            if (!g_strncasecmp(song + j, keys[i], len))
+                goto found;
+            j++;
+        }
+        rv = FALSE;
+    found:
+        i++;
+    }
+
+    return rv;
 }
 
 /* FIXME: Clear the entry when the list gets updated */
@@ -1957,7 +1967,7 @@
          * In any case the string to match should _never_ contain
          * something the user can't actually see in the playlist.
          */
-        if (words[0] != NULL && strlen(words[0]) > 3)
+        if (words[0] != NULL)
             match = mainwin_jump_to_file_match(title, words);
         else
             match = TRUE;