[geary/wip/733271-search] Fix for Frédéric's pr oblem, waiting to see if this solves Adam's
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/733271-search] Fix for Frédéric's pr oblem, waiting to see if this solves Adam's
- Date: Thu, 24 Jul 2014 22:57:12 +0000 (UTC)
commit 76e40c1c01a7867a2ba72ac77d504cb78da2d9ef
Author: Jim Nelson <jim yorba org>
Date: Thu Jul 24 15:56:32 2014 -0700
Fix for Frédéric's problem, waiting to see if this solves Adam's
.../imap-db/imap-db-search-email-identifier.vala | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-search-email-identifier.vala
b/src/engine/imap-db/imap-db-search-email-identifier.vala
index 53c9b5b..cea7f0b 100644
--- a/src/engine/imap-db/imap-db-search-email-identifier.vala
+++ b/src/engine/imap-db/imap-db-search-email-identifier.vala
@@ -53,11 +53,18 @@ private class Geary.ImapDB.SearchEmailIdentifier : ImapDB.EmailIdentifier,
}
public virtual int compare_to(SearchEmailIdentifier other) {
- if (date_received != null && other.date_received != null)
- return date_received.compare(other.date_received);
+ // if both have date received, compare on that, using stable sort if the same
+ if (date_received != null && other.date_received != null) {
+ int compare = date_received.compare(other.date_received);
+
+ return (compare != 0) ? compare : stable_sort_comparator(other);
+ }
+
+ // if neither have date received, fall back on stable sort
if (date_received == null && other.date_received == null)
return stable_sort_comparator(other);
+ // put identifiers with no date ahead of those with
return (date_received == null ? -1 : 1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]