Show new notification dot when DND is on, and the counter is hidden.
Show new notification dot when DND is on, and the counter is hidden.

The patch was provided by Norman L. Smith.

More details from Norman:
----------------------------------------------------------------------------

First the problem:

If the extension is set to block display of notifications and the option
is set to not Show Notification Count, notifications can be received with no
indication of unseen notifications.  The shell has a queue to buffer up to
three notifications as they are normally displayed to the user.  If the queue
is full and a non-critical notification is received it by-passes the queue,
flags the notification as unseen, and the dot is displayed to alert the user
of unseen notifications in the calendar notification area.

With the display of notifications blocked no notifications are seen by the
user when they are received. The dot is only displayed if the queue is full
and a notification is received while the queue is full.

Three notifications will fill the queue; and if all are processed, then three
more can fill the queue and be processed...ad infinitum, never indicating any
unseen notifications.

The fix:

Please refer to the patch.

+        this._showCountChangedSig = this._settings.connect('changed:: ...

I moved the signal connect to the DoNotDisturbButton class.

+        this._showCount = this._settings.get_boolean('panel-count-show');

I changed the show_count to Camel case.  It is good practice to follow
whatever style is used in code you modify. Camel case is used consistently
in the Gnome Shell javascript code.

+        this._indicatorActor = Main.panel.statusArea['dateMenu'] ...
+        this._indicatorSources = Main.panel.statusArea['dateMenu'] ...
+        this._timeoutId = Mainloop.timeout_add(30000, Lang.bind(this, ...

+    _findUnseenNotifications: function() {
+        if (this._iconBusy.visible && !this._showCount && !this ...
+            let count = 0;
+            this._indicatorSources.forEach(Lang.bind(this, function ...
+                count += source.unseenCount;
+            }));
+            if (count > 0)
+                this._indicatorActor.visible = true;
+            }
+        return true;

The above code displays the dot indicator if unseen notifications are
found hidden in the calendar notification area.  Every 30 seconds the
notifications are examined, and if any unseen are found, the dot is
made visible. Note the extension must be in the do not disturb busy
mode, the show count is disabled, and the dot is not visible
for the examination to be performed.  My testing indicates this fixes
the problem.

-        let show_count  = this._settings.get_boolean('panel-count-show');

-        if (count < 1 || !show_count)
+        if (count < 1 || !this._showCount)

I changed show_count to a class variable when it was changed to Camel case.
The variable is persistent and in scope, so it does not require setting each
time it is checked.

+        Mainloop.source_remove(this._timeoutId);
+        this._settings.disconnect(this._showCountChangedSig);

Clean-up timer and signal connection when the button is destroyed.

-        this._showCountChangedSig = 0;

-        if (this._showCountChangedSig > 0) {
-            this._settings.disconnect(this._showCountChangedSig);
-            this._showCountChangedSig = 0;
-        }

Signal disconnect is now handled in DoNotDisturbButton class.

jonnius/acme-code