background: Update animations when coming back from suspend
We currently reload animated backgrounds on timezone changes, but there are other cases where the time can change unexpectedly and the background no longer matches the time of day. One case we can easily handle is when coming back from suspend, so do that. https://bugzilla.gnome.org/show_bug.cgi?id=773265
This commit is contained in:
parent
5117139add
commit
ccacb5f6de
@ -102,6 +102,7 @@ const Lang = imports.lang;
|
|||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
|
const LoginManager = imports.misc.loginManager;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
@ -254,6 +255,13 @@ const Background = new Lang.Class({
|
|||||||
this._loadAnimation(this._animation.file);
|
this._loadAnimation(this._animation.file);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
LoginManager.getLoginManager().connect('prepare-for-sleep',
|
||||||
|
(lm, aboutToSuspend) => {
|
||||||
|
if (aboutToSuspend)
|
||||||
|
return;
|
||||||
|
this._refreshAnimation();
|
||||||
|
});
|
||||||
|
|
||||||
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
|
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
}));
|
}));
|
||||||
@ -282,10 +290,16 @@ const Background = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateResolution: function() {
|
updateResolution: function() {
|
||||||
if (this._animation) {
|
if (this._animation)
|
||||||
this._removeAnimationTimeout();
|
this._refreshAnimation();
|
||||||
this._updateAnimation();
|
},
|
||||||
}
|
|
||||||
|
_refreshAnimation: function() {
|
||||||
|
if (!this._animation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._removeAnimationTimeout();
|
||||||
|
this._updateAnimation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLoaded: function() {
|
_setLoaded: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user