diff --git a/gui/gst.cpp b/gui/gst.cpp index 54e8960c..3bb8bd6e 100644 --- a/gui/gst.cpp +++ b/gui/gst.cpp @@ -20,7 +20,11 @@ static Gtk::Button *o_prev; static Gtk::Scale *o_seek; static Gtk::Button *o_stop; -static Gtk::Label *o_position; +static Gtk::Label *o_album; +static Gtk::Label *o_artist; +static Gtk::Label *o_duration; +static Gtk::Label *o_position; +static Gtk::Label *o_title; static Glib::RefPtr o_progress; @@ -36,6 +40,13 @@ static bool gst_change_state(GstState state) } } +static void set_markup(Gtk::Label *label, const std::string &size, + const std::string &text) +{ + label->set_markup("" + + Glib::Markup::escape_text(text) + ""); +} + class GSTDriver : public AudioDriver { @@ -48,6 +59,11 @@ public: g_object_set(G_OBJECT(gst_player), "uri", uri, NULL); g_free(uri); + set_markup(o_album, "x-large", "From: " + track->album()->name()); + set_markup(o_artist, "x-large", "By: " + track->artist()->name()); + set_markup(o_title, "xx-large", track->name()); + o_duration->set_text(track->length_str()); + on_track_loaded(track); } @@ -185,7 +201,11 @@ void init_gst(int *argc, char ***argv) o_seek = lib :: get_widget("o_seek"); o_stop = lib :: get_widget("o_stop"); + o_album = lib :: get_widget("o_album"); + o_artist = lib :: get_widget("o_artist"); + o_duration = lib :: get_widget("o_duration"); o_position = lib :: get_widget("o_position"); + o_title = lib :: get_widget("o_title"); o_progress = lib :: get_object("o_progress"); o_next->signal_clicked().connect(sigc::ptr_fun(on_next)); diff --git a/gui/gui.cpp b/gui/gui.cpp index a1723332..f7c49536 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -31,26 +31,10 @@ static void on_config_pause_count() enabled->set_active(true); } -static void set_label_text(Gtk::Label *label, const std::string &size, - const std::string &text) -{ - label->set_markup("" + - Glib::Markup::escape_text(text) + ""); -} - void on_track_loaded(Track *track) { Gtk::ToggleButton *ban = lib :: get_widget("o_ban"); Gtk::ToggleButton *fav = lib :: get_widget("o_favorite"); - Gtk::Label *title = lib :: get_widget("o_title"); - Gtk::Label *artist = lib :: get_widget("o_artist"); - Gtk::Label *album = lib :: get_widget("o_album"); - Gtk::Label *duration = lib :: get_widget("o_duration"); - - set_label_text(title, "xx-large", track->name()); - set_label_text(artist, "x-large", "By: " + track->artist()->name()); - set_label_text(album, "x-large", "From: " + track->album()->name()); - duration->set_text(track->length_str()); bool banned = playlist :: has(track, "Banned"); bool favorite = playlist :: has(track, "Favorites");