From 90b2d8fa8d5fe3ed29a363a223cd6dd15c4a3917 Mon Sep 17 00:00:00 2001 From: js Date: Fri, 24 Oct 2008 17:00:39 +0000 Subject: [PATCH] Fix #4140. --- src/chat_control.py | 11 +++++++---- src/roster_window.py | 28 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 93489437a..77ceca0ff 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1239,12 +1239,15 @@ class ChatControl(ChatControlBase): if activity is not None: if activity in ACTIVITIES: - self._activity_image.set_from_pixbuf( - gtkgui_helpers.load_activity_icon(activity).get_pixbuf()) # Translate standard activities if subactivity in ACTIVITIES[activity]: - subactivity = ACTIVITIES[activity] \ - [subactivity] + self._activity_image.set_from_pixbuf( + gtkgui_helpers.load_activity_icon(activity, subactivity). \ + get_pixbuf()) + subactivity = ACTIVITIES[activity][subactivity] + else: + self._activity_image.set_from_pixbuf( + gtkgui_helpers.load_activity_icon(activity).get_pixbuf()) activity = ACTIVITIES[activity]['category'] else: self._activity_image.set_from_pixbuf( diff --git a/src/roster_window.py b/src/roster_window.py index d84cd04ad..81fb8ff6a 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -996,10 +996,19 @@ class RosterWindow: and 'activity' in gajim.connections[account].activity \ and gajim.connections[account].activity['activity'].strip() \ in ACTIVITIES: - self.model[child_iter][C_ACTIVITY_PIXBUF] = \ - gtkgui_helpers.load_activity_icon( - gajim.connections[account]. \ - activity['activity'].strip()).get_pixbuf() + if 'subactivity' in gajim.connections[account].activity \ + and gajim.connections[account].activity['subactivity'].strip() \ + in ACTIVITIES[gajim.connections[account].activity['activity'].strip()]: + self.model[child_iter][C_ACTIVITY_PIXBUF] = \ + gtkgui_helpers.load_activity_icon( + gajim.connections[account].activity['activity'].strip(), + gajim.connections[account].activity['subactivity'].strip()). \ + get_pixbuf() + else: + self.model[child_iter][C_ACTIVITY_PIXBUF] = \ + gtkgui_helpers.load_activity_icon( + gajim.connections[account].activity['activity'].strip()). \ + get_pixbuf() elif gajim.config.get('show_activity_in_roster') \ and 'activity' in gajim.connections[account].activity: self.model[child_iter][C_ACTIVITY_PIXBUF] = \ @@ -1247,8 +1256,15 @@ class RosterWindow: contact = gajim.contacts.get_contact(account, jid) if 'activity' in contact.activity \ and contact.activity['activity'].strip() in ACTIVITIES: - pixbuf = gtkgui_helpers.load_activity_icon( - contact.activity['activity'].strip()).get_pixbuf() + if 'subactivity' in contact.activity \ + and contact.activity['subactivity'].strip() in \ + ACTIVITIES[contact.activity['activity'].strip()]: + pixbuf = gtkgui_helpers.load_activity_icon( + contact.activity['activity'].strip(), + contact.activity['subactivity'].strip()).get_pixbuf() + else: + pixbuf = gtkgui_helpers.load_activity_icon( + contact.activity['activity'].strip()).get_pixbuf() elif 'activity' in contact.activity: pixbuf = gtkgui_helpers.load_activity_icon( 'unknown').get_pixbuf()