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:
parent
adb326a5f2
commit
dd12584fe6
2 changed files with 5 additions and 37 deletions
|
@ -630,30 +630,9 @@ class ChatControl(ChatControlBase):
|
||||||
jid = contact.jid
|
jid = contact.jid
|
||||||
|
|
||||||
# Set banner image
|
# Set banner image
|
||||||
img_32 = app.interface.roster.get_appropriate_state_images(jid,
|
icon = gtkgui_helpers.get_iconset_name_for(show)
|
||||||
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
|
|
||||||
|
|
||||||
banner_status_img = self.xml.get_object('banner_status_image')
|
banner_status_img = self.xml.get_object('banner_status_image')
|
||||||
if banner_image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
banner_status_img.set_from_icon_name(icon, Gtk.IconSize.DND)
|
||||||
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)
|
|
||||||
|
|
||||||
def draw_banner_text(self):
|
def draw_banner_text(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1048,23 +1048,12 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
def _update_banner_state_image(self):
|
def _update_banner_state_image(self):
|
||||||
banner_status_img = self.xml.get_object('gc_banner_status_image')
|
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 \
|
if self.room_jid in app.gc_connected[self.account] and \
|
||||||
app.gc_connected[self.account][self.room_jid]:
|
app.gc_connected[self.account][self.room_jid]:
|
||||||
image = 'muc_active'
|
icon = gtkgui_helpers.get_iconset_name_for('muc-active')
|
||||||
else:
|
else:
|
||||||
image = 'muc_inactive'
|
icon = gtkgui_helpers.get_iconset_name_for('muc-inactive')
|
||||||
if '32' in images and image in images['32']:
|
banner_status_img.set_from_icon_name(icon, Gtk.IconSize.DND)
|
||||||
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)
|
|
||||||
|
|
||||||
def get_continued_conversation_name(self):
|
def get_continued_conversation_name(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue