Reload animated wallpapers when timezone changes (#1461)

This commit is contained in:
lenemter 2022-11-15 13:17:02 +09:00 committed by GitHub
parent 0a72682e32
commit 2c6aa503b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -36,6 +36,9 @@ namespace Gala {
Cancellable cancellable;
uint update_animation_timeout_id = 0;
private Gnome.WallClock clock;
private ulong clock_timezone_handler = 0;
public Background (Meta.Display display, int monitor_index, string? filename,
BackgroundSource background_source, GDesktop.BackgroundStyle style) {
Object (display: display,
@ -54,6 +57,13 @@ namespace Gala {
background_source.changed.connect (settings_changed);
clock = new Gnome.WallClock ();
clock_timezone_handler = clock.notify["timezone"].connect (() => {
if (animation != null) {
load_animation.begin (animation.filename);
}
});
load ();
}
@ -68,6 +78,10 @@ namespace Gala {
}
background_source.changed.disconnect (settings_changed);
if (clock_timezone_handler != 0) {
clock.disconnect (clock_timezone_handler);
}
}
public void update_resolution () {

View File

@ -32,7 +32,6 @@ namespace Gala {
Gee.HashMap<string,BackgroundSource> background_sources;
Animation animation;
string animation_filename;
public BackgroundCache () {
Object ();
@ -61,7 +60,7 @@ namespace Gala {
}
public async Animation get_animation (string filename) {
if (animation_filename == filename) {
if (animation != null && animation.filename == filename) {
Idle.add (() => {
get_animation.callback ();
return false;