diff options
author | Simon McVittie <smcv@debian.org> | 2022-04-04 11:52:02 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2022-04-04 11:53:25 +0100 |
commit | 01bc647ea897cc4b9c06dadfbf9ff4470dcd85c0 (patch) | |
tree | 9ba18a5e7e7dd9d9e070a17aa4e9cf409c058fdf | |
parent | c33ccf042009d9d152711ac40304107b21dac937 (diff) |
Update patches to the version that was applied upstream
This drops compatibility with GNOME Shell 41.
6 files changed, 157 insertions, 168 deletions
diff --git a/debian/control b/debian/control index 6928ee9..4e5ec25 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Architecture: all Depends: bluez, gnome-shell (<< 43~), - gnome-shell (>= 40~), + gnome-shell (>= 42~), ${misc:Depends}, Recommends: gnome-shell-extension-prefs, diff --git a/debian/patches/bluetooth-Adapt-to-new-GnomeBluetooth-library-in-GNOME-Sh.patch b/debian/patches/bluetooth-Adapt-to-new-GnomeBluetooth-library-in-GNOME-Sh.patch new file mode 100644 index 0000000..1b34dbb --- /dev/null +++ b/debian/patches/bluetooth-Adapt-to-new-GnomeBluetooth-library-in-GNOME-Sh.patch @@ -0,0 +1,153 @@ +From: Simon McVittie <smcv@debian.org> +Date: Thu, 31 Mar 2022 10:37:54 +0100 +Subject: bluetooth: Adapt to new GnomeBluetooth library in GNOME Shell 42 + +GNOME 42 has a new version of the GnomeBluetooth library, with a +different API. Adjust to this. + +Signed-off-by: Simon McVittie <smcv@debian.org> +Resolves: https://github.com/bjarosze/gnome-bluetooth-quick-connect/issues/53 +Forwarded: https://github.com/bjarosze/gnome-bluetooth-quick-connect/pull/55 +Applied-upstream: 27, commit:f240049b3a093534e4a5175d89907e6f9bfc5cbd +--- + bluetooth.js | 85 ++++++++++++++++++++++++----------------------------------- + metadata.json | 3 +-- + 2 files changed, 35 insertions(+), 53 deletions(-) + +diff --git a/bluetooth.js b/bluetooth.js +index 7472b07..d9dff16 100644 +--- a/bluetooth.js ++++ b/bluetooth.js +@@ -24,45 +24,46 @@ const Utils = Me.imports.utils; + var BluetoothController = class { + constructor() { + this._client = new GnomeBluetooth.Client(); +- this._model = this._client.get_model(); ++ this._deviceNotifyConnected = new Set(); ++ this._store = this._client.get_devices(); + } + + enable() { +- this._connectSignal(this._model, 'row-changed', (arg0, arg1, iter) => { +- if (iter) { +- let device = this._buildDevice(iter); +- if (device.isDefault) { +- this.emit('default-adapter-changed', device); +- } +- else { +- this.emit('device-changed', device); +- } +- } +- ++ this._client.connect('notify::default-adapter', () => { ++ this._deviceNotifyConnected.clear(); ++ this.emit('default-adapter-changed'); ++ }); ++ this._client.connect('notify::default-adapter-powered', () => { ++ this._deviceNotifyConnected.clear(); ++ this.emit('default-adapter-changed'); + }); +- this._connectSignal(this._model, 'row-deleted', () => { ++ this._client.connect('device-removed', (c, path) => { ++ this._deviceNotifyConnected.delete(path); + this.emit('device-deleted'); + }); +- this._connectSignal(this._model, 'row-inserted', (arg0, arg1, iter) => { +- if (iter) { +- let device = this._buildDevice(iter); +- this.emit('device-inserted', device); +- } ++ this._client.connect('device-added', (c, device) => { ++ this._connectDeviceNotify(device); ++ this.emit('device-inserted', new BluetoothDevice(device)); + }); + } + +- getDevices() { +- let adapter = this._getDefaultAdapter(); +- if (!adapter) +- return []; ++ _connectDeviceNotify(device) { ++ const path = device.get_object_path(); ++ ++ if (this._deviceNotifyConnected.has(path)) ++ return; ++ ++ device.connect('notify', (device) => { ++ this.emit('device-changed', new BluetoothDevice(device)); ++ }); ++ } + ++ getDevices() { + let devices = []; + +- let [ret, iter] = this._model.iter_children(adapter); +- while (ret) { +- let device = this._buildDevice(iter); ++ for (let i = 0; i < this._store.get_n_items(); i++) { ++ let device = new BluetoothDevice(this._store.get_item(i)); + devices.push(device); +- ret = this._model.iter_next(iter); + } + + return devices; +@@ -77,39 +78,21 @@ var BluetoothController = class { + destroy() { + this._disconnectSignals(); + } +- +- _getDefaultAdapter() { +- let [ret, iter] = this._model.get_iter_first(); +- while (ret) { +- let isDefault = this._model.get_value(iter, GnomeBluetooth.Column.DEFAULT); +- let isPowered = this._model.get_value(iter, GnomeBluetooth.Column.POWERED); +- if (isDefault && isPowered) +- return iter; +- ret = this._model.iter_next(iter); +- } +- return null; +- } +- +- _buildDevice(iter) { +- return new BluetoothDevice(this._model, iter); +- } + } + + Signals.addSignalMethods(BluetoothController.prototype); + Utils.addSignalsHelperMethods(BluetoothController.prototype); + + var BluetoothDevice = class { +- constructor(model, iter) { +- this._model = model; +- this.update(iter); ++ constructor(dev) { ++ this.update(dev); + } + +- update(iter) { +- this.name = this._model.get_value(iter, GnomeBluetooth.Column.ALIAS) || this._model.get_value(iter, GnomeBluetooth.Column.NAME); +- this.isConnected = this._model.get_value(iter, GnomeBluetooth.Column.CONNECTED); +- this.isPaired = this._model.get_value(iter, GnomeBluetooth.Column.PAIRED); +- this.mac = this._model.get_value(iter, GnomeBluetooth.Column.ADDRESS); +- this.isDefault = this._model.get_value(iter, GnomeBluetooth.Column.DEFAULT); ++ update(dev) { ++ this.name = dev.alias || dev.name; ++ this.isConnected = dev.connected; ++ this.isPaired = dev.paired; ++ this.mac = dev.address; + } + + disconnect() { +diff --git a/metadata.json b/metadata.json +index 68effed..3301558 100644 +--- a/metadata.json ++++ b/metadata.json +@@ -6,7 +6,6 @@ + "settings-schema": "org.gnome.shell.extensions.bluetooth-quick-connect", + "gettext-domain": "bluetooth-quick-connect", + "shell-version": [ +- "40", +- "41" ++ "42" + ] + } diff --git a/debian/patches/bluetooth-Use-GListStore-for-GNOME-Shell-42.patch b/debian/patches/bluetooth-Use-GListStore-for-GNOME-Shell-42.patch deleted file mode 100644 index 03e3fb7..0000000 --- a/debian/patches/bluetooth-Use-GListStore-for-GNOME-Shell-42.patch +++ /dev/null @@ -1,166 +0,0 @@ -From: Simon McVittie <smcv@debian.org> -Date: Thu, 31 Mar 2022 10:37:54 +0100 -Subject: bluetooth: Use GListStore for GNOME Shell 42 - -GNOME 42 has a new version of the GnomeBluetooth library, with a -different API. Adjust to this. - -Signed-off-by: Simon McVittie <smcv@debian.org> -Forwarded: https://github.com/bjarosze/gnome-bluetooth-quick-connect/pull/55 ---- - bluetooth.js | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - metadata.json | 3 +- - 2 files changed, 83 insertions(+), 8 deletions(-) - -diff --git a/bluetooth.js b/bluetooth.js -index 7472b07..f8c938d 100644 ---- a/bluetooth.js -+++ b/bluetooth.js -@@ -24,10 +24,41 @@ const Utils = Me.imports.utils; - var BluetoothController = class { - constructor() { - this._client = new GnomeBluetooth.Client(); -+ -+ if (this._client.get_devices) { -+ /* >= 42 */ -+ this._deviceNotifyConnected = new Set(); -+ this._store = this._client.get_devices(); -+ return; -+ } -+ -+ /* <= 41 */ - this._model = this._client.get_model(); - } - - enable() { -+ if (this._store) { -+ /* >= 42 */ -+ this._client.connect('notify::default-adapter', () => { -+ this._deviceNotifyConnected.clear(); -+ this.emit('default-adapter-changed'); -+ }); -+ this._client.connect('notify::default-adapter-powered', () => { -+ this._deviceNotifyConnected.clear(); -+ this.emit('default-adapter-changed'); -+ }); -+ this._client.connect('device-removed', (c, path) => { -+ this._deviceNotifyConnected.delete(path); -+ this.emit('device-deleted'); -+ }); -+ this._client.connect('device-added', (c, device) => { -+ this._connectDeviceNotify(device); -+ this.emit('device-inserted', this._buildDevice(device)); -+ }); -+ return; -+ } -+ -+ /* <= 41 */ - this._connectSignal(this._model, 'row-changed', (arg0, arg1, iter) => { - if (iter) { - let device = this._buildDevice(iter); -@@ -51,13 +82,36 @@ var BluetoothController = class { - }); - } - -+ _connectDeviceNotify(device) { -+ /* >= 42 only */ -+ const path = device.get_object_path(); -+ -+ if (this._deviceNotifyConnected.has(path)) -+ return; -+ -+ device.connect('notify', (device) => { -+ this.emit('device-changed', this._buildDevice(device)); -+ }); -+ } -+ - getDevices() { -+ let devices = []; -+ -+ if (this._store) { -+ /* >= 42 */ -+ for (let i = 0; i < this._store.get_n_items(); i++) { -+ let device = this._buildDevice(this._store.get_item(i)); -+ devices.push(device); -+ } -+ -+ return devices; -+ } -+ -+ /* <= 41 */ - let adapter = this._getDefaultAdapter(); - if (!adapter) - return []; - -- let devices = []; -- - let [ret, iter] = this._model.iter_children(adapter); - while (ret) { - let device = this._buildDevice(iter); -@@ -79,6 +133,7 @@ var BluetoothController = class { - } - - _getDefaultAdapter() { -+ /* <= 41 only */ - let [ret, iter] = this._model.get_iter_first(); - while (ret) { - let isDefault = this._model.get_value(iter, GnomeBluetooth.Column.DEFAULT); -@@ -90,8 +145,14 @@ var BluetoothController = class { - return null; - } - -- _buildDevice(iter) { -- return new BluetoothDevice(this._model, iter); -+ _buildDevice(devOrIter) { -+ if (this._store) { -+ /* >= 42 */ -+ return new BluetoothDevice(null, devOrIter); -+ } -+ -+ /* <= 41 */ -+ return new BluetoothDevice(this._model, devOrIter); - } - } - -@@ -99,12 +160,25 @@ Signals.addSignalMethods(BluetoothController.prototype); - Utils.addSignalsHelperMethods(BluetoothController.prototype); - - var BluetoothDevice = class { -- constructor(model, iter) { -+ constructor(model, devOrIter) { - this._model = model; -- this.update(iter); -+ this.update(devOrIter); - } - -- update(iter) { -+ update(devOrIter) { -+ if (!this._model) { -+ /* >= 42 */ -+ const dev = devOrIter; -+ this.name = dev.alias || dev.name; -+ this.isConnected = dev.connected; -+ this.isPaired = dev.paired; -+ this.mac = dev.address; -+ this.isDefault = false; -+ return; -+ } -+ -+ /* <= 41 */ -+ const iter = devOrIter; - this.name = this._model.get_value(iter, GnomeBluetooth.Column.ALIAS) || this._model.get_value(iter, GnomeBluetooth.Column.NAME); - this.isConnected = this._model.get_value(iter, GnomeBluetooth.Column.CONNECTED); - this.isPaired = this._model.get_value(iter, GnomeBluetooth.Column.PAIRED); -diff --git a/metadata.json b/metadata.json -index 68effed..1a68657 100644 ---- a/metadata.json -+++ b/metadata.json -@@ -7,6 +7,7 @@ - "gettext-domain": "bluetooth-quick-connect", - "shell-version": [ - "40", -- "41" -+ "41", -+ "42" - ] - } diff --git a/debian/patches/bluetooth-Use-a-separate-signal-for-changes-to-the-defaul.patch b/debian/patches/bluetooth-Use-a-separate-signal-for-changes-to-the-defaul.patch index 4d362e8..160b6dc 100644 --- a/debian/patches/bluetooth-Use-a-separate-signal-for-changes-to-the-defaul.patch +++ b/debian/patches/bluetooth-Use-a-separate-signal-for-changes-to-the-defaul.patch @@ -9,6 +9,7 @@ separately. Signed-off-by: Simon McVittie <smcv@debian.org> Forwarded: https://github.com/bjarosze/gnome-bluetooth-quick-connect/pull/55 +Applied-upstream: 27, commit:f70c63f07357a0081985545e6dc447340b3d0ce9 --- bluetooth.js | 7 ++++++- extension.js | 9 ++++++--- diff --git a/debian/patches/power-Use-var-syntax-to-export-object.patch b/debian/patches/power-Use-var-syntax-to-export-object.patch index f78f353..fd43ef7 100644 --- a/debian/patches/power-Use-var-syntax-to-export-object.patch +++ b/debian/patches/power-Use-var-syntax-to-export-object.patch @@ -7,6 +7,7 @@ This seems to be required by GNOME Shell 42 (gjs 1.72). Signed-off-by: Simon McVittie <smcv@debian.org> Forwarded: https://github.com/bjarosze/gnome-bluetooth-quick-connect/pull/55 +Applied-upstream: 27, commit:4fc876d51848ceb411031dcb6805f5570ba8f6f6 --- power.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/patches/series b/debian/patches/series index 7140a30..39c9a88 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,3 @@ power-Use-var-syntax-to-export-object.patch bluetooth-Use-a-separate-signal-for-changes-to-the-defaul.patch -bluetooth-Use-GListStore-for-GNOME-Shell-42.patch +bluetooth-Adapt-to-new-GnomeBluetooth-library-in-GNOME-Sh.patch |