diff --git a/gui/gst.cpp b/gui/gst.cpp
index 1d1843cd..fcfe9a9b 100644
--- a/gui/gst.cpp
+++ b/gui/gst.cpp
@@ -19,36 +19,30 @@ static GtkScale *o_seek;
static GtkSpinButton *o_count;
static GtkToggleButton *o_enabled;
-static GtkLabel *o_album;
-static GtkLabel *o_artist;
static GtkLabel *o_duration;
static GtkLabel *o_position;
-static GtkLabel *o_title;
static GtkAdjustment *o_progress;
+const gchar *TITLE_FMT = "%s";
+const gchar *ARTIST_FMT = "By: %s";
+const gchar *ALBUM_FMT = "From: %s";
-static void set_markup(GtkLabel *label, const std::string &size,
- const std::string &text)
+static inline void __audio_set_label(const gchar *label, const gchar *fmt,
+ const gchar *text)
{
- gchar *markup = g_markup_printf_escaped("%s",
- size.c_str(), text.c_str());
- gtk_label_set_markup(label, markup);
+ gchar *markup = g_markup_printf_escaped(fmt, text);
+ gtk_label_set_markup(GTK_LABEL(gui_builder_widget(label)), markup);
g_free(markup);
}
static void on_load(struct track *track)
{
Gtk::ToggleButton *toggle;
+ gchar *str;
- gchar *str = g_strdup_printf("From: %s", track->tr_album->al_name);
- set_markup(o_album, "x-large", str);
- g_free(str);
-
- str = g_strdup_printf("By: %s", track->tr_artist->ar_name);
- set_markup(o_artist, "x-large", str);
- g_free(str);
-
- set_markup(o_title, "xx-large", track->tr_title);
+ __audio_set_label("o_title", TITLE_FMT, track->tr_title);
+ __audio_set_label("o_artist", ARTIST_FMT, track->tr_artist->ar_name);
+ __audio_set_label("o_album", ALBUM_FMT, track->tr_album->al_name);
str = string_sec2str(track->tr_length);
gtk_label_set_text(o_duration, str);
@@ -136,11 +130,8 @@ void gst :: init_pre()
o_count = GTK_SPIN_BUTTON(gui_builder_widget("o_pause_count"));
o_enabled = GTK_TOGGLE_BUTTON(gui_builder_widget("o_pause_enabled"));
- o_album = GTK_LABEL(gui_builder_widget("o_album"));
- o_artist = GTK_LABEL(gui_builder_widget("o_artist"));
o_duration = GTK_LABEL(gui_builder_widget("o_duration"));
o_position = GTK_LABEL(gui_builder_widget("o_position"));
- o_title = GTK_LABEL(gui_builder_widget("o_title"));
o_progress = GTK_ADJUSTMENT(gui_builder_object("o_progress"));
g_signal_connect(o_seek, "change-value", G_CALLBACK(on_seek), NULL);