From 07055ccaade8014414eeccc27292112a731f0601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 6 Nov 2017 23:29:07 +0100 Subject: [PATCH] Update menus on account label change --- gajim/accounts_window.py | 1 + gajim/gui_menu_builder.py | 7 +++++-- gajim/roster_window.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gajim/accounts_window.py b/gajim/accounts_window.py index b029bf301..01970826e 100644 --- a/gajim/accounts_window.py +++ b/gajim/accounts_window.py @@ -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) diff --git a/gajim/gui_menu_builder.py b/gajim/gui_menu_builder.py index 8436acf3d..46d1aec46 100644 --- a/gajim/gui_menu_builder.py +++ b/gajim/gui_menu_builder.py @@ -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 diff --git a/gajim/roster_window.py b/gajim/roster_window.py index b6b5645cb..44222cde9 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -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)