MessageTray: clamp unexpanded notification height

The height of an unexpanded notification could include expanded
content if the notification has extra widgets (like actions and images),
so tweening to that cause it to expand visually.
Instead, use the height of the message tray before the restyle
as an upper bound.

https://bugzilla.gnome.org/show_bug.cgi?id=682738
This commit is contained in:
Giovanni Campagna
2012-08-26 20:27:06 +02:00
parent 2672f205fd
commit f96dcaccbe
2 changed files with 12 additions and 0 deletions

View File

@ -337,6 +337,7 @@ const Notification = new Lang.Class({
}));
this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
this.actor.add_style_class_name('notification-unexpanded');
this.actor._delegate = this;
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
@ -852,6 +853,8 @@ const Notification = new Lang.Class({
expand: function(animate) {
this.expanded = true;
this.actor.remove_style_class_name('notification-unexpanded');
// The banner is never shown when the title did not fit, so this
// can be an if-else statement.
if (!this._titleFitsInBannerMode) {
@ -889,6 +892,8 @@ const Notification = new Lang.Class({
// Restore banner opacity in case the notification is shown in the
// banner mode again on update.
this._bannerLabel.opacity = 255;
// Restore height requisition
this.actor.add_style_class_name('notification-unexpanded');
this.emit('collapsed');
},