diff options
author | rmacqueen <rorymacqueen@gmail.com> | 2013-08-06 17:45:21 -0700 |
---|---|---|
committer | rmacqueen <rorymacqueen@gmail.com> | 2013-08-06 17:45:21 -0700 |
commit | eb7154fc2f9e04e678100b7ad3537b90f04f6380 (patch) | |
tree | 98dd7db76aa09ff3502376f72cce90d5c27d2197 | |
parent | f1f7ebe477c2b72b55bd6a267f42e672e66cccfc (diff) | |
parent | d01648e9e3ec38fd404748ef83050d68f5741bd6 (diff) |
Merge pull request #227 from endlessm/issues/226
Ellipisze long article titles
-rw-r--r-- | wikipedia/TextButton.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/wikipedia/TextButton.js b/wikipedia/TextButton.js index 13a47ac..0960090 100644 --- a/wikipedia/TextButton.js +++ b/wikipedia/TextButton.js @@ -2,6 +2,11 @@ const Lang = imports.lang; const Gdk = imports.gi.Gdk; const GdkPixbuf = imports.gi.GdkPixbuf; const Gtk = imports.gi.Gtk; +const Pango = imports.gi.Pango; + +// This is an approximate number of characters that will keep the label from +// going over its specified 258px +const ARTICLE_LABEL_MAX_WIDTH_CHARS = 18; const TextButton = new Lang.Class({ Name: 'EndlessTextButton', @@ -25,7 +30,9 @@ const TextButton = new Lang.Class({ }); this._label = new Gtk.Label({ - label: label_text.toUpperCase() + label: label_text.toUpperCase(), + max_width_chars: ARTICLE_LABEL_MAX_WIDTH_CHARS, + ellipsize: Pango.EllipsizeMode.END }); this._box.pack_start(this._label, false, false, 0); |