[gnome-characters/bilelmoussaoui/gtk4: 61/71] characters view: stop limiting results




commit 123f9a26a4ccfa49c082830c03e24580a4fbdab4
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Nov 24 21:42:17 2021 +0100

    characters view: stop limiting results
    
    we have dropped the load more concept & ask we render things using gsk
    it should be fine to render a ton of results without lagging

 src/charactersView.js | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/src/charactersView.js b/src/charactersView.js
index 4df9072..81c6bf9 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -168,8 +168,6 @@ const CharacterListRow = GObject.registerClass({
     }
 });
 
-const MAX_SEARCH_RESULTS = 100;
-
 var CharactersView = GObject.registerClass({
     Signals: {
         'character-selected': { param_types: [GObject.TYPE_STRING] },
@@ -412,29 +410,13 @@ var CharactersView = GObject.registerClass({
         this.setCharacters(characters);
     }
 
-    get initialSearchCount() {
-        // Use our parents allocation; we aren't visible before we do the
-        // initial search, so our allocation is 1x1
-        let allocation = this.get_parent().get_allocation();
-
-        // Sometimes more MAX_SEARCH_RESULTS are visible on screen
-        // (eg. fullscreen at 1080p).  We always present a over-full screen,
-        // otherwise the lazy loading gets broken
-        let cellSize = getCellSize(this._fontDescription);
-        let cellsPerRow = Math.floor(allocation.width / cellSize);
-        // Ensure the rows cause a scroll
-        let heightInRows = Math.ceil((allocation.height + 1) / cellSize);
-
-        return Math.max(MAX_SEARCH_RESULTS, heightInRows * cellsPerRow);
-    }
-
     _addSearchResult(result) {
         const characters = Util.searchResultToArray(result);
         this.setCharacters(this._characters.concat(characters));
     }
 
-    _searchWithContext(context, count) {
-        context.search(count, this._cancellable, (ctx, res) => {
+    _searchWithContext(context) {
+        context.search(Number.MAX_SAFE_INTEGER, this._cancellable, (ctx, res) => {
             try {
                 let result = ctx.search_finish(res);
                 this._addSearchResult(result);
@@ -460,7 +442,7 @@ var CharactersView = GObject.registerClass({
 
         let criteria = Gc.SearchCriteria.new_category(category);
         this._searchContext = new Gc.SearchContext({ criteria });
-        await this._searchWithContext(this._searchContext, this.initialSearchCount);
+        await this._searchWithContext(this._searchContext);
     }
 
     async searchByKeywords(keywords) {
@@ -469,13 +451,13 @@ var CharactersView = GObject.registerClass({
             criteria,
             flags: Gc.SearchFlag.WORD,
         });
-        await this._searchWithContext(this._searchContext, this.initialSearchCount);
+        await this._searchWithContext(this._searchContext);
     }
 
     async _searchByScripts() {
         var criteria = Gc.SearchCriteria.new_scripts(this.scripts);
         this._searchContext = new Gc.SearchContext({ criteria });
-        await this._searchWithContext(this._searchContext, this.initialSearchCount);
+        await this._searchWithContext(this._searchContext);
     }
 
     cancelSearch() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]