From 963a4c1ba594d40974912f0a1a5032315affc016 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Thu, 12 Dec 2013 12:29:47 -0800 Subject: Force fill alignment of our AssetButton internals Gtk 3.10 switched to baseline alignment for Gtk.Button label and image widget. Which is not what we want. So I forall through the internals and set the valign to fill (same as 3.8). This isn't pretty, but unless Gtk provides some public API for controlling our alignment, the only alternative is to use our own box with our own internal widgets in AssetButton. Which would be a lot of code duplicated from Gtk.Button [endlessm/eos-sdk#427] --- overrides/endless_private/asset_button.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/overrides/endless_private/asset_button.js b/overrides/endless_private/asset_button.js index 594581e..dbb2282 100644 --- a/overrides/endless_private/asset_button.js +++ b/overrides/endless_private/asset_button.js @@ -46,9 +46,22 @@ const AssetButton = new Lang.Class({ this.parent(params); this.set_image(this._image); + this._force_center_valign(this); this.connect('state-flags-changed', Lang.bind(this, this._update_appearance)); }, + // Gtk 3.10 switched to vertically aligning internal children with + // Gtk.Align.BASELINE, which is not what we want for our buttons. This + // forces the button internals to use Gtk.Align.CENTER which we want. If + // Gtk ever provides public api for controlling alignment of its image and + // label, that would be much preferable. + _force_center_valign: function (w) { + w.set_valign(Gtk.Align.FILL); + if (w instanceof Gtk.Container) { + w.forall(Lang.bind(this, this._force_center_valign)); + } + }, + _update_appearance: function() { let flags = this.get_state_flags(); -- cgit v1.2.3