From f8b1a84b81328f1594b468a65a16c3b2fdf6cb54 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Thu, 16 Aug 2012 22:38:22 +0200 Subject: [PATCH] ScreenShield: Fix updating visibility of the notification box If there were no persistent or resident notification sources, nothing ever would call _updateVisibility, and the box would stay there empty https://bugzilla.gnome.org/show_bug.cgi?id=681143 --- js/ui/screenShield.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 31355a6f7..5e294c210 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -93,8 +93,9 @@ const NotificationsBox = new Lang.Class({ this._items = []; Main.messageTray.getSummaryItems().forEach(Lang.bind(this, function(item) { - this._summaryItemAdded(Main.messageTray, item); + this._summaryItemAdded(Main.messageTray, item, true); })); + this._updateVisibility(); this._summaryAddedId = Main.messageTray.connect('summary-item-added', Lang.bind(this, this._summaryItemAdded)); }, @@ -118,7 +119,7 @@ const NotificationsBox = new Lang.Class({ return; } - let children = this._persistentNotificationBox.get_children() + let children = this._persistentNotificationBox.get_children(); this.actor.visible = children.some(function(a) { return a.visible; }); }, @@ -157,7 +158,7 @@ const NotificationsBox = new Lang.Class({ return [box, countLabel]; }, - _summaryItemAdded: function(tray, item) { + _summaryItemAdded: function(tray, item, dontUpdateVisibility) { // Ignore transient sources if (item.source.isTransient) return; @@ -186,7 +187,8 @@ const NotificationsBox = new Lang.Class({ obj.sourceDestroyId = item.source.connect('destroy', Lang.bind(this, this._onSourceDestroy)); this._items.push(obj); - this._updateVisibility(); + if (!dontUpdateVisibility) + this._updateVisibility(); }, _findSource: function(source) {