From 749fcc1b487a9f1a6992198e7e7b1b3a65c4d1b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <forenjunkie@chello.at>
Date: Fri, 27 Oct 2017 20:46:48 +0200
Subject: [PATCH] Set enryption icon correctly

---
 gajim/chat_control_base.py          | 17 ++++++++---------
 gajim/data/gui/chat_control.ui      |  6 +-----
 gajim/data/gui/groupchat_control.ui |  6 +-----
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py
index 9bcc143171..e557c59fdf 100644
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -474,17 +474,16 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
         return state
 
     def set_encryption_menu_icon(self):
-        for child in self.encryption_menu.get_children():
-            if isinstance(child, Gtk.Image):
-                image = child
-                break
-
+        image = self.encryption_menu.get_image()
+        if image is None:
+            image = Gtk.Image()
+            self.encryption_menu.set_image(image)
         if not self.encryption:
-            icon = gtkgui_helpers.get_icon_pixmap(
-                'channel-insecure-symbolic', color=[Color.BLACK])
+            image.set_from_icon_name('channel-insecure-symbolic',
+                                     Gtk.IconSize.MENU)
         else:
-            icon = gtkgui_helpers.get_icon_pixmap('channel-secure-symbolic')
-        image.set_from_pixbuf(icon)
+            image.set_from_icon_name('channel-secure-symbolic',
+                                     Gtk.IconSize.MENU)
 
     def set_speller(self):
         if not app.HAVE_SPELL or not app.config.get('use_speller'):
diff --git a/gajim/data/gui/chat_control.ui b/gajim/data/gui/chat_control.ui
index 613eba6e62..43223d675d 100644
--- a/gajim/data/gui/chat_control.ui
+++ b/gajim/data/gui/chat_control.ui
@@ -801,11 +801,7 @@ audio-mic-volume-low</property>
                     <property name="tooltip_text" translatable="yes">Choose an encryption</property>
                     <property name="relief">none</property>
                     <child>
-                      <object class="GtkImage">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="icon_name">channel-secure-symbolic</property>
-                      </object>
+                      <placeholder/>
                     </child>
                     <style>
                       <class name="chatcontrol-actionbar-button"/>
diff --git a/gajim/data/gui/groupchat_control.ui b/gajim/data/gui/groupchat_control.ui
index eb58e2c200..9e15ec0145 100644
--- a/gajim/data/gui/groupchat_control.ui
+++ b/gajim/data/gui/groupchat_control.ui
@@ -280,11 +280,7 @@
                         <property name="tooltip_text" translatable="yes">Choose an encryption</property>
                         <property name="relief">none</property>
                         <child>
-                          <object class="GtkImage">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="icon_name">channel-secure-symbolic</property>
-                          </object>
+                          <placeholder/>
                         </child>
                         <style>
                           <class name="chatcontrol-actionbar-button"/>
-- 
GitLab