Timer: Preserve current theme when sunrise/sunset is unavailable
This commit is contained in:
committed by
Romain Vigier
parent
755605f3fe
commit
4d023d9f9f
@@ -234,6 +234,11 @@ export class Timer extends GObject.Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#colorSchemeToTime() {
|
||||||
|
return this.#interfaceSettings.get_string('color-scheme') === 'prefer-dark' ? Time.NIGHT : Time.DAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#onLocationStateChanged() {
|
#onLocationStateChanged() {
|
||||||
this.disable();
|
this.disable();
|
||||||
this.enable();
|
this.enable();
|
||||||
@@ -254,8 +259,7 @@ export class Timer extends GObject.Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#onColorSchemeChanged() {
|
#onColorSchemeChanged() {
|
||||||
const time = this.#interfaceSettings.get_string('color-scheme') === 'prefer-dark' ? Time.NIGHT : Time.DAY;
|
this.#changeTime(this.#colorSchemeToTime(), true);
|
||||||
this.#changeTime(time, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#onGeoclueReady(_geoclue, result) {
|
#onGeoclueReady(_geoclue, result) {
|
||||||
@@ -319,8 +323,9 @@ export class Timer extends GObject.Object {
|
|||||||
// Sunset happens on the day after
|
// Sunset happens on the day after
|
||||||
else if (sunrise > sunset)
|
else if (sunrise > sunset)
|
||||||
return hour >= sunrise || hour < sunset ? Time.DAY : Time.NIGHT;
|
return hour >= sunrise || hour < sunset ? Time.DAY : Time.NIGHT;
|
||||||
|
// Sunset and Sunrise times are identical; preserve current theme
|
||||||
else
|
else
|
||||||
return Time.DAY;
|
return this.#time || this.#colorSchemeToTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
#updateSuntimes() {
|
#updateSuntimes() {
|
||||||
|
|||||||
Reference in New Issue
Block a user