[gnome-characters/bilelmoussaoui/gtk4: 61/76] characters view: await on async search functions
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/bilelmoussaoui/gtk4: 61/76] characters view: await on async search functions
- Date: Fri, 26 Nov 2021 08:59:07 +0000 (UTC)
commit 9d6c9fdfc16332b2c647f22c460739bed2dbfa7b
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Wed Nov 24 21:40:23 2021 +0100
characters view: await on async search functions
src/charactersView.js | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/charactersView.js b/src/charactersView.js
index 79aa203..4df9072 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -444,39 +444,38 @@ var CharactersView = GObject.registerClass({
});
}
- searchByCategory(category) {
+ async searchByCategory(category) {
this._characters = [];
// whether to draw a baseline or not
this.baseline = category <= Gc.Category.LETTER_LATIN;
if (category === Gc.Category.LETTER_LATIN) {
if (!this._scriptsLoaded)
- this.populateScripts(); // we run the search once the scripts are loaded
- else
- this._searchByScripts();
+ await this.populateScripts(); // we run the search once the scripts are loaded
+
+ await this._searchByScripts();
return;
}
let criteria = Gc.SearchCriteria.new_category(category);
this._searchContext = new Gc.SearchContext({ criteria });
- this._searchWithContext(this._searchContext, this.initialSearchCount);
+ await this._searchWithContext(this._searchContext, this.initialSearchCount);
}
- searchByKeywords(keywords) {
+ async searchByKeywords(keywords) {
const criteria = Gc.SearchCriteria.new_keywords(keywords);
this._searchContext = new Gc.SearchContext({
criteria,
flags: Gc.SearchFlag.WORD,
});
- this._searchWithContext(this._searchContext, this.initialSearchCount);
- return this._characters.length;
+ await this._searchWithContext(this._searchContext, this.initialSearchCount);
}
- _searchByScripts() {
+ async _searchByScripts() {
var criteria = Gc.SearchCriteria.new_scripts(this.scripts);
this._searchContext = new Gc.SearchContext({ criteria });
- this._searchWithContext(this._searchContext, this.initialSearchCount);
+ await this._searchWithContext(this._searchContext, this.initialSearchCount);
}
cancelSearch() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]