Author: asterix Date: 2007-10-14 21:08:29 +0200 (Sun, 14 Oct 2007) New Revision: 8908
Modified: trunk/src/common/helpers.py trunk/src/roster_window.py trunk/src/systray.py Log: [shivan] show nothing in status combobox when status is not unified for all globaly sync'ed accounts. see #3489
Modified: trunk/src/common/helpers.py =================================================================== --- trunk/src/common/helpers.py 2007-10-14 18:14:20 UTC (rev 8907) +++ trunk/src/common/helpers.py 2007-10-14 19:08:29 UTC (rev 8908) @@ -544,6 +544,19 @@ 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):
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2007-10-14 18:14:20 UTC (rev 8907) +++ trunk/src/roster_window.py 2007-10-14 19:08:29 UTC (rev 8908) @@ -3729,7 +3729,10 @@ # 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:
Modified: trunk/src/systray.py =================================================================== --- trunk/src/systray.py 2007-10-14 18:14:20 UTC (rev 8907) +++ trunk/src/systray.py 2007-10-14 19:08:29 UTC (rev 8908) @@ -330,21 +330,10 @@ 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()