main: Fix transitions if one profile is inhibited

When transitioning from one profile to another, we only want to stop the
active profile from changing if the target profile is inhibited, which
it might not be if we want to switch to, say, the power-saver profile.

This was broken since drivers could handle more than one profile.
This commit is contained in:
Bastien Nocera 2020-08-10 15:31:02 +02:00
parent f65f3cddd5
commit a92150c2b7

View file

@ -247,13 +247,14 @@ set_selected_profile (PpdApp *data,
return FALSE;
}
g_debug ("Transitioning from '%s' to '%s'",
g_debug ("Transitioning selected profile from '%s' to '%s'",
ppd_profile_to_str (data->selected_profile), profile);
data->selected_profile = target_profile;
if (ppd_driver_is_inhibited (SELECTED_DRIVER)) {
if (target_profile == PPD_PROFILE_PERFORMANCE &&
ppd_driver_is_inhibited (SELECTED_DRIVER)) {
send_dbus_event (data, PROP_SELECTED_PROFILE);
g_debug ("Not transitioning to '%s' as inhibited", profile);
g_debug ("Not transitioning active profile to '%s' as inhibited", profile);
return TRUE;
}