From dd12584fe6f9f474c463d35aceffcc0d59e5051f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <forenjunkie@chello.at>
Date: Fri, 20 Oct 2017 19:57:10 +0200
Subject: [PATCH] Use icons from IconTheme for ChatControl Banner

It will correctly scale on HiDPI Displays if we set it like that
---
 gajim/chat_control.py      | 25 ++-----------------------
 gajim/groupchat_control.py | 17 +++--------------
 2 files changed, 5 insertions(+), 37 deletions(-)

diff --git a/gajim/chat_control.py b/gajim/chat_control.py
index 9e001f7ad2..1a7a6e6d7e 100644
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -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):
         """
diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py
index 45b25c9d9a..be07e9f1ef 100644
--- a/gajim/groupchat_control.py
+++ b/gajim/groupchat_control.py
@@ -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):
         """
-- 
GitLab