De-cruftify Geary.Collection utility functions

Remove functions that have as-convenient methods in up-tp-date Gee,
rename ::get_first to ::first so it reads better and add API docs,
replace ::to_array_list with ::copy, since that's what's actually
needed.
This commit is contained in:
Michael Gratton 2019-11-19 14:20:42 +11:00 committed by Michael James Gratton
parent 1deae845c3
commit e4cbff8bfa
27 changed files with 135 additions and 149 deletions

View file

@ -73,7 +73,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
assert_int(1, contacts.size, "contacts length");
Contact? created = Collection.get_first<Contact>(contacts) as Contact;
Contact? created = Collection.first(contacts) as Contact;
assert_non_null(created, "contacts contents");
assert_string("Test", created.real_name);
@ -121,7 +121,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
this.store.assert_expectations();
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
Contact? created = Collection.get_first<Contact>(contacts) as Contact;
Contact? created = Collection.first(contacts) as Contact;
assert_int(
Contact.Importance.SEEN,
created.highest_importance,
@ -150,7 +150,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
this.store.assert_expectations();
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
Contact? created = Collection.get_first<Contact>(contacts) as Contact;
Contact? created = Collection.first(contacts) as Contact;
assert_int(
Contact.Importance.SENT_TO,
created.highest_importance,
@ -179,7 +179,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
this.store.assert_expectations();
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
Contact? created = Collection.get_first<Contact>(contacts) as Contact;
Contact? created = Collection.first(contacts) as Contact;
assert_int(
Contact.Importance.RECEIVED_FROM,
created.highest_importance,

View file

@ -125,7 +125,7 @@ class Geary.ContactStoreImplTest : TestCase {
);
assert_int(1, results.size, "results.size");
Contact search_hit = Collection.get_first(results);
Contact search_hit = Collection.first(results);
assert_string("Test@example.com", search_hit.email, "Existing email");
assert_string("test@example.com", search_hit.normalized_email, "Existing normalized_email");
assert_string("Test Name", search_hit.real_name, "Existing real_name");
@ -146,7 +146,7 @@ class Geary.ContactStoreImplTest : TestCase {
);
assert_int(1, results.size, "results.size");
Contact search_hit = Collection.get_first(results);
Contact search_hit = Collection.first(results);
assert_string("Test@example.com", search_hit.email, "Existing email");
assert_string("test@example.com", search_hit.normalized_email, "Existing normalized_email");
assert_string("Test Name", search_hit.real_name, "Existing real_name");
@ -180,7 +180,7 @@ class Geary.ContactStoreImplTest : TestCase {
);
assert_int(1, results.size, "results.size");
Contact search_hit = Collection.get_first(results);
Contact search_hit = Collection.first(results);
assert_string("Germán", search_hit.real_name, "Existing real_name");
}
@ -211,7 +211,7 @@ class Geary.ContactStoreImplTest : TestCase {
);
assert_int(1, results.size, "results.size");
Contact search_hit = Collection.get_first(results);
Contact search_hit = Collection.first(results);
assert_string("年収1億円目指せ", search_hit.real_name, "Existing real_name");
}