popupMenu: Hide settings menus outside user session

The control-center contains user-pertinent settings
panels. These panels don't make sense to show outside
of a user's session, so hide them for session types other
than SessionType.USER.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
This commit is contained in:
Ray Strode 2011-08-28 22:15:53 -04:00
parent 35e99266ba
commit 239a9e4816
2 changed files with 11 additions and 6 deletions

View File

@ -97,13 +97,14 @@ DateMenuButton.prototype = {
vbox.add(this._calendar.actor);
item = this.menu.addSettingsAction(_("Date and Time Settings"), 'gnome-datetime-panel.desktop');
if (item) {
let separator = new PopupMenu.PopupSeparatorMenuItem();
separator.setColumnWidths(1);
vbox.add(separator.actor, {y_align: St.Align.END, expand: true, y_fill: false});
let separator = new PopupMenu.PopupSeparatorMenuItem();
separator.setColumnWidths(1);
vbox.add(separator.actor, {y_align: St.Align.END, expand: true, y_fill: false});
item.actor.can_focus = false;
item.actor.reparent(vbox);
item.actor.can_focus = false;
item.actor.reparent(vbox);
}
if (params.showEvents) {
// Add vertical separator

View File

@ -813,6 +813,10 @@ PopupMenuBase.prototype = {
},
addSettingsAction: function(title, desktopFile) {
// Don't allow user settings to get edited unless we're in a user session
if (global.session_type != Shell.SessionType.USER)
return null;
let menuItem = this.addAction(title, function() {
let app = Shell.AppSystem.get_default().lookup_setting(desktopFile);