Load all contacts into ContactStore: Closes #6921

All contacts are now loaded into the ContactStore, leaving it to
the application (i.e. client) to decide what to display and what
not to display.  This moves that responsibility into the composer's
autocompletion logic.

This leaves the door open for other contact-related code (i.e.
contact list regardless of their importance.
This commit is contained in:
Robert Schroll 2013-05-09 15:30:37 -07:00 committed by Jim Nelson
parent f950f1578e
commit 204ca8006a
3 changed files with 8 additions and 6 deletions

View file

@ -8,6 +8,9 @@ public class ContactEntryCompletion : Gtk.EntryCompletion {
// Sort column indices.
private const int SORT_COLUMN = 0;
// Minimum visibility for the contact to appear in autocompletion.
private const Geary.ContactImportance CONTACT_VISIBILITY_THRESHOLD = Geary.ContactImportance.TO_TO;
private Gtk.ListStore list_store;
private Gtk.TreeIter? last_iter = null;
@ -53,6 +56,9 @@ public class ContactEntryCompletion : Gtk.EntryCompletion {
}
private void add_contact(Geary.Contact contact) {
if (contact.highest_importance < CONTACT_VISIBILITY_THRESHOLD)
return;
string full_address = contact.get_rfc822_address().get_full_address();
Gtk.TreeIter iter;
list_store.append(out iter);

View file

@ -31,8 +31,5 @@ public enum Geary.ContactImportance {
TO_CC = 50,
CC_FROM = 40,
CC_TO = 30,
CC_CC = 20,
// Minimum visibility for the contact to appear in autocompletion.
VISIBILITY_THRESHOLD = TO_TO;
CC_CC = 20
}

View file

@ -201,8 +201,7 @@ private class Geary.ImapDB.Account : BaseObject {
(context) => {
Db.Statement statement = context.prepare(
"SELECT email, real_name, highest_importance, normalized_email " +
"FROM ContactTable WHERE highest_importance >= ?");
statement.bind_int(0, ContactImportance.VISIBILITY_THRESHOLD);
"FROM ContactTable");
Db.Result result = statement.exec(cancellable);
while (!result.finished) {