appDisplay: Don't emit 'apps-changed' when deleting folder
To delete a folder, FolderView needs to reset all keys under that particular folder's GSettings path. That generates 5 'changed' signals, all of which end up calling AppDisplay._redisplay(), which is costly. Don't emit 'apps-changed' when deleting a folder. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
This commit is contained in:
parent
31591ff029
commit
7dafd25ef4
@ -1639,6 +1639,7 @@ 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._deletingFolder = false;
|
||||||
this._appIds = [];
|
this._appIds = [];
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
}
|
}
|
||||||
@ -1809,6 +1810,8 @@ class FolderView extends BaseAppView {
|
|||||||
// Remove the folder if this is the last app icon; otherwise,
|
// Remove the folder if this is the last app icon; otherwise,
|
||||||
// just remove the icon
|
// just remove the icon
|
||||||
if (folderApps.length == 0) {
|
if (folderApps.length == 0) {
|
||||||
|
this._deletingFolder = true;
|
||||||
|
|
||||||
// Resetting all keys deletes the relocatable schema
|
// Resetting all keys deletes the relocatable schema
|
||||||
let keys = this._folder.settings_schema.list_keys();
|
let keys = this._folder.settings_schema.list_keys();
|
||||||
for (const key of keys)
|
for (const key of keys)
|
||||||
@ -1818,6 +1821,8 @@ class FolderView extends BaseAppView {
|
|||||||
let folders = settings.get_strv('folder-children');
|
let folders = settings.get_strv('folder-children');
|
||||||
folders.splice(folders.indexOf(this._id), 1);
|
folders.splice(folders.indexOf(this._id), 1);
|
||||||
settings.set_strv('folder-children', folders);
|
settings.set_strv('folder-children', folders);
|
||||||
|
|
||||||
|
this._deletingFolder = false;
|
||||||
} else {
|
} else {
|
||||||
// If this is a categories-based folder, also add it to
|
// If this is a categories-based folder, also add it to
|
||||||
// the list of excluded apps
|
// the list of excluded apps
|
||||||
@ -1831,6 +1836,10 @@ class FolderView extends BaseAppView {
|
|||||||
this._folder.set_strv('apps', folderApps);
|
this._folder.set_strv('apps', folderApps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get deletingFolder() {
|
||||||
|
return this._deletingFolder;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var FolderIcon = GObject.registerClass({
|
var FolderIcon = GObject.registerClass({
|
||||||
@ -1972,6 +1981,9 @@ var FolderIcon = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sync() {
|
_sync() {
|
||||||
|
if (this.view.deletingFolder)
|
||||||
|
return;
|
||||||
|
|
||||||
this.emit('apps-changed');
|
this.emit('apps-changed');
|
||||||
this._updateName();
|
this._updateName();
|
||||||
this.visible = this.view.getAllItems().length > 0;
|
this.visible = this.view.getAllItems().length > 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user