[evolution] Bug #552779 - Sort order of messages by "From" is case sensitive



commit 84888e0f7544b8b8cd3f45e4720694277ed5355b
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 16 14:02:08 2009 +0200

    Bug #552779 - Sort order of messages by "From" is case sensitive

 mail/message-list.c      |   20 +++++++-------------
 mail/message-list.etspec |    6 +++---
 2 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index 5972447..a9a49e1 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -293,9 +293,6 @@ e_mail_address_free (EMailAddress *addr)
 	g_free (addr);
 }
 
-/* Note: by the time this function is called, the strings have already
-   been normalised which means we can assume all lowercase chars and
-   we can just use strcmp for the final comparison. */
 static gint
 e_mail_address_compare (gconstpointer address1, gconstpointer address2)
 {
@@ -311,7 +308,7 @@ e_mail_address_compare (gconstpointer address1, gconstpointer address2)
 		g_return_val_if_fail (addr1->address != NULL, 1);
 		g_return_val_if_fail (addr2->address != NULL, -1);
 
-		return strcmp (addr1->address, addr2->address);
+		return g_ascii_strcasecmp (addr1->address, addr2->address);
 	}
 
 	if (!addr1->wname)
@@ -325,7 +322,7 @@ e_mail_address_compare (gconstpointer address1, gconstpointer address2)
 		g_return_val_if_fail (addr1->address != NULL, 1);
 		g_return_val_if_fail (addr2->address != NULL, -1);
 
-		return strcmp (addr1->address, addr2->address);
+		return g_ascii_strcasecmp (addr1->address, addr2->address);
 	}
 
 	if (!addr1->wname->last)
@@ -333,31 +330,28 @@ e_mail_address_compare (gconstpointer address1, gconstpointer address2)
 	if (!addr2->wname->last)
 		return 1;
 
-	retval = strcmp (addr1->wname->last, addr2->wname->last);
+	retval = g_ascii_strcasecmp (addr1->wname->last, addr2->wname->last);
 	if (retval)
 		return retval;
 
 	/* last names are identical - compare first names */
 
 	if (!addr1->wname->first && !addr2->wname->first)
-		return strcmp (addr1->address, addr2->address);
+		return g_ascii_strcasecmp (addr1->address, addr2->address);
 
 	if (!addr1->wname->first)
 		return -1;
 	if (!addr2->wname->first)
 		return 1;
 
-	retval = strcmp (addr1->wname->first, addr2->wname->first);
+	retval = g_ascii_strcasecmp (addr1->wname->first, addr2->wname->first);
 	if (retval)
 		return retval;
 
-	return strcmp (addr1->address, addr2->address);
+	return g_ascii_strcasecmp (addr1->address, addr2->address);
 }
 #endif /* SMART_ADDRESS_COMPARE */
 
-/* Note: by the time this function is called, the strings have already
-   been normalised which means we can assume all lowercase chars and
-   we can just use strcmp for the final comparison. */
 static gint
 address_compare (gconstpointer address1, gconstpointer address2)
 {
@@ -376,7 +370,7 @@ address_compare (gconstpointer address1, gconstpointer address2)
 	e_mail_address_free (addr1);
 	e_mail_address_free (addr2);
 #else
-	retval = strcmp ((gchar *) address1, (gchar *) address2);
+	retval = g_ascii_strcasecmp ((gchar *) address1, (gchar *) address2);
 #endif /* SMART_ADDRESS_COMPARE */
 
 	return retval;
diff --git a/mail/message-list.etspec b/mail/message-list.etspec
index c8d438b..d153acb 100644
--- a/mail/message-list.etspec
+++ b/mail/message-list.etspec
@@ -9,7 +9,7 @@
 
   <ETableColumn model_col="4" compare_col="20" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/>
 
-  <ETableColumn model_col="5" compare_col="21" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/>
+  <ETableColumn model_col="5" compare_col="21" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="stringcase" search="string"/>
 
   <ETableColumn model_col="6" _title="Date" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
 
@@ -31,9 +31,9 @@
   <ETableColumn model_col="15"  _title="Recipients" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/>
   <ETableColumn model_col="16"  _title="Messages" expansion="1.0" minimum_width="32" resizable="true" cell="render_composite_from" compare="address_compare" search="string" priority="10"   sortable="false"/>
   <ETableColumn model_col="17"  _title="Sent Messages" expansion="1.0" minimum_width="32" resizable="true" cell="render_composite_to" compare="address_compare" search="string" priority="10"   sortable="false"/>
-  <ETableColumn model_col="18"  _title="Labels" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="string" search="string" priority="10"/>
+  <ETableColumn model_col="18"  _title="Labels" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="stringcase" search="string" priority="10"/>
 
-  <ETableColumn model_col="19" compare_col="21" _title="Subject - Trimmed" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/>
+  <ETableColumn model_col="19" compare_col="21" _title="Subject - Trimmed" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="stringcase" search="string"/>
 
   <ETableState>
     <column source="0"/> <column source="3"/> <column source="1"/>



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