add avatar icons to message tray
This commit is contained in:
parent
f106ee7182
commit
64373fe77e
@ -163,6 +163,7 @@ StScrollBar StButton#vhandle:hover
|
|||||||
border: 1px solid rgba(128,128,128,0.45);
|
border: 1px solid rgba(128,128,128,0.45);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
spacing: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* App Switcher */
|
/* App Switcher */
|
||||||
|
@ -18,6 +18,9 @@ Notification.prototype = {
|
|||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.BoxLayout({ name: 'notification' });
|
this.actor = new St.BoxLayout({ name: 'notification' });
|
||||||
|
|
||||||
|
this._iconBox = new St.Bin();
|
||||||
|
this.actor.add(this._iconBox);
|
||||||
|
|
||||||
this._text = new St.Label();
|
this._text = new St.Label();
|
||||||
this.actor.add(this._text, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
|
this.actor.add(this._text, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
|
||||||
|
|
||||||
@ -34,13 +37,14 @@ Notification.prototype = {
|
|||||||
this._hideTimeoutId = 0;
|
this._hideTimeoutId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(text) {
|
show: function(icon, text) {
|
||||||
let primary = global.get_primary_monitor();
|
let primary = global.get_primary_monitor();
|
||||||
|
|
||||||
if (this._hideTimeoutId > 0)
|
if (this._hideTimeoutId > 0)
|
||||||
Mainloop.source_remove(this._hideTimeoutId);
|
Mainloop.source_remove(this._hideTimeoutId);
|
||||||
this._hideTimeoutId = Mainloop.timeout_add(NOTIFICATION_TIMEOUT * 1000, Lang.bind(this, this.hide));
|
this._hideTimeoutId = Mainloop.timeout_add(NOTIFICATION_TIMEOUT * 1000, Lang.bind(this, this.hide));
|
||||||
|
|
||||||
|
this._iconBox.child = icon;
|
||||||
this._text.text = text;
|
this._text.text = text;
|
||||||
|
|
||||||
this.actor.x = Math.round((primary.width - this.actor.width) / 2);
|
this.actor.x = Math.round((primary.width - this.actor.width) / 2);
|
||||||
@ -60,13 +64,19 @@ Notification.prototype = {
|
|||||||
{ y: primary.height,
|
{ y: primary.height,
|
||||||
time: ANIMATION_TIME,
|
time: ANIMATION_TIME,
|
||||||
transition: "easeOutQuad",
|
transition: "easeOutQuad",
|
||||||
onComplete: function() {
|
onComplete: this.hideComplete,
|
||||||
// Don't hide the notification if we are showing a new one.
|
|
||||||
if (this._hideTimeoutId == 0)
|
|
||||||
this.actor.hide();
|
|
||||||
},
|
|
||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
hideComplete: function() {
|
||||||
|
// We don't explicitly destroy the icon, since the caller may
|
||||||
|
// still want it.
|
||||||
|
this._iconBox.child = null;
|
||||||
|
|
||||||
|
// Don't hide the notification if we are showing a new one.
|
||||||
|
if (this._hideTimeoutId == 0)
|
||||||
|
this.actor.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -232,6 +232,6 @@ Source.prototype = {
|
|||||||
_receivedMessage: function(channel, id, timestamp, sender,
|
_receivedMessage: function(channel, id, timestamp, sender,
|
||||||
type, flags, text) {
|
type, flags, text) {
|
||||||
log('Received: id ' + id + ', time ' + timestamp + ', sender ' + sender + ', type ' + type + ', flags ' + flags + ': ' + text);
|
log('Received: id ' + id + ', time ' + timestamp + ', sender ' + sender + ', type ' + type + ', flags ' + flags + ': ' + text);
|
||||||
Main.notificationPopup.show(text);
|
Main.notificationPopup.show(this._avatar, text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user