Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- applet.js.orig 2012-10-31 23:25:21.485032500 +0700
- +++ applet.js 2012-10-31 23:33:48.495951528 +0700
- @@ -1,17 +1,8 @@
- const Applet = imports.ui.applet;
- const Clutter = imports.gi.Clutter;
- const GLib = imports.gi.GLib;
- -var Bluetooth;
- -try {
- - Bluetooth = imports.gi.GnomeBluetooth;
- - new Bluetooth.Applet(); // try the 3.6 ABI
- - global.logError("Bluetooth Gnome 3.6 ABI");
- -}
- -catch(e) {
- - // Fallback to the 3.4 ABI
- - Bluetooth = imports.gi.GnomeBluetoothApplet;
- - global.logError("Bluetooth Gnome 3.4 ABI");
- -}
- +const GnomeBluetoothApplet = imports.gi.GnomeBluetoothApplet;
- +var GnomeBluetooth = imports.gi.GnomeBluetoothApplet;
- const Lang = imports.lang;
- const St = imports.gi.St;
- @@ -26,6 +17,10 @@
- CONNECTING: 3
- }
- +if (GnomeBluetooth.KillSwitchstate===undefined){
- + GnomeBluetooth = imports.gi.GnomeBluetooth;
- +}
- +
- function Source() {
- this._init.apply(this, arguments);
- }
- @@ -216,17 +211,17 @@
- this.set_applet_tooltip(_("Bluetooth"));
- GLib.spawn_command_line_sync ('pkill -f "^bluetooth-applet$"');
- - this._applet = new Bluetooth.Applet();
- + this._applet = new GnomeBluetoothApplet.Applet();
- this._killswitch = new PopupMenu.PopupSwitchMenuItem(_("Bluetooth"), false);
- this._applet.connect('notify::killswitch-state', Lang.bind(this, this._updateKillswitch));
- this._killswitch.connect('toggled', Lang.bind(this, function() {
- let current_state = this._applet.killswitch_state;
- - if (current_state != Bluetooth.KillswitchState.HARD_BLOCKED &&
- - current_state != Bluetooth.KillswitchState.NO_ADAPTER) {
- + if (current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED &&
- + current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER) {
- this._applet.killswitch_state = this._killswitch.state ?
- - Bluetooth.KillswitchState.UNBLOCKED:
- - Bluetooth.KillswitchState.SOFT_BLOCKED;
- + GnomeBluetooth.KillswitchState.UNBLOCKED:
- + GnomeBluetooth.KillswitchState.SOFT_BLOCKED;
- } else
- this._killswitch.setToggleState(false);
- }));
- @@ -290,10 +285,10 @@
- _updateKillswitch: function() {
- let current_state = this._applet.killswitch_state;
- - let on = current_state == Bluetooth.KillswitchState.UNBLOCKED;
- - let has_adapter = current_state != Bluetooth.KillswitchState.NO_ADAPTER;
- - let can_toggle = current_state != Bluetooth.KillswitchState.NO_ADAPTER &&
- - current_state != Bluetooth.KillswitchState.HARD_BLOCKED;
- + let on = current_state == GnomeBluetooth.KillswitchState.UNBLOCKED;
- + let has_adapter = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER;
- + let can_toggle = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER &&
- + current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED;
- this._killswitch.setToggleState(on);
- if (can_toggle)
- @@ -352,7 +347,7 @@
- },
- _updateDeviceItem: function(item, device) {
- - if (!device.can_connect && device.capabilities == Bluetooth.Capabilities.NONE) {
- + if (!device.can_connect && device.capabilities == GnomeBluetoothApplet.Capabilities.NONE) {
- item.destroy();
- return;
- }
- @@ -381,7 +376,7 @@
- },
- _createDeviceItem: function(device) {
- - if (!device.can_connect && device.capabilities == Bluetooth.Capabilities.NONE)
- + if (!device.can_connect && device.capabilities == GnomeBluetoothApplet.Capabilities.NONE)
- return null;
- let item = new PopupMenu.PopupSubMenuMenuItem(device.alias);
- @@ -436,12 +431,12 @@
- item.menu.addMenuItem(item._connectedMenuitem);
- }
- - if (device.capabilities & Bluetooth.Capabilities.OBEX_PUSH) {
- + if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_PUSH) {
- item.menu.addAction(_("Send Files..."), Lang.bind(this, function() {
- this._applet.send_to_address(device.bdaddr, device.alias);
- }));
- }
- - if (device.capabilities & Bluetooth.Capabilities.OBEX_FILE_TRANSFER) {
- + if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_FILE_TRANSFER) {
- item.menu.addAction(_("Browse Files..."), Lang.bind(this, function(event) {
- this._applet.browse_address(device.bdaddr, event.get_time(),
- Lang.bind(this, function(applet, result) {
- @@ -459,15 +454,15 @@
- }
- switch (device.type) {
- - case Bluetooth.Type.KEYBOARD:
- + case GnomeBluetoothApplet.Type.KEYBOARD:
- item.menu.addSettingsAction(_("Keyboard Settings"), 'gnome-keyboard-panel.desktop');
- break;
- - case Bluetooth.Type.MOUSE:
- + case GnomeBluetoothApplet.Type.MOUSE:
- item.menu.addSettingsAction(_("Mouse Settings"), 'gnome-mouse-panel.desktop');
- break;
- - case Bluetooth.Type.HEADSET:
- - case Bluetooth.Type.HEADPHONES:
- - case Bluetooth.Type.OTHER_AUDIO:
- + case GnomeBluetoothApplet.Type.HEADSET:
- + case GnomeBluetoothApplet.Type.HEADPHONES:
- + case GnomeBluetoothApplet.Type.OTHER_AUDIO:
- item.menu.addSettingsAction(_("Sound Settings"), 'gnome-sound-panel.desktop');
- break;
- default:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement