diff --git a/src/common/helpers.py b/src/common/helpers.py index 178b51302..d87c8cecf 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -544,6 +544,19 @@ def get_global_status(): status = gajim.connections[account].status return status +def statuses_unified(): + '''testing if all statuses are the same.''' + reference = None + for account in gajim.connections: + if not gajim.config.get_per('accounts', account, + 'sync_with_global_status'): + continue + if reference == None: + reference = gajim.connections[account].connected + elif reference != gajim.connections[account].connected: + return False + return True + def get_icon_name_to_show(contact, account = None): '''Get the icon name to show in online, away, requested, ...''' if account and gajim.events.get_nb_roster_events(account, contact.jid): diff --git a/src/roster_window.py b/src/roster_window.py index 35f9e825c..6dfaeea04 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3729,7 +3729,10 @@ class RosterWindow: # temporarily block signal in order not to send status that we show # in the combobox self.combobox_callback_active = False - self.status_combobox.set_active(table[show]) + if helpers.statuses_unified(): + self.status_combobox.set_active(table[show]) + else: + self.status_combobox.set_active(-1) self._change_awn_icon_status(show) self.combobox_callback_active = True if gajim.interface.systray_enabled: diff --git a/src/systray.py b/src/systray.py index fb3dd408b..e80d9fb9c 100644 --- a/src/systray.py +++ b/src/systray.py @@ -330,21 +330,10 @@ class Systray: current = gajim.interface.roster.status_combobox.get_active() if index != current: gajim.interface.roster.status_combobox.set_active(index) - else: + elif not helpers.statuses_unified(): # We maybe need to emit the changed signal if all globaly sync'ed # account don't have the global status - need_to_change = False - accounts = gajim.connections.keys() - for acct in accounts: - if not gajim.config.get_per('accounts', acct, - 'sync_with_global_status'): - continue - acct_show = gajim.SHOW_LIST[gajim.connections[acct].connected] - if acct_show != show: - need_to_change = True - break - if need_to_change: - gajim.interface.roster.status_combobox.emit('changed') + gajim.interface.roster.status_combobox.emit('changed') def on_change_status_message_activate(self, widget): model = gajim.interface.roster.status_combobox.get_model()