diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js index 653f0cfba..c65040d8a 100644 --- a/js/ui/appFavorites.js +++ b/js/ui/appFavorites.js @@ -2,6 +2,7 @@ /* exported getAppFavorites */ const Shell = imports.gi.Shell; +const ParentalControlsManager = imports.misc.parentalControlsManager; const Signals = imports.signals; const Main = imports.ui.main; @@ -64,6 +65,13 @@ const RENAMED_DESKTOP_IDS = { class AppFavorites { constructor() { + // Filter the apps through the user’s parental controls. + this._parentalControlsManager = ParentalControlsManager.getDefault(); + this._parentalControlsManager.connect('app-filter-changed', () => { + this.reload(); + this.emit('changed'); + }); + this.FAVORITE_APPS_KEY = 'favorite-apps'; this._favorites = {}; global.settings.connect('changed::%s'.format(this.FAVORITE_APPS_KEY), this._onFavsChanged.bind(this)); @@ -95,7 +103,7 @@ class AppFavorites { global.settings.set_strv(this.FAVORITE_APPS_KEY, ids); let apps = ids.map(id => appSys.lookup_app(id)) - .filter(app => app != null); + .filter(app => app !== null && this._parentalControlsManager.shouldShowApp(app.app_info)); this._favorites = {}; for (let i = 0; i < apps.length; i++) { let app = apps[i]; @@ -134,6 +142,9 @@ class AppFavorites { if (!app) return false; + if (!this._parentalControlsManager.shouldShowApp(app.app_info)) + return false; + let ids = this._getIds(); if (pos == -1) ids.push(appId);