[gnome-shell] messageTray: only update an icon when necessary on notification update



commit a0ba664c6468a41ef6dc9d953bcf38132eb3faba
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Wed Sep 21 16:47:49 2011 -0400

    messageTray: only update an icon when necessary on notification update
    
    This avoids unnecessarily removing and resetting the icon in the notifications.
    
    This fixes the new chat notification sliding down and up slightly when new
    messages are received.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659768

 js/ui/messageTray.js |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index d41fd7d..cf149ea 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -504,8 +504,11 @@ Notification.prototype = {
 
         let oldFocus = global.stage.key_focus;
 
-        if (this._icon)
+        if (this._icon && (params.icon || params.clear)) {
             this._icon.destroy();
+            this._icon = null;
+        }
+
         // We always clear the content area if we don't have custom
         // content because it might contain the @banner that didn't
         // fit in the banner mode.
@@ -531,13 +534,15 @@ Notification.prototype = {
         if (!this._scrollArea && !this._actionArea && !this._imageBin)
             this._table.remove_style_class_name('multi-line-notification');
 
-        this._icon = params.icon || this.source.createNotificationIcon();
-        this._table.add(this._icon, { row: 0,
-                                      col: 0,
-                                      x_expand: false,
-                                      y_expand: false,
-                                      y_fill: false,
-                                      y_align: St.Align.START });
+        if (!this._icon) {
+            this._icon = params.icon || this.source.createNotificationIcon();
+            this._table.add(this._icon, { row: 0,
+                                          col: 0,
+                                          x_expand: false,
+                                          y_expand: false,
+                                          y_fill: false,
+                                          y_align: St.Align.START });
+        }
 
         this.title = title;
         title = title ? _fixMarkup(title.replace(/\n/g, ' '), params.titleMarkup) : '';



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