[gnome-shell] lookingGlass: Use resultsArea to keep track of results
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] lookingGlass: Use resultsArea to keep track of results
- Date: Wed, 16 Oct 2019 15:32:43 +0000 (UTC)
commit 4dea1f801ae130b2a5c80537c4e05189dab0f6df
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Mon May 20 23:25:14 2019 +0200
lookingGlass: Use resultsArea to keep track of results
Now that results are actors we can just use their container to keep
track of them
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
js/ui/lookingGlass.js | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 85e8874b19..38e45edb45 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -793,7 +793,6 @@ class LookingGlass extends St.BoxLayout {
this._it = null;
this._offset = 0;
- this._results = [];
// Sort of magic, but...eh.
this._maxItems = 150;
@@ -937,17 +936,14 @@ class LookingGlass extends St.BoxLayout {
}
_pushResult(command, obj) {
- let index = this._results.length + this._offset;
+ let index = this._resultsArea.get_n_children() + this._offset;
let result = new Result(this, CHEVRON + command, obj, index);
- this._results.push(result);
this._resultsArea.add(result);
if (obj instanceof Clutter.Actor)
this.setBorderPaintTarget(obj);
- let children = this._resultsArea.get_children();
- if (children.length > this._maxItems) {
- this._results.shift();
- children[0].destroy();
+ if (this._resultsArea.get_n_children() > this._maxItems) {
+ this._resultsArea.get_first_child().destroy();
this._offset++;
}
this._it = obj;
@@ -1034,7 +1030,7 @@ class LookingGlass extends St.BoxLayout {
getResult(idx) {
try {
- return this._results[idx - this._offset].o;
+ return this._resultsArea.get_child_at_index(idx - this._offset).o;
} catch (e) {
throw new Error(`Unknown result at index ${idx}`);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]