remoteMenu: Allow separator items to have labels

This fixes a regression with remote menus where sections have
labels, like gnome-documents.

https://bugzilla.gnome.org/show_bug.cgi?id=700257
This commit is contained in:
Jasper St. Pierre
2013-04-24 16:21:57 -04:00
parent 3075f3cfe4
commit af063dc2f2
2 changed files with 42 additions and 7 deletions

View File

@ -393,12 +393,19 @@ const PopupSeparatorMenuItem = new Lang.Class({
Name: 'PopupSeparatorMenuItem',
Extends: PopupBaseMenuItem,
_init: function () {
_init: function (text) {
this.parent({ reactive: false,
can_focus: false});
this._box = new St.BoxLayout();
this.addActor(this._box, { span: -1, expand: true });
this.label = new St.Label({ text: text || '' });
this._box.add(this.label);
this.actor.label_actor = this.label;
this._separator = new Separator.HorizontalSeparator({ style_class: 'popup-separator-menu-item' });
this.addActor(this._separator.actor, { span: -1, expand: true });
this._box.add(this._separator.actor, { expand: true });
}
});
@ -983,6 +990,9 @@ const PopupMenuBase = new Lang.Class({
},
_updateSeparatorVisibility: function(menuItem) {
if (menuItem.label.text)
return;
let children = this.box.get_children();
let index = children.indexOf(menuItem.actor);