sessionMode: Add allowSettings property
Add a sessionMode.allowSettings property, which determines whether menus in the top bar should allow access to System Settings or not. https://bugzilla.gnome.org/show_bug.cgi?id=676156
This commit is contained in:
parent
ba92cfa064
commit
a3fcb8c284
@ -888,8 +888,7 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addSettingsAction: function(title, desktopFile) {
|
addSettingsAction: function(title, desktopFile) {
|
||||||
// Don't allow user settings to get edited unless we're in a user session
|
if (!Main.sessionMode.allowSettings)
|
||||||
if (Main.sessionMode.sessionType != Shell.SessionType.USER)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
let menuItem = this.addAction(title, function() {
|
let menuItem = this.addAction(title, function() {
|
||||||
|
@ -11,11 +11,13 @@ const _modes = {
|
|||||||
'gdm': { hasOverview: false,
|
'gdm': { hasOverview: false,
|
||||||
hasAppMenu: false,
|
hasAppMenu: false,
|
||||||
showCalendarEvents: false,
|
showCalendarEvents: false,
|
||||||
|
allowSettings: false,
|
||||||
sessionType: Shell.SessionType.GDM },
|
sessionType: Shell.SessionType.GDM },
|
||||||
|
|
||||||
'user': { hasOverview: true,
|
'user': { hasOverview: true,
|
||||||
hasAppMenu: true,
|
hasAppMenu: true,
|
||||||
showCalendarEvents: true,
|
showCalendarEvents: true,
|
||||||
|
allowSettings: true,
|
||||||
sessionType: Shell.SessionType.USER }
|
sessionType: Shell.SessionType.USER }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,11 @@ const XKBIndicator = new Lang.Class({
|
|||||||
|
|
||||||
this._syncConfig();
|
this._syncConfig();
|
||||||
|
|
||||||
if (Main.sessionMode.sessionType == Shell.SessionType.USER) {
|
// re-using "allowSettings" for the keyboard layout is a bit shady,
|
||||||
|
// but at least for now it is used as "allow popping up windows
|
||||||
|
// from shell menus"; we can always add a separate sessionMode
|
||||||
|
// option if need arises.
|
||||||
|
if (Main.sessionMode.allowSettings) {
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, function() {
|
this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, function() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
|
@ -624,7 +624,8 @@ const UserMenuButton = new Lang.Class({
|
|||||||
let item;
|
let item;
|
||||||
|
|
||||||
item = new IMStatusChooserItem();
|
item = new IMStatusChooserItem();
|
||||||
item.connect('activate', Lang.bind(this, this._onMyAccountActivate));
|
if (Main.sessionMode.allowSettings)
|
||||||
|
item.connect('activate', Lang.bind(this, this._onMyAccountActivate));
|
||||||
this.menu.addMenuItem(item);
|
this.menu.addMenuItem(item);
|
||||||
this._statusChooser = item;
|
this._statusChooser = item;
|
||||||
|
|
||||||
@ -636,9 +637,11 @@ const UserMenuButton = new Lang.Class({
|
|||||||
item = new PopupMenu.PopupSeparatorMenuItem();
|
item = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
this.menu.addMenuItem(item);
|
this.menu.addMenuItem(item);
|
||||||
|
|
||||||
item = new PopupMenu.PopupMenuItem(_("System Settings"));
|
if (Main.sessionMode.allowSettings) {
|
||||||
item.connect('activate', Lang.bind(this, this._onPreferencesActivate));
|
item = new PopupMenu.PopupMenuItem(_("System Settings"));
|
||||||
this.menu.addMenuItem(item);
|
item.connect('activate', Lang.bind(this, this._onPreferencesActivate));
|
||||||
|
this.menu.addMenuItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
item = new PopupMenu.PopupAlternatingMenuItem(_("Power Off"),
|
item = new PopupMenu.PopupAlternatingMenuItem(_("Power Off"),
|
||||||
_("Suspend"));
|
_("Suspend"));
|
||||||
|
Loading…
Reference in New Issue
Block a user