[gnome-shell] Fix insensitive styling for popup menu items



commit 7499b0463808471607d218441c758fa1e5652e83
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Sep 11 14:00:22 2012 +0200

    Fix insensitive styling for popup menu items
    
    The selector for insensitive popup menu items was wrong (a PopupMenuItem is
    a ShellGenericContainer, not a StButton). Fixing it showed that previous
    :insensitive tracking was manual for a reason: we have many items that are
    not reactive, but don't want the insensitive styling (for example those in
    the battery menu).
    Fix it by adding a new style-class, popup-inactive-menu-item, that is added
    to all new PopupMenuItems that are not activatable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683988

 data/theme/gnome-shell.css |   11 ++++++++---
 js/ui/popupMenu.js         |    5 ++++-
 js/ui/status/network.js    |    2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 01536ee..a7cfc65 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -195,7 +195,7 @@ StScrollBar StButton#vhandle:active {
     background-color: #4c4c4c;
 }
 
-StButton.popup-menu-item:insensitive {
+.popup-menu-item:insensitive {
     color: #9f9f9f;
 }
 
@@ -234,13 +234,18 @@ StButton.popup-menu-item:insensitive {
     spacing: .5em;
 }
 
-.popup-inactive-menu-item {
+.popup-status-menu-item {
     font-weight: normal;
     color: #999;
 }
 
-.popup-subtitle-menu-item {
+.popup-inactive-menu-item, .popup-inactive-menu-item:insensitive {
+    color: white;
+}
+
+.popup-subtitle-menu-item, .popup-subtitle-menu-item:insensitive {
     font-weight: bold;
+    color: white;
 }
 
 .popup-menu-icon {
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 28be350..c4b6c4e 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -61,6 +61,9 @@ const PopupBaseMenuItem = new Lang.Class({
 
         this.setSensitive(this.sensitive);
 
+        if (!this._activatable)
+            this.actor.add_style_class_name('popup-inactive-menu-item');
+
         if (params.style_class)
             this.actor.add_style_class_name(params.style_class);
 
@@ -763,7 +766,7 @@ const PopupSwitchMenuItem = new Lang.Class({
                       { expand: true, span: -1, align: St.Align.END });
 
         this._statusLabel = new St.Label({ text: '',
-                                           style_class: 'popup-inactive-menu-item'
+                                           style_class: 'popup-status-menu-item'
                                          });
         this._statusBin.child = this._switch.actor;
     },
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 89aa63d..4e4e155 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1570,7 +1570,7 @@ const NMApplet = new Lang.Class({
         this._client = NMClient.Client.new();
 
         this._statusSection = new PopupMenu.PopupMenuSection();
-        this._statusItem = new PopupMenu.PopupMenuItem('', { style_class: 'popup-inactive-menu-item', reactive: false });
+        this._statusItem = new PopupMenu.PopupMenuItem('', { reactive: false });
         this._statusSection.addMenuItem(this._statusItem);
         this._statusSection.addAction(_("Enable networking"), Lang.bind(this, function() {
             this._client.networking_enabled = true;



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