Changeset 6347

Show
Ignore:
Timestamp:
05/21/06 21:35:33 (3 years ago)
Author:
jim++
Message:

when clicking on a contact in roster : remove duplicate code, also open awaiting events when middle clicking
instead of always open chat

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/roster_window.py

    r6328 r6347  
    17161716                # hide tooltip, no matter the button is pressed 
    17171717                self.tooltip.hide_tooltip() 
     1718                try: 
     1719                        path, column, x, y = self.tree.get_path_at_pos(int(event.x), 
     1720                                int(event.y)) 
     1721                except TypeError: 
     1722                        self.tree.get_selection().unselect_all() 
     1723                        return False 
     1724 
    17181725                if event.button == 3: # Right click 
    1719                         try: 
    1720                                 path, column, x, y = self.tree.get_path_at_pos(int(event.x), 
    1721                                         int(event.y)) 
    1722                         except TypeError: 
    1723                                 self.tree.get_selection().unselect_all() 
    1724                                 return 
    17251726                        self.tree.get_selection().select_path(path) 
    17261727                        model = self.tree.get_model() 
     
    17301731 
    17311732                elif event.button == 2: # Middle click 
    1732                         try: 
    1733                                 path, column, x, y = self.tree.get_path_at_pos(int(event.x), 
    1734                                         int(event.y)) 
    1735                         except TypeError: 
    1736                                 self.tree.get_selection().unselect_all() 
    1737                                 return 
    17381733                        self.tree.get_selection().select_path(path) 
    17391734                        model = self.tree.get_model() 
     
    17411736                        type = model[iter][C_TYPE] 
    17421737                        if type in ('agent', 'contact'): 
    1743                                 account = model[iter][C_ACCOUNT].decode('utf-8') 
    1744                                 jid = model[iter][C_JID].decode('utf-8') 
    1745                                 win = None 
    1746                                 c = gajim.contacts.get_contact_with_highest_priority(account, jid) 
    1747                                 if gajim.interface.msg_win_mgr.has_window(c.jid, account): 
    1748                                         win = gajim.interface.msg_win_mgr.get_window(c.jid, account) 
    1749                                 elif c: 
    1750                                         self.new_chat(c, account) 
    1751                                         win = gajim.interface.msg_win_mgr.get_window(jid, account) 
    1752                                 win.set_active_tab(jid, account) 
    1753                                 win.window.present() 
     1738                                self.on_roster_treeview_row_activated(widget, path) 
    17541739                        elif type == 'account': 
    17551740                                account = model[iter][C_ACCOUNT].decode('utf-8') 
     
    17751760 
    17761761                elif event.button == 1: # Left click 
    1777                         try: 
    1778                                 path, column, x, y = self.tree.get_path_at_pos(int(event.x), 
    1779                                         int(event.y)) 
    1780                         except TypeError: 
    1781                                 self.tree.get_selection().unselect_all() 
    1782                                 return False 
    17831762                        model = self.tree.get_model() 
    17841763                        iter = model.get_iter(path)