From b0bbe73658c3083bfcdcca93831a88972b620f2c Mon Sep 17 00:00:00 2001 From: Sushma Rai Date: Tue, 4 Oct 2005 13:06:08 +0000 Subject: dded case insensitive compare support etable, and using it for Organization filed. Fixes #207110. Patch submitted by "Devashish Sharma " svn path=/trunk/; revision=30489 --- addressbook/ChangeLog | 7 +++++++ addressbook/gui/widgets/e-addressbook-view.etspec | 2 +- e-util/ChangeLog | 5 +++++ e-util/e-util.c | 13 +++++++++++++ e-util/e-util.h | 2 ++ widgets/table/ChangeLog | 7 +++++++ widgets/table/e-table-extras.c | 1 + 7 files changed, 36 insertions(+), 1 deletion(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 85740ecb3a..79bbd9abb0 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2005-10-04 Devashish Sharma + + * gui/widgets/e-addressbook-view.etspec: Changed the compare type for + "Organization" to stringcase. This new type has been defined for + performing case insensitive locale sensitive UTF8 string compares. + Fixes #207110. + 2005-10-04 Devashish Sharma * gui/widgets/e-addresbook-view.etspec: Changed the compare type for diff --git a/addressbook/gui/widgets/e-addressbook-view.etspec b/addressbook/gui/widgets/e-addressbook-view.etspec index 3c85c3087c..2aba2af5b1 100644 --- a/addressbook/gui/widgets/e-addressbook-view.etspec +++ b/addressbook/gui/widgets/e-addressbook-view.etspec @@ -36,7 +36,7 @@ different and established translation for this in your language. --> - + diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 3aa33477a0..f8c63cea64 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2005-10-04 Devashish Sharma + + * e-util.c (g_str_case_compare): added a function for case insensitive + and locale sensitive UTF8 string compare. See #207110. + 2005-09-28 Tor Lillqvist * e-html-utils.c (e_text_to_html_full): Use g_ascii_strncasecmp() diff --git a/e-util/e-util.c b/e-util/e-util.c index 7a9f81d81b..bf4fe6292b 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -57,6 +57,19 @@ g_str_compare (const void *x, const void *y) return strcmp (x, y); } +int +g_str_case_compare (const void *x, const void *y) +{ + if (x == NULL || y == NULL) { + if (x == y) + return 0; + else + return x ? -1 : 1; + } + + return g_utf8_collate (g_utf8_casefold (x, -1), g_utf8_casefold (y, -1)); +} + int g_collate_compare (const void *x, const void *y) { diff --git a/e-util/e-util.h b/e-util/e-util.h index 6fe75746c2..d665a67052 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -139,6 +139,8 @@ typedef enum { } EFocus; int g_str_compare (const void *x, const void *y); +int g_str_case_compare (const void *x, + const void *y); int g_collate_compare (const void *x, const void *y); int g_int_compare (const void *x, diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index 93a045b66e..5b9ddc0898 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,10 @@ +2005-10-04 Devashish Sharma + + * e-table-extras.c (ete_init): Added compare type "stringcase" to + ETableExtras to comapre hash table for case insensitive strings. The + corresponding function g_str_case_compare has been added to e-util.c. + See #207110. + 2005-09-29 Tor Lillqvist * e-table.c (e_table_load_specification) diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index e8529914e8..8bb4c23ae6 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -168,6 +168,7 @@ ete_init (ETableExtras *extras) extras->pixbufs = g_hash_table_new(g_str_hash, g_str_equal); e_table_extras_add_compare(extras, "string", g_str_compare); + e_table_extras_add_compare(extras, "stringcase", g_str_case_compare); e_table_extras_add_compare(extras, "collate", g_collate_compare); e_table_extras_add_compare(extras, "integer", g_int_compare); e_table_extras_add_compare(extras, "string-integer", e_strint_compare); -- cgit v1.2.3