Skip to content
Snippets Groups Projects
Commit 564f35d6 authored by nkour's avatar nkour
Browse files

[Sef] Group Chat roster has now tooltips

parent 650bbdca
No related branches found
No related tags found
No related merge requests found
...@@ -270,7 +270,7 @@ def remove_contact(self, room_jid, nick): ...@@ -270,7 +270,7 @@ def remove_contact(self, room_jid, nick):
def escape(self, s): def escape(self, s):
return s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;') return s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
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() model = self.list_treeview[room_jid].get_model()
image = self.plugin.roster.jabber_state_images[show] image = self.plugin.roster.jabber_state_images[show]
resource = '' resource = ''
...@@ -291,7 +291,7 @@ def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation): ...@@ -291,7 +291,7 @@ def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation):
iter = model.append(role_iter, (image, nick, self.escape(nick))) iter = model.append(role_iter, (image, nick, self.escape(nick)))
gajim.gc_contacts[self.account][room_jid][nick] = \ gajim.gc_contacts[self.account][room_jid][nick] = \
Contact(jid = j, name = nick, show = show, resource = resource, 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 if nick == self.nicks[room_jid]: # we became online
self.got_connected(room_jid) self.got_connected(room_jid)
self.list_treeview[room_jid].expand_row((model.get_path(role_iter)), self.list_treeview[room_jid].expand_row((model.get_path(role_iter)),
...@@ -363,13 +363,13 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation, ...@@ -363,13 +363,13 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation,
iter = self.get_contact_iter(room_jid, nick) iter = self.get_contact_iter(room_jid, nick)
if not iter: if not iter:
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid, iter = self.add_contact_to_roster(room_jid, nick, show, role, jid,
affiliation) affiliation, status)
else: else:
actual_role = self.get_role(room_jid, nick) actual_role = self.get_role(room_jid, nick)
if role != actual_role: if role != actual_role:
self.remove_contact(room_jid, nick) self.remove_contact(room_jid, nick)
self.add_contact_to_roster(room_jid, nick, show, role, jid, self.add_contact_to_roster(room_jid, nick, show, role, jid,
affiliation) affiliation, status)
else: else:
c = gajim.gc_contacts[self.account][room_jid][nick] c = gajim.gc_contacts[self.account][room_jid][nick]
if c.show == show and c.status == status and \ if c.show == show and c.status == status and \
...@@ -377,6 +377,7 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation, ...@@ -377,6 +377,7 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation,
return return
c.show = show c.show = show
c.affiliation = affiliation c.affiliation = affiliation
c.status = status
roster = self.plugin.roster roster = self.plugin.roster
state_images = roster.get_appropriate_state_images(jid) state_images = roster.get_appropriate_state_images(jid)
image = state_images[show] image = state_images[show]
...@@ -391,6 +392,7 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation, ...@@ -391,6 +392,7 @@ def chg_contact_status(self, room_jid, nick, show, status, role, affiliation,
st += ' (' + status + ')' st += ' (' + status + ')'
self.print_conversation(st, room_jid) self.print_conversation(st, room_jid)
def set_subject(self, room_jid, subject): def set_subject(self, room_jid, subject):
self.subjects[room_jid] = subject self.subjects[room_jid] = subject
...@@ -1070,7 +1072,6 @@ def new_room(self, room_jid, nick): ...@@ -1070,7 +1072,6 @@ def new_room(self, room_jid, nick):
self.got_disconnected(room_jid) #init some variables self.got_disconnected(room_jid) #init some variables
conversation_textview.grab_focus() conversation_textview.grab_focus()
self.childs[room_jid].show_all() self.childs[room_jid].show_all()
def on_list_treeview_motion_notify_event(self, widget, event): def on_list_treeview_motion_notify_event(self, widget, event):
model = widget.get_model() model = widget.get_model()
props = widget.get_path_at_pos(int(event.x), int(event.y)) props = widget.get_path_at_pos(int(event.x), int(event.y))
......
...@@ -248,10 +248,12 @@ class GCTooltip(BaseTooltip, StatusTable): ...@@ -248,10 +248,12 @@ class GCTooltip(BaseTooltip, StatusTable):
def __init__(self, plugin): def __init__(self, plugin):
self.account = None self.account = None
self.plugin = plugin self.plugin = plugin
self.text_lable = gtk.Label() self.text_lable = gtk.Label()
self.text_lable.set_line_wrap(True) self.text_lable.set_line_wrap(True)
self.text_lable.set_alignment(0., 0.) self.text_lable.set_alignment(0., 0.)
self.text_lable.set_selectable(False) self.text_lable.set_selectable(False)
BaseTooltip.__init__(self) BaseTooltip.__init__(self)
def populate(self, contact): def populate(self, contact):
...@@ -259,7 +261,12 @@ def populate(self, contact): ...@@ -259,7 +261,12 @@ def populate(self, contact):
return return
self.create_window() self.create_window()
hbox = gtk.HBox() 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>' + \ info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \
helpers.get_uf_role(contact.role) helpers.get_uf_role(contact.role)
...@@ -274,12 +281,20 @@ def populate(self, contact): ...@@ -274,12 +281,20 @@ def populate(self, contact):
if status != '': if status != '':
# escape markup entities # escape markup entities
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status) 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) self.text_lable.set_markup(info)
hbox.add(self.text_lable) hbox.add(self.text_lable)
self.win.add(hbox) self.win.add(hbox)
class RosterTooltip(BaseTooltip, StatusTable): class RosterTooltip(BaseTooltip, StatusTable):
''' Tooltip that is shown in the roster treeview ''' ''' Tooltip that is shown in the roster treeview '''
def __init__(self, plugin): def __init__(self, plugin):
...@@ -455,4 +470,4 @@ def populate(self, file_props): ...@@ -455,4 +470,4 @@ def populate(self, file_props):
text += status text += status
self.text_lable.set_markup(text) self.text_lable.set_markup(text)
self.hbox.add(self.text_lable) self.hbox.add(self.text_lable)
self.win.add(self.hbox)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment