def __init__(self): Gtk.ApplicationWindow.__init__(self) self.set_application(app.app) self.set_position(Gtk.WindowPosition.CENTER) self.set_show_menubar(False) self.set_name('AccountsWindow') self.set_default_size(700, 550) self.set_resizable(True) self.set_title(_('Accounts')) self._need_relogin = {} self._accounts = {} self._menu = AccountMenu() self._settings = Settings() box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) box.add(self._menu) box.add(self._settings) self.add(box) for account in app.get_accounts_sorted(): if account == 'Local': # Disable zeroconf support until its working again continue self.add_account(account, initial=True) self._menu.connect('menu-activated', self._on_menu_activated) self.connect('destroy', self._on_destroy) self.connect_after('key-press-event', self._on_key_press) self.show_all()
def _get_accounts(): accounts = app.get_accounts_sorted() combo_accounts = [] for account in accounts: label = app.get_account_label(account) combo_accounts.append((account, label)) return combo_accounts