[gnome-shell/gbsneto/icon-grid-dnd-fixes: 6/11] appDisplay: Don't emit 'apps-changed' when deleting folder
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd-fixes: 6/11] appDisplay: Don't emit 'apps-changed' when deleting folder
- Date: Thu, 24 Sep 2020 23:22:50 +0000 (UTC)
commit 819e9f5b1f91d388e743d2b2f3d63efbf25bb7b1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Sep 24 13:36:40 2020 -0300
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.
js/ui/appDisplay.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index ce99e7ee39..fe19b8720e 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1605,8 +1605,11 @@ class FolderGrid extends IconGrid.IconGrid {
}
});
-var FolderView = GObject.registerClass(
-class FolderView extends BaseAppView {
+var FolderView = GObject.registerClass({
+ Signals: {
+ 'apps-changed': {},
+ },
+}, class FolderView extends BaseAppView {
_init(folder, id, parentView) {
super._init({
layout_manager: new Clutter.BinLayout(),
@@ -1806,6 +1809,8 @@ class FolderView extends BaseAppView {
// Remove the folder if this is the last app icon; otherwise,
// just remove the icon
if (folderApps.length == 0) {
+ this._deletingFolder = true;
+
// Resetting all keys deletes the relocatable schema
let keys = this._folder.settings_schema.list_keys();
for (const key of keys)
@@ -1815,6 +1820,8 @@ class FolderView extends BaseAppView {
let folders = settings.get_strv('folder-children');
folders.splice(folders.indexOf(this._id), 1);
settings.set_strv('folder-children', folders);
+
+ this._deletingFolder = false;
} else {
// If this is a categories-based folder, also add it to
// the list of excluded apps
@@ -1828,6 +1835,10 @@ class FolderView extends BaseAppView {
this._folder.set_strv('apps', folderApps);
}
}
+
+ get deletingFolder() {
+ return this._deletingFolder;
+ }
});
var FolderIcon = GObject.registerClass({
@@ -1969,6 +1980,9 @@ var FolderIcon = GObject.registerClass({
}
_sync() {
+ if (this.view.deletingFolder)
+ return;
+
this.emit('apps-changed');
this._updateName();
this.visible = this.view.getAllItems().length > 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]