Commit 619793a0 authored by Philipp Hörist's avatar Philipp Hörist

Groupchat: Use icons from IconTheme

parent acc89ad6
......@@ -1015,24 +1015,22 @@ class ChatControl(ChatControlBase):
['printed_' + self.type_id, self.type_id]))
else:
num_unread = 0
# Set tab image (always 16x16); unread messages show the 'event' image
tab_img = None
transport = None
if app.jid_is_transport(jid):
transport = app.get_transport_name_from_jid(jid)
if num_unread and app.config.get('show_unread_tab_icon'):
img_16 = app.interface.roster.get_appropriate_state_images(
self.contact.jid, icon_name='event')
tab_img = img_16['event']
icon_name = get_icon_name('event', transport=transport)
else:
contact = app.contacts.get_contact_with_highest_priority(
self.account, self.contact.jid)
if not contact or self.resource:
# For transient contacts
contact = self.contact
img_16 = app.interface.roster.get_appropriate_state_images(
self.contact.jid, icon_name=contact.show)
tab_img = img_16[contact.show]
icon_name = get_icon_name(contact.show, transport=transport)
return tab_img
return icon_name
def prepare_context_menu(self, hide_buttonbar_items=False):
"""
......
This diff is collapsed.
......@@ -307,3 +307,19 @@ def get_metacontact_surface(icon_name, expanded, scale):
ctx.set_source_surface(expanded_surface)
ctx.fill()
return state_surface
def get_affiliation_surface(icon_name, affiliation, scale):
surface = _icon_theme.load_surface(
icon_name, 16, scale, None, 0)
ctx = cairo.Context(surface)
ctx.rectangle(16 - 4, 16 - 4, 4, 4)
if affiliation == 'owner':
ctx.set_source_rgb(204/255, 0, 0)
elif affiliation == 'admin':
ctx.set_source_rgb(255/255, 140/255, 0)
elif affiliation == 'member':
ctx.set_source_rgb(0, 255/255, 0)
ctx.fill()
return surface
......@@ -554,21 +554,6 @@ def remove_css_class(widget, class_name):
style = widget.get_style_context()
style.remove_class(class_name)
def draw_affiliation(surface, affiliation):
icon_size = 16
size = 4 * 1
if affiliation not in ('owner', 'admin', 'member'):
return
ctx = cairo.Context(surface)
ctx.rectangle(icon_size-size, icon_size-size, size, size)
if affiliation == 'owner':
ctx.set_source_rgb(204/255, 0, 0)
elif affiliation == 'admin':
ctx.set_source_rgb(255/255, 140/255, 0)
elif affiliation == 'member':
ctx.set_source_rgb(0, 255/255, 0)
ctx.fill()
def pango_to_css_weight(number):
# Pango allows for weight values between 100 and 1000
# CSS allows only full hundred numbers like 100, 200 ..
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment