From f1fb0d32c69dd5c8d49806827b0edbe8c3cb38ad Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 3 Feb 2010 15:15:12 -0500 Subject: [PATCH] [MessageTray] fix ellipsization when the title is too long The code previously assumed that an StLabel with a 0-width allocation would not be visible; this is apparently not true. Part of https://bugzilla.gnome.org/show_bug.cgi?id=608915 --- js/ui/messageTray.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 4c01bb3b2..c82c7122e 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -153,15 +153,21 @@ Notification.prototype = { titleBox.y2 = titleNatH; this._titleText.allocate(titleBox, flags); - let bannerBox = new Clutter.ActorBox(); - bannerBox.x1 = Math.min(titleBox.x2 + spacing, availWidth); - bannerBox.y1 = 0; - bannerBox.x2 = Math.min(bannerBox.x1 + bannerNatW, availWidth); - bannerBox.y2 = titleNatH; - this._bannerText.allocate(bannerBox, flags); - - if (bannerBox.x2 < bannerBox.x1 + bannerNatW) + if (titleBox.x2 + spacing > availWidth) { + this._bannerText.hide(); this._canPopOut = true; + } else { + let bannerBox = new Clutter.ActorBox(); + bannerBox.x1 = titleBox.x2 + spacing; + bannerBox.y1 = 0; + bannerBox.x2 = Math.min(bannerBox.x1 + bannerNatW, availWidth); + bannerBox.y2 = titleNatH; + this._bannerText.show(); + this._bannerText.allocate(bannerBox, flags); + + if (bannerBox.x2 < bannerBox.x1 + bannerNatW) + this._canPopOut = true; + } }, popOut: function() {