| 232 | |
| 233 | #if GLIB_CHECK_VERSION(2, 70, 0) |
| 234 | static void |
| 235 | power_save_cb (GPowerProfileMonitor *monitor, GParamSpec *pspec, |
| 236 | signal_user_data_t *ud) |
| 237 | { |
| 238 | gboolean power_save; |
| 239 | |
| 240 | if (!ghb_dict_get_bool(ud->prefs, "PauseEncodingOnPowerSave")) |
| 241 | return; |
| 242 | |
| 243 | int queue_state = ghb_get_queue_state(); |
| 244 | |
| 245 | g_object_get(monitor, "power-saver-enabled", &power_save, NULL); |
| 246 | |
| 247 | if (power_save && (queue_state & GHB_STATE_WORKING) |
| 248 | && !(queue_state & GHB_STATE_PAUSED)) |
| 249 | { |
| 250 | power_state = GHB_POWER_PAUSED_POWER_SAVE; |
| 251 | ghb_log("Power saver enabled: pausing encode"); |
| 252 | ghb_pause_queue(); |
| 253 | ghb_send_notification(GHB_NOTIFY_PAUSED_POWER_SAVE, 0, ud); |
| 254 | } |
| 255 | else if (!power_save && (power_state == GHB_POWER_PAUSED_POWER_SAVE)) |
| 256 | { |
| 257 | if (queue_state & GHB_STATE_PAUSED) |
| 258 | { |
| 259 | ghb_resume_queue(); |
| 260 | ghb_log("Power saver disabled: resuming encode"); |
| 261 | ghb_withdraw_notification(GHB_NOTIFY_PAUSED_POWER_SAVE); |
| 262 | } |
| 263 | power_state = GHB_POWER_OK; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | static GPowerProfileMonitor * |
| 268 | power_monitor_new (signal_user_data_t *ud) |
nothing calls this directly
no test coverage detected