ocarina: Add back Title / Artist / Album labels
Using GtkBuilder now... Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
037577850f
commit
ff0f4a2c66
|
@ -13,6 +13,9 @@ string lib_file(const string &);
|
|||
/* window.cpp */
|
||||
void init_window();
|
||||
|
||||
/* status.cpp */
|
||||
void update_status();
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ string lib_file(const string &path)
|
|||
static gboolean timeout_poll(gpointer data)
|
||||
{
|
||||
idle_add();
|
||||
update_status();
|
||||
/* ocarina::body::set_now_playing();
|
||||
ocarina::body::update_controls();*/
|
||||
return TRUE;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker
|
||||
#include <ocarina/ocarina.h>
|
||||
#include <libsaria/track.h>
|
||||
|
||||
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) {
|
||||
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());
|
||||
g_free(escaped);
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
void update_status()
|
||||
{
|
||||
libsaria::Track *cur = libsaria::current_track();
|
||||
if (cur == current)
|
||||
return;
|
||||
|
||||
current = cur;
|
||||
refresh_widgets();
|
||||
}
|
|
@ -1,13 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkWindow" id="MainWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">800</property>
|
||||
<property name="default_height">600</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkViewport" id="viewport1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="TitleLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><span size='xx-large'> </span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="ArtistLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes"><span size='x-large'> </span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="AlbumLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes"><span size='x-large'> </span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
Loading…
Reference in New Issue