[Sef] Group Chat roster has now tooltips
This commit is contained in:
parent
650bbdca39
commit
564f35d61c
|
@ -270,7 +270,7 @@ class GroupchatWindow(chat.Chat):
|
|||
def escape(self, s):
|
||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
|
||||
def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation):
|
||||
def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation, status):
|
||||
model = self.list_treeview[room_jid].get_model()
|
||||
image = self.plugin.roster.jabber_state_images[show]
|
||||
resource = ''
|
||||
|
@ -291,7 +291,7 @@ class GroupchatWindow(chat.Chat):
|
|||
iter = model.append(role_iter, (image, nick, self.escape(nick)))
|
||||
gajim.gc_contacts[self.account][room_jid][nick] = \
|
||||
Contact(jid = j, name = nick, show = show, resource = resource,
|
||||
role = role, affiliation = affiliation)
|
||||
role = role, affiliation = affiliation, status = status)
|
||||
if nick == self.nicks[room_jid]: # we became online
|
||||
self.got_connected(room_jid)
|
||||
self.list_treeview[room_jid].expand_row((model.get_path(role_iter)),
|
||||
|
@ -363,13 +363,13 @@ class GroupchatWindow(chat.Chat):
|
|||
iter = self.get_contact_iter(room_jid, nick)
|
||||
if not iter:
|
||||
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
||||
affiliation)
|
||||
affiliation, status)
|
||||
else:
|
||||
actual_role = self.get_role(room_jid, nick)
|
||||
if role != actual_role:
|
||||
self.remove_contact(room_jid, nick)
|
||||
self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
||||
affiliation)
|
||||
affiliation, status)
|
||||
else:
|
||||
c = gajim.gc_contacts[self.account][room_jid][nick]
|
||||
if c.show == show and c.status == status and \
|
||||
|
@ -377,6 +377,7 @@ class GroupchatWindow(chat.Chat):
|
|||
return
|
||||
c.show = show
|
||||
c.affiliation = affiliation
|
||||
c.status = status
|
||||
roster = self.plugin.roster
|
||||
state_images = roster.get_appropriate_state_images(jid)
|
||||
image = state_images[show]
|
||||
|
@ -391,6 +392,7 @@ class GroupchatWindow(chat.Chat):
|
|||
st += ' (' + status + ')'
|
||||
self.print_conversation(st, room_jid)
|
||||
|
||||
|
||||
|
||||
def set_subject(self, room_jid, subject):
|
||||
self.subjects[room_jid] = subject
|
||||
|
@ -1070,7 +1072,6 @@ class GroupchatWindow(chat.Chat):
|
|||
self.got_disconnected(room_jid) #init some variables
|
||||
conversation_textview.grab_focus()
|
||||
self.childs[room_jid].show_all()
|
||||
|
||||
def on_list_treeview_motion_notify_event(self, widget, event):
|
||||
model = widget.get_model()
|
||||
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||
|
|
|
@ -248,10 +248,12 @@ class GCTooltip(BaseTooltip, StatusTable):
|
|||
def __init__(self, plugin):
|
||||
self.account = None
|
||||
self.plugin = plugin
|
||||
|
||||
self.text_lable = gtk.Label()
|
||||
self.text_lable.set_line_wrap(True)
|
||||
self.text_lable.set_alignment(0., 0.)
|
||||
self.text_lable.set_selectable(False)
|
||||
|
||||
BaseTooltip.__init__(self)
|
||||
|
||||
def populate(self, contact):
|
||||
|
@ -259,7 +261,12 @@ class GCTooltip(BaseTooltip, StatusTable):
|
|||
return
|
||||
self.create_window()
|
||||
hbox = gtk.HBox()
|
||||
info = '<span size="large" weight="bold">' + contact.name + '</span>'
|
||||
|
||||
if contact.jid.strip() != '':
|
||||
info = '<span size="large" weight="bold">' + contact.jid + '</span>'
|
||||
else:
|
||||
info = '<span size="large" weight="bold">' + contact.name + '</span>'
|
||||
|
||||
info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \
|
||||
helpers.get_uf_role(contact.role)
|
||||
|
||||
|
@ -274,12 +281,20 @@ class GCTooltip(BaseTooltip, StatusTable):
|
|||
if status != '':
|
||||
# escape markup entities
|
||||
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
|
||||
|
||||
if contact.resource.strip() != '':
|
||||
info += '\n<span weight="bold">' + _('Resource: ') + \
|
||||
'</span>' + gtkgui_helpers.escape_for_pango_markup(
|
||||
contact.resource)
|
||||
|
||||
|
||||
|
||||
self.text_lable.set_markup(info)
|
||||
hbox.add(self.text_lable)
|
||||
self.win.add(hbox)
|
||||
|
||||
|
||||
|
||||
class RosterTooltip(BaseTooltip, StatusTable):
|
||||
''' Tooltip that is shown in the roster treeview '''
|
||||
def __init__(self, plugin):
|
||||
|
@ -455,4 +470,4 @@ class FileTransfersTooltip(BaseTooltip):
|
|||
text += status
|
||||
self.text_lable.set_markup(text)
|
||||
self.hbox.add(self.text_lable)
|
||||
self.win.add(self.hbox)
|
||||
|
||||
|
|
Loading…
Reference in New Issue