messageList: Keep secondary actor when showing close button

Currently the secondary actor (if set) and the close button are
exclusive, that is the latter replaces the former on hover. As
the swapping feels rather busy and there's no real reason both
cannot be shown at the same time, keep the secondary actor always
visible.
A welcome side effect is that it no longer needs to be placed at
the end, so we can move the notification timestamp right next to
the corresponding title.

https://bugzilla.gnome.org/show_bug.cgi?id=775763
This commit is contained in:
Florian Müllner
2017-02-26 03:33:26 +01:00
parent fec511c786
commit c4f2bb5fe0
3 changed files with 10 additions and 10 deletions

View File

@ -331,18 +331,18 @@ const Message = new Lang.Class({
let titleBox = new St.BoxLayout();
contentBox.add_actor(titleBox);
this.titleLabel = new St.Label({ style_class: 'message-title',
x_expand: true,
x_align: Clutter.ActorAlign.START });
this.titleLabel = new St.Label({ style_class: 'message-title' });
this.setTitle(title);
titleBox.add_actor(this.titleLabel);
this._secondaryBin = new St.Bin({ style_class: 'message-secondary-bin' });
this._secondaryBin = new St.Bin({ style_class: 'message-secondary-bin',
x_expand: true, y_expand: true,
x_fill: true, y_fill: true });
titleBox.add_actor(this._secondaryBin);
let closeIcon = new St.Icon({ icon_name: 'window-close-symbolic',
icon_size: 16 });
this._closeButton = new St.Button({ child: closeIcon, visible: false });
this._closeButton = new St.Button({ child: closeIcon, opacity: 0 });
titleBox.add_actor(this._closeButton);
this._bodyStack = new St.Widget({ x_expand: true });
@ -493,9 +493,8 @@ const Message = new Lang.Class({
},
_sync: function() {
let hovered = this.actor.hover;
this._closeButton.visible = hovered && this.canClose();
this._secondaryBin.visible = !hovered;
let visible = this.actor.hover && this.canClose();
this._closeButton.opacity = visible ? 255 : 0;
},
_onClicked: function() {