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