summaryrefslogtreecommitdiffstats
path: root/src/SampleWindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SampleWindow.cc')
-rw-r--r--src/SampleWindow.cc36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/SampleWindow.cc b/src/SampleWindow.cc
index c3ff7fc..1685213 100644
--- a/src/SampleWindow.cc
+++ b/src/SampleWindow.cc
@@ -11,8 +11,10 @@ SampleWindow::SampleWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
indexLabel(NULL),
volumeLabel(NULL),
sampleTypeLabel(NULL),
- sizeLabel(NULL),
durationLabel(NULL),
+ sizeLabel(NULL),
+ lazyLabel(NULL),
+ filenameLabel(NULL),
closeButton(NULL) {
refGlade->get_widget("nameLabel", nameLabel);
@@ -21,6 +23,8 @@ SampleWindow::SampleWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl
refGlade->get_widget("sampleTypeLabel", sampleTypeLabel);
refGlade->get_widget("durationLabel", durationLabel);
refGlade->get_widget("sizeLabel", sizeLabel);
+ refGlade->get_widget("lazyLabel", lazyLabel);
+ refGlade->get_widget("filenameLabel", filenameLabel);
refGlade->get_widget("closeButton", closeButton);
closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SampleWindow::onCloseButton));
@@ -43,14 +47,30 @@ void SampleWindow::updateInfo(const SampleInfo &i) {
snprintf(t, sizeof(t), "%0.0f%%", (double) i.volume / 0x100 * 100);
volumeLabel->set_text(t);
- pa_sample_spec_snprint(ss, sizeof(ss), &i.sample_spec);
- sampleTypeLabel->set_text(ss);
+ if (pa_sample_spec_valid(&i.sample_spec)) {
+ pa_sample_spec_snprint(ss, sizeof(ss), &i.sample_spec);
+ sampleTypeLabel->set_text(ss);
+ } else
+ sampleTypeLabel->set_markup("<i>n/a</i>");
+
+ if (i.duration > 0) {
+ snprintf(t, sizeof(t), "%0.1fs", (double) i.duration/1000000);
+ durationLabel->set_text(t);
+ } else
+ durationLabel->set_markup("<i>n/a</i>");
+
+ if (i.bytes > 0) {
+ pa_bytes_snprint(t, sizeof(t), i.bytes);
+ sizeLabel->set_text(t);
+ } else
+ sizeLabel->set_markup("<i>n/a</i>");
- snprintf(t, sizeof(t), "%0.1fs", (double) i.duration/1000000);
- durationLabel->set_text(t);
+ lazyLabel->set_text(i.lazy ? "yes" : "no");
- pa_bytes_snprint(t, sizeof(t), i.bytes);
- sizeLabel->set_text(t);
+ if (i.filename.size() > 0)
+ filenameLabel->set_text(i.filename);
+ else
+ filenameLabel->set_markup("<i>n/a</i>");
set_title("Sample: "+i.name);
}
@@ -59,7 +79,7 @@ void SampleWindow::onCloseButton() {
hide();
}
-bool SampleWindow::on_delete_event(GdkEventAny* e) {
+bool SampleWindow::on_delete_event(GdkEventAny*) {
hide();
return false;
}