Record in a map the combobox indexes vs. the sink/source indexes

This commit is contained in:
Colin Guthrie 2009-03-16 21:06:33 +00:00
parent 903c26bd44
commit cfa1cd3d49
2 changed files with 13 additions and 16 deletions

View File

@ -180,26 +180,23 @@ void MainWindow::updateCard(const pa_card_info &info) {
}
void MainWindow::rebuildSinkCombo() {
//int active_idx = -1;
uint32_t idx = 0;
Gtk::TreeModel::Row row;
// Update our sinkTree
sinkTree->clear();
sinkTreeIndexes.clear();
row = *(sinkTree->append());
idx++;
row[deviceColumns.index] = -1;
row[deviceColumns.name] = "Default Output";
for (std::map<uint32_t, SinkWidget*>::iterator i = sinkWidgets.begin(); i != sinkWidgets.end(); ++i) {
Gtk::TreeModel::Row row = *(sinkTree->append());
sinkTreeIndexes[i->first] = idx++;
row[deviceColumns.index] = i->first;
row[deviceColumns.name] = i->second->description.c_str();
/*if (i->first == activeProfile)
active_idx = idx;
idx++;*/
}
/*if (active_idx >= 0)
sinkTree->set_active(active_idx);*/
}
void MainWindow::updateSink(const pa_sink_info &info) {
@ -351,26 +348,22 @@ void MainWindow::createMonitorStreamForSinkInput(uint32_t sink_input_idx, uint32
}
void MainWindow::rebuildSourceCombo() {
//int active_idx = -1;
uint32_t idx = 0;
Gtk::TreeModel::Row row;
// Update our sinkTree
sourceTree->clear();
sourceTreeIndexes.clear();
row = *(sourceTree->append());
idx++;
row[deviceColumns.index] = -1;
row[deviceColumns.name] = "Default Input";
for (std::map<uint32_t, SourceWidget*>::iterator i = sourceWidgets.begin(); i != sourceWidgets.end(); ++i) {
Gtk::TreeModel::Row row = *(sourceTree->append());
sourceTreeIndexes[i->first] = idx++;
row[deviceColumns.index] = i->first;
row[deviceColumns.name] = i->second->description.c_str();
/*if (i->first == activeProfile)
active_idx = idx;
idx++;*/
}
/*if (active_idx >= 0)
sourceTree->set_active(active_idx);*/
}
void MainWindow::updateSource(const pa_source_info &info) {

View File

@ -103,8 +103,12 @@ public:
};
DeviceColumns deviceColumns;
Glib::RefPtr<Gtk::ListStore> sinkTree;
std::map<uint32_t, uint32_t> sinkTreeIndexes;
Glib::RefPtr<Gtk::ListStore> sourceTree;
std::map<uint32_t, uint32_t> sourceTreeIndexes;
protected:
virtual void on_realize();