[gnome-shell/message-tray: 5/5] add avatar icons to message tray
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell/message-tray: 5/5] add avatar icons to message tray
- Date: Tue, 3 Nov 2009 15:49:01 +0000 (UTC)
commit 64373fe77e1c0c7e38cd9566609d3d7cbcf5a474
Author: Dan Winship <danw gnome org>
Date: Tue Nov 3 10:47:02 2009 -0500
add avatar icons to message tray
data/theme/gnome-shell.css | 1 +
js/ui/messageTray.js | 22 ++++++++++++++++------
js/ui/messaging.js | 2 +-
3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index a097d78..dfe8dc7 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -163,6 +163,7 @@ StScrollBar StButton#vhandle:hover
border: 1px solid rgba(128,128,128,0.45);
color: white;
padding: 10px;
+ spacing: 10px;
}
/* App Switcher */
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 73128af..512aec0 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -18,6 +18,9 @@ Notification.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ name: 'notification' });
+ this._iconBox = new St.Bin();
+ this.actor.add(this._iconBox);
+
this._text = new St.Label();
this.actor.add(this._text, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
@@ -34,13 +37,14 @@ Notification.prototype = {
this._hideTimeoutId = 0;
},
- show: function(text) {
+ show: function(icon, text) {
let primary = global.get_primary_monitor();
if (this._hideTimeoutId > 0)
Mainloop.source_remove(this._hideTimeoutId);
this._hideTimeoutId = Mainloop.timeout_add(NOTIFICATION_TIMEOUT * 1000, Lang.bind(this, this.hide));
+ this._iconBox.child = icon;
this._text.text = text;
this.actor.x = Math.round((primary.width - this.actor.width) / 2);
@@ -60,13 +64,19 @@ Notification.prototype = {
{ y: primary.height,
time: ANIMATION_TIME,
transition: "easeOutQuad",
- onComplete: function() {
- // Don't hide the notification if we are showing a new one.
- if (this._hideTimeoutId == 0)
- this.actor.hide();
- },
+ onComplete: this.hideComplete,
onCompleteScope: this
});
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();
}
};
diff --git a/js/ui/messaging.js b/js/ui/messaging.js
index 11d0d15..5cc45e0 100644
--- a/js/ui/messaging.js
+++ b/js/ui/messaging.js
@@ -232,6 +232,6 @@ Source.prototype = {
_receivedMessage: function(channel, id, timestamp, sender,
type, 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);
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]