[gnome-shell] [MessageTray] fix ellipsization when the title is too long



commit f1fb0d32c69dd5c8d49806827b0edbe8c3cb38ad
Author: Dan Winship <danw gnome org>
Date:   Wed Feb 3 15:15:12 2010 -0500

    [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 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 4c01bb3..c82c712 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() {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]