power: Use the icon from the primary device for status
https://bugzilla.gnome.org/show_bug.cgi?id=709925
This commit is contained in:
parent
0892065649
commit
575b373cd5
@ -86,38 +86,30 @@ const Indicator = new Lang.Class({
|
|||||||
return _("Estimating…");
|
return _("Estimating…");
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncStatusLabel: function() {
|
_sync: function() {
|
||||||
this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
|
function isBattery(result) {
|
||||||
if (error) {
|
if (!result)
|
||||||
this._item.actor.hide();
|
return false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let [device] = result;
|
let [device] = result;
|
||||||
let [device_id, device_type] = device;
|
let [, deviceType] = device;
|
||||||
if (device_type == UPower.DeviceKind.BATTERY) {
|
return (deviceType == UPower.DeviceKind.BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
|
||||||
|
if (isBattery(result)) {
|
||||||
|
let [device] = result;
|
||||||
|
let [,, icon] = device;
|
||||||
|
let gicon = Gio.icon_new_for_string(icon);
|
||||||
|
this._indicator.gicon = gicon;
|
||||||
|
this._item.icon.gicon = gicon;
|
||||||
this._item.status.text = this._statusForDevice(device);
|
this._item.status.text = this._statusForDevice(device);
|
||||||
this._item.actor.show();
|
this._item.actor.show();
|
||||||
} else {
|
} else {
|
||||||
|
// If there's no battery, then we use the power icon.
|
||||||
|
this._indicator.icon_name = 'system-shutdown-symbolic';
|
||||||
this._item.actor.hide();
|
this._item.actor.hide();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncIcon: function() {
|
|
||||||
let icon = this._proxy.Icon;
|
|
||||||
if (icon) {
|
|
||||||
let gicon = Gio.icon_new_for_string(icon);
|
|
||||||
this._indicator.gicon = gicon;
|
|
||||||
this._item.icon.gicon = gicon;
|
|
||||||
} else {
|
|
||||||
// If there's no battery, then we use the power icon.
|
|
||||||
this._indicator.icon_name = 'system-shutdown-symbolic';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_sync: function() {
|
|
||||||
this._syncIcon();
|
|
||||||
this._syncStatusLabel();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user