From d7203cf2213d27810fd55a656bac92ed608d96ab Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 28 Jul 2021 15:50:43 +0200 Subject: Add GPowerProfileMonitor to glib annotations See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2194 --- gir/gio-2.0.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c index c1ffdd09..063276ad 100644 --- a/gir/gio-2.0.c +++ b/gir/gio-2.0.c @@ -2653,6 +2653,35 @@ */ +/** + * GPowerProfileMonitor: + * + * #GPowerProfileMonitor monitors system power profile and notifies on + * changes. + * + * Since: 2.70 + */ + + +/** + * GPowerProfileMonitor:power-saver-enabled: + * + * Whether “Power Saver” mode is enabled on the system. + * + * Since: 2.70 + */ + + +/** + * GPowerProfileMonitorInterface: + * @g_iface: The parent interface. + * + * The virtual function table for #GPowerProfileMonitor. + * + * Since: 2.70 + */ + + /** * GPropertyAction: * @@ -7412,6 +7441,39 @@ */ +/** + * SECTION:gpowerprofilemonitor + * @title: GPowerProfileMonitor + * @short_description: Power profile monitor + * @include: gio/gio.h + * + * #GPowerProfileMonitor makes it possible for applications as well as OS components + * to monitor system power profiles and act upon them. It currently only exports + * whether the system is in “Power Saver” mode (known as “Low Power” mode on + * some systems). + * + * When in “Low Power” mode, it is recommended that applications: + * - disabling automatic downloads + * - reduce the rate of refresh from online sources such as calendar or + * email synchronisation + * - if the application has expensive visual effects, reduce them + * + * It is also likely that OS components providing services to applications will + * lower their own background activity, for the sake of the system. + * + * There are a variety of tools that exist for power consumption analysis, but those + * usually depend on the OS and hardware used. On Linux, one could use `upower` to + * monitor the battery discharge rate, `powertop` to check on the background activity + * or activity at all), `sysprof` to inspect CPU usage, and `intel_gpu_time` to + * profile GPU usage. + * + * Don't forget to disconnect the #GPowerProfileMonitor::notify::power-saver-enabled + * signal, and unref the #GPowerProfileMonitor itself when exiting. + * + * Since: 2.70 + */ + + /** * SECTION:gpropertyaction * @title: GPropertyAction @@ -31283,6 +31345,31 @@ */ +/** + * g_power_profile_monitor_dup_default: + * + * Gets a reference to the default #GPowerProfileMonitor for the system. + * + * Returns: (not nullable) (transfer full): a new reference to the default #GPowerProfileMonitor + * Since: 2.70 + */ + + +/** + * g_power_profile_monitor_get_power_saver_enabled: + * @monitor: a #GPowerProfileMonitor + * + * Gets whether the system is in “Power Saver” mode. + * + * You are expected to listen to the + * #GPowerProfileMonitor::notify::power-saver-enabled signal to know when the profile has + * changed. + * + * Returns: Whether the system is in “Power Saver” mode. + * Since: 2.70 + */ + + /** * g_property_action_new: * @name: the name of the action to create -- cgit v1.2.1