[gnome-shell] appFavorites: Hide favourites which are blacklisted by parental controls
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] appFavorites: Hide favourites which are blacklisted by parental controls
- Date: Tue, 7 Apr 2020 15:53:12 +0000 (UTC)
commit 91b13effc8b417bc12c3d91d40a3e5b713149308
Author: Philip Withnall <withnall endlessm com>
Date: Tue Mar 31 10:33:18 2020 +0100
appFavorites: Hide favourites which are blacklisted by parental controls
If a favourite is set for an app which is blocked by parental controls,
that favourite should be hidden.
Signed-off-by: Philip Withnall <withnall endlessm com>
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465
js/ui/appFavorites.js | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js
index 653f0cfba1..c65040d8a2 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]