[cinnamon] update the bluetooth applet patch

leigh123linux leigh123linux at fedoraproject.org
Fri Nov 2 13:09:42 UTC 2012


commit 96a4f69b3215ac5fdb79713d70ffb58eea5ad57d
Author: leigh123linux <leigh123linux at googlemail.com>
Date:   Fri Nov 2 13:09:16 2012 +0000

    update the bluetooth applet patch

 bluetooth_applet.patch |   82 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 62 insertions(+), 20 deletions(-)
---
diff --git a/bluetooth_applet.patch b/bluetooth_applet.patch
index 90a29a3..67fa5b2 100644
--- a/bluetooth_applet.patch
+++ b/bluetooth_applet.patch
@@ -1,6 +1,6 @@
 --- a/files/usr/share/cinnamon/applets/bluetooth at cinnamon.org/applet.js
 +++ b/files/usr/share/cinnamon/applets/bluetooth at cinnamon.org/applet.js
-@@ -1,17 +1,8 @@
+@@ -1,20 +1,11 @@
  const Applet = imports.ui.applet;
  const Clutter = imports.gi.Clutter;
  const GLib = imports.gi.GLib;
@@ -19,31 +19,62 @@
 +const GnomeBluetooth = imports.gi.GnomeBluetooth;
  const Lang = imports.lang;
  const St = imports.gi.St;
+-
++var ABI=6;
+ const Main = imports.ui.main;
+ const MessageTray = imports.ui.messageTray;
+ const PopupMenu = imports.ui.popupMenu;
+@@ -26,6 +17,10 @@
+     CONNECTING: 3
+ }
  
-@@ -216,17 +206,17 @@ MyApplet.prototype = {
++ if (!GnomeBluetooth.hasOwnProperty('KillswitchState')){
++ 	ABI=4;
++}
++
+ function Source() {
+     this._init.apply(this, arguments);
+ }
+@@ -216,19 +211,29 @@
              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 ?
+-                    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);
+-                } else
+-                    this._killswitch.setToggleState(false);
++		if (ABI==6){
++			if (current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED &&
++			    current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER) {
++			    this._applet.killswitch_state = this._killswitch.state ?
++				GnomeBluetooth.KillswitchState.UNBLOCKED:
++			        GnomeBluetooth.KillswitchState.SOFT_BLOCKED;
++			} else
++				this._killswitch.setToggleState(false);
++		} else {
++			if (current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED &&
++			    current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER) {
++			    this._applet.killswitch_state = this._killswitch.state ?
++				GnomeBluetoothApplet.KillswitchState.UNBLOCKED:
++			        GnomeBluetoothApplet.KillswitchState.SOFT_BLOCKED;
++			} else
++				this._killswitch.setToggleState(false);
++		}
++		global.logError(this._killswitch.state)
              }));
-@@ -290,10 +280,10 @@ MyApplet.prototype = {
+ 
+             this._discoverable = new PopupMenu.PopupSwitchMenuItem(_("Visibility"), this._applet.discoverable);
+@@ -290,11 +295,20 @@
     
      _updateKillswitch: function() {
          let current_state = this._applet.killswitch_state;
@@ -51,14 +82,25 @@
 -        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;
- 
+-
++	let on;
++	let has_adapter;
++	let can_toggle;
++	if (ABI==6){
++		on = current_state == GnomeBluetooth.KillswitchState.UNBLOCKED;
++		has_adapter = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER;
++		can_toggle = current_state != GnomeBluetooth.KillswitchState.NO_ADAPTER &&
++			         current_state != GnomeBluetooth.KillswitchState.HARD_BLOCKED;
++	} else {
++		on = current_state == GnomeBluetoothApplet.KillswitchState.UNBLOCKED;
++		has_adapter = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER;
++		can_toggle = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER &&
++			         current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED;
++	}
          this._killswitch.setToggleState(on);
          if (can_toggle)
-@@ -352,7 +342,7 @@ MyApplet.prototype = {
+             this._killswitch.setStatus(null);
+@@ -352,7 +366,7 @@
      },
  
      _updateDeviceItem: function(item, device) {
@@ -67,7 +109,7 @@
              item.destroy();
              return;
          }
-@@ -381,7 +371,7 @@ MyApplet.prototype = {
+@@ -381,7 +395,7 @@
      },
  
      _createDeviceItem: function(device) {
@@ -76,7 +118,7 @@
              return null;
          let item = new PopupMenu.PopupSubMenuMenuItem(device.alias);
  
-@@ -436,12 +426,12 @@ MyApplet.prototype = {
+@@ -436,12 +450,12 @@
              item.menu.addMenuItem(item._connectedMenuitem);
          }
  
@@ -91,7 +133,7 @@
              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 +449,15 @@ MyApplet.prototype = {
+@@ -459,15 +473,15 @@
          }
  
          switch (device.type) {


More information about the scm-commits mailing list