background: Reload animation on timezone changes

Animated backgrounds are based on a start time in local time - in case
of a timezone change, that time is no longer accurate. To fix, we need
to either make BGSlideShow aware of timezone changes (and notify us to
update the animation), or just reload the animation - timezone changes
should be a rare event, so go with the simpler second option.

https://bugzilla.gnome.org/show_bug.cgi?id=758939
This commit is contained in:
Florian Müllner 2015-12-02 07:44:05 -08:00
parent 80911535a7
commit 965aedb0bb

View File

@ -247,6 +247,13 @@ const Background = new Lang.Class({
this._cancellable = new Gio.Cancellable(); this._cancellable = new Gio.Cancellable();
this.isLoaded = false; this.isLoaded = false;
this._clock = new GnomeDesktop.WallClock();
this._timezoneChangedId = this._clock.connect('notify::timezone',
Lang.bind(this, function() {
if (this._animation)
this._loadAnimation(this._animation.file);
}));
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');
})); }));
@ -265,6 +272,10 @@ const Background = new Lang.Class({
} }
this._fileWatches = null; this._fileWatches = null;
if (this._timezoneChangedId != 0)
this._clock.disconnect(this._timezoneChangedId);
this._timezoneChangedId = 0;
if (this._settingsChangedSignalId != 0) if (this._settingsChangedSignalId != 0)
this._settings.disconnect(this._settingsChangedSignalId); this._settings.disconnect(this._settingsChangedSignalId);
this._settingsChangedSignalId = 0; this._settingsChangedSignalId = 0;