summaryrefslogtreecommitdiff
path: root/wikipedia
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2013-12-03 20:42:17 -0800
committerMatt Watson <mattdangerw@gmail.com>2013-12-05 13:10:52 -0800
commit0bd0ce3245e0f7860ec5e0794b9a45865ba69d91 (patch)
tree7fc1bc60fa46ce03a48150cfac292abda3ccd90c /wikipedia
parent789e1b1a80c35697081184bc80707bc08df0e189 (diff)
Category button sizing for gtk 3.10
Another one. This one for gtk 3.10. With the new Gtk version, overriding get_preferred_width to handle overlong titles can mess up the height allocation when labels wrap. Specifying width for height management for the button fixed this [endlessm/eos-sdk#376]
Diffstat (limited to 'wikipedia')
-rw-r--r--wikipedia/widgets/category_button.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/wikipedia/widgets/category_button.js b/wikipedia/widgets/category_button.js
index 44a3e1b..e6cfdde 100644
--- a/wikipedia/widgets/category_button.js
+++ b/wikipedia/widgets/category_button.js
@@ -162,9 +162,15 @@ const CategoryButton = new Lang.Class({
// Sometimes our label content runs too long and the min window width can
// be greater than the screen width. So we provide our own min width for
- // category buttons here, and allow the GtkLabels to be cut off
- vfunc_get_preferred_width: function() {
- let natural_width = this.parent()[1];
+ // category buttons here, and allow the GtkLabels to be cut off if there's
+ // no space. We ask for width for height management so the height will be
+ // allocated first.
+ vfunc_get_request_mode: function() {
+ return Gtk.SizeRequestMode.WIDTH_FOR_HEIGHT;
+ },
+
+ vfunc_get_preferred_width_for_height: function(height) {
+ let natural_width = this.parent(height)[1];
return [CATEGORY_MIN_WIDTH, natural_width];
},