Should I push the following patch for the next version?

It changes the behaviour of the component filter, to allow glob matches.
I surround the passed filter string with *<FILTERSTRING>*, so the
current behaviour is retained, and matches anywhere within the component
name are matched.

This might mean more time taken computing the matches though.


commit 6a869fc6875a5965113fae2afa7bfb8523ff5df9
Author: Peter Clifton <[EMAIL PROTECTED]>
Date:   Fri Dec 28 16:34:32 2007 +0000

    Allow standard glob matches in the component selector's filter entry.

diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index abeae9d..9162378 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -359,7 +359,7 @@ lib_model_filter_visible_func (GtkTreeModel *model,
   Compselect *compselect = (Compselect*)data;
   CLibSymbol *sym;
   const gchar *compname;
-  gchar *compname_upper=NULL, *text_upper=NULL;
+  gchar *compname_upper, *text_upper, *pattern;
   const gchar *text;
   gboolean ret;
 
@@ -392,9 +392,11 @@ lib_model_filter_visible_func (GtkTreeModel *model,
        to uppercase */
     compname_upper = g_ascii_strup(compname, -1);
     text_upper = g_ascii_strup(text, -1);
-    ret = (strstr (compname_upper, text_upper) != NULL);
+    pattern = g_strconcat ("*", text_upper, "*", NULL);
+    ret = g_pattern_match_simple (pattern, compname_upper);
     g_free(compname_upper);
     g_free(text_upper);
+    g_free(pattern);
   }
 
   return ret;

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to