This file is indexed.

/usr/bin/blueman-manager is in blueman 1.23-0ubuntu2.

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#!/usr/bin/python

# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
# Copyright (C) 2008 Tadas Dailyda <tadas at dailyda dot com>
#
# Licensed under the GNU General Public License Version 3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 


import os.path
import sys
import gtk
import dbus, dbus.glib
import gobject

#support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if os.path.exists(os.path.join(_dirname,"ChangeLog")):
	sys.path.insert(0, _dirname)

from blueman.Constants import *
from blueman.Functions import *
from blueman.main.Device import Device
from blueman.bluez.Device import Device as BluezDevice
from blueman.gui.manager.ManagerDeviceList import ManagerDeviceList
from blueman.gui.manager.ManagerToolbar import ManagerToolbar
from blueman.gui.manager.ManagerMenu import ManagerMenu
from blueman.gui.manager.ManagerStats import ManagerStats
from blueman.gui.manager.ManagerProgressbar import ManagerProgressbar
from blueman.main.Config import Config

from blueman.gui.MessageArea import MessageArea

from blueman.main.PluginManager import PluginManager
import blueman.plugins.manager
from blueman.plugins.ManagerPlugin import ManagerPlugin

enable_rgba_colormap()

class Blueman:

	def __init__(self):
		
		self.Builder = gtk.Builder()
		self.Builder.set_translation_domain("blueman")
		self.Builder.add_from_file(UI_PATH +"/manager-main.ui")
	
		self.window = self.Builder.get_object("window")
		
		self.Plugins = PluginManager(ManagerPlugin, blueman.plugins.manager, None)
		self.Plugins.Load()
		
		vbox = self.Builder.get_object("vbox1")
		area = MessageArea()
		vbox.pack_start(area, False)
		vbox.reorder_child(area, 3)
	
		def do_present(time):
			if self.window.props.visible:
				self.window.present_with_time(time)
	
		check_single_instance("blueman-manager", do_present)	
		def on_window_delete(window, event):
			(x, y) = self.window.get_size()
			self.Config.props.window_height = y
			self.Config.props.window_width = x
			
			(x, y) = self.window.get_position()
			self.Config.props.window_posx = x
			self.Config.props.window_posy = y
			gtk.main_quit()
			
		def on_property_changed(config, key, value):
			if key == "show_toolbar":
				if value:
					self.Builder.get_object("toolbar2").props.visible = True
				else:
					self.Builder.get_object("toolbar2").props.visible = False
			elif key == "show_statusbar":
				if value:
					self.Builder.get_object("statusbar").props.visible = True
				else:
					self.Builder.get_object("statusbar").props.visible = False
			elif key == "latest_last":
				try:	
					self.List.DisplayKnownDevices(autoselect=True)
				except:
					pass
				
		def on_bt_status_changed(status):
			if not status:
				self.window.hide()
				check_bluetooth_status(_("Bluetooth needs to be turned on for the device manager to function"), lambda: gtk.main_quit())
			else:
				self.window.show()
		
		def on_bluez_name_owner_changed(owner):
			dprint('org.bluez owner changed to ', owner)
			if owner == '':
				self.window.hide()
				d = gtk.MessageDialog(self.window, type=gtk.MESSAGE_ERROR)
				d.props.icon_name = "blueman"
				d.props.text = _("Connection to BlueZ failed")

				d.props.secondary_text = _("Bluez daemon is not running, blueman-manager cannot continue.\nThis probably means that there were no Bluetooth adapters detected or Bluetooth daemon was not started.")

				d.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_NO)
				d.run()
				d.destroy()	
				try:
					exit(1)
				except:
					gtk.main_quit()
			else:
				
				setup_icon_path()
		
				self.Config = Config()
		
				try:
					self.Applet = AppletService()
				except:
					print "Blueman applet needs to be running"
					exit()
				try:
					if not self.Applet.GetBluetoothStatus():
						on_bt_status_changed(False)
				except:
					pass
				self.Applet.Handle("BluetoothStatusChanged", on_bt_status_changed)

		
				self.window.connect("delete-event", on_window_delete)
				self.window.props.icon_name = "blueman"
		
				h = self.Config.props.window_height
				w = self.Config.props.window_width
				if w != None and h != None:
					self.window.resize(w, h)
			
				x = self.Config.props.window_posx
				y = self.Config.props.window_posy
				if x and y:
					self.window.move(x, y)
			
		
				sw = self.Builder.get_object("scrollview")
		
				self.List = ManagerDeviceList(adapter=self.Config.props.last_adapter, inst=self)

				self.List.show()
				sw.add(self.List)
		
		
				self.Toolbar = ManagerToolbar(self)
				self.Menu = ManagerMenu(self)
				self.Stats = ManagerStats(self)
		
				if self.List.IsValidAdapter():
					self.List.DisplayKnownDevices(autoselect=True)
		
				self.List.connect("adapter-changed", self.on_adapter_changed)
		
				self.Config.connect("property-changed", on_property_changed)
		
				if self.Config.props.show_toolbar != None:
					on_property_changed(self.Config, "show_toolbar", self.Config.props.show_toolbar)
			
				if self.Config.props.show_statusbar != None:
					on_property_changed(self.Config, "show_statusbar", self.Config.props.show_statusbar)
				
				self.window.show()
						
		dbus.SystemBus().watch_name_owner('org.bluez', on_bluez_name_owner_changed)
		gtk.main()

	def on_adapter_changed(self, list, adapter):
		if adapter != None:
			self.List.DisplayKnownDevices(autoselect=True)
		
	def add_device(self, device):

		def ok(device):
			dev = Device(device)
			self.List.add_device(dev)
			prog.finalize()
			MessageArea.close()
		
		def err(*args):
			prog.finalize()
			MessageArea.show_message(e_(str(args[0])))
		
		adapter = self.List.Adapter
		
		prog = ManagerProgressbar(self, text=_("Adding"))
		prog.connect("cancelled", lambda x: self.List.Adapter.GetInterface().CancelDeviceCreation(device.Address))
		
		prog.start()
		adapter.CreateDevice(device.Address, reply_handler=ok, error_handler=err)
		
	def inquiry(self):
		def prop_changed(List, adapter, (key, value)):
			if key == "Discovering" and not value:
				prog.finalize()
				self.List.disconnect(s1)
				self.List.disconnect(s2)
				
		def on_progress(list, frac):
			if abs(1.0 - frac) <= 0.00001:
				if not prog.started():
					prog.start()
			else:
				prog.fraction(frac)
				
		prog = ManagerProgressbar(self, text=_("Searching"))
		prog.connect("cancelled", lambda x: self.List.StopDiscovery())
		try:
			self.List.DiscoverDevices()
		except Exception, e:
			prog.finalize()
			MessageArea.show_message(e_(e))
			
		s1 = self.List.connect("discovery-progress", on_progress)
		s2 = self.List.connect("adapter-property-changed", prop_changed)
		
	def setup(self, device):
		sn = startup_notification("Bluetooth Assistant", _("Starting Bluetooth Assistant"), bin_name="blueman-assistant", icon="blueman")
		spawn(["blueman-assistant", "--device=%s" % device.Address], sn=sn)
		
	def bond(self, device):
		def ok(device):
			dev = Device(BluezDevice(device))
			self.List.add_device(dev)
			prog.message(_("Success"))
			MessageArea.close()
		
		def err(*args):
			dprint(args)
			prog.message(_("Failure"))
			MessageArea.show_message(e_(str(args[0])))
		
		applet = AppletService()
		
		address = device.GetProperties()["Address"]
		adapter = self.List.Adapter
		
		prog = ManagerProgressbar(self, text=_("Pairing"))
		prog.connect("cancelled", lambda x: applet.CancelDeviceCreation(adapter.GetObjectPath(), device.Address))
		prog.start()
		
		name = adapter_path_to_name(self.List.Adapter.GetObjectPath())

		applet.CreateDevice(adapter.GetObjectPath(), device.Address, True, gtk.get_current_event_time(), reply_handler=ok, error_handler=err, timeout=120) 
		
		
	def adapter_properties(self):
		adapter = self.List.Adapter
		name = os.path.basename(adapter.GetObjectPath())
		sn = startup_notification("Blueman Adapters", _("Starting Adapter Preferences"), bin_name="blueman-adapters", icon="blueman")
		spawn(["blueman-adapters", name], sn=sn)

		
	def toggle_trust(self, device):
		props = device.GetProperties()
		device.Trusted = not device.Trusted
		
	def send(self, device, File=None):
		sn = startup_notification("Blueman Sendto", _("Starting File Sender"), bin_name="blueman-sendto", icon="blueman")
		adapter = self.List.Adapter
		props = adapter.GetProperties()
		spawn(["blueman-sendto", "--source=%s" % props["Address"], "--device=%s" % device.Address], sn=sn)
		
	def remove(self, device):
		self.List.Adapter.RemoveDevice(device.Device)
		
		
	def browse(self, device):
		spawn(["blueman-browse", "-d %s" % device.Address])
		
	def disconnect(self, device, *args, **kwargs):
		applet = AppletService()
		applet.DisconnectDevice(device.get_object_path(), *args, **kwargs)

		



Blueman()