Show user tune in conversation window.
This commit is contained in:
parent
c3079e5ac5
commit
b9ea534850
|
@ -71,12 +71,14 @@
|
|||
<widget class="GtkImage" id="mood_image">
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon_size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImage" id="activity_image">
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon_size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
@ -85,7 +87,8 @@
|
|||
<child>
|
||||
<widget class="GtkImage" id="tune_image">
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="pixbuf">music.png</property>
|
||||
<property name="icon_size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
|
|
@ -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(_(
|
||||
'<b>"%(title)s"</b> by <i>%(artist)s</i>\n' +
|
||||
'from <i>%(source)s</i>') % {'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
|
||||
|
|
|
@ -612,9 +612,9 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
source = gobject.markup_escape_text(source)
|
||||
else:
|
||||
source = _('Unknown Source')
|
||||
tune_string = _('Tune:') + ' ' + _('<b>"%(title)s"' +
|
||||
'</b> by <i>%(artist)s</i>\nfrom ' +
|
||||
'<i>%(source)s</i>') % {'title': title,
|
||||
tune_string = _('Tune:') + ' ' + \
|
||||
_('<b>"%(title)s</b> by <i>%(artist)s</i>\n' +
|
||||
'from <i>%(source)s</i>') % {'title': title,
|
||||
'artist': artist, 'source': source}
|
||||
properties.append((tune_string, None))
|
||||
|
||||
|
|
Loading…
Reference in New Issue