[gnome-shell] Replace direct call to MessageTray::showNotification() with 'notify' signal in Source::notify()
- From: Marina Zhurakhinskaya <marinaz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Replace direct call to MessageTray::showNotification() with 'notify' signal in Source::notify()
- Date: Thu, 28 Jan 2010 18:20:49 +0000 (UTC)
commit ee75355e713991604750eb3524ac0634dddebaf0
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date: Thu Jan 28 13:12:03 2010 -0500
Replace direct call to MessageTray::showNotification() with 'notify' signal in Source::notify()
This decouples Source and MessageTray, so Source doesn't need to know how
MessageTray works.
js/ui/messageTray.js | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index b045894..378dff0 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -59,6 +59,7 @@ function Source(id, createIcon) {
Source.prototype = {
_init: function(id, createIcon) {
this.id = id;
+ this.text = null;
if (createIcon)
this.createIcon = createIcon;
},
@@ -70,7 +71,8 @@ Source.prototype = {
},
notify: function(text) {
- Main.messageTray.showNotification(new Notification(this.createIcon(ICON_SIZE), text));
+ this.text = text;
+ this.emit('notify');
},
clicked: function() {
@@ -145,6 +147,8 @@ MessageTray.prototype = {
this._icons[source.id] = iconBox;
this._sources[source.id] = source;
+ source.connect('notify', Lang.bind(this, this._onNotify));
+
iconBox.connect('button-release-event', Lang.bind(this,
function () {
source.clicked();
@@ -169,6 +173,11 @@ MessageTray.prototype = {
return this._sources[id];
},
+ _onNotify: function(source) {
+ let notification = new Notification(source.createIcon(ICON_SIZE), source.text);
+ this.showNotification(notification);
+ },
+
_onMessageTrayEntered: function() {
// Don't hide the message tray after a timeout if the user has moved the mouse over it.
// We might have a timeout in place if the user moved the mouse away from the message tray for a very short period of time
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]