From 16c78fca279f046b405cbab8800199893fc39f6e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 19 Sep 2004 23:14:59 +0000 Subject: update to current polypaudio git-svn-id: file:///home/lennart/svn/public/paman/trunk@35 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/MainWindow.cc | 6 +++--- src/SampleWindow.cc | 4 ++-- src/ServerInfoManager.cc | 34 ++++++++++++++++++++++++++-------- src/ServerInfoManager.hh | 2 ++ src/SinkInputWindow.cc | 2 +- src/SinkWindow.cc | 2 +- src/SourceOutputWindow.cc | 2 +- src/SourceWindow.cc | 2 +- 8 files changed, 37 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 67dfe37..46e083b 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -339,15 +339,15 @@ void MainWindow::onSampleTreeViewRowActivated(const Gtk::TreeModel::Path& path, } void MainWindow::updateInfo(const struct pa_server_info &i) { - char t[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[PA_SAMPLE_SPEC_SNPRINT_MAX]; serverNameLabel->set_text(i.server_name); serverVersionLabel->set_text(i.server_version); pa_sample_spec_snprint(t, sizeof(t), &i.sample_spec); defaultSampleTypeLabel->set_text(t); hostNameLabel->set_text(i.host_name); userNameLabel->set_text(i.user_name); - defaultSinkLabel->set_markup(*i.default_sink_name ? i.default_sink_name : "not set"); - defaultSourceLabel->set_markup(*i.default_source_name ? i.default_source_name: "not set"); + defaultSinkLabel->set_markup(i.default_sink_name ? i.default_sink_name : "not set"); + defaultSourceLabel->set_markup(i.default_source_name ? i.default_source_name: "not set"); } void MainWindow::showSuccess(const char *t) { diff --git a/src/SampleWindow.cc b/src/SampleWindow.cc index 1685213..81ddaa0 100644 --- a/src/SampleWindow.cc +++ b/src/SampleWindow.cc @@ -38,7 +38,7 @@ SampleWindow* SampleWindow::create() { } void SampleWindow::updateInfo(const SampleInfo &i) { - char t[60], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[60], ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; nameLabel->set_text(i.name); snprintf(t, sizeof(t), "#%u", i.index); @@ -67,7 +67,7 @@ void SampleWindow::updateInfo(const SampleInfo &i) { lazyLabel->set_text(i.lazy ? "yes" : "no"); - if (i.filename.size() > 0) + if (i.filename_valid) filenameLabel->set_text(i.filename); else filenameLabel->set_markup("n/a"); diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 5d0a6f0..e05b401 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -6,7 +6,6 @@ SinkInfo::SinkInfo(const struct pa_sink_info &i) : name(i.name), - description(i.description), index(i.index), sample_spec(i.sample_spec), monitor_source(i.monitor_source), @@ -15,6 +14,9 @@ SinkInfo::SinkInfo(const struct pa_sink_info &i) : latency(i.latency), monitor_source_name(i.monitor_source_name), window(NULL) { + + if (i.description) + description = i.description; } SinkInfo::~SinkInfo() { @@ -24,7 +26,6 @@ SinkInfo::~SinkInfo() { void SinkInfo::update(const struct pa_sink_info &i) { name = Glib::ustring(i.name); - description = i.description; index = i.index; sample_spec = i.sample_spec; monitor_source = i.monitor_source; @@ -33,6 +34,8 @@ void SinkInfo::update(const struct pa_sink_info &i) { latency = i.latency; monitor_source_name = i.monitor_source_name; + description = i.description ? i.description : ""; + if (window) window->updateInfo(*this); g_assert(mainWindow); @@ -51,13 +54,15 @@ void SinkInfo::showWindow() { SourceInfo::SourceInfo(const struct pa_source_info &i) : name(i.name), - description(i.description), index(i.index), sample_spec(i.sample_spec), owner_module(i.owner_module), monitor_of_sink(i.monitor_of_sink), latency(i.latency), window(NULL) { + + if (i.description) + description = i.description; } SourceInfo::~SourceInfo() { @@ -67,13 +72,14 @@ SourceInfo::~SourceInfo() { void SourceInfo::update(const struct pa_source_info &i) { name = i.name; - description = i.description; index = i.index; sample_spec = i.sample_spec; owner_module = i.owner_module; monitor_of_sink = i.monitor_of_sink; latency = i.latency; + description = i.description ? i.description : ""; + if (window) window->updateInfo(*this); g_assert(mainWindow); @@ -129,10 +135,12 @@ void ClientInfo::showWindow() { ModuleInfo::ModuleInfo(const struct pa_module_info &i) : index(i.index), name(i.name), - argument(i.argument), autoloaded(i.auto_unload), used(i.n_used), window(NULL) { + + if (i.argument) + argument = i.argument; } ModuleInfo::~ModuleInfo() { @@ -142,11 +150,12 @@ ModuleInfo::~ModuleInfo() { void ModuleInfo::update(const struct pa_module_info &i) { name = i.name; - argument = i.argument; index = i.index; autoloaded = i.auto_unload; used = i.n_used; + argument = i.argument ? i.argument : ""; + if (window) window->updateInfo(*this); g_assert(mainWindow); @@ -259,8 +268,13 @@ SampleInfo::SampleInfo(const struct pa_sample_info &i) : duration(i.duration), bytes(i.bytes), lazy(!!i.lazy), - filename(i.filename), + filename_valid(false), window(NULL) { + + if (i.filename) { + filename = i.filename; + filename_valid = true; + } } SampleInfo::~SampleInfo() { @@ -276,8 +290,12 @@ void SampleInfo::update(const struct pa_sample_info &i) { duration = i.duration; bytes = i.bytes; lazy = !!i.lazy; - filename = i.filename; + filename_valid = !!i.filename; + + if (i.filename) + filename = i.filename; + if (window) window->updateInfo(*this); g_assert(mainWindow); diff --git a/src/ServerInfoManager.hh b/src/ServerInfoManager.hh index 5cd5c5e..a3f0aaf 100644 --- a/src/ServerInfoManager.hh +++ b/src/ServerInfoManager.hh @@ -161,6 +161,8 @@ public: bool lazy; Glib::ustring filename; + bool filename_valid; + Gtk::TreeRowReference treeRef; SampleWindow *window; diff --git a/src/SinkInputWindow.cc b/src/SinkInputWindow.cc index ffd1791..9a07304 100644 --- a/src/SinkInputWindow.cc +++ b/src/SinkInputWindow.cc @@ -59,7 +59,7 @@ SinkInputWindow* SinkInputWindow::create() { } void SinkInputWindow::updateInfo(const SinkInputInfo &i) { - char t[80], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[80], ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; double percent, db; nameLabel->set_text(i.name); diff --git a/src/SinkWindow.cc b/src/SinkWindow.cc index 4c6a01a..76153d1 100644 --- a/src/SinkWindow.cc +++ b/src/SinkWindow.cc @@ -56,7 +56,7 @@ SinkWindow* SinkWindow::create() { } void SinkWindow::updateInfo(const SinkInfo &i) { - char t[64], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[64], ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; double percent, db; nameLabel->set_text(i.name); diff --git a/src/SourceOutputWindow.cc b/src/SourceOutputWindow.cc index e2cc5db..fde5c0e 100644 --- a/src/SourceOutputWindow.cc +++ b/src/SourceOutputWindow.cc @@ -48,7 +48,7 @@ SourceOutputWindow* SourceOutputWindow::create() { } void SourceOutputWindow::updateInfo(const SourceOutputInfo &i) { - char t[100], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[100], ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; nameLabel->set_text(i.name); snprintf(t, sizeof(t), "#%u", i.index); diff --git a/src/SourceWindow.cc b/src/SourceWindow.cc index bb48071..ff12e8b 100644 --- a/src/SourceWindow.cc +++ b/src/SourceWindow.cc @@ -43,7 +43,7 @@ SourceWindow* SourceWindow::create() { } void SourceWindow::updateInfo(const SourceInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[20], ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; nameLabel->set_text(i.name); descriptionLabel->set_text(i.description); -- cgit