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
This commit is contained in:
Marina Zhurakhinskaya 2011-03-27 14:57:34 -04:00
parent 8f58bc5b19
commit 9a21008177

View File

@ -740,15 +740,22 @@ Notification.prototype = {
// If the banner doesn't fully fit in the banner box, we possibly need to add the // 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 // 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. // relayout, so we add it to the main loop.
if (!bannerFits) if (!bannerFits && this._canExpandContent())
Mainloop.idle_add(Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
function() { Lang.bind(this,
function() {
if (this._canExpandContent()) {
this._addBannerBody(); 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(); this._updated();
return false; }
})); return false;
}));
},
_canExpandContent: function() {
return this._bannerBodyText ||
(!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
}, },
_updated: function() { _updated: function() {