Advertisement
Guest User

Untitled

a guest
Oct 31st, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- applet.js.orig  2012-10-31 23:25:21.485032500 +0700
  2. +++ applet.js   2012-10-31 23:33:48.495951528 +0700
  3. @@ -1,17 +1,8 @@
  4.  const Applet = imports.ui.applet;
  5.  const Clutter = imports.gi.Clutter;
  6.  const GLib = imports.gi.GLib;
  7. -var Bluetooth;
  8. -try {
  9. -    Bluetooth = imports.gi.GnomeBluetooth;
  10. -    new Bluetooth.Applet(); // try the 3.6 ABI
  11. -    global.logError("Bluetooth Gnome 3.6 ABI");
  12. -}
  13. -catch(e) {
  14. -    // Fallback to the 3.4 ABI
  15. -    Bluetooth = imports.gi.GnomeBluetoothApplet;
  16. -    global.logError("Bluetooth Gnome 3.4 ABI");
  17. -}
  18. +const GnomeBluetoothApplet = imports.gi.GnomeBluetoothApplet;
  19. +var GnomeBluetooth = imports.gi.GnomeBluetoothApplet;
  20.  const Lang = imports.lang;
  21.  const St = imports.gi.St;
  22.  
  23. @@ -26,6 +17,10 @@
  24.      CONNECTING: 3
  25.  }
  26.  
  27. +if (GnomeBluetooth.KillSwitchstate===undefined){
  28. +   GnomeBluetooth = imports.gi.GnomeBluetooth;
  29. +}
  30. +
  31.  function Source() {
  32.      this._init.apply(this, arguments);
  33.  }
  34. @@ -216,17 +211,17 @@
  35.              this.set_applet_tooltip(_("Bluetooth"));
  36.                          
  37.              GLib.spawn_command_line_sync ('pkill -f "^bluetooth-applet$"');
  38. -            this._applet = new Bluetooth.Applet();
  39. +            this._applet = new GnomeBluetoothApplet.Applet();
  40.  
  41.              this._killswitch = new PopupMenu.PopupSwitchMenuItem(_("Bluetooth"), false);
  42.              this._applet.connect('notify::killswitch-state', Lang.bind(this, this._updateKillswitch));
  43.              this._killswitch.connect('toggled', Lang.bind(this, function() {
  44.                  let current_state = this._applet.killswitch_state;
  45. -                if (current_state != Bluetooth.KillswitchState.HARD_BLOCKED &&
  46. -                    current_state != Bluetooth.KillswitchState.NO_ADAPTER) {
  47. +                if (current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED &&
  48. +                    current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER) {
  49.                      this._applet.killswitch_state = this._killswitch.state ?
  50. -                        Bluetooth.KillswitchState.UNBLOCKED:
  51. -                        Bluetooth.KillswitchState.SOFT_BLOCKED;
  52. +                        GnomeBluetooth.KillswitchState.UNBLOCKED:
  53. +                        GnomeBluetooth.KillswitchState.SOFT_BLOCKED;
  54.                  } else
  55.                      this._killswitch.setToggleState(false);
  56.              }));
  57. @@ -290,10 +285,10 @@
  58.    
  59.      _updateKillswitch: function() {
  60.          let current_state = this._applet.killswitch_state;
  61. -        let on = current_state == Bluetooth.KillswitchState.UNBLOCKED;
  62. -        let has_adapter = current_state != Bluetooth.KillswitchState.NO_ADAPTER;
  63. -        let can_toggle = current_state != Bluetooth.KillswitchState.NO_ADAPTER &&
  64. -                         current_state != Bluetooth.KillswitchState.HARD_BLOCKED;
  65. +        let on = current_state == GnomeBluetooth.KillswitchState.UNBLOCKED;
  66. +        let has_adapter = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER;
  67. +        let can_toggle = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER &&
  68. +                         current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED;
  69.  
  70.          this._killswitch.setToggleState(on);
  71.          if (can_toggle)
  72. @@ -352,7 +347,7 @@
  73.      },
  74.  
  75.      _updateDeviceItem: function(item, device) {
  76. -        if (!device.can_connect && device.capabilities == Bluetooth.Capabilities.NONE) {
  77. +        if (!device.can_connect && device.capabilities == GnomeBluetoothApplet.Capabilities.NONE) {
  78.              item.destroy();
  79.              return;
  80.          }
  81. @@ -381,7 +376,7 @@
  82.      },
  83.  
  84.      _createDeviceItem: function(device) {
  85. -        if (!device.can_connect && device.capabilities == Bluetooth.Capabilities.NONE)
  86. +        if (!device.can_connect && device.capabilities == GnomeBluetoothApplet.Capabilities.NONE)
  87.              return null;
  88.          let item = new PopupMenu.PopupSubMenuMenuItem(device.alias);
  89.  
  90. @@ -436,12 +431,12 @@
  91.              item.menu.addMenuItem(item._connectedMenuitem);
  92.          }
  93.  
  94. -        if (device.capabilities & Bluetooth.Capabilities.OBEX_PUSH) {
  95. +        if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_PUSH) {
  96.              item.menu.addAction(_("Send Files..."), Lang.bind(this, function() {
  97.                  this._applet.send_to_address(device.bdaddr, device.alias);
  98.              }));
  99.          }
  100. -        if (device.capabilities & Bluetooth.Capabilities.OBEX_FILE_TRANSFER) {
  101. +        if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_FILE_TRANSFER) {
  102.              item.menu.addAction(_("Browse Files..."), Lang.bind(this, function(event) {
  103.                  this._applet.browse_address(device.bdaddr, event.get_time(),
  104.                      Lang.bind(this, function(applet, result) {
  105. @@ -459,15 +454,15 @@
  106.          }
  107.  
  108.          switch (device.type) {
  109. -        case Bluetooth.Type.KEYBOARD:
  110. +        case GnomeBluetoothApplet.Type.KEYBOARD:
  111.              item.menu.addSettingsAction(_("Keyboard Settings"), 'gnome-keyboard-panel.desktop');
  112.              break;
  113. -        case Bluetooth.Type.MOUSE:
  114. +        case GnomeBluetoothApplet.Type.MOUSE:
  115.              item.menu.addSettingsAction(_("Mouse Settings"), 'gnome-mouse-panel.desktop');
  116.              break;
  117. -        case Bluetooth.Type.HEADSET:
  118. -        case Bluetooth.Type.HEADPHONES:
  119. -        case Bluetooth.Type.OTHER_AUDIO:
  120. +        case GnomeBluetoothApplet.Type.HEADSET:
  121. +        case GnomeBluetoothApplet.Type.HEADPHONES:
  122. +        case GnomeBluetoothApplet.Type.OTHER_AUDIO:
  123.              item.menu.addSettingsAction(_("Sound Settings"), 'gnome-sound-panel.desktop');
  124.              break;
  125.          default:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement