|
62 | 62 |
|
63 | 63 | enum { |
64 | 64 | NIGHT_LIGHT_SCHEDULE_AUTO = 0, |
65 | | - NIGHT_LIGHT_SCHEDULE_MANUAL = 1 |
| 65 | + NIGHT_LIGHT_SCHEDULE_MANUAL = 1, |
| 66 | + NIGHT_LIGHT_SCHEDULE_ALWAYS_ON = 2 |
66 | 67 | }; |
67 | 68 |
|
68 | 69 | #define CSD_NIGHT_LIGHT_SCHEDULE_TIMEOUT 5 /* seconds */ |
@@ -274,13 +275,26 @@ night_light_recheck (CsdNightLight *self) |
274 | 275 | return; |
275 | 276 | } |
276 | 277 |
|
277 | | - /* calculate the position of the sun */ |
278 | | - if (g_settings_get_enum (self->settings, "night-light-schedule-mode") == NIGHT_LIGHT_SCHEDULE_AUTO) { |
| 278 | + /* schedule-mode */ |
| 279 | + switch (g_settings_get_enum (self->settings, "night-light-schedule-mode")) { |
| 280 | + case NIGHT_LIGHT_SCHEDULE_ALWAYS_ON: |
| 281 | + /* just set the temperature to night light */ |
| 282 | + temperature = g_settings_get_uint (self->settings, "night-light-temperature"); |
| 283 | + g_debug ("night light mode always on, using temperature of %uK", |
| 284 | + temperature); |
| 285 | + csd_night_light_set_active (self, TRUE); |
| 286 | + csd_night_light_set_temperature (self, temperature); |
| 287 | + return; |
| 288 | + case NIGHT_LIGHT_SCHEDULE_AUTO: |
| 289 | + /* calculate the position of the sun */ |
279 | 290 | update_cached_sunrise_sunset (self); |
280 | 291 | if (self->cached_sunrise > 0.f && self->cached_sunset > 0.f) { |
281 | 292 | schedule_to = self->cached_sunrise; |
282 | 293 | schedule_from = self->cached_sunset; |
283 | 294 | } |
| 295 | + break; |
| 296 | + default: |
| 297 | + break; |
284 | 298 | } |
285 | 299 |
|
286 | 300 | /* fall back to manual settings */ |
|
0 commit comments