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

Function upower_status_cb

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

Source from the content-addressed store, hash-verified

168}
169
170static void
171upower_status_cb (GDBusProxy *proxy, GVariant *changed_properties,
172 GStrv invalidated_properties, signal_user_data_t *ud)
173{
174 gboolean on_battery;
175 int queue_state;
176
177 if (!ghb_dict_get_bool(ud->prefs, "PauseEncodingOnBatteryPower") ||
178 !g_variant_lookup(changed_properties, "OnBattery", "b", &on_battery))
179 return;
180
181 queue_state = ghb_get_queue_state();
182
183 if (on_battery && (queue_state & GHB_STATE_WORKING)
184 && !(queue_state & GHB_STATE_PAUSED))
185 {
186 power_state = GHB_POWER_PAUSED_ON_BATTERY;
187 ghb_log("Charger disconnected: pausing encode");
188 ghb_send_notification(GHB_NOTIFY_PAUSED_ON_BATTERY, 0, ud);
189 ghb_pause_queue();
190 }
191 else if (!on_battery && (power_state == GHB_POWER_PAUSED_ON_BATTERY))
192 {
193 if (queue_state & GHB_STATE_PAUSED)
194 {
195 ghb_resume_queue();
196 ghb_log("Charger connected: resuming encode");
197 ghb_withdraw_notification(GHB_NOTIFY_PAUSED_ON_BATTERY);
198 }
199 power_state = GHB_POWER_OK;
200 }
201}
202
203static void
204upower_proxy_new_cb (GObject *source, GAsyncResult *result,

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected