def on_keyring_password_required(self, opath, callback=None): from wader.gtk.profiles import manager profile = manager.get_profile_by_object_path(opath) password = None if profile.secrets.manager.is_new(): dialog = NewKeyringDialog(self.view.get_top_widget()) response = dialog.run() elif not profile.secrets.manager.is_open(): dialog = KeyringPasswordDialog(self.view.get_top_widget()) response = dialog.run() if response == gtk.RESPONSE_OK: password = dialog.password_entry.get_text() dialog.destroy() if password is not None: try: profile.secrets.manager.open(password) except KeyringInvalidPassword: title = _("Invalid password") details = _("The supplied password is incorrect") show_error_dialog(title, details) # call ourselves again self.on_keyring_password_required(opath) else: if callback is not None: uuid = profile.get_settings()['connection']['uuid'] callback(profile.secrets.manager.get_secrets(uuid))
def on_net_password_required(self, opath, tag): password = ask_password_dialog(self.view) if password: from wader.gtk.profiles import manager ret = {'gsm': {'passwd': password}} profile = manager.get_profile_by_object_path(opath) profile.set_secrets(tag, ret)