appDisplay: Do not duplicate app favorites

With the new position, the dash is now stronger connected to the
app grid than it used to; reflect that by showing apps either
in the grid or the dash, not both (except for non-favorite
running apps).

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/88

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1580>
This commit is contained in:
Florian Müllner 2021-01-20 01:44:21 +01:00 committed by Marge Bot
parent c57a299d57
commit 8c792969bb

View File

@ -218,6 +218,11 @@ var BaseAppView = GObject.registerClass({
this._redisplay(); this._redisplay();
}); });
// Don't duplicate favorites
this._appFavorites = AppFavorites.getAppFavorites();
this._appFavoritesChangedId =
this._appFavorites.connect('changed', () => this._redisplay());
// Drag n' Drop // Drag n' Drop
this._lastOvershoot = -1; this._lastOvershoot = -1;
this._lastOvershootTimeoutId = 0; this._lastOvershootTimeoutId = 0;
@ -236,6 +241,11 @@ var BaseAppView = GObject.registerClass({
this._appFilterChangedId = 0; this._appFilterChangedId = 0;
} }
if (this._appFavoritesChangedId > 0) {
this._appFavorites.disconnect(this._appFavoritesChangedId);
this._appFavoritesChangedId = 0;
}
if (this._swipeTracker) { if (this._swipeTracker) {
this._swipeTracker.destroy(); this._swipeTracker.destroy();
delete this._swipeTracker; delete this._swipeTracker;
@ -1138,7 +1148,8 @@ class AppDisplay extends BaseAppView {
} catch (e) { } catch (e) {
return false; return false;
} }
return this._parentalControlsManager.shouldShowApp(appInfo); return !this._appFavorites.isFavorite(appInfo.get_id()) &&
this._parentalControlsManager.shouldShowApp(appInfo);
}); });
let apps = this._appInfoList.map(app => app.get_id()); let apps = this._appInfoList.map(app => app.get_id());
@ -1757,6 +1768,9 @@ class FolderView extends BaseAppView {
if (excludedApps.includes(appId)) if (excludedApps.includes(appId))
return; return;
if (this._appFavorites.isFavorite(appId))
return;
const app = appSys.lookup_app(appId); const app = appSys.lookup_app(appId);
if (!app) if (!app)
return; return;