appDisplay: Reload folder views on installed app changes
Since the FolderViews are not connected to the "installed-changed" signal, we need to reload their apps by calling _redisplay() when an app is removed or installed. We can't connect to "installed-changed" inside FolderView because we need to ensure _redisplay() of the FolderView is called before AppView tries to access the apps of the folder inside _refilterApps(). So reload the FolderViews inside AllViews _redisplay() implementation to ensure everything is up to date before accessing the apps of the folder. Since the "apps-changed" signal of FolderIcon now indirectly triggers a _redisplay() of the FolderViews, the 'changed' handler of FolderView is now redundant and can be removed. Because of this, we also need to move the emission of the "apps-changed" signal to the start of the signal handler to make sure the view is updated before we try to access items of the view. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1901 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
This commit is contained in:
parent
989c0ee49e
commit
3155d03d9e
@ -431,6 +431,10 @@ var AllView = GObject.registerClass({
|
|||||||
|
|
||||||
_redisplay() {
|
_redisplay() {
|
||||||
super._redisplay();
|
super._redisplay();
|
||||||
|
|
||||||
|
this._folderIcons.forEach(icon => {
|
||||||
|
icon.view._redisplay();
|
||||||
|
});
|
||||||
this._refilterApps();
|
this._refilterApps();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,20 +1328,9 @@ class FolderView extends BaseAppView {
|
|||||||
action.connect('pan', this._onPan.bind(this));
|
action.connect('pan', this._onPan.bind(this));
|
||||||
this._scrollView.add_action(action);
|
this._scrollView.add_action(action);
|
||||||
|
|
||||||
this.connect('destroy', this._onDestroy.bind(this));
|
|
||||||
|
|
||||||
this._folderChangedId = this._folder.connect(
|
|
||||||
'changed', this._redisplay.bind(this));
|
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDestroy() {
|
|
||||||
if (this._folderChangedId) {
|
|
||||||
this._folder.disconnect(this._folderChangedId);
|
|
||||||
delete this._folderChangedId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_childFocused(actor) {
|
_childFocused(actor) {
|
||||||
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
||||||
}
|
}
|
||||||
@ -1630,10 +1623,10 @@ var FolderIcon = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sync() {
|
_sync() {
|
||||||
|
this.emit('apps-changed');
|
||||||
this._updateName();
|
this._updateName();
|
||||||
this.visible = this.view.getAllItems().length > 0;
|
this.visible = this.view.getAllItems().length > 0;
|
||||||
this.icon.update();
|
this.icon.update();
|
||||||
this.emit('apps-changed');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createIcon(iconSize) {
|
_createIcon(iconSize) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user