Beispiel #1
0
 def start(self):
     gobject.threads_init()
     gobject.idle_add(self._start_idle)
     try:
         gtk.main()
     except KeyboardInterrupt:
         logger.info ('KeyboardInterrupt the main loop')
Beispiel #2
0
 def set_manager(self, manager):
     #The same manager, we don't need do nothing
     if manager == self.current:
         logger.debug("Setting the keyring manager but it is the same")
         return
     logger.info("Setting the keyring manager: %s" % (manager.get_name()))
     from cloudsn.core import account
     old = self.current
     for acc in account.AccountManager.get_instance().get_accounts():
         try:
             credentials = acc.get_credentials()
             old.remove_credentials(acc)
             manager.store_credentials(acc, credentials)
         except Exception, e:
             logger.exception("Cannot change the keyring for the account "\
                 + acc.get_name() + ": %s" , e)
 def set_manager(self, manager):
     #The same manager, we don't need do nothing
     if manager == self.current:
         logger.debug("Setting the keyring manager but it is the same")
         return
     logger.info("Setting the keyring manager: %s" % (manager.get_name()))
     from cloudsn.core import account
     old = self.current
     for acc in account.AccountManager.get_instance().get_accounts():
         try:
             credentials = acc.get_credentials()
             old.remove_credentials(acc)
             manager.store_credentials(acc, credentials)
         except Exception, e:
             logger.exception("Cannot change the keyring for the account "\
                 + acc.get_name() + ": %s" , e)
Beispiel #4
0
        self.__add_manager(PlainKeyring())
        try:
            from keyrings.base64keyring import Base64Keyring
            self.__add_manager(Base64Keyring())
        except Exception, e:
            logger.exception("Cannot load base64 keyring: %s", e)
        try:
            from keyrings.gkeyring import GnomeKeyring
            self.__add_manager(GnomeKeyring())
        except Exception, e:
            logger.exception("Cannot load gnome keyring: %s", e)
        configured_name = self.config.get_prefs()["keyring"]
        for m in self.managers:
            if m.get_id() == configured_name:
                self.current = m
                logger.info("Current keyring: %s " % (self.current.get_name()))
                break
        if not self.current:
            #Plain by default
            self.current = self.managers[0]
            logger.info("No keyring configured, using %s " %
                        (self.current.get_name()))

    @staticmethod
    def get_instance():
        if not KeyringManager.__default:
            KeyringManager.__default = KeyringManager()
        return KeyringManager.__default

    def __add_manager(self, manager):
        self.managers.append(manager)
        self.__add_manager (PlainKeyring())
        try:
            from keyrings.base64keyring import Base64Keyring
            self.__add_manager (Base64Keyring())
        except Exception, e:
            logger.exception("Cannot load base64 keyring: %s", e)
        try:
            from keyrings.gkeyring import GnomeKeyring
            self.__add_manager (GnomeKeyring())
        except Exception, e:
            logger.exception("Cannot load gnome keyring: %s", e)
        configured_name = self.config.get_prefs()["keyring"]
        for m in self.managers:
            if m.get_id() == configured_name:
                self.current = m
                logger.info("Current keyring: %s " % (self.current.get_name()))
                break
        if not self.current:
            #The most secure by default
            self.current = self.managers[-1]
            logger.info("No keyring configured, using %s " % (self.current.get_name()))

    @staticmethod
    def get_instance():
        if not KeyringManager.__default:
            KeyringManager.__default = KeyringManager()
        return KeyringManager.__default

    def __add_manager (self, manager):
        self.managers.append (manager)