[gnome-shell] Make sure notification has all the content when it is expanded



commit 9a2100817788cad27edd0cc88907ec4130bdb73e
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Sun Mar 27 14:57:34 2011 -0400

    Make sure notification has all the content when it is expanded
    
    Use Meta.later_add() with BEFORE_REDRAW rather than Mainloop.idle_add()
    to add the banner body so that the notification body is reliably added
    after the first frame is drawn. This is important for notifications that
    are expanded right away, such as the summary notifications that
    were not shown as banners because the user was in the Busy mode or was
    interacting with the summary. Otherwise, these notifications were sometimes
    shown with an ellipsized banner and were only getting full content when
    they were done animating.
    
    Only add expanded content and signal the change once. Previously, we
    used to signal the change numerous times and processing this signal was
    holding up processing other things, such as the user moving the mouse
    away from the notification so that the notification collapses.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645719

 js/ui/messageTray.js |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f1244a5..fa96526 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -740,15 +740,22 @@ Notification.prototype = {
         // If the banner doesn't fully fit in the banner box, we possibly need to add the
         // banner to the body. We can't do that from here though since that will force a
         // relayout, so we add it to the main loop.
-        if (!bannerFits)
-            Mainloop.idle_add(Lang.bind(this,
-                                        function() {
+        if (!bannerFits && this._canExpandContent())
+            Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
+                           Lang.bind(this,
+                                     function() {
+                                        if (this._canExpandContent()) {
                                             this._addBannerBody();
-                                            if (!this._titleFitsInBannerMode)
-                                                this._table.add_style_class_name('multi-line-notification');
+                                            this._table.add_style_class_name('multi-line-notification');
                                             this._updated();
-                                            return false;
-                                        }));
+                                        }
+                                        return false;
+                                     }));
+    },
+
+    _canExpandContent: function() {
+        return this._bannerBodyText ||
+               (!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
     },
 
     _updated: function() {



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