gui: Escape text before setting labels

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-01-25 13:35:09 -05:00 committed by Anna Schumaker
parent 00706cc33f
commit 1b8c55b0fc
1 changed files with 11 additions and 3 deletions

View File

@ -60,6 +60,13 @@ static bool on_seek(Gtk::ScrollType type, double value)
return true;
}
static void set_label_text(Gtk::Label *label, const std::string &size,
const std::string &text)
{
label->set_markup("<span size='" + size + "'>" +
Glib::Markup::escape_text(text) + "</span>");
}
static void on_track_loaded(library :: Song &song)
{
Gtk::Label *title, *artist, *album, *duration;
@ -68,9 +75,9 @@ static void on_track_loaded(library :: Song &song)
builder->get_widget("o_album", album);
builder->get_widget("o_total_time", duration);
title->set_markup("<span size='xx-large'>" + song.track->title + "</span>");
artist->set_markup("<span size='x-large'>By: " + song.artist->primary_key + "</span>");
album->set_markup("<span size='x-large'>From: " + song.album->name + "</span>");
set_label_text(title, "xx-large", song.track->title);
set_label_text(artist, "x-large", song.artist->primary_key);
set_label_text(album, "x-large", song.album->name);
duration->set_text(song.track->length_str);
}
@ -88,6 +95,7 @@ static void on_pause_count_changed(bool enabled, unsigned int count)
}
/*
* Collection manager functions
*/