diff --git a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js index a0f45180d9..051865ea45 100644 --- a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js @@ -65,9 +65,18 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet { _openMenu() { this._update_timestamp(); + + this.notifications.forEach(notification => { + global.reparentActor(notification.actor, this._notificationbin); + }); + this.menu.toggle(); } + _onMenuClosed() { + this._notificationbin.remove_all_children(); + } + _display() { // Always start the applet empty, void of any notifications. this.set_applet_icon_symbolic_name("empty-notif"); @@ -138,8 +147,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet { if (notification._destroyed) { this.notifications.splice(existing_index, 1); } else { - notification._inNotificationBin = true; - global.reparentActor(notification.actor, this._notificationbin); notification._timeLabel.show(); } this.update_list(); @@ -148,11 +155,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet { return; } // Add notification to list. - notification._inNotificationBin = true; this.notifications.push(notification); - // Steal the notification panel. - this._notificationbin.add(notification.actor); - notification.actor._parent_container = this._notificationbin; + notification.actor.add_style_class_name('notification-applet-padding'); // Register for destruction. notification.connect('scrolling-changed', (notif, scrolling) => { this.menu.passEvents = scrolling }); diff --git a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/metadata.json b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/metadata.json index 0d9d00af31..cf7af74b8e 100644 --- a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/metadata.json +++ b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/metadata.json @@ -2,5 +2,6 @@ "uuid": "notifications@cinnamon.org", "name": "Notifications", "description": "Click to display and manage system notifications", -"icon": "cs-notifications" +"icon": "cs-notifications", +"max-instances": -1 } diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 7d224852c4..457791c011 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -262,12 +262,10 @@ var Notification = class Notification { this._actionArea = null; this._imageBin = null; this._timestamp = new Date(); - this._inNotificationBin = false; source.connect('destroy', (source, reason) => { this.destroy(reason) }); this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION }); - this.actor._parent_container = null; this.actor.connect('clicked', () => this._onClicked()); this.actor.connect('destroy', () => this._onDestroy()); @@ -348,7 +346,6 @@ var Notification = class Notification { */ update(title, body, params) { this._timestamp = new Date(); - this._inNotificationBin = false; params = Params.parse(params, { icon: null, titleMarkup: false, @@ -929,8 +926,8 @@ MessageTray.prototype = { _showNotification: function () { this._notification = this._notificationQueue.shift(); - if (this._notification.actor._parent_container) { - this._notification.actor._parent_container.remove_actor(this._notification.actor); + if (this._notification.actor.get_parent()) { + this._notification.actor.get_parent().remove_actor(this._notification.actor); } this._notificationBin.child = this._notification.actor;