dash: Improve feedback when favorite-apps key is locked
In a lockdown scenario, where the favorite-apps GSettings key is not writable, hide the menu items for adding and removing favorites from the dash menu. Additionally, reject drops to the dash for DND. https://bugzilla.gnome.org/show_bug.cgi?id=741325
This commit is contained in:
parent
c363e2a322
commit
e69cc20fc7
js/ui
@ -1748,6 +1748,8 @@ const AppIconMenu = new Lang.Class({
|
|||||||
|
|
||||||
this.actor.add_style_class_name('app-well-menu');
|
this.actor.add_style_class_name('app-well-menu');
|
||||||
|
|
||||||
|
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
|
||||||
|
|
||||||
// Chain our visibility and lifecycle to that of the source
|
// Chain our visibility and lifecycle to that of the source
|
||||||
source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
||||||
if (!source.actor.mapped)
|
if (!source.actor.mapped)
|
||||||
@ -1807,6 +1809,10 @@ const AppIconMenu = new Lang.Class({
|
|||||||
this.emit('activate-window', null);
|
this.emit('activate-window', null);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let canFavorite = this._settings.is_writable('favorite-apps');
|
||||||
|
|
||||||
|
if (canFavorite) {
|
||||||
this._appendSeparator();
|
this._appendSeparator();
|
||||||
|
|
||||||
let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
|
let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
|
||||||
@ -1824,6 +1830,7 @@ const AppIconMenu = new Lang.Class({
|
|||||||
favs.addFavorite(this._source.app.get_id());
|
favs.addFavorite(this._source.app.get_id());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
|
if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
|
||||||
this._appendSeparator();
|
this._appendSeparator();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -269,6 +270,9 @@ const ShowAppsIcon = new Lang.Class({
|
|||||||
if (app == null)
|
if (app == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!this._settings.is_writable('favorite-apps'))
|
||||||
|
return false;
|
||||||
|
|
||||||
let id = app.get_id();
|
let id = app.get_id();
|
||||||
let isFavorite = AppFavorites.getAppFavorites().isFavorite(id);
|
let isFavorite = AppFavorites.getAppFavorites().isFavorite(id);
|
||||||
return isFavorite;
|
return isFavorite;
|
||||||
@ -424,6 +428,8 @@ const Dash = new Lang.Class({
|
|||||||
|
|
||||||
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
|
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
|
||||||
|
|
||||||
|
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
|
||||||
|
|
||||||
this._appSystem = Shell.AppSystem.get_default();
|
this._appSystem = Shell.AppSystem.get_default();
|
||||||
|
|
||||||
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
||||||
@ -850,6 +856,9 @@ const Dash = new Lang.Class({
|
|||||||
if (app == null || app.is_window_backed())
|
if (app == null || app.is_window_backed())
|
||||||
return DND.DragMotionResult.NO_DROP;
|
return DND.DragMotionResult.NO_DROP;
|
||||||
|
|
||||||
|
if (!this._settings.is_writable('favorite-apps'))
|
||||||
|
return DND.DragMotionResult.NO_DROP;
|
||||||
|
|
||||||
let favorites = AppFavorites.getAppFavorites().getFavorites();
|
let favorites = AppFavorites.getAppFavorites().getFavorites();
|
||||||
let numFavorites = favorites.length;
|
let numFavorites = favorites.length;
|
||||||
|
|
||||||
@ -926,6 +935,9 @@ const Dash = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this._settings.is_writable('favorite-apps'))
|
||||||
|
return false;
|
||||||
|
|
||||||
let id = app.get_id();
|
let id = app.get_id();
|
||||||
|
|
||||||
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
||||||
|
Loading…
Reference in New Issue
Block a user