/usr/bin/blueman-applet is in blueman 1.23-git201403102151-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #! /usr/bin/python
import sys
import os.path
import os
import pynotify
import dbus
import dbus.glib
import gobject
import gtk
import gtk.gdk
import __builtin__
#support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if os.path.exists(os.path.join(_dirname, "CHANGELOG.md")):
sys.path.insert(0, _dirname)
from blueman.Constants import *
from blueman.Functions import *
from blueman.main.DbusService import DbusService
import blueman.plugins.applet
from blueman.plugins.AppletPlugin import AppletPlugin
from blueman.plugins.BasePlugin import BasePlugin
import blueman.bluez as Bluez
from blueman.main.SignalTracker import SignalTracker
from blueman.main.PluginManager import PersistentPluginManager
class BluemanApplet(object):
def __init__(self):
setup_icon_path()
if not pynotify.init("Blueman"):
dprint("Error: Failed to init pynotify")
check_single_instance("blueman-applet")
self.Manager = None
self.DbusSvc = DbusService("org.blueman.Applet", "/")
self.Signals = SignalTracker()
self.Plugins = PersistentPluginManager(AppletPlugin, blueman.plugins.applet, self)
self.Plugins.Load()
self.Plugins.Run("on_plugins_loaded")
self.bus = dbus.SystemBus()
self.bus.watch_name_owner("org.bluez", self.on_dbus_name_owner_change)
self.bus.add_signal_receiver(self.on_adapter_property_changed, "PropertyChanged", "org.bluez.Adapter",
"org.bluez", path_keyword="path")
gtk.main()
def manager_init(self):
try:
self.Signals.DisconnectAll()
self.Manager = Bluez.Manager("gobject")
self.Plugins.Run("on_manager_state_changed", True)
self.Signals.Handle("bluez", self.Manager, self.on_adapter_removed, "AdapterRemoved")
self.Signals.Handle("bluez", self.Manager, self.on_adapter_added, "AdapterAdded")
except dbus.exceptions.DBusException as e:
dprint(e)
self.manager_deinit()
dprint("Bluez DBus API not available. Listening for DBus name ownership changes")
def manager_deinit(self):
self.Signals.DisconnectAll()
self.Manager = None
self.Plugins.Run("on_manager_state_changed", False)
def on_dbus_name_owner_change(self, owner):
dprint("org.bluez owner changed to", owner)
if owner == "":
self.manager_deinit()
elif self.Manager is None:
self.manager_init()
def on_adapter_property_changed(self, key, value, path):
self.Plugins.Run("on_adapter_property_changed", path, key, value)
def on_adapter_added(self, path):
dprint("Adapter added ", path)
def on_activate():
dprint("Adapter activated")
self.Plugins.Run("on_adapter_added", path)
adapter = Bluez.Adapter(path)
wait_for_adapter(adapter, on_activate)
def on_adapter_removed(self, path):
dprint("Adapter removed ", path)
self.Plugins.Run("on_adapter_removed", path)
BluemanApplet()
|