summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Jaroszewski <b.jarosze@gmail.com>2020-06-07 14:20:33 +0200
committerSimon McVittie <smcv@debian.org>2020-09-26 11:30:25 +0100
commit1f9ef3f9cd5c15f3cf9d671107e2db230c205021 (patch)
tree448675b648734b53712748b66bce454ce8aa669d
parent7817d12b2075de25f71bb737182f456b3e0d99d5 (diff)
add support for gnome 3.34
Gbp-Pq: Name add-support-for-gnome-3.34.patch
-rw-r--r--metadata.json3
-rw-r--r--ui.js28
2 files changed, 20 insertions, 11 deletions
diff --git a/metadata.json b/metadata.json
index bc3f83f..e710ffd 100644
--- a/metadata.json
+++ b/metadata.json
@@ -6,6 +6,7 @@
"settings-schema": "org.gnome.shell.extensions.bluetooth-quick-connect",
"gettext-domain": "bluetooth-quick-connect",
"shell-version": [
- "3.36"
+ "3.36",
+ "3.34"
]
}
diff --git a/ui.js b/ui.js
index e773f98..b2dc363 100644
--- a/ui.js
+++ b/ui.js
@@ -20,11 +20,7 @@ const GObject = imports.gi.GObject;
const St = imports.gi.St;
const Tweener = imports.ui.tweener;
const PopupMenu = imports.ui.popupMenu;
-
-const ExtensionUtils = imports.misc.extensionUtils;
-const Me = ExtensionUtils.getCurrentExtension();
-const Utils = Me.imports.utils;
-
+const Config = imports.misc.config;
var PopupBluetoothDeviceMenuItem = GObject.registerClass(
class PopupSwitchWithButtonMenuItem extends PopupMenu.PopupSwitchMenuItem {
@@ -42,6 +38,11 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._pendingLabel = this._buildPendingLabel();
this._connectToggledEvent();
+ if (this._isOldGnome()) {
+ this.remove_child(this._statusBin);
+ this.add(this._statusBin, { expand: false });
+ }
+
this.insert_child_at_index(this._refreshButton, this.get_n_children() - 1);
this.add_child(this._pendingLabel);
@@ -50,7 +51,7 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
sync(device) {
this._device = device;
- this._switch.state = device.isConnected;
+ this._syncSwitch(device);
this.visible = device.isPaired;
if (this._showRefreshButton && device.isConnected)
this._refreshButton.show();
@@ -58,6 +59,13 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._refreshButton.hide();
}
+ _syncSwitch(device) {
+ if (this._isOldGnome())
+ return this._switch.setToggleState(device.isConnected);
+
+ this._switch.state = device.isConnected;
+ }
+
_buildRefreshButton() {
let icon = new St.Icon({
icon_name: 'view-refresh',
@@ -144,10 +152,6 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._enablePending();
}
- hideRefreshButton() {
- this._refreshButton.hide();
- }
-
_enablePending() {
this._refreshButton.reactive = false;
this._switch.hide();
@@ -161,5 +165,9 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._pendingLabel.hide();
this.reactive = true;
}
+
+ _isOldGnome() {
+ return Config.PACKAGE_VERSION.match(/3\.3[24]/);
+ }
}
);