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
This commit is contained in:
Giovanni Campagna 2012-09-11 14:00:22 +02:00
parent bf2d2071fc
commit 7499b04638
3 changed files with 13 additions and 5 deletions

View File

@ -195,7 +195,7 @@ StScrollBar StButton#vhandle:active {
background-color: #4c4c4c; background-color: #4c4c4c;
} }
StButton.popup-menu-item:insensitive { .popup-menu-item:insensitive {
color: #9f9f9f; color: #9f9f9f;
} }
@ -234,13 +234,18 @@ StButton.popup-menu-item:insensitive {
spacing: .5em; spacing: .5em;
} }
.popup-inactive-menu-item { .popup-status-menu-item {
font-weight: normal; font-weight: normal;
color: #999; 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; font-weight: bold;
color: white;
} }
.popup-menu-icon { .popup-menu-icon {

View File

@ -61,6 +61,9 @@ const PopupBaseMenuItem = new Lang.Class({
this.setSensitive(this.sensitive); this.setSensitive(this.sensitive);
if (!this._activatable)
this.actor.add_style_class_name('popup-inactive-menu-item');
if (params.style_class) if (params.style_class)
this.actor.add_style_class_name(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 }); { expand: true, span: -1, align: St.Align.END });
this._statusLabel = new St.Label({ text: '', this._statusLabel = new St.Label({ text: '',
style_class: 'popup-inactive-menu-item' style_class: 'popup-status-menu-item'
}); });
this._statusBin.child = this._switch.actor; this._statusBin.child = this._switch.actor;
}, },

View File

@ -1570,7 +1570,7 @@ const NMApplet = new Lang.Class({
this._client = NMClient.Client.new(); this._client = NMClient.Client.new();
this._statusSection = new PopupMenu.PopupMenuSection(); 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.addMenuItem(this._statusItem);
this._statusSection.addAction(_("Enable networking"), Lang.bind(this, function() { this._statusSection.addAction(_("Enable networking"), Lang.bind(this, function() {
this._client.networking_enabled = true; this._client.networking_enabled = true;