Skip to content

Commit dac9613

Browse files
committed
power applet: Don't check for a backlight step before establishing
that a keyboard or monitor supports adjustment.
1 parent 1f511ac commit dac9613

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const Settings = imports.ui.settings;
1212
const BrightnessBusName = "org.cinnamon.SettingsDaemon.Power.Screen";
1313
const KeyboardBusName = "org.cinnamon.SettingsDaemon.Power.Keyboard";
1414

15+
const CSD_BACKLIGHT_NOT_SUPPORTED_CODE = 1;
16+
1517
const PANEL_EDIT_MODE_KEY = "panel-edit-mode";
1618
// TODO: why aren't we using introspection - upower-glib?
1719
const UPDeviceType = {
@@ -214,21 +216,29 @@ class BrightnessSlider extends PopupMenu.PopupSliderMenuItem {
214216
Interfaces.getDBusProxyAsync(busName, Lang.bind(this, function(proxy, error) {
215217
this._proxy = proxy;
216218
this._proxy.GetPercentageRemote(Lang.bind(this, this._dbusAcquired));
217-
218-
try {
219-
this._proxy.GetStepRemote((step) => {
220-
this._step = (step / 100);
221-
});
222-
} catch(e) {
223-
this._step = .05;
224-
}
225219
}));
226220
}
227221

228222
_dbusAcquired(b, error) {
229-
if(error)
223+
if (error)
230224
return;
231225

226+
try {
227+
this._proxy.GetStepRemote((step, error) => {
228+
if (error != null) {
229+
if (error.code != CSD_BACKLIGHT_NOT_SUPPORTED_CODE) {
230+
global.logError(`Could not get backlight step for ${busName}: ${error.message}`);
231+
return;
232+
} else {
233+
this._step = .05;
234+
}
235+
}
236+
this._step = (step / 100);
237+
});
238+
} catch(e) {
239+
this._step = .05;
240+
}
241+
232242
this._updateBrightnessLabel(b);
233243
this.setValue(b / 100);
234244
this.connect("value-changed", Lang.bind(this, this._sliderChanged));

0 commit comments

Comments
 (0)