mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof-power-profile: Use UPower DBus API
Since some time the power-profiles-daemon project has been moved under the upower umbrella and renamed its API to follow that. While the legacy name is still supported, there are plans to not support it anymore in future [2]. So let's update gnome-shell code to use the current main name instead. [1] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/148 [2] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/166
This commit is contained in:
@ -52,7 +52,7 @@ static GParamSpec *properties[N_PROPS];
|
||||
static char **
|
||||
sysprof_power_profile_list_required_policy (SysprofInstrument *instrument)
|
||||
{
|
||||
static const char *required_policy[] = {"net.hadess.PowerProfiles.switch-profile", NULL};
|
||||
static const char *required_policy[] = {"org.freedesktop.UPower.PowerProfiles.switch-profile", NULL};
|
||||
|
||||
return g_strdupv ((char **)required_policy);
|
||||
}
|
||||
@ -73,12 +73,12 @@ restore_power_profile (char *power_profile)
|
||||
return;
|
||||
|
||||
ret = g_dbus_connection_call_sync (bus,
|
||||
"net.hadess.PowerProfiles",
|
||||
"/net/hadess/PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"/org/freedesktop/UPower/PowerProfiles",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
"net.hadess.PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"ActiveProfile",
|
||||
g_variant_new_string (power_profile)),
|
||||
NULL,
|
||||
@ -147,12 +147,12 @@ sysprof_power_profile_prepare_fiber (gpointer user_data)
|
||||
goto failure;
|
||||
|
||||
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
||||
"net.hadess.PowerProfiles",
|
||||
"/net/hadess/PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"/org/freedesktop/UPower/PowerProfiles",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"Get",
|
||||
g_variant_new ("(ss)",
|
||||
"net.hadess.PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"ActiveProfile"),
|
||||
G_VARIANT_TYPE ("(v)"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
@ -168,12 +168,12 @@ sysprof_power_profile_prepare_fiber (gpointer user_data)
|
||||
if (g_strcmp0 (self->id, self->restore_id) != 0)
|
||||
{
|
||||
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
||||
"net.hadess.PowerProfiles",
|
||||
"/net/hadess/PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"/org/freedesktop/UPower/PowerProfiles",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"Set",
|
||||
g_variant_new ("(ssv)",
|
||||
"net.hadess.PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"ActiveProfile",
|
||||
g_variant_new_string (self->id)),
|
||||
NULL,
|
||||
|
||||
@ -50,12 +50,12 @@ sysprof_power_profiles_new (void)
|
||||
goto failure;
|
||||
|
||||
result = g_dbus_connection_call_sync (bus,
|
||||
"net.hadess.PowerProfiles",
|
||||
"/net/hadess/PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"/org/freedesktop/UPower/PowerProfiles",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"Get",
|
||||
g_variant_new ("(ss)",
|
||||
"net.hadess.PowerProfiles",
|
||||
"org.freedesktop.UPower.PowerProfiles",
|
||||
"Profiles"),
|
||||
G_VARIANT_TYPE ("(v)"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
|
||||
Reference in New Issue
Block a user