Changeset 9847

Show
Ignore:
Timestamp:
06/27/08 01:37:12 (2 months ago)
Author:
bct
Message:

win.get_controls() isn't needed anymore

Location:
trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gajim.py

    r9846 r9847  
    10351035 
    10361036                # show avatar in chat 
    1037                 ctrls = [] 
    10381037                if resource and self.msg_win_mgr.has_window(fjid, account): 
    10391038                        win = self.msg_win_mgr.get_window(fjid, account) 
    1040                         ctrls = win.get_controls(fjid, account) 
     1039                        ctrl = win.get_control(fjid, account) 
    10411040                elif self.msg_win_mgr.has_window(jid, account): 
    10421041                        win = self.msg_win_mgr.get_window(jid, account) 
    1043                         ctrls = win.get_controls(jid, account) 
    1044  
    1045                 for ctrl in ctrls: 
    1046                         if ctrl.type_id != message_control.TYPE_GC: 
    1047                                 ctrl.show_avatar() 
     1042                        ctrl = win.get_control(jid, account) 
     1043 
     1044                if ctrl and ctrl.type_id != message_control.TYPE_GC: 
     1045                        ctrl.show_avatar() 
    10481046 
    10491047                # Show avatar in roster or gc_roster 
     
    26062604 
    26072605                        if win: 
    2608                                 ctrls = win.get_controls(fjid, account) 
    2609                                 if ctrls: 
    2610                                         ctrl = ctrls[0] 
     2606                                ctrl = win.get_control(fjid, account) 
    26112607 
    26122608                if not ctrl: 
     
    26212617 
    26222618                if gajim.connections[account].is_zeroconf and \ 
    2623                                 gajim.connections[account].status in ('offline', 'invisible'): 
    2624                         for ctrl in win.get_controls(fjid, account): 
     2619                gajim.connections[account].status in ('offline', 'invisible'): 
     2620                        ctrl = win.get_control(fjid, account) 
     2621                        if ctrl: 
    26252622                                ctrl.got_disconnected() 
    26262623 
  • trunk/src/groupchat_control.py

    r9846 r9847  
    20772077                        win = gajim.interface.msg_win_mgr.get_window(nick_jid, self.account) 
    20782078 
    2079                 ctrl = win.get_controls(nick_jid, self.account)[0] 
     2079                ctrl = win.get_control(nick_jid, self.account) 
    20802080 
    20812081                win.set_active_tab(ctrl) 
  • trunk/src/message_window.py

    r9846 r9847  
    586586        def has_control(self, jid, acct): 
    587587                return (acct in self._controls and jid in self._controls[acct]) 
    588  
    589         def get_controls(self, jid, acct): 
    590                 try: 
    591                         return self._controls[acct][jid] 
    592                 except KeyError: 
    593                         return [] 
    594588 
    595589        def change_key(self, old_jid, new_jid, acct): 
  • trunk/src/roster_window.py

    r9846 r9847  
    18131813                        if contact.resource != '': 
    18141814                                name += '/' + contact.resource 
    1815                          
     1815 
    18161816                        # Remove resource when going offline 
    18171817                        if show in ('offline', 'error') and \ 
     
    18221822                                        win = gajim.interface.msg_win_mgr.get_window(jid_with_resource, 
    18231823                                                account) 
    1824                                         for ctrl in win.get_controls(jid_with_resource, account): 
     1824                                        ctrl = win.get_control(jid_with_resource, account) 
     1825                                        if ctrl: 
    18251826                                                ctrl.update_ui() 
    18261827                                                win.redraw_tab(ctrl) 
     
    18371838                        uf_show = helpers.get_uf_show(show) 
    18381839 
    1839                         for ctrl in win.get_controls(contact.jid, account): 
     1840                        ctrl = win.get_control(contact.jid, account) 
     1841                        if ctrl: 
    18401842                                ctrl.contact = gajim.contacts.get_contact_with_highest_priority( 
    18411843                                        account, contact.jid)