MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / power_save_cb

Function power_save_cb

gtk/src/power-manager.c:234–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233#if GLIB_CHECK_VERSION(2, 70, 0)
234static void
235power_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
267static GPowerProfileMonitor *
268power_monitor_new (signal_user_data_t *ud)

Callers

nothing calls this directly

Calls 7

ghb_dict_get_boolFunction · 0.85
ghb_get_queue_stateFunction · 0.85
ghb_logFunction · 0.85
ghb_pause_queueFunction · 0.85
ghb_send_notificationFunction · 0.85
ghb_resume_queueFunction · 0.85

Tested by

no test coverage detected