[gnome-shell] bluetooth: Remove pairing agent
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] bluetooth: Remove pairing agent
- Date: Tue, 26 Nov 2013 17:53:28 +0000 (UTC)
commit abf7c333b1b2248f41b3f5411e9a4591032c320b
Author: Bastien Nocera <hadess hadess net>
Date: Tue Nov 26 11:11:20 2013 +0100
bluetooth: Remove pairing agent
We'll only have it in the Bluetooth settings panel.
https://bugzilla.gnome.org/show_bug.cgi?id=719341
js/ui/status/bluetooth.js | 206 ---------------------------------------------
1 files changed, 0 insertions(+), 206 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 4b74b23..edcc04e 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -35,12 +35,6 @@ const Indicator = new Lang.Class({
this._applet = new GnomeBluetoothApplet.Applet();
this._applet.connect('devices-changed', Lang.bind(this, this._sync));
this._sync();
-
- this._applet.connect('pincode-request', Lang.bind(this, this._pinRequest));
- this._applet.connect('confirm-request', Lang.bind(this, this._confirmRequest));
- this._applet.connect('auth-request', Lang.bind(this, this._authRequest));
- this._applet.connect('auth-service-request', Lang.bind(this, this._authServiceRequest));
- this._applet.connect('cancel-request', Lang.bind(this, this._cancelRequest));
},
_sync: function() {
@@ -56,204 +50,4 @@ const Indicator = new Lang.Class({
if (on)
this._item.status.text = ngettext("%d Connected Device", "%d Connected Devices",
nDevices).format(nDevices);
},
-
- _ensureSource: function() {
- if (!this._source) {
- this._source = new MessageTray.Source(_("Bluetooth"), 'bluetooth-active');
- this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-bluetooth-panel');
- Main.messageTray.add(this._source);
- }
- },
-
- _authRequest: function(applet, device_path, name, long_name) {
- this._ensureSource();
- this._source.notify(new AuthNotification(this._source, this._applet, device_path, name, long_name));
- },
-
- _authServiceRequest: function(applet, device_path, name, long_name, uuid) {
- this._ensureSource();
- this._source.notify(new AuthServiceNotification(this._source, this._applet, device_path, name,
long_name, uuid));
- },
-
- _confirmRequest: function(applet, device_path, name, long_name, pin) {
- this._ensureSource();
- this._source.notify(new ConfirmNotification(this._source, this._applet, device_path, name,
long_name, pin));
- },
-
- _pinRequest: function(applet, device_path, name, long_name, numeric) {
- this._ensureSource();
- this._source.notify(new PinNotification(this._source, this._applet, device_path, name, long_name,
numeric));
- },
-
- _cancelRequest: function() {
- this._source.destroy();
- }
-});
-
-const AuthNotification = new Lang.Class({
- Name: 'AuthNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, applet, device_path, name, long_name) {
- this.parent(source,
- _("Bluetooth"),
- _("Authorization request from %s").format(name),
- { customContent: true });
- this.setResident(true);
-
- this._applet = applet;
- this._devicePath = device_path;
- this.addBody(_("Device %s wants to pair with this computer").format(long_name));
-
- this.addAction('allow', _("Allow"));
- this.addAction('deny', _("Deny"));
-
- this.connect('action-invoked', Lang.bind(this, function(self, action) {
- if (action == 'allow')
- this._applet.agent_reply_confirm(this._devicePath, true);
- else
- this._applet.agent_reply_confirm(this._devicePath, false);
- this.destroy();
- }));
- }
-});
-
-const AuthServiceNotification = new Lang.Class({
- Name: 'AuthServiceNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, applet, device_path, name, long_name, uuid) {
- this.parent(source,
- _("Bluetooth"),
- _("Authorization request from %s").format(name),
- { customContent: true });
- this.setResident(true);
-
- this._applet = applet;
- this._devicePath = device_path;
- this.addBody(_("Device %s wants access to the service '%s'").format(long_name, uuid));
-
- this.addAction('always-grant', _("Always grant access"));
- this.addAction('grant', _("Grant this time only"));
- this.addAction('reject', _("Reject"));
-
- this.connect('action-invoked', Lang.bind(this, function(self, action) {
- switch (action) {
- case 'always-grant':
- this._applet.agent_reply_auth_service(this._devicePath, true, true);
- break;
- case 'grant':
- this._applet.agent_reply_auth_service(this._devicePath, true, false);
- break;
- case 'reject':
- default:
- this._applet.agent_reply_auth_service(this._devicePath, false, false);
- }
- this.destroy();
- }));
- }
-});
-
-const ConfirmNotification = new Lang.Class({
- Name: 'ConfirmNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, applet, device_path, name, long_name, pin) {
- this.parent(source,
- _("Bluetooth"),
- /* Translators: argument is the device short name */
- _("Pairing confirmation for %s").format(name),
- { customContent: true });
- this.setResident(true);
-
- this._applet = applet;
- this._devicePath = device_path;
- this.addBody(_("Device %s wants to pair with this computer").format(long_name));
- this.addBody(_("Please confirm whether the Passkey '%06d' matches the one on the
device.").format(pin));
-
- /* Translators: this is the verb, not the noun */
- this.addAction('matches', _("Matches"));
- this.addAction('does-not-match', _("Does not match"));
-
- this.connect('action-invoked', Lang.bind(this, function(self, action) {
- if (action == 'matches')
- this._applet.agent_reply_confirm(this._devicePath, true);
- else
- this._applet.agent_reply_confirm(this._devicePath, false);
- this.destroy();
- }));
- }
-});
-
-const PinNotification = new Lang.Class({
- Name: 'PinNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, applet, device_path, name, long_name, numeric) {
- this.parent(source,
- _("Bluetooth"),
- _("Pairing request for %s").format(name),
- { customContent: true });
- this.setResident(true);
-
- this._applet = applet;
- this._devicePath = device_path;
- this._numeric = numeric;
- this.addBody(_("Device %s wants to pair with this computer").format(long_name));
- this.addBody(_("Please enter the PIN mentioned on the device."));
-
- this._entry = new St.Entry();
- this._entry.connect('key-release-event', Lang.bind(this, function(entry, event) {
- let key = event.get_key_symbol();
- if (key == Clutter.KEY_Return) {
- if (this._canActivateOkButton())
- this._ok();
- return true;
- } else if (key == Clutter.KEY_Escape) {
- this._cancel();
- return true;
- }
- return false;
- }));
- this.addActor(this._entry);
-
- let okButton = this.addAction(_("OK"), Lang.bind(this, this._ok));
- this.addAction(_("Cancel"), Lang.bind(this, this._cancel));
-
- okButton.reactive = this._canActivateOkButton();
- this._entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
- okButton.reactive = this._canActivateOkButton();
- }));
- },
-
- _ok: function() {
- if (this._numeric) {
- let num = parseInt(this._entry.text, 10);
- if (isNaN(num)) {
- // user reply was empty, or was invalid
- // cancel the operation
- num = -1;
- }
- this._applet.agent_reply_passkey(this._devicePath, num);
- } else {
- this._applet.agent_reply_pincode(this._devicePath, this._entry.text);
- }
- this.destroy();
- },
-
- _cancel: function() {
- if (this._numeric)
- this._applet.agent_reply_passkey(this._devicePath, -1);
- else
- this._applet.agent_reply_pincode(this._devicePath, null);
- this.destroy();
- },
-
- _canActivateOkButton: function() {
- // PINs have a fixed length of 6
- if (this._numeric)
- return this._entry.clutter_text.text.length == 6;
- else
- return true;
- }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]