From 878fea16a2d7a319e59a0d7b4d470b0e3b1e42fb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 16 Aug 2004 23:17:43 +0000 Subject: fix source output and sink input updateing git-svn-id: file:///home/lennart/svn/public/paman/trunk@14 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/MainWindow.cc | 16 ++++++++-------- src/ServerInfoManager.cc | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 26a3b90..9e385f3 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -162,7 +162,7 @@ void MainWindow::updateInfo(SourceOutputInfo &i) { SourceInfo *si = serverInfoManager->getSourceInfo(i.source); if (!si) return; - + Gtk::TreeIter iter = deviceTreeStore->get_iter(si->treeRef.get_path()); i.treeRef = Gtk::TreeRowReference(deviceTreeStore, Gtk::TreePath(deviceTreeStore->append(iter->children()))); } @@ -172,7 +172,7 @@ void MainWindow::updateInfo(SourceOutputInfo &i) { row[deviceTreeModelColumns.index] = i.index; row[deviceTreeModelColumns.type] = ROW_TYPE_SOURCE_OUTPUT; - deviceTreeView->expand_row(sinkRef.get_path(), true); + deviceTreeView->expand_row(sourceRef.get_path(), true); onDeviceTreeViewCursorChanged(); } @@ -184,7 +184,7 @@ void MainWindow::removeInfo(SinkInfo &i) { } void MainWindow::removeInfo(SourceInfo &i) { - if (!i.treeRef) + if (i.treeRef) deviceTreeStore->erase(deviceTreeStore->get_iter(i.treeRef.get_path())); onDeviceTreeViewCursorChanged(); @@ -204,21 +204,21 @@ void MainWindow::removeInfo(ModuleInfo &i) { moduleOpenButton->set_sensitive(!moduleTreeStore->children().empty()); } -void MainWindow::removeInfo(SourceOutputInfo &i) { - if (!i.treeRef) +void MainWindow::removeInfo(SinkInputInfo &i) { + if (i.treeRef) deviceTreeStore->erase(deviceTreeStore->get_iter(i.treeRef.get_path())); onDeviceTreeViewCursorChanged(); } -void MainWindow::removeInfo(SinkInputInfo &i) { - if (!i.treeRef) +void MainWindow::removeInfo(SourceOutputInfo &i) { + + if (i.treeRef) deviceTreeStore->erase(deviceTreeStore->get_iter(i.treeRef.get_path())); onDeviceTreeViewCursorChanged(); } - void MainWindow::onDeviceTreeViewCursorChanged() { Gtk::TreeModel::Path p; Gtk::TreeViewColumn *c; diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index f271354..1f454eb 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -206,9 +206,9 @@ SourceOutputInfo::SourceOutputInfo(const struct pa_source_output_info &i) : name(i.name), index(i.index), sample_spec(i.sample_spec), - source(source), - client(client), - owner_module(owner_module), + source(i.source), + client(i.client), + owner_module(i.owner_module), window(NULL) { } @@ -218,8 +218,8 @@ SourceOutputInfo::~SourceOutputInfo() { } void SourceOutputInfo::update(const struct pa_source_output_info &i) { - index = i.index; name = i.name; + index = i.index; sample_spec = i.sample_spec; source = i.source; client = i.client; @@ -296,7 +296,7 @@ static void source_output_info_callback(struct pa_context *c, const struct pa_so static void subscribe_callback(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; - //fprintf(stderr, "EV: %u %u\n", t, index); +// fprintf(stderr, "EV: %u %u\n", t, index); switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) { case PA_SUBSCRIPTION_EVENT_SINK: @@ -396,6 +396,7 @@ void ServerInfoManager::updateInfo(const struct pa_sink_info &i) { void ServerInfoManager::updateInfo(const struct pa_source_info &i) { SourceInfo *si; + if ((si = sources[i.index])) si->update(i); else { -- cgit