Dont build menu for Local account
This commit is contained in:
parent
690dcfa84b
commit
3e0557dae6
|
@ -358,6 +358,8 @@ class GajimApplication(Gtk.Application):
|
|||
accounts_list = sorted(app.config.get_per('accounts'))
|
||||
if not accounts_list:
|
||||
return
|
||||
if 'Local' in accounts_list:
|
||||
accounts_list.remove('Local')
|
||||
if len(accounts_list) > 1:
|
||||
for acc in accounts_list:
|
||||
self.add_account_actions(acc)
|
||||
|
@ -365,6 +367,8 @@ class GajimApplication(Gtk.Application):
|
|||
self.add_account_actions(accounts_list[0])
|
||||
|
||||
def add_account_actions(self, account):
|
||||
if account == 'Local':
|
||||
return
|
||||
for action in self.account_actions:
|
||||
action_name, func, state, type_ = action
|
||||
action_name = account + action_name
|
||||
|
@ -384,6 +388,8 @@ class GajimApplication(Gtk.Application):
|
|||
self.remove_action(action_name)
|
||||
|
||||
def set_account_actions_state(self, account, new_state=False):
|
||||
if account == 'Local':
|
||||
return
|
||||
for action in self.account_actions:
|
||||
action_name, _, state, _ = action
|
||||
if not new_state and state in ('online', 'feature'):
|
||||
|
|
|
@ -237,8 +237,12 @@ class LegacyContactsAPI:
|
|||
GC_Contacts())
|
||||
self._metacontact_manager.add_account(account_name)
|
||||
|
||||
def get_accounts(self):
|
||||
return list(self._accounts.keys())
|
||||
def get_accounts(self, zeroconf=True):
|
||||
accounts = list(self._accounts.keys())
|
||||
if not zeroconf:
|
||||
if 'Local' in accounts:
|
||||
accounts.remove('Local')
|
||||
return accounts
|
||||
|
||||
def remove_account(self, account):
|
||||
del self._accounts[account]
|
||||
|
|
|
@ -781,7 +781,7 @@ def build_accounts_menu():
|
|||
|
||||
acc_menu = menubar.get_item_link(menu_position, 'submenu')
|
||||
acc_menu.remove_all()
|
||||
accounts_list = sorted(app.contacts.get_accounts())
|
||||
accounts_list = sorted(app.contacts.get_accounts(zeroconf=False))
|
||||
if not accounts_list:
|
||||
no_accounts = _('No Accounts available')
|
||||
acc_menu.append_item(Gio.MenuItem.new(no_accounts, None))
|
||||
|
|
Loading…
Reference in New Issue