Commit 3e0557da authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Dont build menu for Local account

parent 690dcfa8
......@@ -358,6 +358,8 @@ def add_actions(self):
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 @@ def add_actions(self):
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 @@ def remove_account_actions(self, account):
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 @@ def add_account(self, account_name):
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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment