示例#1
0
    def on_load(self, applet):
        self._config = Config("org.blueman.transfer")

        if not self._config["shared-path"]:
            d = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)
            if not d:
                self._config["shared-path"] = os.path.expanduser("~")
            else:
                self._config["shared-path"] = d

        if not os.path.isdir(self._config["shared-path"]):
            logging.info("Configured share directory %s does not exist" % self._config["shared-path"])

            text = _("Configured directory for incoming files does not exist")
            secondary_text = _("Please make sure that directory \"<b>%s</b>\" exists or configure it with blueman-services")
            dlg = ErrorDialog(text, secondary_text % self._config["shared-path"])

            dlg.run()
            dlg.destroy()

        self._manager = obex.Manager()
        self._manager.connect("transfer-started", self._on_transfer_started)
        self._manager.connect("transfer-completed", self._on_transfer_completed)
        self._manager.connect('session-removed', self._on_session_removed)

        self._watch = obex.Manager.watch_name_owner(self._on_dbus_name_appeared, self._on_dbus_name_vanished)
示例#2
0
    def _on_dbus_name_appeared(self, _connection, name, owner):
        logging.info("%s %s" % (name, owner))

        self._manager = obex.Manager()
        self._manager.connect("transfer-started", self._on_transfer_started)
        self._manager.connect("transfer-completed",
                              self._on_transfer_completed)
        self._manager.connect('session-removed', self._on_session_removed)

        self._register_agent()
示例#3
0
    def on_load(self, applet):
        self._config = Config("org.blueman.transfer")

        if not self._config["shared-path"]:
            d = GLib.get_user_special_dir(
                GLib.UserDirectory.DIRECTORY_DOWNLOAD)
            if not d:
                self._config["shared-path"] = os.path.expanduser("~")
            else:
                self._config["shared-path"] = d

        if not os.path.isdir(self._config["shared-path"]):
            dprint("Configured share directory %s does not exist" %
                   self._config["shared-path"])

            dlg = Gtk.MessageDialog(None,
                                    buttons=Gtk.ButtonsType.OK,
                                    type=Gtk.MessageType.ERROR)
            text = _("Configured directory for incoming files does not exist")
            secondary_text = _(
                "Please make sure that directory \"<b>%s</b>\" exists or configure it with blueman-services"
            )
            dlg.props.text = text
            dlg.format_secondary_markup(secondary_text %
                                        self._config["shared-path"])

            dlg.run()
            dlg.destroy()

        self._manager = obex.Manager()
        self._manager.connect("transfer-started", self._on_transfer_started)
        self._manager.connect("transfer-completed",
                              self._on_transfer_completed)
        self._manager.connect('session-removed', self._on_session_removed)

        self._watch = dbus.SessionBus().watch_name_owner(
            "org.bluez.obex", self._on_obex_owner_changed)