def __init__(self, *args, **kwargs):
        super(Dialog, self).__init__(*args, **kwargs)        
        
        self.set_title('Google Accounts')

        self.connect('delete-event', self.__on_delete_event)
        self.connect('response', self.__on_response)

        self.add_button(gtk.STOCK_CLOSE,
                        gtk.RESPONSE_OK)
        self.set_default_response(gtk.RESPONSE_OK)

        self.__editors_by_account = {}

        self.__connections = gutil.DisconnectSet()

        accts = accounts.get_accounts()
        id = accts.connect('account-added', self.__on_account_added)
        self.__connections.add(accts, id)
        id = accts.connect('account-removed', self.__on_account_removed)
        self.__connections.add(accts, id)

        google_accounts = accts.get_accounts_with_kind(accounts.KIND_GOOGLE)
        if len(google_accounts) == 0:
            accounts.get_accounts().create_account(accounts.KIND_GOOGLE)
        else:
            for a in google_accounts:
                self.__on_account_added(accts, a)
Beispiel #2
0
def init():
    global __initialized
    
    if __initialized:
        return
    __initialized = True
    
    a = accounts.get_accounts()
    __refresh_googles(a)
    a.connect('account-added', __on_account_added)
    a.connect('account-removed', __on_account_removed)
    def __init__(self, action_id, **kwargs):
        super(GoogleStock, self).__init__(**kwargs)

        # A dictionary of authenticated google accounts, with keys that are used
        # to identify those accounts within the stock.
        self.googles = set()
        self.__googles_by_account = {} ## map accounts.Account => google.Google

        self.__action_id = action_id

        self.__connections = gutil.DisconnectSet()

        accts = accounts.get_accounts()
        for a in accts.get_accounts_with_kind(accounts.KIND_GOOGLE):
            self.__on_account_added(a)
        id = accts.connect('account-added', lambda accounts, account: self.__on_account_added(account))
        self.__connections.add(accts, id)
        id = accts.connect('account-removed', lambda accounts, account: self.__on_account_removed(account))
        self.__connections.add(accts, id)        
 def __on_password_entry_changed(self, entry):
     text = entry.get_text()
     accounts.get_accounts().save_account_changes(self.__account,
                                                  { 'password' : text })
 def __on_username_entry_changed(self, entry):
     text = entry.get_text()
     accounts.get_accounts().save_account_changes(self.__account,
                                                  { 'username' : text })