Use icons from IconTheme for ChatControl Banner

It will correctly scale on HiDPI Displays if we set it like that
This commit is contained in:
Philipp Hörist 2017-10-20 19:57:10 +02:00 committed by Philipp Hörist
parent adb326a5f2
commit dd12584fe6
2 changed files with 5 additions and 37 deletions

View File

@ -630,30 +630,9 @@ class ChatControl(ChatControlBase):
jid = contact.jid
# Set banner image
img_32 = app.interface.roster.get_appropriate_state_images(jid,
size='32', icon_name=show)
img_16 = app.interface.roster.get_appropriate_state_images(jid,
icon_name=show)
if show in img_32 and img_32[show].get_pixbuf():
# we have 32x32! use it!
banner_image = img_32[show]
use_size_32 = True
else:
banner_image = img_16[show]
use_size_32 = False
icon = gtkgui_helpers.get_iconset_name_for(show)
banner_status_img = self.xml.get_object('banner_status_image')
if banner_image.get_storage_type() == Gtk.ImageType.ANIMATION:
banner_status_img.set_from_animation(banner_image.get_animation())
else:
pix = banner_image.get_pixbuf()
if pix is not None:
if use_size_32:
banner_status_img.set_from_pixbuf(pix)
else: # we need to scale 16x16 to 32x32
scaled_pix = pix.scale_simple(32, 32,
GdkPixbuf.InterpType.BILINEAR)
banner_status_img.set_from_pixbuf(scaled_pix)
banner_status_img.set_from_icon_name(icon, Gtk.IconSize.DND)
def draw_banner_text(self):
"""

View File

@ -1048,23 +1048,12 @@ class GroupchatControl(ChatControlBase):
def _update_banner_state_image(self):
banner_status_img = self.xml.get_object('gc_banner_status_image')
images = app.interface.jabber_state_images
if self.room_jid in app.gc_connected[self.account] and \
app.gc_connected[self.account][self.room_jid]:
image = 'muc_active'
icon = gtkgui_helpers.get_iconset_name_for('muc-active')
else:
image = 'muc_inactive'
if '32' in images and image in images['32']:
muc_icon = images['32'][image]
if muc_icon.get_storage_type() != Gtk.ImageType.EMPTY:
pix = muc_icon.get_pixbuf()
banner_status_img.set_from_pixbuf(pix)
return
# we need to scale 16x16 to 32x32
muc_icon = images['16'][image]
pix = muc_icon.get_pixbuf()
scaled_pix = pix.scale_simple(32, 32, GdkPixbuf.InterpType.BILINEAR)
banner_status_img.set_from_pixbuf(scaled_pix)
icon = gtkgui_helpers.get_iconset_name_for('muc-inactive')
banner_status_img.set_from_icon_name(icon, Gtk.IconSize.DND)
def get_continued_conversation_name(self):
"""