Clean up Engine search API

Clean up search API so that query string parsing and error handling can
be pushed out to the client.

Rename Geary.Account::open_search factory method to ::new_search_query
to better reflect what it actually does.

Update Geary.SearchFolder::search to be async so it can throw errors and
the caller can catch them, require SearchQuery objects instead of plain
text query strings.

Add Geary.SearchQuery::owner property so that the query's account can be
sanity checked.

Update API documentation to reflect this.
This commit is contained in:
Michael Gratton 2019-12-09 12:35:02 +11:00 committed by Michael James Gratton
parent 4d0ed05a2b
commit c93cfc38b1
9 changed files with 215 additions and 161 deletions

View file

@ -10,8 +10,9 @@ public class Geary.MockAccount : Account, MockObject {
public class MockSearchQuery : SearchQuery {
internal MockSearchQuery() {
base("", SearchQuery.Strategy.EXACT);
internal MockSearchQuery(Account owner,
string raw) {
base(owner, raw, SearchQuery.Strategy.EXACT);
}
}
@ -214,11 +215,11 @@ public class Geary.MockAccount : Account, MockObject {
);
}
public override async SearchQuery open_search(string query,
SearchQuery.Strategy strategy,
GLib.Cancellable? cancellable)
public override async SearchQuery new_search_query(string raw,
SearchQuery.Strategy strategy,
GLib.Cancellable? cancellable)
throws GLib.Error {
return new MockSearchQuery();
return new MockSearchQuery(this, raw);
}
public override async Gee.Collection<EmailIdentifier>?