[gnome-shell] messageTray: update the SummaryItem's label based on Source title changes



commit 890efa787a05e3fbc043cd0f4ac369d91a8fc531
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 8 02:27:57 2011 -0400

    messageTray: update the SummaryItem's label based on Source title changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643513

 js/ui/messageTray.js        |   10 ++++++++++
 js/ui/notificationDaemon.js |    7 +++++--
 js/ui/telepathyClient.js    |    2 +-
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index a16fde5..c9ca0fc 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -893,6 +893,11 @@ Source.prototype = {
         this.isTransient = isTransient;
     },
 
+    setTitle: function(newTitle) {
+        this.title = newTitle;
+        this.emit('title-changed');
+    },
+
     // Called to create a new icon actor (of size this.ICON_SIZE).
     // Must be overridden by the subclass if you do not pass icons
     // explicitly to the Notification() constructor.
@@ -995,6 +1000,11 @@ SummaryItem.prototype = {
         this._sourceTitleBin.child = this._sourceTitle;
         this._sourceTitleBin.width = 0;
 
+        this.source.connect('title-changed',
+                            Lang.bind(this, function() {
+                                this._sourceTitle.text = source.title;
+                            }));
+
         this._sourceBox.add(this._sourceIcon, { y_fill: false });
         this._sourceBox.add(this._sourceTitleBin, { expand: true, y_fill: false });
         this.actor.child = this._sourceBox;
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 00a7d2c..35eb581 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -165,8 +165,11 @@ NotificationDaemon.prototype = {
         // with a transient one from the same sender, so we
         // always create a new source object for new transient notifications
         // and never add it to this._sources .
-        if (!isForTransientNotification && this._sources[pid])
-            return this._sources[pid];
+        if (!isForTransientNotification && this._sources[pid]) {
+            let source = this._sources[pid];
+            source.setTitle(title);
+            return source;
+        }
 
         let source = new Source(title, pid);
         source.setTransient(isForTransientNotification);
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index a87ab2e..ba6113d 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -241,7 +241,7 @@ Source.prototype = {
 
     _updateAlias: function() {
         let oldAlias = this.title;
-        this.title = this._contact.get_alias();
+        this.setTitle(this._contact.get_alias());
         this._notification.appendAliasChange(oldAlias, this.title);
         this.pushNotification(this._notification);
     },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]