BluetoothStatus: show "hardware disabled" when disabled by rfkill
Use the new PopupSwitchMenuItem functionality when bluetooth cannot be enabled. Use it also for showing "connecting..." when activating device items. https://bugzilla.gnome.org/show_bug.cgi?id=648048
This commit is contained in:
parent
c8670819dc
commit
9412ac2027
@ -109,7 +109,11 @@ Indicator.prototype = {
|
|||||||
current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED;
|
current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED;
|
||||||
|
|
||||||
this._killswitch.setToggleState(on);
|
this._killswitch.setToggleState(on);
|
||||||
this._killswitch.actor.reactive = can_toggle;
|
if (can_toggle)
|
||||||
|
this._killswitch.setStatus(null);
|
||||||
|
else
|
||||||
|
/* TRANSLATORS: this means that bluetooth was disabled by hardware rfkill */
|
||||||
|
this._killswitch.setStatus(_("hardware disabled"));
|
||||||
|
|
||||||
if (has_adapter)
|
if (has_adapter)
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
@ -211,14 +215,15 @@ Indicator.prototype = {
|
|||||||
if (device.can_connect) {
|
if (device.can_connect) {
|
||||||
item._connected = device.connected;
|
item._connected = device.connected;
|
||||||
item._connectedMenuitem = new PopupMenu.PopupSwitchMenuItem(_("Connection"), device.connected);
|
item._connectedMenuitem = new PopupMenu.PopupSwitchMenuItem(_("Connection"), device.connected);
|
||||||
|
|
||||||
item._connectedMenuitem.connect('toggled', Lang.bind(this, function() {
|
item._connectedMenuitem.connect('toggled', Lang.bind(this, function() {
|
||||||
if (item._connected > ConnectionState.CONNECTED) {
|
if (item._connected > ConnectionState.CONNECTED) {
|
||||||
// operation already in progress, revert
|
// operation already in progress, revert
|
||||||
|
// (should not happen anyway)
|
||||||
menuitem.setToggleState(menuitem.state);
|
menuitem.setToggleState(menuitem.state);
|
||||||
}
|
}
|
||||||
if (item._connected) {
|
if (item._connected) {
|
||||||
item._connected = ConnectionState.DISCONNECTING;
|
item._connected = ConnectionState.DISCONNECTING;
|
||||||
|
menuitem.setStatus(_("disconnecting..."));
|
||||||
this._applet.disconnect_device(item._device.device_path, function(applet, success) {
|
this._applet.disconnect_device(item._device.device_path, function(applet, success) {
|
||||||
if (success) { // apply
|
if (success) { // apply
|
||||||
item._connected = ConnectionState.DISCONNECTED;
|
item._connected = ConnectionState.DISCONNECTED;
|
||||||
@ -227,9 +232,11 @@ Indicator.prototype = {
|
|||||||
item._connected = ConnectionState.CONNECTED;
|
item._connected = ConnectionState.CONNECTED;
|
||||||
menuitem.setToggleState(true);
|
menuitem.setToggleState(true);
|
||||||
}
|
}
|
||||||
|
menuitem.setStatus(null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
item._connected = ConnectionState.CONNECTING;
|
item._connected = ConnectionState.CONNECTING;
|
||||||
|
menuitem.setStatus(_("connecting..."));
|
||||||
this._applet.connect_device(item._device.device_path, function(applet, success) {
|
this._applet.connect_device(item._device.device_path, function(applet, success) {
|
||||||
if (success) { // apply
|
if (success) { // apply
|
||||||
item._connected = ConnectionState.CONNECTED;
|
item._connected = ConnectionState.CONNECTED;
|
||||||
@ -238,6 +245,7 @@ Indicator.prototype = {
|
|||||||
item._connected = ConnectionState.DISCONNECTED;
|
item._connected = ConnectionState.DISCONNECTED;
|
||||||
menuitem.setToggleState(false);
|
menuitem.setToggleState(false);
|
||||||
}
|
}
|
||||||
|
menuitem.setStatus(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user