Philipp Hörist pushed to branch master at gajim / gajim

Commits:
bf9e01ee by Philipp Hörist at 2018-11-02T21:51:57Z
Fix displaying PEP icons

- Rename get_pep_as_pixbuf to get_pep_icon

- - - - -


3 changed files:

- gajim/chat_control.py
- gajim/gtkgui_helpers.py
- gajim/roster_window.py


Changes:

=====================================
gajim/chat_control.py
=====================================
@@ -416,7 +416,11 @@ class ChatControl(ChatControlBase):
         pep = self.contact.pep
         img = self._pep_images[pep_type]
         if pep_type in pep:
-            
img.set_from_pixbuf(gtkgui_helpers.get_pep_as_pixbuf(pep[pep_type]))
+            icon = gtkgui_helpers.get_pep_icon(pep[pep_type])
+            if isinstance(icon, str):
+                img.set_from_icon_name(icon, Gtk.IconSize.MENU)
+            else:
+                img.set_from_pixbuf(icon)
             img.set_tooltip_markup(pep[pep_type].as_markup_text())
             img.show()
         else:


=====================================
gajim/gtkgui_helpers.py
=====================================
@@ -383,7 +383,7 @@ def load_activity_icon(category, activity=None):
     icon_list = _load_icon_list([activity], path)
     return icon_list[activity]
 
-def get_pep_as_pixbuf(pep_class):
+def get_pep_icon(pep_class):
     if pep_class == PEPEventType.MOOD:
         received_mood = pep_class.data['mood']
         mood = received_mood if received_mood in MOODS else 'unknown'


=====================================
gajim/roster_window.py
=====================================
@@ -1088,27 +1088,27 @@ class RosterWindow:
         pep_dict = app.connections[account].pep
         if app.config.get('show_mood_in_roster') and 'mood' in pep_dict:
             self.model[child_iter][Column.MOOD_PIXBUF] = \
-                gtkgui_helpers.get_pep_as_pixbuf(pep_dict['mood'])
+                gtkgui_helpers.get_pep_icon(pep_dict['mood'])
         else:
             self.model[child_iter][Column.MOOD_PIXBUF] = None
 
         if app.config.get('show_activity_in_roster') and 'activity' in \
         pep_dict:
             self.model[child_iter][Column.ACTIVITY_PIXBUF] = \
-                gtkgui_helpers.get_pep_as_pixbuf(pep_dict['activity'])
+                gtkgui_helpers.get_pep_icon(pep_dict['activity'])
         else:
             self.model[child_iter][Column.ACTIVITY_PIXBUF] = None
 
         if app.config.get('show_tunes_in_roster') and 'tune' in pep_dict:
             self.model[child_iter][Column.TUNE_ICON] = \
-                gtkgui_helpers.get_pep_as_pixbuf(pep_dict['tune'])
+                gtkgui_helpers.get_pep_icon(pep_dict['tune'])
         else:
             self.model[child_iter][Column.TUNE_ICON] = None
 
         if app.config.get('show_location_in_roster') and 'geoloc' in \
         pep_dict:
             self.model[child_iter][Column.LOCATION_ICON] = \
-                gtkgui_helpers.get_pep_as_pixbuf(pep_dict['geoloc'])
+                gtkgui_helpers.get_pep_icon(pep_dict['geoloc'])
         else:
             self.model[child_iter][Column.LOCATION_ICON] = None
 
@@ -1392,7 +1392,7 @@ class RosterWindow:
 
         pixbuf = None
         if pep_type in contact.pep:
-            pixbuf = gtkgui_helpers.get_pep_as_pixbuf(contact.pep[pep_type])
+            pixbuf = gtkgui_helpers.get_pep_icon(contact.pep[pep_type])
 
         for child_iter in iters:
             self.model[child_iter][model_column] = pixbuf



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/bf9e01ee31a231118c9c73d9f3e0d9dd1a2ba2c5

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/bf9e01ee31a231118c9c73d9f3e0d9dd1a2ba2c5
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to