mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +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 **
|
static char **
|
||||||
sysprof_power_profile_list_required_policy (SysprofInstrument *instrument)
|
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);
|
return g_strdupv ((char **)required_policy);
|
||||||
}
|
}
|
||||||
@ -73,12 +73,12 @@ restore_power_profile (char *power_profile)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ret = g_dbus_connection_call_sync (bus,
|
ret = g_dbus_connection_call_sync (bus,
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"/net/hadess/PowerProfiles",
|
"/org/freedesktop/UPower/PowerProfiles",
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"Set",
|
"Set",
|
||||||
g_variant_new ("(ssv)",
|
g_variant_new ("(ssv)",
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"ActiveProfile",
|
"ActiveProfile",
|
||||||
g_variant_new_string (power_profile)),
|
g_variant_new_string (power_profile)),
|
||||||
NULL,
|
NULL,
|
||||||
@ -147,12 +147,12 @@ sysprof_power_profile_prepare_fiber (gpointer user_data)
|
|||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"/net/hadess/PowerProfiles",
|
"/org/freedesktop/UPower/PowerProfiles",
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"Get",
|
"Get",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"ActiveProfile"),
|
"ActiveProfile"),
|
||||||
G_VARIANT_TYPE ("(v)"),
|
G_VARIANT_TYPE ("(v)"),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
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 (g_strcmp0 (self->id, self->restore_id) != 0)
|
||||||
{
|
{
|
||||||
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
if (!(ret = dex_await_variant (dex_dbus_connection_call (bus,
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"/net/hadess/PowerProfiles",
|
"/org/freedesktop/UPower/PowerProfiles",
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"Set",
|
"Set",
|
||||||
g_variant_new ("(ssv)",
|
g_variant_new ("(ssv)",
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"ActiveProfile",
|
"ActiveProfile",
|
||||||
g_variant_new_string (self->id)),
|
g_variant_new_string (self->id)),
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@ -50,12 +50,12 @@ sysprof_power_profiles_new (void)
|
|||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
result = g_dbus_connection_call_sync (bus,
|
result = g_dbus_connection_call_sync (bus,
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"/net/hadess/PowerProfiles",
|
"/org/freedesktop/UPower/PowerProfiles",
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"Get",
|
"Get",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
"net.hadess.PowerProfiles",
|
"org.freedesktop.UPower.PowerProfiles",
|
||||||
"Profiles"),
|
"Profiles"),
|
||||||
G_VARIANT_TYPE ("(v)"),
|
G_VARIANT_TYPE ("(v)"),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
|
|||||||
Reference in New Issue
Block a user