apps-menu: Prevent the ApplicationMenuItem from becoming too wide

PopupMenu.PopupBaseMenuItem uses the natural width of its children to
set its own minimum and natural widths. We don't want that because
some of our children can be too wide. So, we override it.

We also set the span and expand parameters of the label to -1 and true
respectively. Otherwise we won't get to see the "...".

https://bugzilla.gnome.org/show_bug.cgi?id=693282
This commit is contained in:
Debarshi Ray
2013-02-09 21:35:21 +01:00
parent f187f47cdd
commit b9fba54b9f
+5 -1
View File
@@ -57,7 +57,7 @@ const ApplicationMenuItem = new Lang.Class({
this.addActor(icon);
let appLabel = new St.Label({ text: app.get_name() });
this.addActor(appLabel);
this.addActor(appLabel, { span: -1, expand: true });
this.actor.label_actor = appLabel;
},
@@ -72,6 +72,10 @@ const ApplicationMenuItem = new Lang.Class({
if (active)
this._button.scrollToButton(this);
this.parent(active, params);
},
_getPreferredWidth: function(actor, forHeight, alloc) {
alloc.min_size = alloc.natural_size = -1;
}
});