bluetooth: Remove unused 'had-bluetooth-devices-setup' setting
Now that we always show the Bluetooth switch when there's a Bluetooth adapter hiding somewhere, remove all the settings it used as storage. If the user wants to really really disable any Bluetooth adapters in their system, the gnome-bluetooth documentation explains how to do that irrespective of GNOME: https://gitlab.gnome.org/GNOME/gnome-bluetooth/#multiple-bluetooth-adapters Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2488>
This commit is contained in:
parent
57aa91e2b3
commit
e7cf6d348c
@ -84,16 +84,6 @@
|
|||||||
This key sets the default state of the checkbox.
|
This key sets the default state of the checkbox.
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
<key name="had-bluetooth-devices-setup" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Whether the default Bluetooth adapter had set up devices associated to it</summary>
|
|
||||||
<description>
|
|
||||||
The shell will only show a Bluetooth menu item if a Bluetooth
|
|
||||||
adapter is powered, or if there were devices set up associated
|
|
||||||
with the default adapter. This will be reset if the default
|
|
||||||
adapter is ever seen not to have devices associated to it.
|
|
||||||
</description>
|
|
||||||
</key>
|
|
||||||
<key name="last-selected-power-profile" type="s">
|
<key name="last-selected-power-profile" type="s">
|
||||||
<default>"power-saver"</default>
|
<default>"power-saver"</default>
|
||||||
<summary>The last selected non-default power profile</summary>
|
<summary>The last selected non-default power profile</summary>
|
||||||
|
@ -15,8 +15,6 @@ const OBJECT_PATH = '/org/gnome/SettingsDaemon/Rfkill';
|
|||||||
const RfkillManagerInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Rfkill');
|
const RfkillManagerInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Rfkill');
|
||||||
const rfkillManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(RfkillManagerInterface);
|
const rfkillManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(RfkillManagerInterface);
|
||||||
|
|
||||||
const HAD_BLUETOOTH_DEVICES_SETUP = 'had-bluetooth-devices-setup';
|
|
||||||
|
|
||||||
const BtClient = GObject.registerClass({
|
const BtClient = GObject.registerClass({
|
||||||
Properties: {
|
Properties: {
|
||||||
'available': GObject.ParamSpec.boolean('available', '', '',
|
'available': GObject.ParamSpec.boolean('available', '', '',
|
||||||
@ -36,8 +34,6 @@ const BtClient = GObject.registerClass({
|
|||||||
_init() {
|
_init() {
|
||||||
super._init();
|
super._init();
|
||||||
|
|
||||||
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
|
|
||||||
|
|
||||||
this._client = new GnomeBluetooth.Client();
|
this._client = new GnomeBluetooth.Client();
|
||||||
this._client.connect('notify::default-adapter-powered', () => {
|
this._client.connect('notify::default-adapter-powered', () => {
|
||||||
this.notify('active');
|
this.notify('active');
|
||||||
@ -128,29 +124,12 @@ const BtClient = GObject.registerClass({
|
|||||||
if (this._devicesChangedId)
|
if (this._devicesChangedId)
|
||||||
return;
|
return;
|
||||||
this._devicesChangedId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
this._devicesChangedId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||||
this._syncHadSetupDevices();
|
|
||||||
delete this._devicesChangedId;
|
delete this._devicesChangedId;
|
||||||
this.emit('devices-changed');
|
this.emit('devices-changed');
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_syncHadSetupDevices() {
|
|
||||||
const {defaultAdapter} = this._client;
|
|
||||||
if (!defaultAdapter || !this._adapter)
|
|
||||||
return; // ignore changes while powering up/down
|
|
||||||
|
|
||||||
const [firstDevice] = this.getDevices();
|
|
||||||
const hadSetupDevices = !!firstDevice;
|
|
||||||
|
|
||||||
if (this._hadSetupDevices === hadSetupDevices)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this._hadSetupDevices = hadSetupDevices;
|
|
||||||
global.settings.set_boolean(
|
|
||||||
HAD_BLUETOOTH_DEVICES_SETUP, this._hadSetupDevices);
|
|
||||||
}
|
|
||||||
|
|
||||||
_connectDeviceNotify(device) {
|
_connectDeviceNotify(device) {
|
||||||
const path = device.get_object_path();
|
const path = device.get_object_path();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user