Set the correct combo index for display purposes

This commit is contained in:
Colin Guthrie 2009-03-16 21:48:57 +00:00
parent cfa1cd3d49
commit 0667b9d5ea
3 changed files with 14 additions and 0 deletions

View File

@ -197,6 +197,12 @@ void MainWindow::rebuildSinkCombo() {
row[deviceColumns.index] = i->first; row[deviceColumns.index] = i->first;
row[deviceColumns.name] = i->second->description.c_str(); row[deviceColumns.name] = i->second->description.c_str();
} }
/* Force a redraw of the dropdown combo due to the model change. */
for (std::map<uint32_t, SinkInputWidget*>::iterator i = sinkInputWidgets.begin(); i != sinkInputWidgets.end(); ++i) {
SinkInputWidget* w = i->second;
w->setSinkIndex(w->sinkIndex());
}
} }
void MainWindow::updateSink(const pa_sink_info &info) { void MainWindow::updateSink(const pa_sink_info &info) {
@ -364,6 +370,12 @@ void MainWindow::rebuildSourceCombo() {
row[deviceColumns.index] = i->first; row[deviceColumns.index] = i->first;
row[deviceColumns.name] = i->second->description.c_str(); row[deviceColumns.name] = i->second->description.c_str();
} }
/* Force a redraw of the dropdown combo due to the model change. */
for (std::map<uint32_t, SourceOutputWidget*>::iterator i = sourceOutputWidgets.begin(); i != sourceOutputWidgets.end(); ++i) {
SourceOutputWidget* w = i->second;
w->setSourceIndex(w->sourceIndex());
}
} }
void MainWindow::updateSource(const pa_source_info &info) { void MainWindow::updateSource(const pa_source_info &info) {

View File

@ -61,6 +61,7 @@ SinkInputWidget* SinkInputWidget::create(MainWindow* mainWindow) {
void SinkInputWidget::setSinkIndex(uint32_t idx) { void SinkInputWidget::setSinkIndex(uint32_t idx) {
mSinkIndex = idx; mSinkIndex = idx;
deviceCombo->set_active(mpMainWindow->sinkTreeIndexes[idx]);
} }
uint32_t SinkInputWidget::sinkIndex() { uint32_t SinkInputWidget::sinkIndex() {

View File

@ -61,6 +61,7 @@ SourceOutputWidget* SourceOutputWidget::create(MainWindow* mainWindow) {
void SourceOutputWidget::setSourceIndex(uint32_t idx) { void SourceOutputWidget::setSourceIndex(uint32_t idx) {
mSourceIndex = idx; mSourceIndex = idx;
deviceCombo->set_active(mpMainWindow->sourceTreeIndexes[idx]);
} }
uint32_t SourceOutputWidget::sourceIndex() { uint32_t SourceOutputWidget::sourceIndex() {