Geary.Account: Make new_search_query synchronous
Constructing a new query should be fast, and it no longer needs to be done async, so remove async from the method and simplify callers.
This commit is contained in:
parent
9cb3a0d98c
commit
9bd2359464
5 changed files with 17 additions and 26 deletions
|
|
@ -968,7 +968,7 @@ public class Application.MainWindow :
|
|||
return closed;
|
||||
}
|
||||
|
||||
internal async void start_search(string query_text, bool is_interactive) {
|
||||
internal void start_search(string query_text, bool is_interactive) {
|
||||
var context = get_selected_account_context();
|
||||
if (context != null) {
|
||||
// Stop any search in progress
|
||||
|
|
@ -986,10 +986,9 @@ public class Application.MainWindow :
|
|||
this.application.config.get_search_strategy(),
|
||||
context.account.information
|
||||
);
|
||||
var query = yield context.account.new_search_query(
|
||||
var query = context.account.new_search_query(
|
||||
expr_factory.parse_query(query_text),
|
||||
query_text,
|
||||
cancellable
|
||||
query_text
|
||||
);
|
||||
this.folder_list.set_search(
|
||||
this.application.engine, context.search
|
||||
|
|
@ -2219,7 +2218,7 @@ public class Application.MainWindow :
|
|||
if (Geary.String.is_empty_or_whitespace(text)) {
|
||||
stop_search(true);
|
||||
} else {
|
||||
this.start_search.begin(text, true);
|
||||
this.start_search(text, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,9 +297,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
|
|||
|
||||
// Highlight matching terms from find if active, otherwise
|
||||
// from the search folder if that's where we are at
|
||||
Geary.SearchQuery? query = yield get_find_search_query(
|
||||
conversation.base_folder.account, null
|
||||
);
|
||||
var query = get_find_search_query(conversation.base_folder.account);
|
||||
if (query == null) {
|
||||
var search_folder = conversation.base_folder as Geary.App.SearchFolder;
|
||||
if (search_folder != null) {
|
||||
|
|
@ -406,9 +404,8 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
|
|||
});
|
||||
this.find_cancellable = cancellable;
|
||||
try {
|
||||
Geary.SearchQuery? query = yield get_find_search_query(
|
||||
list.conversation.base_folder.account,
|
||||
cancellable
|
||||
var query = get_find_search_query(
|
||||
list.conversation.base_folder.account
|
||||
);
|
||||
if (query != null) {
|
||||
yield list.search.highlight_matching_email(query, true);
|
||||
|
|
@ -419,8 +416,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
|
|||
}
|
||||
}
|
||||
|
||||
private async Geary.SearchQuery? get_find_search_query(Geary.Account account,
|
||||
GLib.Cancellable? cancellable)
|
||||
private Geary.SearchQuery? get_find_search_query(Geary.Account account)
|
||||
throws GLib.Error {
|
||||
Geary.SearchQuery? query = null;
|
||||
if (this.conversation_find_bar.get_search_mode()) {
|
||||
|
|
@ -433,10 +429,9 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
|
|||
this.config.get_search_strategy(),
|
||||
account.information
|
||||
);
|
||||
query = yield account.new_search_query(
|
||||
query = account.new_search_query(
|
||||
expr_factory.parse_query(text),
|
||||
text,
|
||||
cancellable
|
||||
text
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -514,10 +514,9 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
|
|||
/**
|
||||
* Create a new search query for this account.
|
||||
*/
|
||||
public abstract async SearchQuery new_search_query(
|
||||
public abstract SearchQuery new_search_query(
|
||||
Gee.List<SearchQuery.Term> expression,
|
||||
string text,
|
||||
GLib.Cancellable? cancellable
|
||||
string text
|
||||
) throws GLib.Error;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -575,10 +575,9 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public override async SearchQuery new_search_query(
|
||||
public override SearchQuery new_search_query(
|
||||
Gee.List<SearchQuery.Term> expression,
|
||||
string text,
|
||||
GLib.Cancellable? cancellable
|
||||
string text
|
||||
) throws GLib.Error {
|
||||
return new FtsSearchQuery(expression, text, this.stemmer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,12 +222,11 @@ public class Mock.Account : Geary.Account,
|
|||
);
|
||||
}
|
||||
|
||||
public override async Geary.SearchQuery new_search_query(
|
||||
public override Geary.SearchQuery new_search_query(
|
||||
Gee.List<Geary.SearchQuery.Term> expression,
|
||||
string raw,
|
||||
GLib.Cancellable? cancellable
|
||||
string text
|
||||
) throws GLib.Error {
|
||||
return new SearchQuery(expression, raw);
|
||||
return new SearchQuery(expression, text);
|
||||
}
|
||||
|
||||
public override async Gee.Collection<Geary.EmailIdentifier>?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue