baseAppView: Move _loadGrid() into _redisplay()

Next commit will introduce differential loading of
app icons, and will reorganize this part of the
codebase.

When doing that, the ideal symmetry of the new code
would be:

 * Update BaseAppView._allItems array
 * Update BaseAppView._items map
 * Update BaseAppView._grid actor

Move the code in _loadGrid() into _redisplay() so that
we can check in-place which new icons need to be added.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
This commit is contained in:
Georges Basile Stavracas Neto 2019-07-01 23:01:59 -03:00
parent 3003e9091d
commit 036e41621d
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -123,7 +123,10 @@ class BaseAppView {
_redisplay() { _redisplay() {
this.removeAll(); this.removeAll();
this._loadApps(); this._loadApps();
this._loadGrid();
this._allItems.sort(this._compareItems);
this._allItems.forEach(item => this._grid.addItem(item));
this.emit('view-loaded');
} }
getAllItems() { getAllItems() {
@ -147,12 +150,6 @@ class BaseAppView {
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
} }
_loadGrid() {
this._allItems.sort(this._compareItems);
this._allItems.forEach(item => this._grid.addItem(item));
this.emit('view-loaded');
}
_selectAppInternal(id) { _selectAppInternal(id) {
if (this._items[id]) if (this._items[id])
this._items[id].actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); this._items[id].actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
@ -338,6 +335,7 @@ var AllView = class AllView extends BaseAppView {
openFolderId = this._currentPopup._source.id; openFolderId = this._currentPopup._source.id;
super._redisplay(); super._redisplay();
this._refilterApps();
if (openFolderId) { if (openFolderId) {
let [folderToReopen] = this.folderIcons.filter(folder => folder.id == openFolderId); let [folderToReopen] = this.folderIcons.filter(folder => folder.id == openFolderId);
@ -420,11 +418,6 @@ var AllView = class AllView extends BaseAppView {
}); });
} }
_loadGrid() {
super._loadGrid();
this._refilterApps();
}
// Overridden from BaseAppView // Overridden from BaseAppView
animate(animationDirection, onComplete) { animate(animationDirection, onComplete) {
this._scrollView.reactive = false; this._scrollView.reactive = false;