Timer: Update times when location value is changed in settings
This commit is contained in:
@@ -131,6 +131,10 @@ export class Timer extends GObject.Object {
|
||||
settings: this.#locationSettings,
|
||||
id: this.#locationSettings.connect("changed::enabled", this.#onLocationStateChanged.bind(this)),
|
||||
});
|
||||
this.#settingsConnections.push({
|
||||
settings: this.#settings,
|
||||
id: this.#settings.connect("changed::location", this.#onLocationSettingsChanged.bind(this)),
|
||||
});
|
||||
this.#settingsConnections.push({
|
||||
settings: this.#settings,
|
||||
id: this.#settings.connect("changed::manual-schedule", this.#onManualScheduleStateChanged.bind(this)),
|
||||
@@ -243,6 +247,10 @@ export class Timer extends GObject.Object {
|
||||
this.enable();
|
||||
}
|
||||
|
||||
#onLocationSettingsChanged() {
|
||||
this.#updateSuntimes();
|
||||
}
|
||||
|
||||
#onManualScheduleStateChanged() {
|
||||
this.disable();
|
||||
this.enable();
|
||||
@@ -303,9 +311,8 @@ export class Timer extends GObject.Object {
|
||||
#onLocationChanged(_geoclue, _location) {
|
||||
debug.message("Location has changed.");
|
||||
const { latitude, longitude } = this.#geoclue.get_location();
|
||||
this.#settings.set_value("location", new GLib.Variant("(dd)", [latitude, longitude]));
|
||||
debug.message(`Current location: (${latitude};${longitude})`);
|
||||
this.#updateSuntimes();
|
||||
this.#settings.set_value("location", new GLib.Variant("(dd)", [latitude, longitude]));
|
||||
}
|
||||
|
||||
#computeTime() {
|
||||
|
||||
Reference in New Issue
Block a user