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

@ -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;
},