[gnome-shell] popupMenu: Hide settings menus outside user session



commit 239a9e4816af1545ad7b6c7f90660d0ea88d5ade
Author: Ray Strode <rstrode redhat com>
Date:   Sun Aug 28 22:15:53 2011 -0400

    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

 js/ui/dateMenu.js  |   13 +++++++------
 js/ui/popupMenu.js |    4 ++++
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index dbab336..37ce87b 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -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
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index fc4956e..afa851d 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]