[shivan] show nothing in status combobox when status is not unified for all globaly sync'ed accounts. see #3489

This commit is contained in:
Yann Leboulanger 2007-10-14 19:08:29 +00:00
parent f2e5d85b9d
commit 025ef4f3eb
3 changed files with 19 additions and 14 deletions

View File

@ -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):

View File

@ -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:

View File

@ -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()