Open private messages in minimized rooms by middle-clicking on systray icon.

This commit is contained in:
Julien Pivotto 2007-06-07 11:58:56 +00:00
parent 7276ca50cf
commit 2f6c9f0d19
2 changed files with 18 additions and 8 deletions

View File

@ -825,11 +825,15 @@ class ChatControlBase(MessageControl):
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid) room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
groupchat_control = gajim.interface.msg_win_mgr.get_control( groupchat_control = gajim.interface.msg_win_mgr.get_control(
room_jid, self.account) room_jid, self.account)
if not groupchat_control and \ if gajim.interface.minimized_controls.has_key(self.account) and \
gajim.interface.minimized_controls.has_key(self.account) and \
room_jid in gajim.interface.minimized_controls[self.account]: room_jid in gajim.interface.minimized_controls[self.account]:
groupchat_control = \ groupchat_control = \
gajim.interface.minimized_controls[self.account][room_jid] gajim.interface.minimized_controls[self.account][room_jid]
contact = \
gajim.contacts.get_contact_with_highest_priority(self.account, \
room_jid)
if contact:
gajim.interface.roster.draw_contact(room_jid, self.account)
groupchat_control.draw_contact(nick) groupchat_control.draw_contact(nick)
mw = gajim.interface.msg_win_mgr.get_window(room_jid, self.account) mw = gajim.interface.msg_win_mgr.get_window(room_jid, self.account)
if mw: if mw:

View File

@ -97,12 +97,15 @@ def tree_cell_data_func(column, renderer, model, iter, tv=None):
class PrivateChatControl(ChatControl): class PrivateChatControl(ChatControl):
TYPE_ID = message_control.TYPE_PM TYPE_ID = message_control.TYPE_PM
def __init__(self, parent_win, gc_contact, contact, acct): def __init__(self, parent_win, gc_contact, contact, account):
room_jid = contact.jid.split('/')[0] room_jid = contact.jid.split('/')[0]
room_ctrl = gajim.interface.msg_win_mgr.get_control(room_jid, acct) room_ctrl = gajim.interface.msg_win_mgr.get_control(room_jid, account)
if gajim.interface.minimized_controls.has_key(account) and \
gajim.interface.minimized_controls[account].has_key(room_jid):
room_ctrl = gajim.interface.minimized_controls[account][room_jid]
self.room_name = room_ctrl.name self.room_name = room_ctrl.name
self.gc_contact = gc_contact self.gc_contact = gc_contact
ChatControl.__init__(self, parent_win, contact, acct) ChatControl.__init__(self, parent_win, contact, account)
self.TYPE_ID = 'pm' self.TYPE_ID = 'pm'
def send_message(self, message): def send_message(self, message):
@ -556,6 +559,9 @@ class GroupchatControl(ChatControlBase):
self.list_treeview.expand_row(path[0:1], False) self.list_treeview.expand_row(path[0:1], False)
self.list_treeview.scroll_to_cell(path) self.list_treeview.scroll_to_cell(path)
self.list_treeview.set_cursor(path) self.list_treeview.set_cursor(path)
contact = gajim.contacts.get_contact_with_highest_priority(self.account, \
self.room_jid)
if contact:
gajim.interface.roster.draw_contact(self.room_jid, self.account) gajim.interface.roster.draw_contact(self.room_jid, self.account)
def get_contact_iter(self, nick): def get_contact_iter(self, nick):