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):
@ -127,7 +130,7 @@ class PrivateChatControl(ChatControl):
return return
ChatControl.send_message(self, message) ChatControl.send_message(self, message)
def update_ui(self): def update_ui(self):
if self.contact.show == 'offline': if self.contact.show == 'offline':
self.got_disconnected() self.got_disconnected()
@ -556,7 +559,10 @@ 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)
gajim.interface.roster.draw_contact(self.room_jid, self.account) 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)
def get_contact_iter(self, nick): def get_contact_iter(self, nick):
model = self.list_treeview.get_model() model = self.list_treeview.get_model()
@ -1841,7 +1847,7 @@ class GroupchatControl(ChatControlBase):
else: # We want to send a private message else: # We want to send a private message
nick = model[path][C_NICK].decode('utf-8') nick = model[path][C_NICK].decode('utf-8')
self._start_private_message(nick) self._start_private_message(nick)
def on_list_treeview_row_activated(self, widget, path, col = 0): def on_list_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the chat window''' '''When an iter is double clicked: open the chat window'''
if not gajim.single_click: if not gajim.single_click: