def __init__(self): super().__init__(application_id="org.blueman.Applet", flags=Gio.ApplicationFlags.FLAGS_NONE) setup_icon_path() self.plugin_run_state_changed = False self.manager_state = False self._active = False self.Manager = Manager() self.Manager.connect_signal('adapter-added', self.on_adapter_added) self.Manager.connect_signal('adapter-removed', self.on_adapter_removed) self.Manager.connect_signal('device-created', self.on_device_created) self.Manager.connect_signal('device-removed', self.on_device_removed) self.DbusSvc = DbusService("org.blueman.Applet", "org.blueman.Applet", "/org/blueman/Applet", Gio.BusType.SESSION) self.DbusSvc.register() self.Plugins = PersistentPluginManager(AppletPlugin, blueman.plugins.applet, self) self.Plugins.load_plugin() self.Plugins.run("on_plugins_loaded") self.Manager.watch_name_owner(self._on_dbus_name_appeared, self._on_dbus_name_vanished) self._any_adapter = AnyAdapter() self._any_adapter.connect_signal('property-changed', self._on_adapter_property_changed) self._any_device = AnyDevice() self._any_device.connect_signal('property-changed', self._on_device_property_changed)
def __init__(self, adapter_name: Optional[str] = None, tabledata: Optional[List[ListDataDict]] = None, headers_visible: bool = True) -> None: if not tabledata: tabledata = [] # cache for fast lookup in the list self.path_to_row: Dict[str, Gtk.TreeRowReference] = {} self.monitored_devices: List[str] = [] self.manager = Manager() self._managerhandlers: List[int] = [] self._managerhandlers.append(self.manager.connect_signal('adapter-removed', self.__on_manager_signal, 'adapter-removed')) self._managerhandlers.append(self.manager.connect_signal('adapter-added', self.__on_manager_signal, 'adapter-added')) self._managerhandlers.append(self.manager.connect_signal('device-created', self.__on_manager_signal, 'device-created')) self._managerhandlers.append(self.manager.connect_signal('device-removed', self.__on_manager_signal, 'device-removed')) self.any_device = AnyDevice() self._anydevhandler = self.any_device.connect_signal("property-changed", self._on_device_property_changed) self.__discovery_time: float = 0 self.__adapter_path: Optional[str] = None self.Adapter: Optional[Adapter] = None self.discovering = False data = tabledata + [ {"id": "device", "type": object}, {"id": "dbus_path", "type": str}, {"id": "timestamp", "type": float} ] super().__init__(data, headers_visible=headers_visible) self.set_name("DeviceList") self.set_adapter(adapter_name) self._any_adapter = AnyAdapter() self._anyadapterhandler = self._any_adapter.connect_signal("property-changed", self._on_property_changed) self._selectionhandler = self.selection.connect('changed', self.on_selection_changed) self.icon_theme = Gtk.IconTheme.get_default() self.icon_theme.prepend_search_path(ICON_PATH) # handle icon theme changes self.icon_theme.connect("changed", self.on_icon_theme_changed)