summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2013-12-12 12:29:47 -0800
committerMatt Watson <mattdangerw@gmail.com>2013-12-12 14:52:19 -0800
commit963a4c1ba594d40974912f0a1a5032315affc016 (patch)
treedd76c0443ca976dfafb9a10d1f3f3731044fa6ee
parentd9480c6bb34848e60c48b963bab38e4c7f4688a5 (diff)
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]
-rw-r--r--overrides/endless_private/asset_button.js13
1 files changed, 13 insertions, 0 deletions
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();