[gnome-shell/gbsneto/pagination: 44/53] appDisplay: Actually destroy icons
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/pagination: 44/53] appDisplay: Actually destroy icons
- Date: Thu, 4 Jun 2020 18:42:34 +0000 (UTC)
commit 69d9b7fe9964c77057d00dc47d3cb86d12d70897
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue May 19 17:49:09 2020 -0300
appDisplay: Actually destroy icons
AppDisplay currently adds all icons, and hides the ones inside
a folder. Change that to only add the icons that are not inside
folders. Adding an icon to a folder removes the icon from the
main grid.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1271
js/ui/appDisplay.js | 48 +++++++++++++-----------------------------------
1 file changed, 13 insertions(+), 35 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 0c8f6aeb81..7239a03d91 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -458,7 +458,6 @@ class AppDisplay extends BaseAppView {
});
super._redisplay();
- this._refilterApps();
}
_itemNameChanged(item) {
@@ -473,39 +472,6 @@ class AppDisplay extends BaseAppView {
this.selectApp(item.id);
}
- _isItemInFolder(itemId) {
- for (let folder of this._folderIcons) {
- let folderApps = folder.getAppIds();
- if (folderApps.some(appId => appId === itemId))
- return true;
- }
-
- return false;
- }
-
- _refilterApps() {
- let filteredApps = this._orderedItems.filter(icon => !icon.visible);
-
- this._orderedItems.forEach(icon => {
- if (icon instanceof AppIcon)
- icon.visible = true;
- });
-
- this._folderIcons.forEach(folder => {
- let folderApps = folder.getAppIds();
- folderApps.forEach(appId => {
- let appIcon = this._items.get(appId);
- appIcon.visible = false;
- });
- });
-
- // Scale in app icons that weren't visible, but now are
- filteredApps.filter(icon => icon.visible).forEach(icon => {
- if (icon instanceof AppIcon)
- icon.scaleIn();
- });
- }
-
getAppInfos() {
return this._appInfoList;
}
@@ -525,6 +491,7 @@ class AppDisplay extends BaseAppView {
let appSys = Shell.AppSystem.get_default();
+ const appsInsideFolders = new Map();
this._folderIcons = [];
let folders = this._folderSettings.get_strv('folder-children');
@@ -536,8 +503,17 @@ class AppDisplay extends BaseAppView {
icon.connect('name-changed', this._itemNameChanged.bind(this));
icon.connect('apps-changed', this._redisplay.bind(this));
}
+
+ // Don't try to display empty folders
+ if (!icon.visible) {
+ icon.destroy();
+ return;
+ }
+
appIcons.push(icon);
this._folderIcons.push(icon);
+
+ icon.getAppIds().forEach(appId => appsInsideFolders.set(appId));
});
// Allow dragging of the icon only if the Dash would accept a drop to
@@ -549,6 +525,9 @@ class AppDisplay extends BaseAppView {
let favoritesWritable = global.settings.is_writable('favorite-apps');
apps.forEach(appId => {
+ if (appsInsideFolders.has(appId))
+ return;
+
let icon = this._items.get(appId);
if (!icon) {
let app = appSys.lookup_app(appId);
@@ -558,7 +537,6 @@ class AppDisplay extends BaseAppView {
});
}
- icon.visible = !this._isItemInFolder(appId);
appIcons.push(icon);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]