diff --git a/data/glade/message_window.glade b/data/glade/message_window.glade index 641389567..509bf5f63 100644 --- a/data/glade/message_window.glade +++ b/data/glade/message_window.glade @@ -71,12 +71,14 @@ True gtk-missing-image + 1 True gtk-missing-image + 1 1 @@ -85,7 +87,8 @@ True - gtk-missing-image + music.png + 1 2 diff --git a/src/chat_control.py b/src/chat_control.py index 072648a0e..264f9ed76 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1090,6 +1090,7 @@ class ChatControl(ChatControlBase): self._tune_image = self.xml.get_widget('tune_image') self.update_mood() + self.update_tune() # keep timeout id and window obj for possible big avatar # it is on enter-notify and leave-notify so no need to be @@ -1225,6 +1226,34 @@ class ChatControl(ChatControlBase): else: self._mood_image.hide() + def update_tune(self): + artist = None + title = None + source = None + + if self.contact.tune.has_key('artist'): + artist = gobject.markup_escape_text( + self.contact.tune['artist'].strip()) + if self.contact.tune.has_key('title'): + title = gobject.markup_escape_text( + self.contact.tune['title'].strip()) + if self.contact.tune.has_key('source'): + title = gobject.markup_escape_text( + self.contact.tune['source'].strip()) + + if artist or title: + artist = artist if artist else _('Unknown Artist') + title = title if title else _('Unknown Title') + source = source if source else _('Unknown Source') + + self._tune_image.set_tooltip_markup(_( + '"%(title)s" by %(artist)s\n' + + 'from %(source)s') % {'title': title, + 'artist': artist, 'source': source}) + self._tune_image.show() + else: + self._tune_image.hide() + def on_avatar_eventbox_enter_notify_event(self, widget, event): ''' we enter the eventbox area so we under conditions add a timeout diff --git a/src/tooltips.py b/src/tooltips.py index b47612690..14363f3a0 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -612,9 +612,9 @@ class RosterTooltip(NotificationAreaTooltip): source = gobject.markup_escape_text(source) else: source = _('Unknown Source') - tune_string = _('Tune:') + ' ' + _('"%(title)s"' + - ' by %(artist)s\nfrom ' + - '%(source)s') % {'title': title, + tune_string = _('Tune:') + ' ' + \ + _('"%(title)s by %(artist)s\n' + + 'from %(source)s') % {'title': title, 'artist': artist, 'source': source} properties.append((tune_string, None))