[gnumeric] Make searching in define-names dialog case-insensitive.



commit 6c6de10dc19b930f5d1896e69e26671c8f9e2a0d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jun 4 11:28:27 2010 -0600

    Make searching in define-names dialog case-insensitive.
    
    2010-06-04 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-define-names.c (cb_name_guru_search): make searching
    	  case-insensitive.

 src/dialogs/ChangeLog             |    5 +++++
 src/dialogs/dialog-define-names.c |   15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 6ecbda2..416b2f5 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,10 @@
 2010-06-04 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-define-names.c (cb_name_guru_search): make searching
+	  case-insensitive.
+
+2010-06-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-define-names.c: convert GtkTreeModelFilter iters to
 	  GtkTreeStore iters throughout
 	(cb_name_guru_show_all): new
diff --git a/src/dialogs/dialog-define-names.c b/src/dialogs/dialog-define-names.c
index 2bae6ba..da10e9e 100644
--- a/src/dialogs/dialog-define-names.c
+++ b/src/dialogs/dialog-define-names.c
@@ -223,8 +223,19 @@ cb_name_guru_search (GtkTreeModel *model, GtkTreePath *path,
 
 	if (type != item_type_workbook &&
 	    type != item_type_main_sheet &&
-	    type != item_type_other_sheet)
-		visible = (NULL != g_strstr_len (name, -1, text));
+	    type != item_type_other_sheet) {
+		gchar *name_n, *name_cf, *text_n, *text_cf;
+
+		text_n = g_utf8_normalize (text, -1, G_NORMALIZE_ALL);
+		text_cf = g_utf8_casefold(text_n, -1);
+		name_n = g_utf8_normalize (name, -1, G_NORMALIZE_ALL);
+		name_cf = g_utf8_casefold(name_n, -1);
+		visible = (NULL != g_strstr_len (name_cf, -1, text_cf));
+		g_free (text_n); 
+		g_free (text_cf);
+		g_free (name_n); 
+		g_free (name_cf);
+	}
 	
 	if (visible != was_visible)
 		gtk_tree_store_set (GTK_TREE_STORE (model), iter, 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]