summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-10-30 23:16:57 +0000
committerSimon McVittie <smcv@debian.org>2020-10-30 23:16:57 +0000
commita5e4859518a17c0c34ef4046fcb344161e46d42d (patch)
tree6b6aa7bffa4efdb63ceecb0e08553fb47f00d622
parent4ebc314e354eb46cc84c566ec60a1b921902f16f (diff)
parent662250e1ef3ebaafdb237c06ea39fbdbee09ee40 (diff)
New upstream version 16
-rw-r--r--README.md5
-rw-r--r--metadata.json2
-rw-r--r--ui.js40
3 files changed, 27 insertions, 20 deletions
diff --git a/README.md b/README.md
index 12b32e5..b93d4c9 100644
--- a/README.md
+++ b/README.md
@@ -18,8 +18,9 @@ https://extensions.gnome.org/extension/1401/bluetooth-quick-connect/
git clone https://github.com/bjarosze/gnome-bluetooth-quick-connect
cd gnome-bluetooth-quick-connect
make
-rm -r ~/.local/share/gnome-shell/extensions/bluetooth-quick-connect@bjarosze.gmail.com
-cp -r gnome-bluetooth-quick-connect ~/.local/share/gnome-shell/extensions/bluetooth-quick-connect@bjarosze.gmail.com
+rm -rf ~/.local/share/gnome-shell/extensions/bluetooth-quick-connect@bjarosze.gmail.com
+mkdir -p ~/.local/share/gnome-shell/extensions/bluetooth-quick-connect@bjarosze.gmail.com
+cp -r * ~/.local/share/gnome-shell/extensions/bluetooth-quick-connect@bjarosze.gmail.com
```
## Troubleshooting
diff --git a/metadata.json b/metadata.json
index bc3f83f..925b6c8 100644
--- a/metadata.json
+++ b/metadata.json
@@ -6,6 +6,6 @@
"settings-schema": "org.gnome.shell.extensions.bluetooth-quick-connect",
"gettext-domain": "bluetooth-quick-connect",
"shell-version": [
- "3.36"
+ "3.38"
]
}
diff --git a/ui.js b/ui.js
index 86deae4..ea3354b 100644
--- a/ui.js
+++ b/ui.js
@@ -18,12 +18,8 @@
const Clutter = imports.gi.Clutter;
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 {
@@ -41,6 +37,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);
@@ -49,7 +50,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();
@@ -57,6 +58,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',
@@ -66,25 +74,23 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
let button = new St.Button({
child: icon,
- x_align: Clutter.ActorAlign.END
+ x_align: St.Align.END
});
button.connect("enter-event", (widget) => {
- Tweener.addTween(
- widget.child, {
+ widget.child.ease( {
opacity: 255,
time: 0.05,
- transition: 'linear'
+ transition: Clutter.AnimationMode.LINEAR
}
);
});
button.connect("leave-event", (widget) => {
- Tweener.addTween(
- widget.child, {
+ widget.child.ease( {
opacity: 155,
time: 0.05,
- transition: 'linear'
+ transition: Clutter.AnimationMode.LINEAR
}
);
});
@@ -143,10 +149,6 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._enablePending();
}
- hideRefreshButton() {
- this._refreshButton.hide();
- }
-
_enablePending() {
this._refreshButton.reactive = false;
this._switch.hide();
@@ -160,5 +162,9 @@ var PopupBluetoothDeviceMenuItem = GObject.registerClass(
this._pendingLabel.hide();
this.reactive = true;
}
+
+ _isOldGnome() {
+ return Config.PACKAGE_VERSION.startsWith('3.34');
+ }
}
);