Changeset 9556 for branches/session_centric/src/message_window.py
- Timestamp:
- 05/02/08 04:32:28 (7 months ago)
- Files:
-
- 1 modified
-
branches/session_centric/src/message_window.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/session_centric/src/message_window.py
r9548 r9556 397 397 gtkgui_helpers.set_unset_urgency_hint(self.window, False) 398 398 399 def set_active_tab(self, session): 400 ctrl = self._controls[session.conn.name][session.jid][session.thread_id] 399 def set_active_tab(self, ctrl): 401 400 ctrl_page = self.notebook.page_num(ctrl.widget) 402 401 self.notebook.set_current_page(ctrl_page) … … 539 538 ctrl.update_tags() 540 539 541 def get_control(self, key, acct ):540 def get_control(self, key, acct, thread_id): 542 541 '''Return the MessageControl for jid or n, where n is a notebook page index. 543 When key is an int index acct may be None'''542 When key is an int index acct and thread_id may be None''' 544 543 if isinstance(key, str): 545 544 key = unicode(key, 'utf-8') … … 548 547 jid = key 549 548 try: 550 return self._controls[acct][jid] 549 return self._controls[acct][jid][thread_id] 551 550 except: 552 551 return None … … 558 557 nth_child = notebook.get_nth_page(page_num) 559 558 return self._widget_to_control(nth_child) 559 560 def get_gc_control(self, jid, acct): 561 return self.get_control(jid, acct, 'gc') 562 563 def get_controls(self, jid, acct): 564 try: 565 return self._controls[acct][jid].values() 566 except KeyError: 567 return [] 560 568 561 569 def change_key(self, old_jid, new_jid, acct): … … 595 603 if ind < 0: 596 604 ind = self.notebook.get_n_pages() - 1 597 ctrl = self.get_control(ind, None )605 ctrl = self.get_control(ind, None, None) 598 606 if ctrl.get_nb_unread() > 0: 599 607 found = True … … 787 795 def get_window(self, jid, acct): 788 796 for win in self.windows(): 789 if win.get_control(jid, acct): 790 return win 797 try: 798 if win._controls[acct][jid]: 799 return win 800 except KeyError: 801 pass 802 return None 803 804 def get_gc_control(self, jid, acct): 805 win = self.get_window(jid, acct) 806 807 if win: 808 return win.get_gc_control(jid, acct) 809 791 810 return None 792 811 … … 915 934 return 916 935 917 def get_control(self, jid, acct ):936 def get_control(self, jid, acct, session): 918 937 '''Amongst all windows, return the MessageControl for jid''' 919 938 win = self.get_window(jid, acct) 920 939 if win: 921 return win.get_control(jid, acct )940 return win.get_control(jid, acct, session) 922 941 return None 923 942 … … 930 949 ctrls.append(c) 931 950 return ctrls 951 952 def get_chat_controls(self, jid, acct): 953 win = self.get_window(jid, acct) 954 955 if win: 956 return win.get_controls(jid, acct) 957 else: 958 return [] 932 959 933 960 def windows(self):
