Fix displaying PEP icons

- Rename get_pep_as_pixbuf to get_pep_icon
This commit is contained in:
Philipp Hörist 2018-11-02 22:51:07 +01:00
parent 61a791d67c
commit bf9e01ee31
3 changed files with 11 additions and 7 deletions

View File

@ -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:

View File

@ -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'

View File

@ -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