Archive / / / / / Echo.UI.Widgets.TrackInfoToolItem.vala
2008-11-28 09:48:17 UTC
previous next
/* vim: set noexpandtab tabstop=4 shiftwidth=4 nowrap textwidth=100 * * Echo Media Player * Copyright (C) 2008 Shane O'Connell * * [ The original file includes a copyright header in this location describing * the file as being released under the terms of the GNU General Public * License. It has been removed in order to display the file as part of the * archive. ] */ using Echo.Core; using Echo.Interfaces; public class Echo.UI.Widgets.TrackInfoToolItem : Gtk.ToolItem { private Gtk.HBox _hbox; private Gtk.Label _label; construct { _hbox = new Gtk.HBox(false, 0); _label = new Gtk.Label(null); _label.set_markup("<b>Not playing</b>\nStopped"); var label_align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 0.0f); label_align.set_padding(1, 1, 10, 5); label_align.add(_label); _hbox.pack_start(label_align, true, true, 0); this.add(_hbox); Services.playback().track_changed += (playback_service) => { if (Services.playback().current_track == null) _label.set_markup("<b>Not playing</b>\nStopped"); else { ITrack track = Services.playback().current_track; _label.set_markup(GLib.Markup.printf_escaped("<b>%s</b>\n" + "<span weight='light' size='smaller'>by </span>%s " + "<span weight='light' size='smaller'>from </span>%s", track.title, track.artist, track.album)); } }; } }