Show user tune in conversation window.
This commit is contained in:
parent
c3079e5ac5
commit
b9ea534850
3 changed files with 36 additions and 4 deletions
|
@ -71,12 +71,14 @@
|
||||||
<widget class="GtkImage" id="mood_image">
|
<widget class="GtkImage" id="mood_image">
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="activity_image">
|
<widget class="GtkImage" id="activity_image">
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
@ -85,7 +87,8 @@
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="tune_image">
|
<widget class="GtkImage" id="tune_image">
|
||||||
<property name="no_show_all">True</property>
|
<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>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
|
|
|
@ -1090,6 +1090,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._tune_image = self.xml.get_widget('tune_image')
|
self._tune_image = self.xml.get_widget('tune_image')
|
||||||
|
|
||||||
self.update_mood()
|
self.update_mood()
|
||||||
|
self.update_tune()
|
||||||
|
|
||||||
# keep timeout id and window obj for possible big avatar
|
# keep timeout id and window obj for possible big avatar
|
||||||
# it is on enter-notify and leave-notify so no need to be
|
# it is on enter-notify and leave-notify so no need to be
|
||||||
|
@ -1225,6 +1226,34 @@ class ChatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
self._mood_image.hide()
|
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):
|
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
||||||
'''
|
'''
|
||||||
we enter the eventbox area so we under conditions add a timeout
|
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)
|
source = gobject.markup_escape_text(source)
|
||||||
else:
|
else:
|
||||||
source = _('Unknown Source')
|
source = _('Unknown Source')
|
||||||
tune_string = _('Tune:') + ' ' + _('<b>"%(title)s"' +
|
tune_string = _('Tune:') + ' ' + \
|
||||||
'</b> by <i>%(artist)s</i>\nfrom ' +
|
_('<b>"%(title)s</b> by <i>%(artist)s</i>\n' +
|
||||||
'<i>%(source)s</i>') % {'title': title,
|
'from <i>%(source)s</i>') % {'title': title,
|
||||||
'artist': artist, 'source': source}
|
'artist': artist, 'source': source}
|
||||||
properties.append((tune_string, None))
|
properties.append((tune_string, None))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue