🪲 Fix issue #278

This commit is contained in:
Simon Schneegans
2023-01-17 20:13:07 +01:00
parent 2a79860aac
commit c21790f5a8
2 changed files with 20 additions and 11 deletions
+11 -6
View File
@@ -108,15 +108,20 @@ var PreferencesDialog = class PreferencesDialog {
// Check whether the power profiles daemon is available - if not, we hide the
// corresponding settings row.
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
let powerProfilesProxy = new PowerProfilesProxy(
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
let hasPowerProfiles = false;
try {
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
let powerProfilesProxy = new PowerProfilesProxy(
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
if (powerProfilesProxy.get_name_owner() == null) {
this._builder.get_object('disable-on-power-save-row').set_visible(false);
hasPowerProfiles = powerProfilesProxy.get_name_owner() != null;
} catch (e) {
// Maybe the service is masked...
}
this._builder.get_object('disable-on-power-save-row').set_visible(hasPowerProfiles);
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We
// have to use a different layout, as the stack sidebar looks pretty ugly with the