[gnome-shell] appDisplay: Do not duplicate app favorites



commit 8c792969bb381d7176a59ee75a1dabe42483823b
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jan 20 01:44:21 2021 +0100

    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>

 js/ui/appDisplay.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index a2c6adaa04..a80fb773be 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -218,6 +218,11 @@ var BaseAppView = GObject.registerClass({
                 this._redisplay();
             });
 
+        // Don't duplicate favorites
+        this._appFavorites = AppFavorites.getAppFavorites();
+        this._appFavoritesChangedId =
+            this._appFavorites.connect('changed', () => this._redisplay());
+
         // Drag n' Drop
         this._lastOvershoot = -1;
         this._lastOvershootTimeoutId = 0;
@@ -236,6 +241,11 @@ var BaseAppView = GObject.registerClass({
             this._appFilterChangedId = 0;
         }
 
+        if (this._appFavoritesChangedId > 0) {
+            this._appFavorites.disconnect(this._appFavoritesChangedId);
+            this._appFavoritesChangedId = 0;
+        }
+
         if (this._swipeTracker) {
             this._swipeTracker.destroy();
             delete this._swipeTracker;
@@ -1138,7 +1148,8 @@ class AppDisplay extends BaseAppView {
             } catch (e) {
                 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());
@@ -1757,6 +1768,9 @@ class FolderView extends BaseAppView {
             if (excludedApps.includes(appId))
                 return;
 
+            if (this._appFavorites.isFavorite(appId))
+                return;
+
             const app = appSys.lookup_app(appId);
             if (!app)
                 return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]