popupMenu: Improve menu item layout

Mixing submenu menuitems and toggle menuitems results in poor layout.
The fix is to right-align the submenu arrows. Since we already need to
right-align the battery percentages as well, add alignment support to
PopupBaseMenuItem.addActor(), and update stuff for that.

Also remove the "column" param from addActor() since it hadn't
actually been implemented correctly before.

https://bugzilla.gnome.org/show_bug.cgi?id=633476
This commit is contained in:
Dan Winship
2010-11-17 14:10:12 -05:00
parent 3262b63325
commit 7eec8a899a
2 changed files with 46 additions and 43 deletions

View File

@ -74,9 +74,7 @@ Indicator.prototype = {
this._batteryItem = new PopupMenu.PopupMenuItem('');
this._primaryPercentage = new St.Label();
let percentBin = new St.Bin();
percentBin.set_child(this._primaryPercentage, { x_align: St.Align.END });
this._batteryItem.addActor(percentBin);
this._batteryItem.addActor(this._primaryPercentage, { align: St.Align.END });
this.menu.addMenuItem(this._batteryItem);
this._deviceSep = new PopupMenu.PopupSeparatorMenuItem();
@ -232,10 +230,8 @@ DeviceItem.prototype = {
this._box.add_actor(this._label);
this.addActor(this._box);
let percentBin = new St.Bin({ x_align: St.Align.END });
let percentLabel = new St.Label({ text: '%d%%'.format(Math.round(percentage)) });
percentBin.child = percentLabel;
this.addActor(percentBin);
this.addActor(percentLabel, { align: St.Align.END });
},
_deviceTypeToString: function(type) {