[gnome-shell] ScreenShield/MessageTray: fix crash after the introduction of close buttons



commit 47d46e367e7dd36d8e266e3a65353072eb3d15cd
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Aug 25 21:01:57 2012 +0200

    ScreenShield/MessageTray: fix crash after the introduction of close buttons
    
    Commit 5c6b1fd0c modified the hierarchy of SummaryItem contents, by
    introducing a notificationStackWidget in place of the StackView, but
    forgot to update the bits in ScreenShield.NotificationsBox that accessed
    and reparented that directly, causing a crash by invalid theme node access.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682683

 js/ui/messageTray.js  |   10 +++++++++-
 js/ui/screenShield.js |   11 +++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 32223c5..31fa470 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1258,6 +1258,14 @@ const SummaryItem = new Lang.Class({
         global.focus_manager.add_group(this.rightClickMenu);
     },
 
+    get closeButtonVisible() {
+        return this._closeButton.visible;
+    },
+
+    set closeButtonVisible(v) {
+        this._closeButton.visible = v;
+    },
+
     prepareNotificationStackForShowing: function() {
         if (this.notificationStack.get_n_children() > 0)
             return;
@@ -1266,7 +1274,6 @@ const SummaryItem = new Lang.Class({
             this._appendNotificationToStack(this.source.notifications[i]);
         }
 
-        this.notificationStackWidget.width = this.notificationStackView.width;
         this.scrollTo(St.Side.BOTTOM);
     },
 
@@ -2341,6 +2348,7 @@ const MessageTray = new Lang.Class({
             this._notificationQueue = newQueue;
 
             this._summaryBoxPointer.bin.child = this._summaryBoxPointerItem.notificationStackWidget;
+            this._summaryBoxPointerItem.closeButtonVisible = true;
             this._summaryBoxPointerItem.prepareNotificationStackForShowing();
         } else if (this._clickedSummaryItemMouseButton == 3) {
             this._summaryBoxPointer.bin.child = this._clickedSummaryItem.rightClickMenu;
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index fd096c9..1a10106 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -183,8 +183,9 @@ const NotificationsBox = new Lang.Class({
         };
 
         if (obj.resident) {
+            this._residentNotificationBox.add(item.notificationStackWidget);
+            item.closeButtonVisible = false;
             item.prepareNotificationStackForShowing();
-            this._residentNotificationBox.add(item.notificationStackView);
         } else {
             [obj.sourceBox, obj.countLabel] = this._makeNotificationSource(item.source);
             this._persistentNotificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.MIDDLE });
@@ -229,7 +230,8 @@ const NotificationsBox = new Lang.Class({
 
         if (obj.resident && !itemShouldBeResident) {
             // make into a regular item
-            this._residentNotificationBox.remove_actor(obj.item.notificationStackView);
+            obj.item.doneShowingNotificationStack();
+            this._residentNotificationBox.remove_actor(obj.item.notificationStackWidget);
 
             [obj.sourceBox, obj.countLabel] = this._makeNotificationSource(obj.source);
             this._persistentNotificationBox.add(obj.sourceBox);
@@ -239,8 +241,9 @@ const NotificationsBox = new Lang.Class({
             obj.sourceBox = obj.countLabel = null;
             obj.resident = true;
 
+            this._residentNotificationBox.add(obj.item.notificationStackWidget);
+            obj.item.closeButtonVisible = false;
             obj.item.prepareNotificationStackForShowing();
-            this._residentNotificationBox.add(obj.item.notificationStackView);
         } else {
             // just update the counter
             let count = obj.source.unseenCount;
@@ -262,8 +265,8 @@ const NotificationsBox = new Lang.Class({
 
     _removeItem: function(obj) {
         if (obj.resident) {
-            this._residentNotificationBox.remove_actor(obj.item.notificationStackView);
             obj.item.doneShowingNotificationStack();
+            this._residentNotificationBox.remove_actor(obj.item.notificationStackWidget);
         } else {
             obj.sourceBox.destroy();
         }



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