backgroundManager: Always emit 'loaded' signal

As backgrounds are cached, it is possible that we never emit the
'loaded' signal added in commit f386103bc1. We are relying on the
signal though, so do the same as Background and emit the signal
from an idle if the background was already loaded.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1371


(cherry picked from commit 5c550daecb)
This commit is contained in:
Florian Müllner 2020-07-22 10:32:49 +00:00 committed by Georges Basile Stavracas Neto
parent 7097796c3f
commit 5f509855e2

View File

@ -758,11 +758,19 @@ var BackgroundManager = class BackgroundManager {
this._updateBackgroundActor();
});
let loadedSignalId = background.connect('loaded', () => {
let loadedSignalId;
if (background.isLoaded) {
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.emit('loaded');
return GLib.SOURCE_REMOVE;
});
} else {
loadedSignalId = background.connect('loaded', () => {
background.disconnect(loadedSignalId);
loadedSignalId = null;
this.emit('loaded');
});
}
backgroundActor.connect('destroy', () => {
if (changeSignalId)