ocarina: Add in the slider and position / duration labels

Only the duration label changes, I don't do anything with the others
yet.  I'll work on it later (once I get the rest of the UI converted
over).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-07-30 07:59:27 -04:00
parent bb56dc4d2a
commit 9eb181d263
2 changed files with 53 additions and 3 deletions

View File

@ -7,7 +7,12 @@ static libsaria::Track *current = NULL;
static void set_label(const string &name, const string &text, const string &size)
{
GtkWidget *label = get_widget(name);
if (label) {
if (!label)
return;
if (size == "") {
gtk_label_set_text(GTK_LABEL(label), text.c_str());
} else {
char *escaped = g_markup_escape_text(text.c_str(), -1);
string markup = "<span size='" + size + "'>" + escaped + "</span>";
gtk_label_set_markup(GTK_LABEL(label), markup.c_str());
@ -20,6 +25,7 @@ static void refresh_widgets()
set_label("TitleLabel", current->get_title(), "xx-large");
set_label("ArtistLabel", current->get_artist(), "x-large");
set_label("AlbumLabel", current->get_album(), "x-large");
set_label("DurLabel", current->get_lenstr(), "");
}
void update_status()

View File

@ -15,7 +15,50 @@
<placeholder/>
</child>
<child>
<placeholder/>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="PosLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHScale" id="ProgressBar">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="round_digits">0</property>
<property name="draw_value">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="DurLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
@ -27,11 +70,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">never</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>