From 3f5996882efe92ec6575ff6fbcc4ff95c69e5b1b Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 9 Aug 2013 17:47:05 -0700 Subject: Word-wrap overly long category title Turn word-wrapping on in the GtkLabel. Set the arrow button's valign to be END, and add a Benton Sans correction to the arrow button. [endlessm/eos-sdk#255] --- wikipedia/widgets/category_button.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wikipedia/widgets/category_button.js b/wikipedia/widgets/category_button.js index 4edac83..ade1f21 100644 --- a/wikipedia/widgets/category_button.js +++ b/wikipedia/widgets/category_button.js @@ -11,6 +11,7 @@ const CATEGORY_LABEL_BOTTOM_MARGIN = 20; // pixels const CATEGORY_BUTTON_RIGHT_MARGIN = 20; // pixels const CATEGORY_BUTTON_BOTTOM_MARGIN = 20; // pixels const CATEGORY_LABEL_BENTON_SANS_CORRECTION = 0; // pixels +const CATEGORY_BUTTON_BENTON_SANS_CORRECTION = 10; // pixels const _HOVER_ARROW_URI = '/com/endlessm/wikipedia-domain/assets/category_hover_arrow.png'; const MAIN_CATEGORY_SCREEN_WIDTH_PERCENTAGE = 0.37; @@ -72,14 +73,17 @@ const CategoryButton = new Lang.Class({ margin_left: CATEGORY_LABEL_LEFT_MARGIN, margin_bottom: CATEGORY_LABEL_BOTTOM_MARGIN - CATEGORY_LABEL_BENTON_SANS_CORRECTION, hexpand: true, - halign: Gtk.Align.START + halign: Gtk.Align.START, + xalign: 0.0, // deprecated Gtk.Misc properties; necessary because + wrap: true // "wrap" doesn't respect "halign" }); this._arrow = new Gtk.Image({ resource: _HOVER_ARROW_URI, margin_right: CATEGORY_BUTTON_RIGHT_MARGIN, - margin_bottom: CATEGORY_BUTTON_BOTTOM_MARGIN - CATEGORY_LABEL_BENTON_SANS_CORRECTION, + margin_bottom: CATEGORY_BUTTON_BOTTOM_MARGIN + CATEGORY_BUTTON_BENTON_SANS_CORRECTION, halign: Gtk.Align.END, - no_show_all: true + valign: Gtk.Align.END, + opacity: 0 }); let context = this._label.get_style_context(); @@ -146,12 +150,12 @@ const CategoryButton = new Lang.Class({ this._eventbox.connect('enter-notify-event', Lang.bind(this, function(widget, event) { this._eventbox.set_state_flags(Gtk.StateFlags.PRELIGHT, false); - this._arrow.show(); + this._arrow.opacity = 1.0; })); this._eventbox.connect('leave-notify-event', Lang.bind(this, function(widget, event) { this._eventbox.unset_state_flags(Gtk.StateFlags.PRELIGHT); - this._arrow.hide(); + this._arrow.opacity = 0.0; })); } }, -- cgit v1.2.3