Skip to content

Commit 5ce8dc2

Browse files
committed
[email protected] - Avoid redundant update_list calls during clear all.
1 parent 1898e91 commit 5ce8dc2

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
4949
// States
5050
this._blinking = false;
5151
this._blink_toggle = false;
52+
this._clearing = false;
5253

5354
this._display();
5455
}
@@ -181,7 +182,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
181182
let i = this.notifications.indexOf(notification);
182183
if (i != -1)
183184
this.notifications.splice(i, 1);
184-
this.update_list();
185+
if (!this._clearing)
186+
this.update_list();
185187
});
186188
notification._timeLabel.show();
187189

@@ -245,9 +247,14 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
245247
_clear_all() {
246248
let count = this.notifications.length;
247249
if (count > 0) {
248-
for (let i = count-1; i >=0; i--) {
249-
this._notificationbin.remove_actor(this.notifications[i].actor);
250-
this.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
250+
this._clearing = true;
251+
try {
252+
for (let i = count-1; i >=0; i--) {
253+
this._notificationbin.remove_actor(this.notifications[i].actor);
254+
this.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
255+
}
256+
} finally {
257+
this._clearing = false;
251258
}
252259
}
253260
this.notifications = [];

0 commit comments

Comments
 (0)