Update menus on account label change

This commit is contained in:
Philipp Hörist 2017-11-06 23:29:07 +01:00
parent e4ad111c02
commit 07055ccaad
3 changed files with 9 additions and 3 deletions

View File

@ -440,6 +440,7 @@ class GenericOptionPage(Gtk.Box):
'account_label', value or self.account)
if app.config.get_per('accounts', self.account, 'active'):
app.interface.roster.draw_account(self.account)
gui_menu_builder.build_accounts_menu()
def update(self):
self.set_entry_text(self.toggle, update=True)

View File

@ -780,8 +780,9 @@ def build_accounts_menu():
return
if len(accounts_list) > 1:
for acc in accounts_list:
label = app.config.get_per('accounts', acc, 'account_label')
acc_menu.append_submenu(
acc, get_account_menu(acc))
label or acc, get_account_menu(acc))
else:
acc_menu = get_account_menu(accounts_list[0])
menubar.remove(menu_position)
@ -805,7 +806,9 @@ def build_bookmark_menu(account):
if acc_menu.get_item_link(0, 'submenu'):
for i in range(acc_menu.get_n_items()):
label = acc_menu.get_item_attribute_value(i, 'label')
if label.get_string() == account:
account_label = app.config.get_per('accounts', account,
'account_label')
if label.get_string() in (account_label, account):
menu = acc_menu.get_item_link(i, 'submenu')
else:
# We have only one Account active

View File

@ -5116,7 +5116,9 @@ class RosterWindow:
accounts.append(account)
accounts.sort()
for account in accounts:
item = Gtk.MenuItem.new_with_label(account)
label = app.config.get_per('accounts', account,
'account_label')
item = Gtk.MenuItem.new_with_label(label or account)
account_menu = self.build_account_menu(account)
item.set_submenu(account_menu)
menu.append(item)