示例#1
0
    def __init__(self):
        if Controller.__default:
           raise Controller.__default

        #Prevent various instances
        import os, fcntl, sys, tempfile, getpass
        self.lockfile = os.path.normpath(tempfile.gettempdir() + '/cloudsn-'+getpass.getuser()+'.lock')
        self.fp = open(self.lockfile, 'w')
        try:
            fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
        except IOError:
            message = _("Another instance is already running, close it first.")
            logger.warn (message)
            print message
            sys.exit(-1)

        gobject.GObject.__init__(self)
        self.started = False
        self.config = config.SettingsController.get_instance()
        self.config.connect("value-changed", self._settings_changed)
        self.prov_manager = ProviderManager.get_instance()
        self.im = indicator.IndicatorManager.get_instance()
        self.am = account.AccountManager.get_instance()
        self.am.connect("account-added", self._account_added_cb)
        self.am.connect("account-deleted", self._account_deleted_cb)
        self.am.connect("account-changed", self._account_changed_cb)
        self.am.connect("account-active-changed", self._account_active_cb)
        self.am.load_accounts()
        self.accounts_checking = []
        self.nm = networkmanager.NetworkManager()
示例#2
0
 def __init__(self):
     if AccountManager.__default:
         raise AccountManager.__default
     gobject.GObject.__init__(self)
     from cloudsn.core.provider import ProviderManager
     self.accounts = {}
     self.sc = config.SettingsController.get_instance()
     self.pm = ProviderManager.get_instance()
 def __init__(self):
     if AccountManager.__default:
         raise AccountManager.__default
     GObject.Object.__init__(self)
     from cloudsn.core.provider import ProviderManager
     self.accounts = {}
     self.sc = config.SettingsController.get_instance()
     self.pm = ProviderManager.get_instance()